feat: implement all admin functions

This commit is contained in:
shinya
2025-07-05 18:49:35 +08:00
parent 774a5dd697
commit 5fcdcbb390
13 changed files with 1337 additions and 310 deletions

28
start.js Normal file
View File

@@ -0,0 +1,28 @@
#!/usr/bin/env node
/* eslint-disable no-console,@typescript-eslint/no-var-requires */
const http = require('http');
// 直接在当前进程中启动 standalone Server`server.js`
require('./server.js');
// 每 1 秒轮询一次,直到请求成功
const TARGET_URL = `http://${process.env.HOSTNAME || 'localhost'}:${
process.env.PORT || 3000
}/login`;
const intervalId = setInterval(() => {
console.log(`Fetching ${TARGET_URL} ...`);
const req = http.get(TARGET_URL, (res) => {
// 当返回 2xx 状态码时认为成功,然后停止轮询
if (res.statusCode && res.statusCode >= 200 && res.statusCode < 300) {
console.log('Server is up, stop polling.');
clearInterval(intervalId);
}
});
req.setTimeout(2000, () => {
req.destroy();
});
}, 1000);