forked from cory/tildefriends
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:
parent
e0dcec074c
commit
0ca05e297d
17
core/core.js
17
core/core.js
@ -38,8 +38,6 @@ let gGlobalSettings = {
|
|||||||
index: "/~core/apps/",
|
index: "/~core/apps/",
|
||||||
};
|
};
|
||||||
|
|
||||||
let kGlobalSettingsFile = "data/global/settings.json";
|
|
||||||
|
|
||||||
let kPingInterval = 60 * 1000;
|
let kPingInterval = 60 * 1000;
|
||||||
|
|
||||||
function printError(out, error) {
|
function printError(out, error) {
|
||||||
@ -769,8 +767,7 @@ ssb.addEventListener('connections', function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
async function loadSettings() {
|
async function loadSettings() {
|
||||||
let data;
|
let data = {};
|
||||||
|
|
||||||
try {
|
try {
|
||||||
let settings = new Database('core').get('settings');
|
let settings = new Database('core').get('settings');
|
||||||
if (settings) {
|
if (settings) {
|
||||||
@ -779,19 +776,7 @@ async function loadSettings() {
|
|||||||
} catch (error) {
|
} catch (error) {
|
||||||
print("Settings not found in database:", 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;
|
gGlobalSettings = data;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function sendStats() {
|
function sendStats() {
|
||||||
|
Loading…
Reference in New Issue
Block a user