You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
394 lines
23 KiB
PHP
394 lines
23 KiB
PHP
<?php
|
|
|
|
use Slim\App;
|
|
use Slim\Container;
|
|
use App\Controllers;
|
|
use App\Middleware\Auth;
|
|
use App\Middleware\Guest;
|
|
use App\Middleware\Admin;
|
|
use App\Middleware\SuperAdmin;
|
|
use App\Services\View;
|
|
use App\Services\UserCopy\UserCopyViewRuntime;
|
|
|
|
/***
|
|
* The slim documents: http://www.slimframework.com/docs/objects/router.html
|
|
*/
|
|
|
|
// config
|
|
$debug = false;
|
|
if (defined("DEBUG")) {
|
|
$debug = true;
|
|
}
|
|
/***
|
|
* $configuration = [
|
|
* 'settings' => [
|
|
* 'displayErrorDetails' => $debug,
|
|
* ]
|
|
* ];
|
|
* $c = new Container($configuration);
|
|
***/
|
|
|
|
// Make a Slim App
|
|
// $app = new App($c);
|
|
|
|
$configuration = [
|
|
'settings' => [
|
|
'debug' => $debug,
|
|
'whoops.editor' => 'sublime',
|
|
'displayErrorDetails' => $debug
|
|
]
|
|
];
|
|
|
|
$container = new Container($configuration);
|
|
|
|
$renderErrorPage = function ($response, $status, $template) {
|
|
$path = parse_url((string) ($_SERVER['REQUEST_URI'] ?? ''), PHP_URL_PATH);
|
|
if (is_string($path) && (str_starts_with($path, '/api/v1/') || str_starts_with($path, '/api/internal/cloud/'))) {
|
|
return $response->withJson(['detail' => $status === 500 ? '服务暂时不可用' : '接口不存在或请求方法不支持'], $status);
|
|
}
|
|
$newResponse = $response->withStatus($status);
|
|
$smarty = View::getSmarty();
|
|
UserCopyViewRuntime::production()->bindCurrentRequest(
|
|
$smarty,
|
|
'public.error'
|
|
);
|
|
$newResponse->getBody()->write($smarty->fetch($template));
|
|
return $newResponse;
|
|
};
|
|
|
|
$container['notFoundHandler'] = function ($c) use ($renderErrorPage) {
|
|
return function ($request, $response) use ($c, $renderErrorPage) {
|
|
return $renderErrorPage($response, 404, '404.tpl');
|
|
};
|
|
};
|
|
|
|
$container['notAllowedHandler'] = function ($c) use ($renderErrorPage) {
|
|
return function ($request, $response, $methods) use ($c, $renderErrorPage) {
|
|
return $renderErrorPage($response, 405, '405.tpl')
|
|
->withHeader('Allow', implode(', ', $methods));
|
|
};
|
|
};
|
|
|
|
if ($debug==false) {
|
|
$container['errorHandler'] = function ($c) use ($renderErrorPage) {
|
|
return function ($request, $response, $exception) use ($c, $renderErrorPage) {
|
|
return $renderErrorPage($response, 500, '500.tpl');
|
|
};
|
|
};
|
|
|
|
$container['phpErrorHandler'] = function ($c) use ($renderErrorPage) {
|
|
return function ($request, $response, $error) use ($c, $renderErrorPage) {
|
|
return $renderErrorPage($response, 500, '500.tpl');
|
|
};
|
|
};
|
|
}
|
|
|
|
$app = new App($container);
|
|
|
|
// Home
|
|
$app->get('/', 'App\Controllers\HomeController:index');
|
|
$app->get('/terms', 'App\Controllers\LegalController:terms');
|
|
$app->get('/privacy', 'App\Controllers\LegalController:privacy');
|
|
$app->get('/404', 'App\Controllers\HomeController:page404');
|
|
$app->get('/405', 'App\Controllers\HomeController:page405');
|
|
$app->get('/500', 'App\Controllers\HomeController:page500');
|
|
$app->post('/telegram_callback', 'App\Controllers\TelegramWebhookController:handle');
|
|
|
|
// User Center
|
|
$app->group('/user', function () {
|
|
$this->get('', 'App\Controllers\CloudPageController:home');
|
|
$this->get('/', 'App\Controllers\CloudPageController:home');
|
|
$this->get('/cloud', 'App\Controllers\CloudPageController:index');
|
|
$this->get('/cloud/instances', 'App\Controllers\CloudPageController:instances');
|
|
$this->get('/cloud/instances/{id:[0-9]+}', 'App\Controllers\CloudPageController:detail');
|
|
$this->get('/cloud/instances/{id:[0-9]+}/reinstall', 'App\Controllers\CloudPageController:reinstall');
|
|
$this->get('/cloud/deploy', 'App\Controllers\CloudPageController:deploy');
|
|
$this->get('/cloud/backups', 'App\Controllers\CloudPageController:backups');
|
|
$this->get('/cloud/cloud-snapshots', 'App\Controllers\CloudPageController:cloudSnapshots');
|
|
$this->get('/cloud/traffic', 'App\Controllers\CloudPageController:trafficPools');
|
|
$this->get('/cloud/vpcs', 'App\Controllers\CloudPageController:vpcs');
|
|
$this->get('/cloud/iso-images', 'App\Controllers\CloudPageController:isoImages');
|
|
$this->get('/cloud/ssh-keys', 'App\Controllers\CloudPageController:sshKeys');
|
|
$this->get('/cloud/invoices', 'App\Controllers\CloudPageController:invoices');
|
|
$this->get('/cloud/invoices/{id:[0-9]+}', 'App\Controllers\CloudPageController:invoiceDetail');
|
|
$this->get('/invite', 'App\Controllers\UserController:invite');
|
|
$this->get('/ticket', 'App\Controllers\UserController:ticket');
|
|
$this->get('/ticket/create', 'App\Controllers\UserController:ticket_create');
|
|
$this->post('/ticket', 'App\Controllers\UserController:ticket_add');
|
|
$this->get('/ticket/{id}/view', 'App\Controllers\UserController:ticket_view');
|
|
$this->get('/ticket/{id}/attachment/{attachment_id:[0-9]+}', 'App\Controllers\UserController:ticket_attachment');
|
|
$this->post('/ticket/{id}/read', 'App\Controllers\UserController:ticket_mark_read');
|
|
// Multipart replies use POST so PHP reliably exposes uploaded files in
|
|
// $_FILES; the legacy PUT endpoint remains available for text clients.
|
|
$this->post('/ticket/{id}/reply', 'App\Controllers\UserController:ticket_update');
|
|
$this->put('/ticket/{id}', 'App\Controllers\UserController:ticket_update');
|
|
$this->post('/aff_check_in', 'App\Controllers\UserController:doAff');
|
|
$this->post('/aff_check_out', 'App\Controllers\UserController:doAff');
|
|
$this->post('/invite', 'App\Controllers\UserController:doInvite');
|
|
// Manual invite-code rotation is account functionality, not a proxy reset job.
|
|
$this->post('/resetiv', 'App\Controllers\UserController:doResetiv');
|
|
$this->get('/edit', 'App\Controllers\UserController:edit');
|
|
$this->post('/profile', 'App\Controllers\AccountSecurityController:updateProfile');
|
|
// Email changes require a one-time code delivered to the new email.
|
|
$this->post('/email/verify/send', 'App\Controllers\AccountSecurityController:emailVerifySend');
|
|
$this->post('/email', 'App\Controllers\AccountSecurityController:updateEmail');
|
|
// Password changes require the current password plus either a one-time
|
|
// email code or an enabled Google Authenticator code.
|
|
$this->post('/password/verify/send', 'App\Controllers\AccountSecurityController:passwordVerifySend');
|
|
$this->post('/password', 'App\Controllers\AccountSecurityController:updatePassword');
|
|
$this->get('/recharge/options', 'App\Controllers\AccountSecurityController:rechargeOptions');
|
|
$this->get('/recharge/methods', 'App\Controllers\AccountSecurityController:rechargeOptions');
|
|
$this->post('/security/google-authenticator', 'App\Controllers\UserController:enableGoogleAuthenticator');
|
|
$this->delete('/security/google-authenticator', 'App\Controllers\UserController:disableGoogleAuthenticator');
|
|
$this->post('/security/verify-method', 'App\Controllers\UserController:updateLoginVerifyMethod');
|
|
$this->get('/logout', 'App\Controllers\UserController:logout');
|
|
$this->get('/code', 'App\Controllers\UserController:code');
|
|
$this->get('/code_check', 'App\Controllers\UserController:code_check');
|
|
$this->post('/usdt/order', 'App\Controllers\UsdtController:create');
|
|
$this->post('/usdt/status', 'App\Controllers\UsdtController:status');
|
|
$this->post('/yipay/order', 'App\Controllers\YipayController:create');
|
|
$this->post('/yipay/status', 'App\Controllers\YipayController:status');
|
|
$this->post('/paytaro', 'App\Controllers\PaytaroController:create');
|
|
$this->post('/paytaro/order', 'App\Controllers\PaytaroController:create');
|
|
$this->post('/paytaro/status', 'App\Controllers\PaytaroController:status');
|
|
$this->post('/stripe/order', 'App\Controllers\StripeController:create');
|
|
$this->post('/stripe/status', 'App\Controllers\StripeController:status');
|
|
$this->get('/disable', 'App\Controllers\UserController:disable');
|
|
$this->post('/survey', 'App\Controllers\UserController:submitSurvey');
|
|
|
|
})->add(new Auth());
|
|
|
|
// Auth
|
|
$app->group('/auth', function () {
|
|
$this->get('/login', 'App\Controllers\AuthController:login');
|
|
$this->post('/login', 'App\Controllers\AuthController:loginHandle');
|
|
$this->post('/login/verify/send', 'App\Controllers\AuthController:sendLoginVerify');
|
|
$this->get('/register', 'App\Controllers\AuthController:register');
|
|
$this->post('/register', 'App\Controllers\AuthController:registerHandle');
|
|
$this->post('/send', 'App\Controllers\AuthController:sendVerify');
|
|
$this->get('/logout', 'App\Controllers\AuthController:logout');
|
|
})->add(new Guest());
|
|
|
|
// Password
|
|
$app->group('/password', function () {
|
|
$this->get('/reset', 'App\Controllers\PasswordController:reset');
|
|
$this->post('/reset', 'App\Controllers\PasswordController:handleReset');
|
|
$this->get('/token/{token}', 'App\Controllers\PasswordController:token');
|
|
$this->post('/token/{token}', 'App\Controllers\PasswordController:handleToken');
|
|
})->add(new Guest());
|
|
|
|
// Admin
|
|
$app->group('/admin', function () {
|
|
$this->get('', 'App\Controllers\AdminController:index');
|
|
$this->get('/', 'App\Controllers\AdminController:index');
|
|
$this->get('/resources', 'App\Controllers\Admin\CloudPageController:resources');
|
|
$this->get('/vpc', 'App\Controllers\Admin\CloudPageController:vpc');
|
|
// Host network preparation (administrator only).
|
|
$this->get('/hosts', 'App\Controllers\Admin\CloudPageController:hosts');
|
|
$this->get('/agents', 'App\Controllers\Admin\CloudPageController:agents');
|
|
$this->get('/object-storage', 'App\Controllers\Admin\ObjectStorageController:index');
|
|
$this->post('/object-storage/backends', 'App\Controllers\Admin\ObjectStorageController:createBackend')->add(new SuperAdmin());
|
|
$this->post('/object-storage/backends/{backend_id:[0-9]+}/config', 'App\Controllers\Admin\ObjectStorageController:updateBackend')->add(new SuperAdmin());
|
|
$this->post('/object-storage/backends/{backend_id:[0-9]+}/test', 'App\Controllers\Admin\ObjectStorageController:testBackend')->add(new SuperAdmin());
|
|
$this->post('/object-storage/backends/{backend_id:[0-9]+}/activate', 'App\Controllers\Admin\ObjectStorageController:activateBackend')->add(new SuperAdmin());
|
|
$this->post('/object-storage/backends/{backend_id:[0-9]+}/drain', 'App\Controllers\Admin\ObjectStorageController:drainBackend')->add(new SuperAdmin());
|
|
$this->post('/object-storage/backends/{backend_id:[0-9]+}/resume', 'App\Controllers\Admin\ObjectStorageController:resumeBackend')->add(new SuperAdmin());
|
|
$this->post('/object-storage/backends/{backend_id:[0-9]+}/disable', 'App\Controllers\Admin\ObjectStorageController:disableBackend')->add(new SuperAdmin());
|
|
$this->get('/object-storage/cleanup-debts', 'App\Controllers\Admin\ObjectStorageController:cleanupDebt');
|
|
$this->post('/object-storage/cleanup-debts/{backup_id:[0-9]+}/retry', 'App\Controllers\Admin\ObjectStorageController:retryCleanup')->add(new SuperAdmin());
|
|
$this->get('/object-storage/replica-attention', 'App\Controllers\Admin\ObjectStorageController:replicaAttention');
|
|
$this->post('/object-storage/replica-attention/{operation_id:[a-f0-9]{32}}/retry', 'App\Controllers\Admin\ObjectStorageController:retryReplicaAttention')->add(new SuperAdmin());
|
|
$this->get('/cloud/templates', 'App\Controllers\Admin\CloudPageController:templates');
|
|
$this->get('/cloud/rescue', 'App\Controllers\Admin\CloudPageController:rescue');
|
|
$this->get('/cloud/instances', 'App\Controllers\Admin\CloudPageController:instances');
|
|
$this->get('/abuse-monitoring',
|
|
'App\Controllers\Admin\CloudPageController:abuseMonitoring');
|
|
$this->get('/billing', 'App\Controllers\Admin\CloudPageController:billing');
|
|
$this->get('/cloud/orders', 'App\Controllers\Admin\CloudPageController:orders');
|
|
$this->get('/operations', 'App\Controllers\Admin\CloudPageController:operations');
|
|
$this->get('/maintenance-notices',
|
|
'App\Controllers\Admin\CloudPageController:maintenanceNotices');
|
|
$this->get('/service-compensations',
|
|
'App\Controllers\Admin\CloudPageController:serviceCompensations');
|
|
$this->get('/system-logs', 'App\Controllers\Admin\CloudPageController:systemLogs');
|
|
$this->get('/platform-default-policy', 'App\Controllers\Admin\CloudPageController:platformDefaultPolicy');
|
|
// Telegram administration is rendered inside the ticket system; these
|
|
// action endpoints remain stable for existing sessions and automation.
|
|
$this->post('/telegram/config', 'App\Controllers\Admin\TelegramController:save')->add(new SuperAdmin());
|
|
$this->post('/telegram/secret/rotate', 'App\Controllers\Admin\TelegramController:rotateSecret')->add(new SuperAdmin());
|
|
$this->post('/telegram/bind', 'App\Controllers\Admin\TelegramController:bind')->add(new SuperAdmin());
|
|
$this->post('/telegram/unbind', 'App\Controllers\Admin\TelegramController:unbind')->add(new SuperAdmin());
|
|
$this->post('/telegram/webhook', 'App\Controllers\Admin\TelegramController:webhook')->add(new SuperAdmin());
|
|
|
|
// Tick
|
|
$this->get('/ticket', 'App\Controllers\Admin\TicketController:index');
|
|
$this->get('/ticket/{id}/view', 'App\Controllers\Admin\TicketController:show');
|
|
$this->get('/ticket/{id}/attachment/{attachment_id:[0-9]+}', 'App\Controllers\Admin\TicketController:attachment')->add(new SuperAdmin());
|
|
$this->post('/ticket/{id}/read', 'App\Controllers\Admin\TicketController:markRead');
|
|
// Keep multipart administrator replies on POST for PHP upload parsing;
|
|
// existing PUT clients continue to use the original endpoint.
|
|
$this->post('/ticket/{id}/reply', 'App\Controllers\Admin\TicketController:update')->add(new SuperAdmin());
|
|
$this->put('/ticket/{id}', 'App\Controllers\Admin\TicketController:update')->add(new SuperAdmin());
|
|
$this->post('/ticket/ajax', 'App\Controllers\Admin\TicketController:ajax');
|
|
|
|
// Shop Mange
|
|
$this->get('/shop', 'App\Controllers\Admin\ShopController:index');
|
|
$this->post('/shop/ajax', 'App\Controllers\Admin\ShopController:ajax_shop');
|
|
|
|
$this->get('/shop/create', 'App\Controllers\Admin\ShopController:create')->add(new SuperAdmin());
|
|
$this->post('/shop', 'App\Controllers\Admin\ShopController:add')->add(new SuperAdmin());
|
|
$this->get('/shop/{id}/edit', 'App\Controllers\Admin\ShopController:edit');
|
|
$this->put('/shop/{id}', 'App\Controllers\Admin\ShopController:update')->add(new SuperAdmin());
|
|
$this->delete('/shop', 'App\Controllers\Admin\ShopController:deleteGet')->add(new SuperAdmin());
|
|
$this->get('/shop/{id}/offers/create', 'App\Controllers\Admin\ShopController:offerCreate')->add(new SuperAdmin());
|
|
$this->post('/shop/{id}/offers', 'App\Controllers\Admin\ShopController:offerAdd')->add(new SuperAdmin());
|
|
$this->get('/shop/{id}/offers/{offer_id}/edit', 'App\Controllers\Admin\ShopController:offerEdit');
|
|
$this->put('/shop/{id}/offers/{offer_id}', 'App\Controllers\Admin\ShopController:offerUpdate')->add(new SuperAdmin());
|
|
$this->delete('/shop/{id}/offers/{offer_id}', 'App\Controllers\Admin\ShopController:offerDelete')->add(new SuperAdmin());
|
|
|
|
// Ann Mange
|
|
$this->get('/announcement', 'App\Controllers\Admin\AnnController:index');
|
|
$this->get('/announcement/create', 'App\Controllers\Admin\AnnController:create')->add(new SuperAdmin());
|
|
$this->post('/announcement', 'App\Controllers\Admin\AnnController:add')->add(new SuperAdmin());
|
|
$this->get('/announcement/{id}/edit', 'App\Controllers\Admin\AnnController:edit')->add(new SuperAdmin());
|
|
$this->put('/announcement/{id}', 'App\Controllers\Admin\AnnController:update')->add(new SuperAdmin());
|
|
$this->post('/announcement/{id}/status', 'App\Controllers\Admin\AnnController:status')->add(new SuperAdmin());
|
|
|
|
// Survey Manage
|
|
$this->get('/survey', 'App\Controllers\Admin\SurveyController:index');
|
|
$this->get('/survey/create', 'App\Controllers\Admin\SurveyController:create')->add(new SuperAdmin());
|
|
$this->post('/survey', 'App\Controllers\Admin\SurveyController:add')->add(new SuperAdmin());
|
|
$this->get('/survey/{id}/edit', 'App\Controllers\Admin\SurveyController:edit')->add(new SuperAdmin());
|
|
$this->put('/survey/{id}', 'App\Controllers\Admin\SurveyController:update')->add(new SuperAdmin());
|
|
$this->delete('/survey', 'App\Controllers\Admin\SurveyController:delete')->add(new SuperAdmin());
|
|
|
|
// Detect Mange
|
|
|
|
// IP Mange
|
|
|
|
$this->get('/login', 'App\Controllers\Admin\IpController:index');
|
|
|
|
$this->post('/login/ajax', 'App\Controllers\Admin\IpController:ajax_login');
|
|
|
|
// Code Mange
|
|
$this->get('/code', 'App\Controllers\Admin\CodeController:index');
|
|
$this->post('/code/ajax', 'App\Controllers\Admin\CodeController:ajax_code');
|
|
$this->get('/usdt', 'App\Controllers\Admin\UsdtController:index');
|
|
$this->post('/usdt/config', 'App\Controllers\Admin\UsdtController:save')->add(new SuperAdmin());
|
|
$this->post('/usdt/test', 'App\Controllers\Admin\UsdtController:test')->add(new SuperAdmin());
|
|
$this->get('/yipay', 'App\Controllers\Admin\YipayController:index');
|
|
$this->post('/yipay/config', 'App\Controllers\Admin\YipayController:save')->add(new SuperAdmin());
|
|
$this->post('/yipay/test', 'App\Controllers\Admin\YipayController:test')->add(new SuperAdmin());
|
|
$this->post('/yipay/refund', 'App\Controllers\Admin\YipayController:refund')->add(new SuperAdmin());
|
|
$this->get('/paytaro', 'App\Controllers\Admin\PaytaroController:index');
|
|
$this->post('/paytaro/config', 'App\Controllers\Admin\PaytaroController:save')->add(new SuperAdmin());
|
|
$this->post('/paytaro/test', 'App\Controllers\Admin\PaytaroController:test')->add(new SuperAdmin());
|
|
$this->get('/stripe', 'App\Controllers\Admin\StripeController:index');
|
|
$this->post('/stripe/config', 'App\Controllers\Admin\StripeController:save')->add(new SuperAdmin());
|
|
$this->post('/stripe/test', 'App\Controllers\Admin\StripeController:test')->add(new SuperAdmin());
|
|
|
|
// User Mange
|
|
$this->get('/user', 'App\Controllers\Admin\UserController:index');
|
|
$this->get('/user/{id}/edit', 'App\Controllers\Admin\UserController:edit')->add(new SuperAdmin());
|
|
$this->post('/user/{id}/trusted-login-devices/clear', 'App\Controllers\Admin\UserController:clearTrustedLoginDevices')->add(new SuperAdmin());
|
|
$this->post('/user/{id}/login-sessions/clear', 'App\Controllers\Admin\UserController:clearLoginSessions')->add(new SuperAdmin());
|
|
$this->put('/user/{id}', 'App\Controllers\Admin\UserController:update')->add(new SuperAdmin());
|
|
$this->delete('/user', 'App\Controllers\Admin\UserController:delete')->add(new SuperAdmin());
|
|
$this->get('/user/ajax', 'App\Controllers\Admin\UserController:ajax');
|
|
$this->post('/user/ajax', 'App\Controllers\Admin\UserController:ajax');
|
|
$this->post('/user/send', 'App\Controllers\Admin\UserController:send')->add(new SuperAdmin());
|
|
$this->post('/user/create', 'App\Controllers\Admin\UserController:createNewUser')->add(new SuperAdmin());
|
|
|
|
$this->get('/coupon', 'App\Controllers\AdminController:coupon');
|
|
$this->post('/coupon', 'App\Controllers\AdminController:addCoupon')->add(new SuperAdmin());
|
|
$this->post('/coupon/ajax', 'App\Controllers\AdminController:ajax_coupon');
|
|
|
|
$this->get('/invite', 'App\Controllers\AdminController:invite');
|
|
$this->get('/logout', 'App\Controllers\AdminController:logout');
|
|
$this->post('/payback/ajax', 'App\Controllers\AdminController:ajax_payback');
|
|
|
|
//checkout apply
|
|
$this->get('/checkout', 'App\Controllers\Admin\CheckoutController:index');
|
|
$this->post('/checkout', 'App\Controllers\Admin\CheckoutController:deal')->add(new SuperAdmin());
|
|
$this->post('/checkout/ajax', 'App\Controllers\Admin\CheckoutController:ajax');
|
|
|
|
//log apply
|
|
// stats
|
|
$this->get('/api/analytics/income', 'App\Controllers\AdminController:getIncome');
|
|
$this->get('/api/analytics/new-users', 'App\Controllers\AdminController:newUsers');
|
|
$this->get('/api/analytics/month-income', 'App\Controllers\AdminController:monthIncome');
|
|
$this->get('/api/analytics/month-new-user-paid-rate', 'App\Controllers\AdminController:monthNewUserPaidRate');
|
|
|
|
$this->get('/site-analytics', 'App\Controllers\Admin\SiteAnalyticsController:index');
|
|
$this->get('/site-analytics/data', 'App\Controllers\Admin\SiteAnalyticsController:data');
|
|
$this->get('/site-analytics/security', 'App\Controllers\Admin\SiteAnalyticsController:security');
|
|
|
|
//email log
|
|
$this->get('/email', 'App\Controllers\Admin\LogController:emailLog');
|
|
$this->post('/email/ajax', 'App\Controllers\Admin\LogController:ajax_emailLog');
|
|
|
|
$this->get('/config', 'App\Controllers\Admin\ConfigController:config');
|
|
$this->get('/config/get', 'App\Controllers\Admin\ConfigController:get');
|
|
$this->post('/config/save', 'App\Controllers\Admin\ConfigController:save')->add(new SuperAdmin());
|
|
$this->post('/config/trusted-login-devices/clear', 'App\Controllers\Admin\ConfigController:clearTrustedLoginDevices')->add(new SuperAdmin());
|
|
$this->post('/config/login-sessions/clear', 'App\Controllers\Admin\ConfigController:clearLoginSessions')->add(new SuperAdmin());
|
|
|
|
// Global legal documents. Content is shared by all configured domains.
|
|
$this->get('/legal', 'App\Controllers\Admin\LegalController:index');
|
|
$this->post('/legal/{slug:terms|privacy}/draft', 'App\Controllers\Admin\LegalController:draft')->add(new SuperAdmin());
|
|
$this->post('/legal/{slug:terms|privacy}/publish', 'App\Controllers\Admin\LegalController:publish')->add(new SuperAdmin());
|
|
$this->post('/legal/{slug:terms|privacy}/preview', 'App\Controllers\Admin\LegalController:preview');
|
|
|
|
// Source-owned Chinese copy with administrator-managed target locales.
|
|
$this->get('/user-copy',
|
|
'App\Controllers\Admin\UserCopyController:index')
|
|
->add(new SuperAdmin());
|
|
$this->get('/user-copy/entries',
|
|
'App\Controllers\Admin\UserCopyController:entries')
|
|
->add(new SuperAdmin());
|
|
$this->get('/user-copy/publications',
|
|
'App\Controllers\Admin\UserCopyController:history')
|
|
->add(new SuperAdmin());
|
|
$this->post('/user-copy/synchronize',
|
|
'App\Controllers\Admin\UserCopyController:synchronize')
|
|
->add(new SuperAdmin());
|
|
$this->put('/user-copy/locales',
|
|
'App\Controllers\Admin\UserCopyController:locale')
|
|
->add(new SuperAdmin());
|
|
$this->put('/user-copy/entries/{copy_key:[a-z0-9._-]+}/draft',
|
|
'App\Controllers\Admin\UserCopyController:draft')
|
|
->add(new SuperAdmin());
|
|
$this->post('/user-copy/publications',
|
|
'App\Controllers\Admin\UserCopyController:publish')
|
|
->add(new SuperAdmin());
|
|
$this->post('/user-copy/publications/{publication_key:[a-f0-9]{32}}/rollback',
|
|
'App\Controllers\Admin\UserCopyController:rollback')
|
|
->add(new SuperAdmin());
|
|
|
|
})->add(new Admin());
|
|
|
|
// API
|
|
$app->group('/api', function () {
|
|
$this->get('/captch', 'App\Controllers\ApiController:createCaptch');
|
|
|
|
});
|
|
|
|
$app->get('/paytaro/callback', 'App\Controllers\PaytaroController:callback');
|
|
$app->post('/paytaro/callback', 'App\Controllers\PaytaroController:callback');
|
|
$app->get('/paytaro/callback/', 'App\Controllers\PaytaroController:callback');
|
|
$app->post('/paytaro/callback/', 'App\Controllers\PaytaroController:callback');
|
|
$app->get('/paytaro/return', 'App\Controllers\PaytaroController:handleReturn');
|
|
$app->post('/paytaro/return', 'App\Controllers\PaytaroController:handleReturn');
|
|
$app->post('/paytaro/status', 'App\Controllers\PaytaroController:status');
|
|
|
|
$app->post('/stripe/webhook', 'App\Controllers\StripeController:webhook');
|
|
$app->get('/stripe/return', 'App\Controllers\StripeController:handleReturn');
|
|
|
|
$app->get('/yipay/callback', 'App\Controllers\YipayController:callback');
|
|
$app->get('/yipay/return', 'App\Controllers\YipayController:handleReturn');
|
|
|
|
// Run Slim Routes for App
|
|
require BASE_PATH . '/config/routes_cloud.php';
|
|
$app->add(new \App\Middleware\SiteAnalytics());
|
|
$app->run();
|