88c6ce8ccc
- 迁移为 frontend-web、frontend-electron、backend-web 与 docker 部署结构 - 网页端:订阅门禁二次弹窗、套餐/支付组件化、顶栏分组对齐 - 首页:最近文件与模板库布局优化,缩略图对齐,下载与删除操作 - 新增管理后台、支付与云端文件 API,更新 README 与项目规范 Co-authored-by: Cursor <cursoragent@cursor.com>
32 lines
757 B
PHP
32 lines
757 B
PHP
<?php
|
|
declare(strict_types=1);
|
|
|
|
$publicRoot = '/var/www/public';
|
|
$uri = parse_url($_SERVER['REQUEST_URI'] ?? '/', PHP_URL_PATH) ?: '/';
|
|
|
|
if ($uri === '/health') {
|
|
header('Content-Type: text/plain; charset=utf-8');
|
|
echo 'ok';
|
|
return true;
|
|
}
|
|
|
|
$file = $publicRoot . $uri;
|
|
if ($uri !== '/' && is_file($file)) {
|
|
return false;
|
|
}
|
|
|
|
if (preg_match('#^/api/admin(/.*)?$#', $uri)) {
|
|
require $publicRoot . '/admin.php';
|
|
return true;
|
|
}
|
|
|
|
if (preg_match('#^/api/v1(/.*)?$#', $uri)) {
|
|
require $publicRoot . '/index.php';
|
|
return true;
|
|
}
|
|
|
|
http_response_code(404);
|
|
header('Content-Type: application/json; charset=utf-8');
|
|
echo json_encode(['ok' => false, 'error' => 'not_found', 'message' => 'Not found'], JSON_UNESCAPED_UNICODE);
|
|
return true;
|