全项目扫描修复: Docker数据卷修复+安全requireAdmin+12页SEO+API白名单+脚本超时+常量提取+假数据删除

This commit is contained in:
ZhuiGuangAI Dev
2026-06-12 17:27:47 +08:00
parent 464924aea0
commit 4c325c8699
454 changed files with 33647 additions and 980 deletions
+37
View File
@@ -0,0 +1,37 @@
#!/bin/sh
# =============================================================================
# 追光AI APP 容器启动入口
# - 校验 .env
# - 跑 prisma migrate deploy(生产环境,安全前向迁移)
# - 启动 next start
# =============================================================================
set -e
cd /app
# Seed data volume if empty
if [ ! -f /app/data/bot-characters.json ] && [ -d /app/data-seed ]; then
echo "[entrypoint] Seeding data volume..."
cp -r /app/data-seed/* /app/data/
fi
# 1) .env 校验
if [ ! -f /app/.env ]; then
echo "[entrypoint-app] FATAL: /app/.env not found. Mount .env file into container."
exit 1
fi
# 让 .env 对 next start 可见(Next.js 14 在 production 下也会读 .env)
set -a
. /app/.env
set +a
# 2) 跑迁移(幂等;不阻塞启动)
echo "[entrypoint-app] Running prisma migrate deploy..."
npx prisma migrate deploy --schema=prisma/schema.prisma 2>&1 | tail -20 || {
echo "[entrypoint-app] WARN: migrate failed, continuing (DB schema may be ahead of migrations)"
}
# 3) 启动 Next.js
echo "[entrypoint-app] Starting next start on port ${PORT:-8301}..."
exec node_modules/.bin/next start --port ${PORT:-8301} --hostname 0.0.0.0