0.16.0 Pre-Release Checks

This commit is contained in:
2026-04-29 07:39:49 +00:00
parent ff8a8f67bf
commit d679eface4
23 changed files with 2372 additions and 301 deletions
+73 -2
View File
@@ -3,12 +3,14 @@ const os = require('os');
const path = require('path');
const { spawn, spawnSync } = require('child_process');
const { getDb } = require('../db/database');
const logger = require('./logger').child('SETTINGS');
const loggerService = require('./logger');
const logger = loggerService.child('SETTINGS');
const {
parseJson,
normalizeValueByType,
serializeValueByType,
validateSetting
validateSetting,
toBoolean
} = require('../utils/validators');
const { splitArgs } = require('../utils/commandLine');
const { setLogRootDir } = require('./logPathService');
@@ -59,6 +61,20 @@ const SUBTITLE_SELECTION_KEYS_FLAG_ONLY = new Set(['--all-subtitles', '--first-s
const SUBTITLE_FLAG_KEYS_WITH_VALUE = new Set(['--subtitle-burned', '--subtitle-default', '--subtitle-forced']);
const TITLE_SELECTION_KEYS_WITH_VALUE = new Set(['-t', '--title']);
const LOG_DIR_SETTING_KEY = 'log_dir';
const SERVER_CONSOLE_LOG_OUTPUT_ENABLED_KEY = 'server_console_log_output_enabled';
const SERVER_CONSOLE_LOG_HTTP_ENABLED_KEY = 'server_console_log_http_enabled';
const SERVER_CONSOLE_LOG_DEBUG_ENABLED_KEY = 'server_console_log_debug_enabled';
const SERVER_CONSOLE_LOG_INFO_ENABLED_KEY = 'server_console_log_info_enabled';
const SERVER_CONSOLE_LOG_WARN_ENABLED_KEY = 'server_console_log_warn_enabled';
const SERVER_CONSOLE_LOG_ERROR_ENABLED_KEY = 'server_console_log_error_enabled';
const SERVER_CONSOLE_LOG_SETTING_KEYS = new Set([
SERVER_CONSOLE_LOG_OUTPUT_ENABLED_KEY,
SERVER_CONSOLE_LOG_HTTP_ENABLED_KEY,
SERVER_CONSOLE_LOG_DEBUG_ENABLED_KEY,
SERVER_CONSOLE_LOG_INFO_ENABLED_KEY,
SERVER_CONSOLE_LOG_WARN_ENABLED_KEY,
SERVER_CONSOLE_LOG_ERROR_ENABLED_KEY
]);
const MEDIA_PROFILES = ['bluray', 'dvd', 'cd', 'audiobook'];
const PROFILED_SETTINGS = {
raw_dir: {
@@ -168,6 +184,35 @@ function applyRuntimeLogDirSetting(rawValue) {
}
}
function normalizeBooleanSetting(rawValue, fallback = true) {
const normalizedRaw = typeof rawValue === 'string' ? rawValue.trim() : rawValue;
if (normalizedRaw === null || normalizedRaw === undefined || normalizedRaw === '') {
return fallback;
}
return toBoolean(normalizedRaw);
}
function applyRuntimeServerConsoleLoggingSettingsFromMap(settingsMap = {}) {
const source = settingsMap && typeof settingsMap === 'object' ? settingsMap : {};
const enabled = normalizeBooleanSetting(source[SERVER_CONSOLE_LOG_OUTPUT_ENABLED_KEY], true);
const http = normalizeBooleanSetting(source[SERVER_CONSOLE_LOG_HTTP_ENABLED_KEY], true);
const debug = normalizeBooleanSetting(source[SERVER_CONSOLE_LOG_DEBUG_ENABLED_KEY], true);
const info = normalizeBooleanSetting(source[SERVER_CONSOLE_LOG_INFO_ENABLED_KEY], true);
const warn = normalizeBooleanSetting(source[SERVER_CONSOLE_LOG_WARN_ENABLED_KEY], true);
const error = normalizeBooleanSetting(source[SERVER_CONSOLE_LOG_ERROR_ENABLED_KEY], true);
const applied = loggerService.configureConsoleOutput({
enabled,
http,
levels: {
debug,
info,
warn,
error
}
});
return applied;
}
function isImmutableSettingKey(key) {
return IMMUTABLE_SETTING_KEYS.has(String(key || '').trim().toLowerCase());
}
@@ -814,6 +859,21 @@ class SettingsService {
return { ...(snapshot?.map || {}) };
}
applyRuntimeSettingsFromMap(settingsMap = {}) {
const source = settingsMap && typeof settingsMap === 'object' ? settingsMap : {};
const logDir = applyRuntimeLogDirSetting(source[LOG_DIR_SETTING_KEY]);
const consoleLogConfig = applyRuntimeServerConsoleLoggingSettingsFromMap(source);
return {
logDir,
serverConsoleLogConfig: consoleLogConfig
};
}
async applyRuntimeSettings() {
const map = await this.getSettingsMap();
return this.applyRuntimeSettingsFromMap(map);
}
normalizeMediaProfile(value) {
return normalizeMediaProfileValue(value);
}
@@ -1014,6 +1074,10 @@ class SettingsService {
if (String(key || '').trim().toLowerCase() === LOG_DIR_SETTING_KEY) {
applyRuntimeLogDirSetting(result.normalized);
}
if (SERVER_CONSOLE_LOG_SETTING_KEYS.has(String(key || '').trim().toLowerCase())) {
const map = await this.getSettingsMap({ forceRefresh: true });
applyRuntimeServerConsoleLoggingSettingsFromMap(map);
}
this.invalidateSettingsCache([key]);
return {
@@ -1107,6 +1171,13 @@ class SettingsService {
if (logDirChange) {
applyRuntimeLogDirSetting(logDirChange.value);
}
const consoleOutputChange = normalizedEntries.find(
(item) => SERVER_CONSOLE_LOG_SETTING_KEYS.has(String(item?.key || '').trim().toLowerCase())
);
if (consoleOutputChange) {
const map = await this.getSettingsMap({ forceRefresh: true });
applyRuntimeServerConsoleLoggingSettingsFromMap(map);
}
this.invalidateSettingsCache(normalizedEntries.map((item) => item.key));
logger.info('settings:bulk-updated', { count: normalizedEntries.length });