feat: enhance PlayScreen and storage management with dynamic source handling and local storage support

This commit is contained in:
zimplexing
2025-07-15 22:59:10 +08:00
parent 0b1fa9df6d
commit 57bc0b3582
3 changed files with 136 additions and 30 deletions

View File

@@ -1,4 +1,5 @@
import express, { Request, Response } from "express";
import { getConfig } from "../config";
const router = express.Router();
@@ -8,19 +9,29 @@ const router = express.Router();
* @apiGroup Server
*
* @apiSuccess {String} SiteName The name of the site.
* @apiSuccess {String} StorageType The storage type used by the server ("localstorage").
* @apiSuccess {String} StorageType The storage type used by the server ("localstorage" or "database").
*
* @apiSuccessExample {json} Success-Response:
* @apiSuccessExample {json} Success-Response (LocalStorage):
* HTTP/1.1 200 OK
* {
* "SiteName": "OrionTV-Local",
* "StorageType": "localstorage"
* }
*
* @apiSuccessExample {json} Success-Response (Database):
* HTTP/1.1 200 OK
* {
* "SiteName": "OrionTV-Cloud",
* "StorageType": "database"
* }
*/
router.get("/server-config", (req: Request, res: Response) => {
const config = getConfig();
const storageType = config.storage?.type || "database"; // Default to 'database' if not specified
res.json({
SiteName: "OrionTV-Local",
StorageType: "localstorage",
SiteName: storageType === "localstorage" ? "OrionTV-Local" : "OrionTV-Cloud",
StorageType: storageType,
});
});