fix: correct Memos links and author identities

This commit is contained in:
2026-07-19 18:51:16 +08:00
parent d512443d00
commit 08059e2a9d
11 changed files with 41 additions and 21 deletions
+5
View File
@@ -180,6 +180,11 @@ db.exec("CREATE INDEX IF NOT EXISTS posts_source_visibility_idx ON posts(source_
db.prepare("INSERT OR IGNORE INTO schema_migrations(version) VALUES(40)").run();
db.exec("CREATE INDEX IF NOT EXISTS alert_deliveries_status_idx ON alert_deliveries(status,run_after)");
db.prepare("INSERT OR IGNORE INTO schema_migrations(version) VALUES(41)").run();
const hasMemoUrlMigration = db.prepare("SELECT 1 FROM schema_migrations WHERE version=42").get();
if (!hasMemoUrlMigration) {
db.exec(`UPDATE posts SET remote_url=(SELECT rtrim(s.base_url,'/') FROM sources s WHERE s.id=posts.source_id) || CASE WHEN substr(remote_memo_name,7)<>'' AND substr(remote_memo_name,7) NOT GLOB '*[^0-9]*' THEN '/m/' || substr(remote_memo_name,7) ELSE '/' || remote_memo_name END WHERE origin='memos' AND remote_memo_name LIKE 'memos/%' AND source_id IS NOT NULL`);
db.prepare("INSERT INTO schema_migrations(version) VALUES(42)").run();
}
const admin = process.env.ADMIN_USERNAME;
const adminPassword = process.env.ADMIN_PASSWORD;