103 lines
2.8 KiB
PHP
103 lines
2.8 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
/*
|
|
* Copyright (c) 2025, Антон Аксенов
|
|
* This file is part of m3u.su project
|
|
* MIT License: https://git.axenov.dev/IPTV/web/src/branch/master/LICENSE
|
|
*/
|
|
|
|
use App\Controllers\ApiController;
|
|
use App\Controllers\BasicController;
|
|
use App\Controllers\BotController;
|
|
use App\Controllers\WebController;
|
|
|
|
return [
|
|
/*
|
|
|--------------------------------------------------------------------------
|
|
| Web routes
|
|
|--------------------------------------------------------------------------
|
|
*/
|
|
|
|
[
|
|
'method' => ['GET', 'POST'],
|
|
'path' => '/bot/webhook',
|
|
'handler' => [BotController::class, 'webhook'],
|
|
'name' => 'bot::webhook',
|
|
],
|
|
[
|
|
'method' => ['GET', 'POST'],
|
|
'path' => '/bot/update',
|
|
'handler' => [BotController::class, 'update'],
|
|
'name' => 'bot::update',
|
|
],
|
|
[
|
|
'method' => 'GET',
|
|
'path' => '/[page/{page:[0-9]+}]',
|
|
'handler' => [WebController::class, 'home'],
|
|
'name' => 'home',
|
|
],
|
|
[
|
|
'method' => 'GET',
|
|
'path' => '/{code:[0-9a-zA-Z]+}[.m3u[8]]',
|
|
'handler' => [WebController::class, 'redirect'],
|
|
'name' => 'redirect',
|
|
],
|
|
[
|
|
'method' => 'GET',
|
|
'path' => '/{code:[0-9a-zA-Z]+}/details',
|
|
'handler' => [WebController::class, 'details'],
|
|
'name' => 'details',
|
|
],
|
|
|
|
/*
|
|
|--------------------------------------------------------------------------
|
|
| API routes
|
|
|--------------------------------------------------------------------------
|
|
*/
|
|
|
|
[
|
|
'method' => 'GET',
|
|
'path' => '/api/playlists/{code:[0-9a-zA-Z]+}',
|
|
'handler' => [ApiController::class, 'getOne'],
|
|
'name' => 'api::getOne',
|
|
],
|
|
[
|
|
'method' => 'GET',
|
|
'path' => '/api/playlists/{code:[0-9a-zA-Z]+}/qrcode',
|
|
'handler' => [ApiController::class, 'makeQrCode'],
|
|
'name' => 'api::makeQrCode',
|
|
],
|
|
[
|
|
'method' => 'GET',
|
|
'path' => '/api/version',
|
|
'handler' => [ApiController::class, 'version'],
|
|
'name' => 'api::version',
|
|
],
|
|
[
|
|
'method' => 'GET',
|
|
'path' => '/api/health',
|
|
'handler' => [ApiController::class, 'health'],
|
|
'name' => 'api::health',
|
|
],
|
|
[
|
|
'method' => 'GET',
|
|
'path' => '/api/stats',
|
|
'handler' => [ApiController::class, 'stats'],
|
|
'name' => 'api::stats',
|
|
],
|
|
|
|
/*
|
|
|--------------------------------------------------------------------------
|
|
| Other routes
|
|
|--------------------------------------------------------------------------
|
|
*/
|
|
|
|
[
|
|
'method' => '*',
|
|
'path' => '/{path:.+}',
|
|
'handler' => [BasicController::class, 'notFound'],
|
|
'name' => 'not-found',
|
|
],
|
|
];
|