The most complete open-source travel planner: real-time collaboration, bookings, budgets, packing lists, journals, offline PWA, SSO and an AI-ready MCP server, with planet-wide place search and routing built in.
TypeScript budget-trackercollaborativedockeritinerarymcp-serveroffline-firstopen-sourceopenstreetmappacking-listpwareal-timeself-hostedselfhostedtraveltravel-apptravel-journaltravel-plannertripitwanderlog
Merge branch 'dev' into feature/naver-support
Marco Sadowski18da5aed3914
diff --cc client/src/i18n/translations/zhTw.tsindex 260d4411c,49e38ebad..25295d04c--- a/client/src/i18n/translations/zhTw.ts+++ b/client/src/i18n/translations/zhTw.ts@@@ -1509,8 -1685,41 +1690,42 @@@ const zhTw: Record<string, string> ='undo.lock': '地點鎖定已切換','undo.importGpx': 'GPX 匯入','undo.importGoogleList': 'Google 地圖匯入',+ 'undo.importNaverList': 'Naver 地圖匯入',+ // Todo+ 'todo.subtab.packing': '行李清單',+ 'todo.subtab.todo': '待辦事項',+ 'todo.completed': '已完成',+ 'todo.filter.all': '全部',+ 'todo.filter.open': '未完成',+ 'todo.filter.done': '已完成',+ 'todo.uncategorized': '未分類',+ 'todo.namePlaceholder': '任務名稱',+ 'todo.descriptionPlaceholder': '說明(可選)',+ 'todo.unassigned': '未指派',+ 'todo.noCategory': '無分類',+ 'todo.hasDescription': '有說明',+ 'todo.addItem': '新增任務...',+ 'todo.newCategory': '分類名稱',+ 'todo.addCategory': '新增分類',+ 'todo.newItem': '新任務',+ 'todo.empty': '尚無任務。新增任務以開始!',+ 'todo.filter.my': '我的任務',+ 'todo.filter.overdue': '已逾期',+ 'todo.sidebar.tasks': '任務',+ 'todo.sidebar.categories': '分類',+ 'todo.detail.title': '任務',+ 'todo.detail.description': '說明',+ 'todo.detail.category': '分類',+ 'todo.detail.dueDate': '到期日',+ 'todo.detail.assignedTo': '指派給',+ 'todo.detail.delete': '刪除',+ 'todo.detail.save': '儲存變更',+ 'todo.sortByPrio': '優先順序',+ 'todo.detail.priority': '優先順序',+ 'todo.detail.noPriority': '無',+ 'todo.detail.create': '建立任務',+// Notifications'notifications.title': '通知','notifications.markAllRead': '全部標為已讀',diff --cc server/src/db/migrations.tsindex 936a92fbc,f614ff4d6..9c9f5a393--- a/server/src/db/migrations.ts+++ b/server/src/db/migrations.ts@@@ -903,31 -885,556 +904,581 @@@ function runMigrations(db: Database.Datins.run(r.trip_id, r.category, idx++);}},+ // Migration: Naver list import addon (default off)+ () => {+ try {+ db.prepare(`+ INSERT INTO addons (id, name, description, type, icon, enabled, sort_order)+ VALUES (?, ?, ?, ?, ?, ?, ?)+ ON CONFLICT(id) DO UPDATE SET+ name = excluded.name,+ description = excluded.description,+ type = excluded.type,+ icon = excluded.icon,+ sort_order = excluded.sort_order+ `).run(+ 'naver_list_import',+ 'Naver List Import',+ 'Import places from shared Naver Maps lists',+ 'trip',+ 'Link2',+ 0,+ 13,+ );+ } catch (err: any) {+ console.warn('[migrations] Non-fatal migration step failed:', err);+ }+ },+ // Migration: OAuth 2.1 clients, consents, and tokens for MCP+ () => {+ db.exec(`+ CREATE TABLE IF NOT EXISTS oauth_clients (+ id TEXT PRIMARY KEY,+ user_id INTEGER NOT NULL REFERENCES users(id) ON DELETE CASCADE,+ name TEXT NOT NULL,+ client_id TEXT UNIQUE NOT NULL,+ client_secret_hash TEXT NOT NULL,+ redirect_uris TEXT NOT NULL DEFAULT '[]',+ allowed_scopes TEXT NOT NULL DEFAULT '[]',+ created_at DATETIME DEFAULT CURRENT_TIMESTAMP+ );+ CREATE INDEX IF NOT EXISTS idx_oauth_clients_user ON oauth_clients(user_id);+ CREATE UNIQUE INDEX IF NOT EXISTS idx_oauth_clients_client_id ON oauth_clients(client_id);++ CREATE TABLE IF NOT EXISTS oauth_consents (+ id INTEGER PRIMARY KEY AUTOINCREMENT,+ client_id TEXT NOT NULL REFERENCES oauth_clients(client_id) ON DELETE CASCADE,+ user_id INTEGER NOT NULL REFERENCES users(id) ON DELETE CASCADE,+ scopes TEXT NOT NULL DEFAULT '[]',+ updated_at DATETIME DEFAULT CURRENT_TIMESTAMP,+ UNIQUE(client_id, user_id)+ );++ CREATE TABLE IF NOT EXISTS oauth_tokens (+ id INTEGER PRIMARY KEY AUTOINCREMENT,+ client_id TEXT NOT NULL REFERENCES oauth_clients(client_id) ON DELETE CASCADE,+ user_id INTEGER NOT NULL REFERENCES users(id) ON DELETE CASCADE,+ access_token_hash TEXT UNIQUE NOT NULL,+ refresh_token_hash TEXT UNIQUE NOT NULL,+ scopes TEXT NOT NULL DEFAULT '[]',+ access_token_expires_at DATETIME NOT NULL,+ refresh_token_expires_at DATETIME NOT NULL,+ revoked_at DATETIME,+ created_at DATETIME DEFAULT CURRENT_TIMESTAMP+ );+ CREATE INDEX IF NOT EXISTS idx_oauth_tokens_user ON oauth_tokens(user_id);+ CREATE UNIQUE INDEX IF NOT EXISTS idx_oauth_tokens_access ON oauth_tokens(access_token_hash);+ CREATE UNIQUE INDEX IF NOT EXISTS idx_oauth_tokens_refresh ON oauth_tokens(refresh_token_hash);+ `);+ },+ // Migration: Refresh-token rotation chain tracking for replay detection+ () => {+ db.exec(`+ ALTER TABLE oauth_tokens ADD COLUMN parent_token_id INTEGER REFERENCES oauth_tokens(id);+ CREATE INDEX IF NOT EXISTS idx_oauth_tokens_parent ON oauth_tokens(parent_token_id);+ `);+ },+ // Migration: Public client support for browser-initiated dynamic registration (DCR)+ () => {+ db.exec(`+ ALTER TABLE oauth_clients ADD COLUMN is_public INTEGER NOT NULL DEFAULT 0;+ ALTER TABLE oauth_clients ADD COLUMN created_via TEXT NOT NULL DEFAULT 'settings_ui';+ `);+ },+ // Migration: Make oauth_clients.user_id nullable to support anonymous RFC 7591 DCR clients+ // (must run outside a transaction because PRAGMA foreign_keys cannot change mid-transaction)+ {+ raw: () => {+ db.exec('PRAGMA foreign_keys = OFF');+ try {+ db.transaction(() => {+ db.exec(`+ CREATE TABLE IF NOT EXISTS oauth_clients_new (+ id TEXT PRIMARY KEY,+ user_id INTEGER REFERENCES users(id) ON DELETE CASCADE,+ name TEXT NOT NULL,+ client_id TEXT UNIQUE NOT NULL,+ client_secret_hash TEXT NOT NULL,+ redirect_uris TEXT NOT NULL DEFAULT '[]',+ allowed_scopes TEXT NOT NULL DEFAULT '[]',+ created_at DATETIME DEFAULT CURRENT_TIMESTAMP,+ is_public INTEGER NOT NULL DEFAULT 0,+ created_via TEXT NOT NULL DEFAULT 'settings_ui'+ )+ `);+ db.exec(`INSERT INTO oauth_clients_new SELECT id, user_id, name, client_id, client_secret_hash, redirect_uris, allowed_scopes, created_at, is_public, created_via FROM oauth_clients`);+ db.exec(`DROP TABLE oauth_clients`);+ db.exec(`ALTER TABLE oauth_clients_new RENAME TO oauth_clients`);+ db.exec(`CREATE INDEX IF NOT EXISTS idx_oauth_clients_user ON oauth_clients(user_id)`);+ db.exec(`CREATE UNIQUE INDEX IF NOT EXISTS idx_oauth_clients_client_id ON oauth_clients(client_id)`);+ })();+ } finally {+ db.exec('PRAGMA foreign_keys = ON');+ }+ },+ },+ // Migration: Add OTP field, skip_ssl column, device_id (did) column, and hint column for Synology Photos+ () => {+ const cols = db.prepare('PRAGMA table_info(photo_provider_fields)').all() as Array<{ name: string }>;+ if (!cols.some(c => c.name === 'hint')) {+ db.exec(`ALTER TABLE photo_provider_fields ADD COLUMN hint TEXT`);+ }+ db.exec(`+ INSERT OR IGNORE INTO photo_provider_fields+ (provider_id, field_key, label, input_type, placeholder, required, secret, settings_key, payload_key, sort_order)+ VALUES+ ('synologyphotos', 'synology_otp', 'providerOTP', 'text', '123456', 0, 0, NULL, 'synology_otp', 3)+ `);+ db.exec(`ALTER TABLE users ADD COLUMN synology_skip_ssl INTEGER NOT NULL DEFAULT 0`);+ db.exec(`ALTER TABLE users ADD COLUMN synology_did TEXT`);+ db.exec(`+ INSERT OR IGNORE INTO photo_provider_fields+ (provider_id, field_key, label, input_type, placeholder, required, secret, settings_key, payload_key, sort_order)+ VALUES+ ('synologyphotos', 'synology_skip_ssl', 'skipSSLVerification', 'checkbox', NULL, 0, 0, 'synology_skip_ssl', 'synology_skip_ssl', 4)+ `);+ db.exec(`+ UPDATE photo_provider_fields+ SET hint = 'providerUrlHintSynology'+ WHERE provider_id = 'synologyphotos' AND field_key = 'synology_url'+ `);+ },+ // Migration 84: Journey addon — trip tracking & travel journal+ () => {+ // Register addon (disabled by default — opt-in)+ db.prepare(`+ INSERT OR IGNORE INTO addons (id, name, description, type, icon, enabled, config, sort_order)+ VALUES ('journey', 'Journey', 'Trip tracking & travel journal — check-ins, photos, daily stories', 'global', 'Compass', 0, '{}', 35)+ `).run();++ // Core journey table+ db.exec(`+ CREATE TABLE IF NOT EXISTS journeys (+ id TEXT PRIMARY KEY,+ trip_id INTEGER REFERENCES trips(id) ON DELETE SET NULL,+ user_id INTEGER NOT NULL REFERENCES users(id) ON DELETE CASCADE,+ title TEXT NOT NULL,+ description TEXT,+ cover_image TEXT,+ status TEXT NOT NULL DEFAULT 'draft',+ started_at TEXT,+ ended_at TEXT,+ is_public INTEGER NOT NULL DEFAULT 0,+ public_token TEXT UNIQUE,+ settings TEXT DEFAULT '{}',+ created_at TEXT NOT NULL DEFAULT (strftime('%Y-%m-%dT%H:%M:%SZ','now')),+ updated_at TEXT NOT NULL DEFAULT (strftime('%Y-%m-%dT%H:%M:%SZ','now'))+ )+ `);++ // Check-ins — visited locations+ db.exec(`+ CREATE TABLE IF NOT EXISTS journey_checkins (+ id TEXT PRIMARY KEY,+ journey_id TEXT NOT NULL REFERENCES journeys(id) ON DELETE CASCADE,+ place_id INTEGER REFERENCES places(id) ON DELETE SET NULL,+ name TEXT NOT NULL,+ lat REAL,+ lng REAL,+ address TEXT,+ country_code TEXT,+ notes TEXT,+ checked_in_at TEXT NOT NULL,+ source TEXT NOT NULL DEFAULT 'manual',+ created_at TEXT NOT NULL DEFAULT (strftime('%Y-%m-%dT%H:%M:%SZ','now'))+ )+ `);++ // Journal entries — daily stories+ db.exec(`+ CREATE TABLE IF NOT EXISTS journey_entries (+ id TEXT PRIMARY KEY,+ journey_id TEXT NOT NULL REFERENCES journeys(id) ON DELETE CASCADE,+ checkin_id TEXT REFERENCES journey_checkins(id) ON DELETE SET NULL,+ entry_date TEXT NOT NULL,+ title TEXT,+ body TEXT,+ mood TEXT,+ weather TEXT,+ sort_order INTEGER NOT NULL DEFAULT 0,+ created_at TEXT NOT NULL DEFAULT (strftime('%Y-%m-%dT%H:%M:%SZ','now')),+ updated_at TEXT NOT NULL DEFAULT (strftime('%Y-%m-%dT%H:%M:%SZ','now'))+ )+ `);++ // Photos — local uploads + provider references (Immich/Synology)+ db.exec(`+ CREATE TABLE IF NOT EXISTS journey_photos (+ id TEXT PRIMARY KEY,+ journey_id TEXT NOT NULL REFERENCES journeys(id) ON DELETE CASCADE,+ checkin_id TEXT REFERENCES journey_checkins(id) ON DELETE SET NULL,+ entry_id TEXT REFERENCES journey_entries(id) ON DELETE SET NULL,+ storage_type TEXT NOT NULL DEFAULT 'local',+ asset_id TEXT,+ file_path TEXT,+ thumbnail_path TEXT,+ original_name TEXT,+ mime_type TEXT,+ size_bytes INTEGER,+ caption TEXT,+ taken_at TEXT,+ lat REAL,+ lng REAL,+ sort_order INTEGER NOT NULL DEFAULT 0,+ created_at TEXT NOT NULL DEFAULT (strftime('%Y-%m-%dT%H:%M:%SZ','now'))+ )+ `);++ // GPS trail points (Dawarich integration)+ db.exec(`+ CREATE TABLE IF NOT EXISTS journey_location_trail (+ id INTEGER PRIMARY KEY AUTOINCREMENT,+ journey_id TEXT NOT NULL REFERENCES journeys(id) ON DELETE CASCADE,+ lat REAL NOT NULL,+ lng REAL NOT NULL,+ altitude REAL,+ accuracy REAL,+ recorded_at TEXT NOT NULL,+ source TEXT NOT NULL DEFAULT 'dawarich'+ )+ `);++ // Indexes+ db.exec(`+ CREATE INDEX IF NOT EXISTS idx_journeys_user ON journeys(user_id);+ CREATE INDEX IF NOT EXISTS idx_journeys_trip ON journeys(trip_id);+ CREATE INDEX IF NOT EXISTS idx_journeys_public_token ON journeys(public_token);+ CREATE INDEX IF NOT EXISTS idx_journey_checkins_journey ON journey_checkins(journey_id, checked_in_at);+ CREATE INDEX IF NOT EXISTS idx_journey_entries_journey_date ON journey_entries(journey_id, entry_date);+ CREATE INDEX IF NOT EXISTS idx_journey_photos_journey ON journey_photos(journey_id);+ CREATE INDEX IF NOT EXISTS idx_journey_photos_checkin ON journey_photos(checkin_id);+ CREATE INDEX IF NOT EXISTS idx_journey_photos_entry ON journey_photos(entry_id);+ CREATE INDEX IF NOT EXISTS idx_journey_trail_journey_time ON journey_location_trail(journey_id, recorded_at);+ `);+ },+ // Migration 85: Journal — richer entry fields for magazine-style design+ () => {+ // Highlight tags (JSON array), visibility control, hero photo, color accent+ try { db.exec('ALTER TABLE journey_entries ADD COLUMN highlight_tags TEXT'); } catch {}+ try { db.exec("ALTER TABLE journey_entries ADD COLUMN visibility TEXT NOT NULL DEFAULT 'private'"); } catch {}+ try { db.exec('ALTER TABLE journey_entries ADD COLUMN hero_photo_id TEXT'); } catch {}+ try { db.exec('ALTER TABLE journey_entries ADD COLUMN color_accent TEXT'); } catch {}+ try { db.exec('ALTER TABLE journey_entries ADD COLUMN place_name TEXT'); } catch {}+ try { db.exec('ALTER TABLE journey_entries ADD COLUMN place_id INTEGER REFERENCES places(id) ON DELETE SET NULL'); } catch {}+ try { db.exec('ALTER TABLE journey_entries ADD COLUMN lat REAL'); } catch {}+ try { db.exec('ALTER TABLE journey_entries ADD COLUMN lng REAL'); } catch {}++ // Check-in: allow a single cover photo reference+ try { db.exec('ALTER TABLE journey_checkins ADD COLUMN photo_id TEXT'); } catch {}++ // Photos: add caption edit timestamp for gallery ordering+ try { db.exec('ALTER TABLE journey_photos ADD COLUMN width INTEGER'); } catch {}+ try { db.exec('ALTER TABLE journey_photos ADD COLUMN height INTEGER'); } catch {}+ },+ // Migration 86: Journey multi-trip support + sharing/collaboration+ () => {+ // Junction table: journey can include multiple trips+ db.exec(`+ CREATE TABLE IF NOT EXISTS journey_trips (+ journey_id TEXT NOT NULL REFERENCES journeys(id) ON DELETE CASCADE,+ trip_id INTEGER NOT NULL REFERENCES trips(id) ON DELETE CASCADE,+ sort_order INTEGER NOT NULL DEFAULT 0,+ added_at TEXT NOT NULL DEFAULT (strftime('%Y-%m-%dT%H:%M:%SZ','now')),+ PRIMARY KEY (journey_id, trip_id)+ )+ `);+ db.exec('CREATE INDEX IF NOT EXISTS idx_journey_trips_journey ON journey_trips(journey_id)');++ // Sharing: invite users to a journey+ db.exec(`+ CREATE TABLE IF NOT EXISTS journey_members (+ id INTEGER PRIMARY KEY AUTOINCREMENT,+ journey_id TEXT NOT NULL REFERENCES journeys(id) ON DELETE CASCADE,+ user_id INTEGER NOT NULL REFERENCES users(id) ON DELETE CASCADE,+ role TEXT NOT NULL DEFAULT 'viewer',+ invited_by INTEGER REFERENCES users(id) ON DELETE SET NULL,+ created_at TEXT NOT NULL DEFAULT (strftime('%Y-%m-%dT%H:%M:%SZ','now')),+ UNIQUE(journey_id, user_id)+ )+ `);+ db.exec('CREATE INDEX IF NOT EXISTS idx_journey_members_user ON journey_members(user_id)');++ // author tracking on entries and checkins+ try { db.exec('ALTER TABLE journey_entries ADD COLUMN user_id INTEGER REFERENCES users(id) ON DELETE SET NULL'); } catch {}+ try { db.exec('ALTER TABLE journey_checkins ADD COLUMN user_id INTEGER REFERENCES users(id) ON DELETE SET NULL'); } catch {}+ },+ // Migration 87: Journey rebuild — new schema with trip sync+ () => {+ // Migrate existing data from old tables into backup, then rebuild+ const hasOldJourneys = db.prepare(+ "SELECT 1 FROM sqlite_master WHERE type='table' AND name='journeys'"+ ).get();++ let oldJourneys: any[] = [];+ let oldEntries: any[] = [];+ let oldPhotos: any[] = [];++ if (hasOldJourneys) {+ // Save existing data before dropping+ try { oldJourneys = db.prepare('SELECT * FROM journeys').all(); } catch {}+ try { oldEntries = db.prepare('SELECT * FROM journey_entries').all(); } catch {}+ try { oldPhotos = db.prepare('SELECT * FROM journey_photos').all(); } catch {}++ // Drop all old journey tables+ db.exec('DROP TABLE IF EXISTS journey_location_trail');+ db.exec('DROP TABLE IF EXISTS journey_photos');+ db.exec('DROP TABLE IF EXISTS journey_entries');+ db.exec('DROP TABLE IF EXISTS journey_checkins');+ db.exec('DROP TABLE IF EXISTS journey_members');+ db.exec('DROP TABLE IF EXISTS journey_trips');+ db.exec('DROP TABLE IF EXISTS journeys');+ }++ // New schema+ db.exec(`+ CREATE TABLE journeys (+ id INTEGER PRIMARY KEY AUTOINCREMENT,+ user_id INTEGER NOT NULL,+ title TEXT NOT NULL,+ subtitle TEXT,+ cover_gradient TEXT,+ status TEXT DEFAULT 'draft',+ created_at INTEGER NOT NULL,+ updated_at INTEGER NOT NULL,+ FOREIGN KEY (user_id) REFERENCES users(id)+ )+ `);++ db.exec(`+ CREATE TABLE journey_trips (+ journey_id INTEGER NOT NULL,+ trip_id INTEGER NOT NULL,+ added_at INTEGER NOT NULL,+ PRIMARY KEY (journey_id, trip_id),+ FOREIGN KEY (journey_id) REFERENCES journeys(id) ON DELETE CASCADE,+ FOREIGN KEY (trip_id) REFERENCES trips(id) ON DELETE CASCADE+ )+ `);++ db.exec(`+ CREATE TABLE journey_entries (+ id INTEGER PRIMARY KEY AUTOINCREMENT,+ journey_id INTEGER NOT NULL,+ source_trip_id INTEGER,+ source_place_id INTEGER,+ author_id INTEGER NOT NULL,+ type TEXT NOT NULL,+ title TEXT,+ story TEXT,+ entry_date TEXT NOT NULL,+ entry_time TEXT,+ location_name TEXT,+ location_lat REAL,+ location_lng REAL,+ mood TEXT,+ weather TEXT,+ tags TEXT,+ visibility TEXT DEFAULT 'private',+ sort_order INTEGER DEFAULT 0,+ created_at INTEGER NOT NULL,+ updated_at INTEGER NOT NULL,+ FOREIGN KEY (journey_id) REFERENCES journeys(id) ON DELETE CASCADE,+ FOREIGN KEY (source_trip_id) REFERENCES trips(id) ON DELETE SET NULL,+ FOREIGN KEY (source_place_id) REFERENCES places(id) ON DELETE SET NULL,+ FOREIGN KEY (author_id) REFERENCES users(id)+ )+ `);++ db.exec(`+ CREATE TABLE journey_photos (+ id INTEGER PRIMARY KEY AUTOINCREMENT,+ entry_id INTEGER NOT NULL,+ file_path TEXT NOT NULL,+ thumbnail_path TEXT,+ caption TEXT,+ sort_order INTEGER DEFAULT 0,+ width INTEGER,+ height INTEGER,+ created_at INTEGER NOT NULL,+ FOREIGN KEY (entry_id) REFERENCES journey_entries(id) ON DELETE CASCADE+ )+ `);++ db.exec(`+ CREATE TABLE journey_contributors (+ journey_id INTEGER NOT NULL,+ user_id INTEGER NOT NULL,+ role TEXT NOT NULL,+ added_at INTEGER NOT NULL,+ PRIMARY KEY (journey_id, user_id),+ FOREIGN KEY (journey_id) REFERENCES journeys(id) ON DELETE CASCADE,+ FOREIGN KEY (user_id) REFERENCES users(id)+ )+ `);++ // Indexes+ db.exec(`+ CREATE INDEX idx_journeys_user ON journeys(user_id);+ CREATE INDEX idx_journey_entries_journey ON journey_entries(journey_id, entry_date);+ CREATE INDEX idx_journey_entries_source ON journey_entries(source_place_id);+ CREATE INDEX idx_journey_photos_entry ON journey_photos(entry_id);+ CREATE INDEX idx_journey_trips_journey ON journey_trips(journey_id);+ CREATE INDEX idx_journey_contributors_user ON journey_contributors(user_id);+ `);++ // Re-import old data if it existed+ if (oldJourneys.length > 0) {+ const ts = Date.now();+ const journeyIdMap = new Map<string, number>(); // old TEXT id -> new INTEGER id++ for (const j of oldJourneys) {+ const res = db.prepare(`+ INSERT INTO journeys (user_id, title, subtitle, status, created_at, updated_at)+ VALUES (?, ?, ?, ?, ?, ?)+ `).run(+ j.user_id,+ j.title || 'Untitled Journey',+ j.description || null,+ j.status || 'draft',+ j.created_at ? new Date(j.created_at).getTime() : ts,+ j.updated_at ? new Date(j.updated_at).getTime() : ts+ );+ journeyIdMap.set(j.id, Number(res.lastInsertRowid));++ // Add owner as contributor+ db.prepare(`+ INSERT OR IGNORE INTO journey_contributors (journey_id, user_id, role, added_at)+ VALUES (?, ?, 'owner', ?)+ `).run(Number(res.lastInsertRowid), j.user_id, ts);++ // Link trip if old journey had one+ if (j.trip_id) {+ try {+ db.prepare(`+ INSERT OR IGNORE INTO journey_trips (journey_id, trip_id, added_at)+ VALUES (?, ?, ?)+ `).run(Number(res.lastInsertRowid), j.trip_id, ts);+ } catch {}+ }+ }++ // Migrate entries+ const entryIdMap = new Map<string, number>();+ for (const e of oldEntries) {+ const newJourneyId = journeyIdMap.get(e.journey_id);+ if (!newJourneyId) continue;++ const res = db.prepare(`+ INSERT INTO journey_entries (journey_id, author_id, type, title, story, entry_date, entry_time, location_name, location_lat, location_lng, mood, weather, visibility, sort_order, created_at, updated_at)+ VALUES (?, ?, 'entry', ?, ?, ?, NULL, ?, ?, ?, ?, ?, ?, ?, ?, ?)+ `).run(+ newJourneyId,+ e.user_id || oldJourneys.find((j: any) => j.id === e.journey_id)?.user_id || 1,+ e.title || null,+ e.body || null,+ e.entry_date || new Date().toISOString().split('T')[0],+ e.place_name || null,+ e.lat || null,+ e.lng || null,+ e.mood || null,+ e.weather || null,+ e.visibility || 'private',+ e.sort_order || 0,+ e.created_at ? new Date(e.created_at).getTime() : ts,+ e.updated_at ? new Date(e.updated_at).getTime() : ts+ );+ entryIdMap.set(e.id, Number(res.lastInsertRowid));+ }++ // Migrate photos+ for (const p of oldPhotos) {+ const newEntryId = p.entry_id ? entryIdMap.get(p.entry_id) : null;+ if (!newEntryId || !p.file_path) continue;++ db.prepare(`+ INSERT INTO journey_photos (entry_id, file_path, thumbnail_path, caption, sort_order, width, height, created_at)+ VALUES (?, ?, ?, ?, ?, ?, ?, ?)+ `).run(+ newEntryId,+ p.file_path,+ p.thumbnail_path || null,+ p.caption || null,+ p.sort_order || 0,+ p.width || null,+ p.height || null,+ p.created_at ? new Date(p.created_at).getTime() : ts+ );+ }++ console.log(`[DB] Journey migration: imported ${journeyIdMap.size} journeys, ${entryIdMap.size} entries, photos migrated`);+ }+ },+ // Migration 88: Journey photos — provider support (Immich/Synology)+ () => {+ try { db.exec("ALTER TABLE journey_photos ADD COLUMN provider TEXT NOT NULL DEFAULT 'local'"); } catch {}+ try { db.exec('ALTER TABLE journey_photos ADD COLUMN asset_id TEXT'); } catch {}+ try { db.exec('ALTER TABLE journey_photos ADD COLUMN owner_id INTEGER REFERENCES users(id)'); } catch {}+ try { db.exec('ALTER TABLE journey_photos ADD COLUMN shared INTEGER NOT NULL DEFAULT 1'); } catch {}+ // file_path was NOT NULL — recreate table to make it nullable+ const hasProvider = db.prepare("SELECT 1 FROM pragma_table_info('journey_photos') WHERE name = 'provider'").get();+ if (hasProvider) {+ // Already has the column, just ensure file_path is nullable by recreating+ try {+ db.exec(`+ CREATE TABLE journey_photos_new (+ id INTEGER PRIMARY KEY AUTOINCREMENT,+ entry_id INTEGER NOT NULL,+ provider TEXT NOT NULL DEFAULT 'local',+ asset_id TEXT,+ owner_id INTEGER REFERENCES users(id),+ file_path TEXT,+ thumbnail_path TEXT,+ caption TEXT,+ sort_order INTEGER DEFAULT 0,+ width INTEGER,+ height INTEGER,+ shared INTEGER NOT NULL DEFAULT 1,+ created_at INTEGER NOT NULL,+ FOREIGN KEY (entry_id) REFERENCES journey_entries(id) ON DELETE CASCADE+ );+ INSERT INTO journey_photos_new SELECT id, entry_id, provider, asset_id, owner_id, file_path, thumbnail_path, caption, sort_order, width, height, shared, created_at FROM journey_photos;+ DROP TABLE journey_photos;+ ALTER TABLE journey_photos_new RENAME TO journey_photos;+ CREATE INDEX idx_journey_photos_entry ON journey_photos(entry_id);+ `);+ } catch {}+ }+ },+ // Migration 89: Journey cover image+ () => {+ try { db.exec('ALTER TABLE journeys ADD COLUMN cover_image TEXT'); } catch {}+ },+ // Migration 90: Pros/Cons for journey entries+ () => {+ try { db.exec('ALTER TABLE journey_entries ADD COLUMN pros_cons TEXT'); } catch {}+ },+ // Migration 91: Journey share tokens+ () => {+ db.exec(`+ CREATE TABLE IF NOT EXISTS journey_share_tokens (+ id INTEGER PRIMARY KEY AUTOINCREMENT,+ journey_id INTEGER NOT NULL,+ token TEXT NOT NULL UNIQUE,+ created_by INTEGER NOT NULL,+ share_timeline INTEGER DEFAULT 1,+ share_gallery INTEGER DEFAULT 1,+ share_map INTEGER DEFAULT 1,+ created_at DATETIME DEFAULT CURRENT_TIMESTAMP,+ FOREIGN KEY (journey_id) REFERENCES journeys(id) ON DELETE CASCADE,+ FOREIGN KEY (created_by) REFERENCES users(id)+ )+ `);+ db.exec('CREATE UNIQUE INDEX IF NOT EXISTS idx_journey_share_journey ON journey_share_tokens(journey_id)');+ },+ // Migration: Vacay week_start setting (0=Sunday, 1=Monday default)+ () => {+ try { db.exec("ALTER TABLE vacay_plans ADD COLUMN week_start INTEGER NOT NULL DEFAULT 1"); } catch {}+ },];if (currentVersion < migrations.length) {diff --cc server/src/db/seeds.tsindex 156d94a7d,5cc557aec..9245d79cf--- a/server/src/db/seeds.ts+++ b/server/src/db/seeds.ts@@@ -88,8 -92,8 +92,9 @@@ function seedAddons(db: Database.Databa{ id: 'vacay', name: 'Vacay', description: 'Personal vacation day planner with calendar view', type: 'global', icon: 'CalendarDays', enabled: 1, sort_order: 10 },{ id: 'atlas', name: 'Atlas', description: 'World map of your visited countries with travel stats', type: 'global', icon: 'Globe', enabled: 1, sort_order: 11 },{ id: 'mcp', name: 'MCP', description: 'Model Context Protocol for AI assistant integration', type: 'integration', icon: 'Terminal', enabled: 0, sort_order: 12 },+ { id: 'naver_list_import', name: 'Naver List Import', description: 'Import places from shared Naver Maps lists', type: 'trip', icon: 'Link2', enabled: 0, sort_order: 13 },{ id: 'collab', name: 'Collab', description: 'Notes, polls, and live chat for trip collaboration', type: 'trip', icon: 'Users', enabled: 1, sort_order: 6 },+ { id: 'journey', name: 'Journey', description: 'Trip tracking & travel journal — check-ins, photos, daily stories', type: 'global', icon: 'Compass', enabled: 0, sort_order: 35 },];const insertAddon = db.prepare('INSERT OR IGNORE INTO addons (id, name, description, type, icon, enabled, sort_order) VALUES (?, ?, ?, ?, ?, ?, ?)');for (const a of defaultAddons) insertAddon.run(a.id, a.name, a.description, a.type, a.icon, a.enabled, a.sort_order);diff --cc server/src/routes/places.tsindex 1553da3a0,62c3cafde..86878449b--- a/server/src/routes/places.ts+++ b/server/src/routes/places.ts@@@ -15,9 -14,9 +15,10 @@@ importdeletePlace,importGpx,importGoogleList,+ importNaverList,searchPlaceImage,} from '../services/placeService';+ import { onPlaceCreated, onPlaceUpdated, onPlaceDeleted } from '../services/journeyService';const gpxUpload = multer({ storage: multer.memoryStorage(), limits: { fileSize: 10 * 1024 * 1024 } });diff --cc server/src/services/placeService.tsindex cf8e887d4,aa90d8800..38c6ed7d2--- a/server/src/services/placeService.ts+++ b/server/src/services/placeService.ts@@@ -389,118 -402,9 +402,118 @@@ export async function importGoogleList(});insertAll();- return { places: created, listName };+ return { places: created, listName, skipped };}+// ---------------------------------------------------------------------------+// Import Naver Maps list+// ---------------------------------------------------------------------------++export async function importNaverList(+ tripId: string,+ url: string,+): Promise<{ places: any[]; listName: string } | { error: string; status: number }> {+ let resolvedUrl = url;+ const limit = 20;++ // Resolve naver.me short links to the canonical map.naver.com folder URL.+ if (url.includes('naver.me')) {+ const redirectRes = await fetch(url, { redirect: 'follow', signal: AbortSignal.timeout(10000) });+ resolvedUrl = redirectRes.url;+ }++ const folderMatch = resolvedUrl.match(/favorite\/myPlace\/folder\/([A-Za-z0-9_-]+)/i);+ const folderId = folderMatch?.[1] || null;+ if (!folderId) {+ return { error: 'Could not extract folder ID from URL. Please use a shared Naver Maps list link.', status: 400 };+ }++ const fetchPage = async (start: number) => {+ const apiUrl = `https://pages.map.naver.com/save-pages/api/maps-bookmark/v3/shares/${encodeURIComponent(folderId)}/bookmarks?placeInfo=true&start=${start}&limit=${limit}&sort=lastUseTime&mcids=ALL&createIdNo=true`;+ const apiRes = await fetch(apiUrl, {+ headers: {+ Accept: 'application/json',+ 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36',+ },+ signal: AbortSignal.timeout(15000),+ });++ if (!apiRes.ok) {+ return { error: 'Failed to fetch list from Naver Maps', status: 502 } as const;+ }++ try {+ const data = await apiRes.json() as {+ folder?: { bookmarkCount?: number; name?: string };+ bookmarkList?: any[];+ };+ return { data } as const;+ } catch {+ return { error: 'Invalid list data received from Naver Maps', status: 400 } as const;+ }+ };++ const firstPage = await fetchPage(0);+ if ('error' in firstPage) {+ return { error: firstPage.error, status: firstPage.status };+ }++ const listName = firstPage.data.folder?.name || 'Naver Maps List';+ const totalCount = typeof firstPage.data.folder?.bookmarkCount === 'number'+ ? firstPage.data.folder.bookmarkCount+ : (firstPage.data.bookmarkList?.length || 0);++ const allItems: any[] = [...(firstPage.data.bookmarkList || [])];+ for (let start = limit; start < totalCount; start += limit) {+ const page = await fetchPage(start);+ if ('error' in page) {+ return { error: page.error, status: page.status };+ }+ const pageItems = page.data.bookmarkList || [];+ if (!Array.isArray(pageItems) || pageItems.length === 0) break;+ allItems.push(...pageItems);+ }++ if (allItems.length === 0) {+ return { error: 'List is empty or could not be read', status: 400 };+ }++ const places: { name: string; lat: number; lng: number; notes: string | null; address: string | null }[] = [];+ for (const item of allItems) {+ const lat = Number(item?.py);+ const lng = Number(item?.px);+ const name = typeof item?.name === 'string' && item.name.trim()+ ? item.name.trim()+ : (typeof item?.displayName === 'string' ? item.displayName.trim() : '');+ const note = typeof item?.memo === 'string' && item.memo.trim() ? item.memo.trim() : null;+ const address = typeof item?.address === 'string' && item.address.trim() ? item.address.trim() : null;++ if (name && Number.isFinite(lat) && Number.isFinite(lng)) {+ places.push({ name, lat, lng, notes: note, address });+ }+ }++ if (places.length === 0) {+ return { error: 'No places with coordinates found in list', status: 400 };+ }++ const insertStmt = db.prepare(`+ INSERT INTO places (trip_id, name, lat, lng, address, notes, transport_mode)+ VALUES (?, ?, ?, ?, ?, ?, 'walking')+ `);+ const created: any[] = [];+ const insertAll = db.transaction(() => {+ for (const p of places) {+ const result = insertStmt.run(tripId, p.name, p.lat, p.lng, p.address, p.notes);+ const place = getPlaceWithTags(Number(result.lastInsertRowid));+ created.push(place);+ }+ });+ insertAll();++ return { places: created, listName };+}+// ---------------------------------------------------------------------------// Search place image (Unsplash)// ---------------------------------------------------------------------------