mirror of
https://github.com/MasterAcnolo/Freedom-Loader.git
synced 2026-09-27 20:11:15 +02:00
fix: refresh config at every download. Used by CreatePlaylistFolder
This commit is contained in:
committed by
MasterAcnolo
parent
32eb849808
commit
9f85acbb59
24
config.js
24
config.js
@@ -68,13 +68,30 @@ function loadFeatures() {
|
||||
return JSON.parse(raw);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reloads feature flags from disk.
|
||||
* Use this instead of the cached configFeatures snapshot
|
||||
* when you need the latest user settings at call time.
|
||||
*
|
||||
* @returns {Object} Fresh feature flags from config file
|
||||
*/
|
||||
function reloadFeatures() {
|
||||
try {
|
||||
const raw = fs.readFileSync(featuresPath, "utf-8");
|
||||
return JSON.parse(raw);
|
||||
} catch (err) {
|
||||
// Fallback to cached snapshot if file read fails
|
||||
return configFeatures;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* In-memory snapshot of application feature flags.
|
||||
*
|
||||
* Note: Changes to the config file are not automatically reflected.
|
||||
* A restart or reload is required.
|
||||
*/
|
||||
const configFeatures = loadFeatures();
|
||||
let configFeatures = loadFeatures();
|
||||
|
||||
module.exports = {
|
||||
/**
|
||||
@@ -102,6 +119,11 @@ module.exports = {
|
||||
*/
|
||||
configFeatures,
|
||||
|
||||
/**
|
||||
* Function to reload the config
|
||||
*/
|
||||
reloadFeatures,
|
||||
|
||||
/**
|
||||
* Path to the active configuration file
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user