Files
UNIT3D-Community-Edition/routes/api.php
clandestine8 de4f4dcb0a Add: Proxy Support via .env
Set PROXY_SCHEME=https when using a Proxy for HTTPS
Set FORCE_ROOT_URL to override the URL used for route variables.
2021-08-14 18:13:48 -04:00

40 lines
1.5 KiB
PHP
Executable File

<?php
use Illuminate\Support\Facades\Route;
use Illuminate\Support\Facades\URL;
/*
* NOTICE OF LICENSE
*
* UNIT3D is open-sourced software licensed under the GNU Affero General Public License v3.0
* The details is bundled with this project in the file LICENSE.txt.
*
* @project UNIT3D
* @license https://www.gnu.org/licenses/agpl-3.0.en.html/ GNU Affero General Public License v3.0
* @author HDVinnie
*/
/*
|--------------------------------------------------------------------------
| API Routes
|--------------------------------------------------------------------------
|
| Here is where you can register API routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| is assigned the "api" middleware group. Enjoy building your API!
|
*/
if (config('unit3d.proxy_scheme')) {
URL::forceScheme(config('unit3d.proxy_scheme'));
}
if(config('unit3d.root_url_override')) {
URL::forceRootUrl(config('unit3d.root_url_override'));
}
// Torrents System
Route::group(['middleware' => 'auth:api', 'prefix' => 'torrents'], function () {
Route::get('/', [App\Http\Controllers\API\TorrentController::class, 'index'])->name('torrents.index');
Route::get('/filter', [App\Http\Controllers\API\TorrentController::class, 'filter']);
Route::get('/{id}', [App\Http\Controllers\API\TorrentController::class, 'show'])->where('id', '[0-9]+');
Route::post('/upload', [App\Http\Controllers\API\TorrentController::class, 'store']);
});