From 39724e6e737456c2d947fb058493c3d8ae8d2551 Mon Sep 17 00:00:00 2001 From: admin <362324317@qq.com> Date: Tue, 19 May 2026 14:23:26 +0800 Subject: [PATCH] =?UTF-8?q?fix(audit):=20=E4=BF=AE=E5=A4=8D3=E4=B8=AA?= =?UTF-8?q?=E5=AE=A1=E8=AE=A1=E5=8F=91=E7=8E=B0=E7=9A=84bug=20-=20migrateC?= =?UTF-8?q?loudConfigs=20=E7=BC=BA=20}=20=E5=AF=BC=E8=87=B4=20notify=5Fcon?= =?UTF-8?q?fig/cloud=5Ftype=5Fuid=20=E5=B5=8C=E5=A5=97=E5=9C=A8=20promotio?= =?UTF-8?q?n=5Faccount=20=E5=86=85=E4=B8=8D=E8=BF=81=E7=A7=BB=20-=20cloud?= =?UTF-8?q?=5Fconfigs=5Fv2=20INSERT/SELECT=20=E7=BC=BA=20cloud=5Ftype=5Fui?= =?UTF-8?q?d/cookie=5Fuid=20=E5=AF=BC=E8=87=B4=E6=95=B0=E6=8D=AE=E4=B8=A2?= =?UTF-8?q?=E5=A4=B1=20-=20deploy.sh=20=E5=AF=86=E7=A0=81=E5=B5=8C?= =?UTF-8?q?=E5=85=A5=E6=94=B9=E6=88=90=20docker=20exec=20-e=20=E4=BC=A0?= =?UTF-8?q?=E5=8F=82(=E9=98=B2=E7=89=B9=E6=AE=8A=E5=AD=97=E7=AC=A6?= =?UTF-8?q?=E6=B3=A8=E5=85=A5)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- VERSION | 2 +- source_clean/VERSION | 2 +- source_clean/deploy.sh | 4 ++-- source_clean/src/database/database.ts | 5 +++-- 4 files changed, 7 insertions(+), 6 deletions(-) diff --git a/VERSION b/VERSION index 75274d8..1f77169 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.4.12 +0.4.13 diff --git a/source_clean/VERSION b/source_clean/VERSION index 75274d8..1f77169 100644 --- a/source_clean/VERSION +++ b/source_clean/VERSION @@ -1 +1 @@ -0.4.12 +0.4.13 diff --git a/source_clean/deploy.sh b/source_clean/deploy.sh index 98c4b81..231ded2 100755 --- a/source_clean/deploy.sh +++ b/source_clean/deploy.sh @@ -97,11 +97,11 @@ done # -- 强制写入管理员密码 -- info "同步管理员密码..." sleep 3 -docker exec CloudSearch_App node -e ' +docker exec -e ADMIN_PASSWORD="$ADMIN_PASSWORD" CloudSearch_App node -e ' var bcrypt = require("bcryptjs"); var Database = require("better-sqlite3"); var db = new Database("/data/database.sqlite"); -var hash = bcrypt.hashSync("'"${ADMIN_PASSWORD}"'", 10); +var pw = process.env.ADMIN_PASSWORD || ""; var hash = bcrypt.hashSync(pw, 10); var existing = db.prepare("SELECT id FROM admins WHERE username = ?").get("admin"); if (existing) { db.prepare("UPDATE admins SET password_hash = ? WHERE username = ?").run(hash, "admin"); diff --git a/source_clean/src/database/database.ts b/source_clean/src/database/database.ts index a5ee697..84e3593 100755 --- a/source_clean/src/database/database.ts +++ b/source_clean/src/database/database.ts @@ -230,8 +230,8 @@ function migrateCloudConfigs(db: Database.Database): void { created_at TEXT NOT NULL DEFAULT (datetime('now', 'localtime')), updated_at TEXT NOT NULL DEFAULT (datetime('now', 'localtime')) ); - INSERT INTO cloud_configs_v2 (id, cloud_type, cookie, nickname, is_active, storage_used, storage_total, checkin_status, last_checkin_at, checkin_message, consecutive_failures, last_used_at, total_saves, created_at, updated_at) - SELECT id, cloud_type, cookie, nickname, is_active, storage_used, storage_total, COALESCE(checkin_status,'none'), last_checkin_at, checkin_message, COALESCE(consecutive_failures,0), last_used_at, COALESCE(total_saves,0), created_at, updated_at FROM cloud_configs; + INSERT INTO cloud_configs_v2 (id, cloud_type, cookie, cloud_type_uid, cookie_uid, nickname, is_active, storage_used, storage_total, checkin_status, last_checkin_at, checkin_message, consecutive_failures, last_used_at, total_saves, created_at, updated_at) + SELECT id, cloud_type, cookie, cloud_type_uid, cookie_uid, nickname, is_active, storage_used, storage_total, COALESCE(checkin_status,'none'), last_checkin_at, checkin_message, COALESCE(consecutive_failures,0), last_used_at, COALESCE(total_saves,0), created_at, updated_at FROM cloud_configs; DROP TABLE cloud_configs; ALTER TABLE cloud_configs_v2 RENAME TO cloud_configs; `); @@ -257,6 +257,7 @@ function migrateCloudConfigs(db: Database.Database): void { if (!hasPromotionAccount) { db.exec("ALTER TABLE cloud_configs ADD COLUMN promotion_account TEXT DEFAULT NULL"); console.log('[DB] cloud_configs migration: promotion_account column added'); +} // v0.3.5: notify_config for per-cloud push notification settings const hasNotifyConfig = db.prepare("SELECT sql FROM sqlite_master WHERE name='cloud_configs' AND sql LIKE '%notify_config%'").get();