mirror of
https://github.com/louislam/uptime-kuma.git
synced 2024-12-24 22:14:47 +02:00
Fix: Allow setting settings type
This commit is contained in:
parent
6cf2eb036d
commit
8caf47988c
@ -11,7 +11,7 @@ const DEFAULT_KEEP_PERIOD = 30;
|
|||||||
|
|
||||||
// Set Default Period
|
// Set Default Period
|
||||||
if (period == null) {
|
if (period == null) {
|
||||||
await setSetting("keepDataPeriodDays", DEFAULT_KEEP_PERIOD);
|
await setSetting("keepDataPeriodDays", DEFAULT_KEEP_PERIOD, "general");
|
||||||
period = DEFAULT_KEEP_PERIOD;
|
period = DEFAULT_KEEP_PERIOD;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -21,7 +21,7 @@ const DEFAULT_KEEP_PERIOD = 30;
|
|||||||
parsedPeriod = parseInt(period);
|
parsedPeriod = parseInt(period);
|
||||||
} catch (_) {
|
} catch (_) {
|
||||||
log("Failed to parse setting, resetting to default..");
|
log("Failed to parse setting, resetting to default..");
|
||||||
await setSetting("keepDataPeriodDays", DEFAULT_KEEP_PERIOD);
|
await setSetting("keepDataPeriodDays", DEFAULT_KEEP_PERIOD, "general");
|
||||||
parsedPeriod = DEFAULT_KEEP_PERIOD;
|
parsedPeriod = DEFAULT_KEEP_PERIOD;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -116,7 +116,7 @@ exports.setting = async function (key) {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
exports.setSetting = async function (key, value) {
|
exports.setSetting = async function (key, value, type = null) {
|
||||||
let bean = await R.findOne("setting", " `key` = ? ", [
|
let bean = await R.findOne("setting", " `key` = ? ", [
|
||||||
key,
|
key,
|
||||||
]);
|
]);
|
||||||
@ -124,6 +124,7 @@ exports.setSetting = async function (key, value) {
|
|||||||
bean = R.dispense("setting");
|
bean = R.dispense("setting");
|
||||||
bean.key = key;
|
bean.key = key;
|
||||||
}
|
}
|
||||||
|
bean.type = type;
|
||||||
bean.value = JSON.stringify(value);
|
bean.value = JSON.stringify(value);
|
||||||
await R.store(bean);
|
await R.store(bean);
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user