From ad921d10a17b2895de1a988b04534bebec69d1a8 Mon Sep 17 00:00:00 2001 From: Dhaverd Date: Tue, 3 Jun 2025 21:49:13 +0800 Subject: [PATCH] =?UTF-8?q?=D0=9F=D0=B5=D1=80=D0=B5=D0=BD=D0=B5=D1=81=20?= =?UTF-8?q?=D0=B7=D0=B0=D0=BF=D1=80=D0=BE=D1=81=D1=8B=20=D0=B2=20api?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- resources/views/Main.vue | 4 ++-- routes/api.php | 9 +++++++++ routes/web.php | 3 --- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/resources/views/Main.vue b/resources/views/Main.vue index fcd88ea..45f76d2 100644 --- a/resources/views/Main.vue +++ b/resources/views/Main.vue @@ -46,7 +46,7 @@ export default { this.downloadAvailable = false; this.error = false; this.fetching = true; - axios.get(`/download_api?videourl=${this.url}`).then((responce)=>{ + axios.get(`/api/v1/video/download?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 = `/download/${responce.data.link}`; + this.downloadLink = `/api/v1/file/download/${responce.data.link}`; } }).catch((error)=>{ this.fetching = false; diff --git a/routes/api.php b/routes/api.php index 889937e..7c503a5 100644 --- a/routes/api.php +++ b/routes/api.php @@ -17,3 +17,12 @@ 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'); + }); +}); diff --git a/routes/web.php b/routes/web.php index 5d1f956..d259f33 100644 --- a/routes/web.php +++ b/routes/web.php @@ -16,6 +16,3 @@ 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');