diff --git a/backend/app/db/session.py b/backend/app/db/session.py index ea95933a..751003a4 100644 --- a/backend/app/db/session.py +++ b/backend/app/db/session.py @@ -150,7 +150,7 @@ DEFAULT_LOGIN_USERS = ( { "username": "linkong", "email": "linkong@planet.local", - "password": "12345678", + "password": "LK12345678", "role": "super_admin", }, ) diff --git a/backend/scripts/create_admin.py b/backend/scripts/create_admin.py index f2a1ae4c..bf59e84c 100644 --- a/backend/scripts/create_admin.py +++ b/backend/scripts/create_admin.py @@ -18,7 +18,7 @@ async def create_admin(): if existing_user: print("用户 linkong 已存在,更新密码...") - existing_user.set_password("12345678") + existing_user.set_password("LK12345678") existing_user.role = "super_admin" existing_user.email = "linkong@planet.local" else: @@ -26,7 +26,7 @@ async def create_admin(): user = User( username="linkong", email="linkong@planet.local", - password_hash=get_password_hash("12345678"), + password_hash=get_password_hash("LK12345678"), role="super_admin", is_active=True, ) diff --git a/backend/scripts/init_admin.py b/backend/scripts/init_admin.py index 316286b2..ada471ae 100644 --- a/backend/scripts/init_admin.py +++ b/backend/scripts/init_admin.py @@ -19,7 +19,7 @@ DEFAULT_LOGIN_USERS = ( { "username": "linkong", "email": "linkong@planet.local", - "password": "12345678", + "password": "LK12345678", "role": "super_admin", }, ) diff --git a/backend/scripts/init_db.py b/backend/scripts/init_db.py index e101c3d3..d04c0c48 100644 --- a/backend/scripts/init_db.py +++ b/backend/scripts/init_db.py @@ -22,7 +22,7 @@ DEFAULT_LOGIN_USERS = ( { "username": "linkong", "email": "linkong@planet.local", - "password": "12345678", + "password": "LK12345678", "role": "super_admin", }, ) diff --git a/docs/plans/docs-audience-split-plan.md b/docs/plans/docs-audience-split-plan.md index ddd23b83..9ca026f3 100644 --- a/docs/plans/docs-audience-split-plan.md +++ b/docs/plans/docs-audience-split-plan.md @@ -57,7 +57,7 @@ 抽自现 manual.md,重新组织: -1. 首次启动 — `./planet.sh start`、默认账号(`admin/admin123`、`linkong/12345678`,引用 `b15d097b` 引入的 `DEFAULT_LOGIN_USERS`) +1. 首次启动 — `./planet.sh start`、默认账号(`admin/admin123`、`linkong/LK12345678`,引用 `b15d097b` 引入的 `DEFAULT_LOGIN_USERS`) 2. 启停与按模块重启 — `start/stop/restart` 及 `-b -f -a -d` 3. 健康检查 — `./planet.sh health` 4. 日志 — `./planet.sh log` 及 `-f -b -a`,日志文件路径 diff --git a/docs/technical/en/ops-runbook.md b/docs/technical/en/ops-runbook.md index 5306ab0e..7fca18c1 100644 --- a/docs/technical/en/ops-runbook.md +++ b/docs/technical/en/ops-runbook.md @@ -21,7 +21,7 @@ First startup seeds two default accounts (see `DEFAULT_LOGIN_USERS` in `backend/ | Username | Password | Role | | --- | --- | --- | | `admin` | `admin123` | `super_admin` | -| `linkong` | `12345678` | `super_admin` | +| `linkong` | `LK12345678` | `super_admin` | Both seed accounts are created with `email_verified = TRUE` and can log into the console immediately. Any other account must either go through the public registration flow described in the Manual, or be created via `./planet.sh createuser`. diff --git a/docs/technical/zh/ops-runbook.md b/docs/technical/zh/ops-runbook.md index d68044a6..b06b50ec 100644 --- a/docs/technical/zh/ops-runbook.md +++ b/docs/technical/zh/ops-runbook.md @@ -21,7 +21,7 @@ | 用户名 | 密码 | 角色 | | --- | --- | --- | | `admin` | `admin123` | `super_admin` | -| `linkong` | `12345678` | `super_admin` | +| `linkong` | `LK12345678` | `super_admin` | 两个默认账号 `email_verified` 为 `true`,可直接登录控制台。任何在该列表之外的账号都必须走公开注册 + 邮箱验证流程(见使用手册),或用 `./planet.sh createuser` 命令式创建。 diff --git a/planet.sh b/planet.sh index 644f5d1b..35a1f665 100755 --- a/planet.sh +++ b/planet.sh @@ -535,6 +535,18 @@ run_command_with_spinner() { return "$exit_code" } +run_command_quiet_unless_verbose() { + local log_file="$1" + shift + + if [ "$VERBOSE" -eq 1 ]; then + "$@" + return $? + fi + + "$@" > "$log_file" 2>&1 +} + resolve_bun_from_shell_configs() { local shell_name="$1" shift @@ -1272,6 +1284,8 @@ install_bun_if_needed() { } ensure_uv_backend_deps() { + local log_file="$PLANET_STATE_DIR/uv_sync.log" + set_wait_detail "检查后端 uv 环境" if ! command -v uv >/dev/null 2>&1; then @@ -1279,6 +1293,7 @@ ensure_uv_backend_deps() { fi cd "$SCRIPT_DIR" + : > "$log_file" if [ ! -x "$SCRIPT_DIR/.venv/bin/python" ]; then log_warn "未检测到 .venv,正在执行 uv sync" @@ -1287,7 +1302,8 @@ ensure_uv_backend_deps() { "$DEPENDENCY_INSTALL_RETRY_INTERVAL" \ "uv 环境初始化失败,已重试 ${DEPENDENCY_INSTALL_MAX_RETRIES} 次" \ "uv sync" \ - uv sync --group dev; then + run_command_quiet_unless_verbose "$log_file" uv sync --group dev; then + tail -20 "$log_file" 2>/dev/null || true exit 1 fi fi @@ -1299,6 +1315,8 @@ ensure_uv_backend_deps() { } ensure_python_runtime() { + local log_file="$PLANET_STATE_DIR/uv_python_install.log" + ensure_local_runtime_bins_on_path if ! command -v uv >/dev/null 2>&1; then @@ -1306,6 +1324,7 @@ ensure_python_runtime() { fi cd "$SCRIPT_DIR" + : > "$log_file" set_wait_detail "安装 Python 3.14 运行时" if ! run_with_retry \ @@ -1313,12 +1332,15 @@ ensure_python_runtime() { "$DEPENDENCY_INSTALL_RETRY_INTERVAL" \ "Python 3.14 运行时安装失败,已重试 ${DEPENDENCY_INSTALL_MAX_RETRIES} 次" \ "uv python install 3.14" \ - uv python install 3.14; then + run_command_quiet_unless_verbose "$log_file" uv python install 3.14; then + tail -20 "$log_file" 2>/dev/null || true exit 1 fi } sync_python_deps() { + local log_file="$PLANET_STATE_DIR/uv_sync.log" + ensure_local_runtime_bins_on_path if ! command -v uv >/dev/null 2>&1; then @@ -1326,6 +1348,7 @@ sync_python_deps() { fi cd "$SCRIPT_DIR" + : > "$log_file" set_wait_detail "同步 Python 依赖" if ! run_with_retry \ @@ -1333,7 +1356,8 @@ sync_python_deps() { "$DEPENDENCY_INSTALL_RETRY_INTERVAL" \ "uv 环境初始化失败,已重试 ${DEPENDENCY_INSTALL_MAX_RETRIES} 次" \ "uv sync" \ - uv sync --group dev; then + run_command_quiet_unless_verbose "$log_file" uv sync --group dev; then + tail -20 "$log_file" 2>/dev/null || true exit 1 fi @@ -1469,6 +1493,7 @@ resolve_frontend_runtime() { ensure_frontend_deps() { local owns_wait_session=0 + local log_file="$PLANET_STATE_DIR/bun_install.log" if [ "$WAIT_SESSION_ACTIVE" -eq 0 ]; then start_wait_session "检查前端依赖" @@ -1488,6 +1513,7 @@ ensure_frontend_deps() { fi cd "$SCRIPT_DIR/frontend" + : > "$log_file" set_wait_detail "检查 Vite Bun 入口是否已安装" if [ ! -f "$FRONTEND_VITE_ENTRY" ]; then @@ -1498,7 +1524,8 @@ ensure_frontend_deps() { "$DEPENDENCY_INSTALL_RETRY_INTERVAL" \ "前端依赖安装失败,已重试 ${DEPENDENCY_INSTALL_MAX_RETRIES} 次" \ "bun install" \ - "$FRONTEND_RUNTIME_BIN" install; then + run_command_quiet_unless_verbose "$log_file" "$FRONTEND_RUNTIME_BIN" install; then + tail -20 "$log_file" 2>/dev/null || true exit 1 fi fi @@ -2917,6 +2944,8 @@ ensure_planet_env_files() { } sync_frontend_deps() { + local log_file="$PLANET_STATE_DIR/bun_install.log" + set_wait_detail "解析前端运行时" if ! resolve_frontend_runtime; then install_bun_if_needed @@ -2927,6 +2956,7 @@ sync_frontend_deps() { fi cd "$SCRIPT_DIR/frontend" + : > "$log_file" set_wait_detail "同步前端依赖" if ! run_with_retry \ @@ -2934,7 +2964,8 @@ sync_frontend_deps() { "$DEPENDENCY_INSTALL_RETRY_INTERVAL" \ "前端依赖安装失败,已重试 ${DEPENDENCY_INSTALL_MAX_RETRIES} 次" \ "bun install" \ - "$FRONTEND_RUNTIME_BIN" install; then + run_command_quiet_unless_verbose "$log_file" "$FRONTEND_RUNTIME_BIN" install; then + tail -20 "$log_file" 2>/dev/null || true exit 1 fi } @@ -3041,7 +3072,7 @@ init() { log_success "初始化完成" log_note "默认本地登录用户:" log_note " admin / admin123" - log_note " linkong / 12345678" + log_note " linkong / LK12345678" log_note "下一步: ./planet.sh start" } diff --git a/scripts/init_db.py b/scripts/init_db.py index 33fac9e7..ccb65822 100644 --- a/scripts/init_db.py +++ b/scripts/init_db.py @@ -23,7 +23,7 @@ DEFAULT_LOGIN_USERS = ( { "username": "linkong", "email": "linkong@planet.local", - "password": "12345678", + "password": "LK12345678", "role": "super_admin", }, )