dev #11

Merged
linkong merged 19 commits from dev into main 2026-05-20 22:41:06 +00:00
9 changed files with 46 additions and 15 deletions
Showing only changes of commit a37d4b6289 - Show all commits

View File

@@ -150,7 +150,7 @@ DEFAULT_LOGIN_USERS = (
{
"username": "linkong",
"email": "linkong@planet.local",
"password": "12345678",
"password": "LK12345678",
"role": "super_admin",
},
)

View File

@@ -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,
)

View File

@@ -19,7 +19,7 @@ DEFAULT_LOGIN_USERS = (
{
"username": "linkong",
"email": "linkong@planet.local",
"password": "12345678",
"password": "LK12345678",
"role": "super_admin",
},
)

View File

@@ -22,7 +22,7 @@ DEFAULT_LOGIN_USERS = (
{
"username": "linkong",
"email": "linkong@planet.local",
"password": "12345678",
"password": "LK12345678",
"role": "super_admin",
},
)

View File

@@ -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`,日志文件路径

View File

@@ -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`.

View File

@@ -21,7 +21,7 @@
| 用户名 | 密码 | 角色 |
| --- | --- | --- |
| `admin` | `admin123` | `super_admin` |
| `linkong` | `12345678` | `super_admin` |
| `linkong` | `LK12345678` | `super_admin` |
两个默认账号 `email_verified``true`,可直接登录控制台。任何在该列表之外的账号都必须走公开注册 + 邮箱验证流程(见使用手册),或用 `./planet.sh createuser` 命令式创建。

View File

@@ -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"
}

View File

@@ -23,7 +23,7 @@ DEFAULT_LOGIN_USERS = (
{
"username": "linkong",
"email": "linkong@planet.local",
"password": "12345678",
"password": "LK12345678",
"role": "super_admin",
},
)