remove jellyfin, mqtt, webhook services, fix tests, add schema migrations
- delete server/services/jellyfin.ts, webhook.ts, mqtt.ts and their tests - strip jellyfin/mqtt imports and startup calls from index.tsx and settings.ts - remove /jellyfin, /mqtt, /mqtt/status, /mqtt/test, /jellyfin/webhook-plugin endpoints from settings router - clean ENV_MAP and isEnvConfigured of jellyfin/mqtt keys - add db/index.ts migrations for series_key, duration_seconds, scan_status, scan_error, last_scanned_at (new columns absent on older dev DBs) - move idx_media_items_series_key out of SCHEMA into migrate() so it runs after the column is added - fix all test fixtures: drop jellyfin_id/series_jellyfin_id column refs, update MediaItem/MediaStream object literals to match current types Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
+9
-10
@@ -12,9 +12,6 @@ const dbPath = join(dataDir, isDev ? "netfelix-dev.db" : "netfelix.db");
|
||||
// ─── Env-var → config key mapping ─────────────────────────────────────────────
|
||||
|
||||
const ENV_MAP: Record<string, string> = {
|
||||
jellyfin_url: "JELLYFIN_URL",
|
||||
jellyfin_api_key: "JELLYFIN_API_KEY",
|
||||
jellyfin_user_id: "JELLYFIN_USER_ID",
|
||||
radarr_url: "RADARR_URL",
|
||||
radarr_api_key: "RADARR_API_KEY",
|
||||
radarr_enabled: "RADARR_ENABLED",
|
||||
@@ -22,11 +19,6 @@ const ENV_MAP: Record<string, string> = {
|
||||
sonarr_api_key: "SONARR_API_KEY",
|
||||
sonarr_enabled: "SONARR_ENABLED",
|
||||
audio_languages: "AUDIO_LANGUAGES",
|
||||
mqtt_enabled: "MQTT_ENABLED",
|
||||
mqtt_url: "MQTT_URL",
|
||||
mqtt_topic: "MQTT_TOPIC",
|
||||
mqtt_username: "MQTT_USERNAME",
|
||||
mqtt_password: "MQTT_PASSWORD",
|
||||
};
|
||||
|
||||
/** Read a config key from environment variables (returns null if not set). */
|
||||
@@ -41,9 +33,9 @@ function envValue(key: string): string | null {
|
||||
return val;
|
||||
}
|
||||
|
||||
/** True when minimum required Jellyfin env vars are present — skips the setup wizard. */
|
||||
/** True when env vars are configured enough to skip the setup wizard. */
|
||||
function isEnvConfigured(): boolean {
|
||||
return !!(process.env.JELLYFIN_URL && process.env.JELLYFIN_API_KEY);
|
||||
return !!(process.env.MOVIES_ROOT || process.env.TV_ROOT);
|
||||
}
|
||||
|
||||
// ─── Database ──────────────────────────────────────────────────────────────────
|
||||
@@ -92,6 +84,13 @@ function migrate(db: Database): void {
|
||||
// Indexes for new columns — must run after the columns exist on existing DBs
|
||||
alter("CREATE INDEX IF NOT EXISTS idx_review_plans_sorted ON review_plans(sorted)");
|
||||
alter("CREATE INDEX IF NOT EXISTS idx_review_plans_auto_class ON review_plans(auto_class)");
|
||||
// drop-jellyfin refactor (2026-04-20): new columns replacing jellyfin-specific ones
|
||||
alter("ALTER TABLE media_items ADD COLUMN series_key TEXT");
|
||||
alter("ALTER TABLE media_items ADD COLUMN duration_seconds REAL");
|
||||
alter("ALTER TABLE media_items ADD COLUMN scan_status TEXT NOT NULL DEFAULT 'pending'");
|
||||
alter("ALTER TABLE media_items ADD COLUMN scan_error TEXT");
|
||||
alter("ALTER TABLE media_items ADD COLUMN last_scanned_at TEXT");
|
||||
alter("CREATE INDEX IF NOT EXISTS idx_media_items_series_key ON media_items(series_key)");
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -96,7 +96,6 @@ CREATE TABLE IF NOT EXISTS jobs (
|
||||
CREATE INDEX IF NOT EXISTS idx_review_plans_status ON review_plans(status);
|
||||
CREATE INDEX IF NOT EXISTS idx_review_plans_is_noop ON review_plans(is_noop);
|
||||
CREATE INDEX IF NOT EXISTS idx_stream_decisions_plan_id ON stream_decisions(plan_id);
|
||||
CREATE INDEX IF NOT EXISTS idx_media_items_series_key ON media_items(series_key);
|
||||
CREATE INDEX IF NOT EXISTS idx_media_items_series_name ON media_items(series_name);
|
||||
CREATE INDEX IF NOT EXISTS idx_media_items_type ON media_items(type);
|
||||
CREATE INDEX IF NOT EXISTS idx_media_streams_item_id ON media_streams(item_id);
|
||||
|
||||
Reference in New Issue
Block a user