Add WebUI dev mode auth & dev script
Introduce a development-only WebUI auth mode controlled by SNOWLUMA_DEV_MODE. When enabled, a fixed in-memory password ("snowluma-dev") is used, config/webui.json is not read or written, and password changes are disabled. Expose WebuiAuth.isDevMode() and WebuiAuth.devPassword, add startup logs when dev mode is active, and wire up dev:mode npm scripts (root and packages/core) using cross-env to set the env flags.
This commit is contained in:
1 parent
466a10a00a
commit
19a564991c
4 files changed
+55
-4
No files matched your search
@@ -77,7 +77,14 @@ export async function initWebUI(
|
||||
): Promise<{ port: number }> {
|
||||
const auth = WebuiAuth.load();
|
||||
const initialPassword = auth.takeInitialPassword();
|
||||
if (initialPassword) {
|
||||
if (auth.isDevMode()) {
|
||||
log.warn('=========================================');
|
||||
log.warn('WebUI 已进入开发模式 (SNOWLUMA_DEV_MODE=1)');
|
||||
log.warn('固定密码: %s', WebuiAuth.devPassword);
|
||||
log.warn('config/webui.json 不会被读写,强制改密流程已跳过');
|
||||
log.warn('请勿在生产环境启用此模式');
|
||||
log.warn('=========================================');
|
||||
} else if (initialPassword) {
|
||||
log.info('=========================================');
|
||||
log.info('WebUI 安全认证(首次启动,已生成临时密码)');
|
||||
log.info('默认用户: admin');
|
||||
|
||||
Reference in new issue
Block a user