Feat: quick install flow

This commit is contained in:
unitwk 2022-10-21 20:41:02 +08:00
parent f8385e818f
commit a9addeb584
2 changed files with 20 additions and 0 deletions

View File

@ -31,4 +31,6 @@ export default class SystemConfig {
// i18n
language = "en_us";
quickInstallAddr = "https://mcsmanager.com/support/quick_install.json";
}

View File

@ -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;