INNER CODE UNIT · JavaScript
startGui
wangshengithub/staticshield · encrypt.js:51
async function startGui() {
const guiPath = path.join(__dirname, 'gui', 'index.html');
if (!fs.existsSync(guiPath)) { console.error('未找到 Web GUI(gui/index.html)。请先运行:node src/build-gui.js'); process.exit(1); }
const { startServer } = require('./src/server');
let info;
try { info = await startServer({ guiPath }); } catch (e) { console.error('启动本地服务失败:' + e.message); process.exit(1); }
const url = 'http://' + info.host + ':' + info.port + '/';
console.log('StaticShield GUI 已启动:' + url);
console.log('(多个客户端可同时访问该地址进行并行加密;按 Ctrl+C 停止服务)');
openUrl(url);
}
async function processFile(file, password, args) {
if (!fs.existsSync(file)) throw new Error('文件不存在: ' + file);
const baseDir = path.dirname(path.resolve(file));
let html = fs.readFileSync(file, 'utf8');
const stats = {};
if (args.bundle) {