No more global settings file.

git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@4161 ed5197a5-7fde-0310-b194-c3ffbd925b24
This commit is contained in:
Cory McWilliams 2023-02-01 23:40:21 +00:00
parent e0dcec074c
commit 0ca05e297d

View File

@ -38,8 +38,6 @@ let gGlobalSettings = {
index: "/~core/apps/",
};
let kGlobalSettingsFile = "data/global/settings.json";
let kPingInterval = 60 * 1000;
function printError(out, error) {
@ -769,8 +767,7 @@ ssb.addEventListener('connections', function() {
});
async function loadSettings() {
let data;
let data = {};
try {
let settings = new Database('core').get('settings');
if (settings) {
@ -779,20 +776,8 @@ async function loadSettings() {
} catch (error) {
print("Settings not found in database:", error);
}
if (!data) {
try {
data = JSON.parse(utf8Decode(await File.readFile(kGlobalSettingsFile)));
new Database('core').set('settings', JSON.stringify(data));
} catch (error) {
print("Unable to load settings from " + kGlobalSettingsFile + ":", error);
}
}
if (data) {
gGlobalSettings = data;
}
}
function sendStats() {
let apps = Object.values(gProcesses).filter(process => process.app && process.stats).map(process => process.app);