This commit is contained in:
2026-09-19 21:35:08 +02:00
parent 15628739b1
commit 5601c282b7
13 changed files with 257 additions and 32 deletions
+10
View File
@@ -12,6 +12,7 @@ import cfg from "../config.mjs";
import security from "../security.mjs";
import crypto from "crypto";
import path from "path";
import YAML from "yaml";
import { getManualApproval, setManualApproval, getMinTags, setMinTags, getRegistrationOpen, setRegistrationOpen, getTrustedUploads, setTrustedUploads, getEnablePdf, setEnablePdf, getLogUserIps, setLogUserIps, getHashUserIps, setHashUserIps, getEnableCleanup, setEnableCleanup, getCleanupStartDate, setCleanupStartDate, getCleanupEndDate, setCleanupEndDate, getCleanupIncludeEngaged, setCleanupIncludeEngaged, getShitpostMode, ensureAllItemsHaveSlugs, getEnableItemSlugs, getBrandImageUrl } from "../settings.mjs";
export default (router, tpl) => {
@@ -939,6 +940,15 @@ export default (router, tpl) => {
// Write formatted JSON to config.json on disk
await fs.writeFile(configPath, JSON.stringify(updatedConfig, null, 2) + "\n", "utf-8");
// Also update config.yaml if it exists
const configYamlPath = path.resolve(process.cwd(), "config.yaml");
try {
const yamlDoc = new YAML.Document(updatedConfig);
await fs.writeFile(configYamlPath, String(yamlDoc), "utf-8");
} catch (yamlErr) {
console.warn('[ADMIN] Could not sync config.yaml:', yamlErr.message);
}
// Mutate in-memory cfg object so changes apply immediately
Object.assign(cfg, updatedConfig);