This commit is contained in:
jocay
2026-08-17 23:57:43 +08:00
parent 005260f893
commit 29b0f03c24
11 changed files with 1085 additions and 256 deletions
+4 -2
View File
@@ -1,7 +1,9 @@
const fs = require('fs');
const path = require('path');
const BASE = 'http://localhost:3030';
const BASE = (process.env.BASE_URL || 'http://localhost:3031').replace(/\/$/, '');
const ADMIN_USER = process.env.ADMIN_USER || 'admin';
const ADMIN_PASS = process.env.ADMIN_PASS || 'admin123';
const ARGS = process.argv.slice(2);
const FILES = ARGS.length ? ARGS : ['set-dart-dev.json', 'set-flutter-dev.json'];
@@ -9,7 +11,7 @@ async function main() {
const loginRes = await fetch(BASE + '/api/admin/login', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ username: 'admin', password: 'admin123' })
body: JSON.stringify({ username: ADMIN_USER, password: ADMIN_PASS })
});
const login = await loginRes.json();
if (!loginRes.ok) throw new Error('登录失败: ' + login.error);