mirror of
https://github.com/MasterAcnolo/Freedom-Loader.git
synced 2026-07-29 18:25:47 +02:00
Fix: Config not working propely
This commit is contained in:
@@ -8,8 +8,6 @@
|
|||||||
"verboseLogs": false,
|
"verboseLogs": false,
|
||||||
"autoDownloadPlaylist": true,
|
"autoDownloadPlaylist": true,
|
||||||
"customCodec": "h264",
|
"customCodec": "h264",
|
||||||
|
|
||||||
|
|
||||||
"logSystem": true,
|
"logSystem": true,
|
||||||
"outputTitleCheck": true,
|
"outputTitleCheck": true,
|
||||||
"downloadSystem": true,
|
"downloadSystem": true,
|
||||||
|
|||||||
51
main.js
51
main.js
@@ -205,21 +205,48 @@ app.whenReady().then(async () => {
|
|||||||
return configFeatures;
|
return configFeatures;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const featureWhitelist = new Set([
|
||||||
|
"autoUpdate",
|
||||||
|
"discordRPC",
|
||||||
|
"customTopBar",
|
||||||
|
"autoCheckInfo",
|
||||||
|
"addThumbnail",
|
||||||
|
"addMetadata",
|
||||||
|
"verboseLogs",
|
||||||
|
"autoDownloadPlaylist",
|
||||||
|
"customCodec"
|
||||||
|
]);
|
||||||
|
|
||||||
|
|
||||||
ipcMain.handle("set-feature", (event, { key, value }) => {
|
ipcMain.handle("set-feature", (event, { key, value }) => {
|
||||||
try {
|
try {
|
||||||
// update mémoire
|
if (!featureWhitelist.has(key)) {
|
||||||
configFeatures[key] = value;
|
logger.warn(`Rejected feature (not whitelisted): ${key}`);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
// écriture directe sur le JSON
|
// optionnel mais propre
|
||||||
fs.writeFileSync(configFolderPath, JSON.stringify(configFeatures, null, 2), "utf-8");
|
if (configFeatures[key] === value) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
configFeatures[key] = value;
|
||||||
|
|
||||||
|
fs.writeFileSync(
|
||||||
|
configFolderPath,
|
||||||
|
JSON.stringify(configFeatures, null, 2),
|
||||||
|
"utf-8"
|
||||||
|
);
|
||||||
|
|
||||||
|
logger.info(`Feature updated: ${key} = ${value}`);
|
||||||
|
return true;
|
||||||
|
|
||||||
|
} catch (err) {
|
||||||
|
logger.error(`set-feature failed (${key}): ${err.message}`);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
logger.info(`Feature updated: ${key} = ${value}`);
|
|
||||||
return true;
|
|
||||||
} catch (err) {
|
|
||||||
logger.error(`set-feature failed (${key}): ${err.message}`);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
configFeatures.discordRPC ? startRPC() : "";
|
configFeatures.discordRPC ? startRPC() : "";
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user