Compare commits
No commits in common. "181dc108c183e97cfb7037a7f8a1542c46562d23" and "65a1ea5a07aa6c7a66caf311bda5427af872fbe5" have entirely different histories.
181dc108c1
...
65a1ea5a07
59
.env
59
.env
|
@ -1,59 +0,0 @@
|
|||
APP_NAME=Laravel
|
||||
APP_ENV=local
|
||||
APP_KEY=
|
||||
APP_DEBUG=true
|
||||
APP_URL=http://localhost
|
||||
|
||||
LOG_CHANNEL=stack
|
||||
LOG_DEPRECATIONS_CHANNEL=null
|
||||
LOG_LEVEL=debug
|
||||
|
||||
DB_CONNECTION=mysql
|
||||
DB_HOST=127.0.0.1
|
||||
DB_PORT=3306
|
||||
DB_DATABASE=laravel
|
||||
DB_USERNAME=root
|
||||
DB_PASSWORD=
|
||||
|
||||
BROADCAST_DRIVER=log
|
||||
CACHE_DRIVER=file
|
||||
FILESYSTEM_DISK=local
|
||||
QUEUE_CONNECTION=sync
|
||||
SESSION_DRIVER=file
|
||||
SESSION_LIFETIME=120
|
||||
|
||||
MEMCACHED_HOST=127.0.0.1
|
||||
|
||||
REDIS_HOST=127.0.0.1
|
||||
REDIS_PASSWORD=null
|
||||
REDIS_PORT=6379
|
||||
|
||||
MAIL_MAILER=smtp
|
||||
MAIL_HOST=mailpit
|
||||
MAIL_PORT=1025
|
||||
MAIL_USERNAME=null
|
||||
MAIL_PASSWORD=null
|
||||
MAIL_ENCRYPTION=null
|
||||
MAIL_FROM_ADDRESS="hello@example.com"
|
||||
MAIL_FROM_NAME="${APP_NAME}"
|
||||
|
||||
AWS_ACCESS_KEY_ID=
|
||||
AWS_SECRET_ACCESS_KEY=
|
||||
AWS_DEFAULT_REGION=us-east-1
|
||||
AWS_BUCKET=
|
||||
AWS_USE_PATH_STYLE_ENDPOINT=false
|
||||
|
||||
PUSHER_APP_ID=
|
||||
PUSHER_APP_KEY=
|
||||
PUSHER_APP_SECRET=
|
||||
PUSHER_HOST=
|
||||
PUSHER_PORT=443
|
||||
PUSHER_SCHEME=https
|
||||
PUSHER_APP_CLUSTER=mt1
|
||||
|
||||
VITE_APP_NAME="${APP_NAME}"
|
||||
VITE_PUSHER_APP_KEY="${PUSHER_APP_KEY}"
|
||||
VITE_PUSHER_HOST="${PUSHER_HOST}"
|
||||
VITE_PUSHER_PORT="${PUSHER_PORT}"
|
||||
VITE_PUSHER_SCHEME="${PUSHER_SCHEME}"
|
||||
VITE_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"
|
|
@ -1,42 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace App\Console\Commands;
|
||||
|
||||
use Illuminate\Console\Command;
|
||||
use Illuminate\Filesystem\Filesystem;
|
||||
|
||||
class ClearDownloads extends Command
|
||||
{
|
||||
/**
|
||||
* The name and signature of the console command.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $signature = 'app:clear-downloads';
|
||||
|
||||
/**
|
||||
* The console command description.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $description = 'Command description';
|
||||
|
||||
/**
|
||||
* Execute the console command.
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
$this->info("Clearing download directory: " . env('PATH_TO_DOWNLOAD'));
|
||||
$directory = new Filesystem();
|
||||
$files = $directory->files(env('PATH_TO_DOWNLOAD'), false);
|
||||
$counter = 0;
|
||||
foreach ($files as $file){
|
||||
if ($file->getFilename() !== '.gitignore'){
|
||||
$this->info("rm " . $file->getRealPath());
|
||||
unlink($file->getRealPath());
|
||||
$counter++;
|
||||
}
|
||||
}
|
||||
$this->info("Deleted " . $counter . " file(s)");
|
||||
}
|
||||
}
|
|
@ -13,7 +13,6 @@ class Kernel extends ConsoleKernel
|
|||
protected function schedule(Schedule $schedule): void
|
||||
{
|
||||
// $schedule->command('inspire')->hourly();
|
||||
$schedule->command('app:clear-downloads')->daily();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -11,6 +11,6 @@ class DownloadController extends Controller
|
|||
$headers = [
|
||||
'Content-Type' => 'video/mp4',
|
||||
];
|
||||
return response()->download($file_path, $file_name, $headers)->deleteFileAfterSend();
|
||||
return response()->download($file_path, $file_name, $headers);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -30,11 +30,8 @@ class YoutubeDownloadController extends Controller
|
|||
return response(json_encode($response));
|
||||
} else {
|
||||
$videotitle = $video->getFile()->getFilename();
|
||||
$thumbnails = $video->getThumbnails();
|
||||
$thumbnail = $thumbnails[0]?->getUrl();
|
||||
$response = new \stdClass();
|
||||
$response->link = $videotitle;
|
||||
$response->thumbnail = $thumbnail;
|
||||
return response(json_encode($response));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -46,7 +46,7 @@ export default {
|
|||
this.downloadAvailable = false;
|
||||
this.error = false;
|
||||
this.fetching = true;
|
||||
axios.get(`/api/v1/video/download?videourl=${this.url}`).then((responce)=>{
|
||||
axios.get(`/download_api?videourl=${this.url}`).then((responce)=>{
|
||||
this.fetching = false;
|
||||
if (responce.data.error){
|
||||
this.error = true;
|
||||
|
@ -55,7 +55,7 @@ export default {
|
|||
console.log(responce.data.error);
|
||||
} else if (responce.data.link){
|
||||
this.downloadAvailable = true;
|
||||
this.downloadLink = `/api/v1/file/download/${responce.data.link}`;
|
||||
this.downloadLink = `/download/${responce.data.link}`;
|
||||
}
|
||||
}).catch((error)=>{
|
||||
this.fetching = false;
|
||||
|
|
|
@ -17,12 +17,3 @@ use Illuminate\Support\Facades\Route;
|
|||
Route::middleware('auth:sanctum')->get('/user', function (Request $request) {
|
||||
return $request->user();
|
||||
});
|
||||
|
||||
Route::group(['prefix' => 'v1'], function () {
|
||||
Route::group(['prefix' => 'video'], function () {
|
||||
Route::get('/download', 'App\Http\Controllers\YoutubeDownloadController@index');
|
||||
});
|
||||
Route::group(['prefix' => 'file'], function () {
|
||||
Route::get('/download/{file}', 'App\Http\Controllers\DownloadController@download')->name('download');
|
||||
});
|
||||
});
|
||||
|
|
|
@ -16,3 +16,6 @@ use Illuminate\Support\Facades\Route;
|
|||
Route::get('/', function () {
|
||||
return view('welcome');
|
||||
});
|
||||
|
||||
Route::get('/download_api', 'App\Http\Controllers\YoutubeDownloadController@index');
|
||||
Route::get('/download/{file}', 'App\Http\Controllers\DownloadController@download')->name('download');
|
||||
|
|
Loading…
Reference in New Issue