diff --git a/src/app/entity/setting.ts b/src/app/entity/setting.ts index f8219112..9e3a6b60 100755 --- a/src/app/entity/setting.ts +++ b/src/app/entity/setting.ts @@ -31,4 +31,6 @@ export default class SystemConfig { // i18n language = "en_us"; + + quickInstallAddr = "https://mcsmanager.com/support/quick_install.json"; } diff --git a/src/app/routers/private/instance_router.ts b/src/app/routers/private/instance_router.ts index cbe6317c..bade5f8b 100755 --- a/src/app/routers/private/instance_router.ts +++ b/src/app/routers/private/instance_router.ts @@ -8,6 +8,8 @@ import RemoteRequest from "../../service/remote_command"; import { multiOperationForwarding } from "../../service/instance_service"; import { timeUuid } from "../../service/password"; import { $t } from "../../i18n"; +import axios from "axios"; +import { systemConfig } from "../../setting"; const router = new Router({ prefix: "/instance" }); @@ -189,4 +191,20 @@ router.post("/multi_kill", permission({ level: 10 }), async (ctx) => { } }); +// [Top-level Permission] +// Get quick install list +router.get("/quick_install_list", permission({ level: 10 }), async (ctx) => { + const ADDR = systemConfig.quickInstallAddr; + try { + const response = await axios.request({ + method: "GET", + url: ADDR + }); + if (response.status !== 200) throw new Error("Response code != 200"); + ctx.body = response.data; + } catch (err) { + ctx.body = []; + } +}); + export default router;