You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
48 lines
1.5 KiB
JavaScript
48 lines
1.5 KiB
JavaScript
/*
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
*/
|
|
|
|
|
|
var accounthubapi = localStorage.getItem("apiurl");
|
|
var apikey = localStorage.getItem("apikey");
|
|
var group = localStorage.getItem("group");
|
|
var kioskmode = localStorage.getItem("kioskmode") == "true" ? true : false;
|
|
var largebtns = localStorage.getItem("largebtns") == "true" ? true : false;
|
|
|
|
function getAPIKey() {
|
|
return apikey;
|
|
}
|
|
|
|
/**
|
|
* Validate the connection settings. Callback will be run with `true` an error message, or `false` for a connection failure.
|
|
* @param function callback(resp) a function to receive whether or not the settings are valid.
|
|
* @returns {undefined}
|
|
*/
|
|
function validateSettings(callback) {
|
|
$.post(accounthubapi, {
|
|
key: apikey,
|
|
action: "ping"
|
|
}, function (resp) {
|
|
if (resp.status == "OK") {
|
|
callback(true);
|
|
} else {
|
|
callback(resp.msg);
|
|
}
|
|
}, "json").fail(function (data) {
|
|
if (data.readyState == 4) {
|
|
callback(data.statusText);
|
|
} else {
|
|
callback(false);
|
|
}
|
|
});
|
|
}
|
|
|
|
function reloadSettings() {
|
|
accounthubapi = localStorage.getItem("apiurl");
|
|
apikey = localStorage.getItem("apikey");
|
|
group = localStorage.getItem("group");
|
|
kioskmode = localStorage.getItem("kioskmode");
|
|
largebtns = localStorage.getItem("largebtns");
|
|
} |