hgfd
This commit is contained in:
@@ -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);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user