0.16.1 Registry Fix MakeMKV
Deploy Docs to GitHub Pages / Build Documentation (push) Has been cancelled
Deploy Docs to GitHub Pages / Deploy to GitHub Pages (push) Has been cancelled

This commit is contained in:
2026-04-29 08:14:06 +00:00
parent d679eface4
commit 6636eb11df
20 changed files with 420 additions and 64 deletions
+42 -25
View File
@@ -14,6 +14,10 @@ const {
} = require('../utils/validators');
const { splitArgs } = require('../utils/commandLine');
const { setLogRootDir } = require('./logPathService');
const {
syncRegistrationKeyToConfig,
normalizeRegistrationKey
} = require('./makemkvKeyService');
const {
defaultRawDir: DEFAULT_RAW_DIR,
@@ -75,6 +79,7 @@ const SERVER_CONSOLE_LOG_SETTING_KEYS = new Set([
SERVER_CONSOLE_LOG_WARN_ENABLED_KEY,
SERVER_CONSOLE_LOG_ERROR_ENABLED_KEY
]);
const MAKEMKV_REGISTRATION_KEY_SETTING_KEY = 'makemkv_registration_key';
const MEDIA_PROFILES = ['bluray', 'dvd', 'cd', 'audiobook'];
const PROFILED_SETTINGS = {
raw_dir: {
@@ -1056,25 +1061,36 @@ class SettingsService {
}
const serializedValue = serializeValueByType(schema.type, result.normalized);
const normalizedKey = String(key || '').trim().toLowerCase();
await db.run(
`
INSERT INTO settings_values (key, value, updated_at)
VALUES (?, ?, CURRENT_TIMESTAMP)
ON CONFLICT(key) DO UPDATE SET
value = excluded.value,
updated_at = CURRENT_TIMESTAMP
`,
[key, serializedValue]
);
try {
await db.exec('BEGIN');
await db.run(
`
INSERT INTO settings_values (key, value, updated_at)
VALUES (?, ?, CURRENT_TIMESTAMP)
ON CONFLICT(key) DO UPDATE SET
value = excluded.value,
updated_at = CURRENT_TIMESTAMP
`,
[key, serializedValue]
);
if (normalizedKey === MAKEMKV_REGISTRATION_KEY_SETTING_KEY) {
await syncRegistrationKeyToConfig(result.normalized);
}
await db.exec('COMMIT');
} catch (error) {
await db.exec('ROLLBACK');
throw error;
}
logger.info('setting:updated', {
key,
value: SENSITIVE_SETTING_KEYS.has(String(key || '').trim().toLowerCase()) ? '[redacted]' : result.normalized
});
if (String(key || '').trim().toLowerCase() === LOG_DIR_SETTING_KEY) {
if (normalizedKey === LOG_DIR_SETTING_KEY) {
applyRuntimeLogDirSetting(result.normalized);
}
if (SERVER_CONSOLE_LOG_SETTING_KEYS.has(String(key || '').trim().toLowerCase())) {
if (SERVER_CONSOLE_LOG_SETTING_KEYS.has(normalizedKey)) {
const map = await this.getSettingsMap({ forceRefresh: true });
applyRuntimeServerConsoleLoggingSettingsFromMap(map);
}
@@ -1159,6 +1175,12 @@ class SettingsService {
[item.key, item.serializedValue]
);
}
const makemkvKeyChange = normalizedEntries.find(
(item) => String(item?.key || '').trim().toLowerCase() === MAKEMKV_REGISTRATION_KEY_SETTING_KEY
);
if (makemkvKeyChange) {
await syncRegistrationKeyToConfig(makemkvKeyChange.value);
}
await db.exec('COMMIT');
} catch (error) {
await db.exec('ROLLBACK');
@@ -1317,20 +1339,15 @@ class SettingsService {
return { cmd, args: [...baseArgs, ...extra] };
}
async buildMakeMKVRegisterConfig() {
const map = await this.getSettingsMap();
const registrationKey = String(map.makemkv_registration_key || '').trim();
if (!registrationKey) {
return null;
}
const cmd = map.makemkv_command || 'makemkvcon';
const args = ['reg', registrationKey];
logger.debug('cli:makemkv:register', { cmd, args: ['reg', '<redacted>'] });
async syncMakeMKVRegistrationKeyFromSettings(options = {}) {
const map = options?.settingsMap || await this.getSettingsMap();
const registrationKey = normalizeRegistrationKey(map?.makemkv_registration_key);
const fileInfo = await syncRegistrationKeyToConfig(registrationKey, options);
return {
cmd,
args,
argsForLog: ['reg', '<redacted>']
applied: Boolean(registrationKey),
key: registrationKey || null,
path: fileInfo?.path || null,
changed: Boolean(fileInfo?.changed)
};
}