2020-07-05 13:38:07 +00:00
|
|
|
|
var bsVersion = {{ bsVersion }};
|
|
|
|
|
|
|
|
|
|
if (bsVersion == 5) {
|
|
|
|
|
function createModal(id, find = false) {
|
|
|
|
|
if (find) {
|
2020-07-05 14:09:42 +00:00
|
|
|
|
return bootstrap.Modal.getInstance(document.getElementById(id));
|
2020-07-05 13:38:07 +00:00
|
|
|
|
};
|
|
|
|
|
return new bootstrap.Modal(document.getElementById(id));
|
|
|
|
|
};
|
|
|
|
|
function triggerTooltips() {
|
|
|
|
|
document.getElementById('settingsMenu').addEventListener('shown.bs.modal', function() {
|
|
|
|
|
// Hack to ensure anything dependent on checkboxes are disabled if necessary
|
|
|
|
|
var checkboxes = document.getElementById('settingsMenu').querySelectorAll('input[type="checkbox"]');
|
|
|
|
|
for (var i = 0; i < checkboxes.length; i++) {
|
|
|
|
|
checkboxes[i].click();
|
|
|
|
|
checkboxes[i].click();
|
|
|
|
|
};
|
|
|
|
|
// Initialize tooltips
|
|
|
|
|
var to_trigger = [].slice.call(document.querySelectorAll('a[data-toggle="tooltip"]'));
|
|
|
|
|
var tooltips = to_trigger.map(function(el) {
|
|
|
|
|
return new bootstrap.Tooltip(el);
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// var loginModal = new bootstrap.Modal(document.getElementById('login'));
|
|
|
|
|
// var settingsModal = new bootstrap.Modal(document.getElementById('settingsMenu'));
|
|
|
|
|
// var userDefaultsModal = new bootstrap.Modal(document.getElementById('userDefaults'));
|
|
|
|
|
// var usersModal = new bootstrap.Modal(document.getElementById('users'));
|
|
|
|
|
// var restartModal = new bootstrap.Modal(document.getElementById('restartModal'));
|
|
|
|
|
} else if (bsVersion == 4) {
|
|
|
|
|
document.getElementById('send_to_address_enabled').classList.remove('form-check-input');
|
|
|
|
|
function createModal(id, find = false) {
|
|
|
|
|
return {
|
|
|
|
|
show : function() {
|
|
|
|
|
return $('#' + id).modal('show');
|
|
|
|
|
},
|
|
|
|
|
hide : function() {
|
|
|
|
|
return $('#' + id).modal('hide');
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
function triggerTooltips() {
|
|
|
|
|
$('#settingsMenu').on('shown.bs.modal', function() {
|
|
|
|
|
var checkboxes = document.getElementById('settingsMenu').querySelectorAll('input[type="checkbox"]');
|
|
|
|
|
for (var i = 0; i < checkboxes.length; i++) {
|
|
|
|
|
checkboxes[i].click();
|
|
|
|
|
checkboxes[i].click();
|
|
|
|
|
};
|
|
|
|
|
$("a[data-toggle='tooltip']").each(function (i, obj) {
|
|
|
|
|
$(obj).tooltip();
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
var loginModal = createModal('login');
|
|
|
|
|
var settingsModal = createModal('settingsMenu');
|
|
|
|
|
var userDefaultsModal = createModal('userDefaults');
|
|
|
|
|
var usersModal = createModal('users');
|
|
|
|
|
var restartModal = createModal('restartModal');
|
2020-07-03 20:07:04 +00:00
|
|
|
|
|
2020-04-13 19:02:00 +00:00
|
|
|
|
function parseInvite(invite, empty = false) {
|
|
|
|
|
if (empty === true) {
|
|
|
|
|
return ["None", "", "1"]
|
|
|
|
|
} else {
|
2020-04-19 21:35:51 +00:00
|
|
|
|
var i = ["", "", "0", invite['email']];
|
2020-04-13 19:02:00 +00:00
|
|
|
|
i[0] = invite['code'];
|
|
|
|
|
if (invite['hours'] == 0) {
|
|
|
|
|
i[1] = invite['minutes'] + 'm';
|
|
|
|
|
} else if (invite['minutes'] == 0) {
|
|
|
|
|
i[1] = invite['hours'] + 'h';
|
|
|
|
|
} else {
|
|
|
|
|
i[1] = invite['hours'] + 'h ' + invite['minutes'] + 'm';
|
|
|
|
|
}
|
|
|
|
|
i[1] = "Expires in " + i[1] + " ";
|
|
|
|
|
return i
|
|
|
|
|
}
|
|
|
|
|
}
|
2020-04-11 14:20:25 +00:00
|
|
|
|
function addItem(invite) {
|
|
|
|
|
var links = document.getElementById('invites');
|
|
|
|
|
var listItem = document.createElement('li');
|
2020-04-13 19:02:00 +00:00
|
|
|
|
listItem.id = invite[0]
|
2020-04-17 14:24:56 +00:00
|
|
|
|
listItem.classList.add('list-group-item', 'd-flex', 'justify-content-between', 'd-inline-block');
|
2020-04-11 14:20:25 +00:00
|
|
|
|
var listCode = document.createElement('div');
|
2020-07-03 21:22:47 +00:00
|
|
|
|
listCode.classList.add('d-flex', 'align-items-center', 'font-monospace');
|
2020-04-11 14:20:25 +00:00
|
|
|
|
var codeLink = document.createElement('a');
|
2020-07-03 21:22:47 +00:00
|
|
|
|
codeLink.setAttribute('style', 'margin-right: 0.5rem;');
|
2020-04-17 14:24:56 +00:00
|
|
|
|
codeLink.appendChild(document.createTextNode(invite[0].replace(/-/g, '‑')));
|
2020-04-11 14:20:25 +00:00
|
|
|
|
listCode.appendChild(codeLink);
|
|
|
|
|
listItem.appendChild(listCode);
|
|
|
|
|
var listRight = document.createElement('div');
|
2020-04-17 14:24:56 +00:00
|
|
|
|
listText = document.createElement('span');
|
2020-04-13 19:02:00 +00:00
|
|
|
|
listText.id = invite[0] + '_expiry'
|
|
|
|
|
listText.appendChild(document.createTextNode(invite[1]));
|
|
|
|
|
listRight.appendChild(listText);
|
2020-04-20 19:37:39 +00:00
|
|
|
|
if (invite[2] == 0) {
|
2020-07-03 21:22:47 +00:00
|
|
|
|
var inviteCode = window.location.href.replace('#', '') + 'invite/' + invite[0];
|
2020-04-11 14:20:25 +00:00
|
|
|
|
codeLink.href = inviteCode;
|
2020-04-17 14:24:56 +00:00
|
|
|
|
// listCode.appendChild(document.createTextNode(" "));
|
2020-04-11 14:20:25 +00:00
|
|
|
|
var codeCopy = document.createElement('i');
|
|
|
|
|
codeCopy.onclick = function(){toClipboard(inviteCode)};
|
2020-07-04 21:17:49 +00:00
|
|
|
|
codeCopy.classList.add('fa', 'fa-clipboard', 'icon-button');
|
2020-04-11 14:20:25 +00:00
|
|
|
|
listCode.appendChild(codeCopy);
|
2020-04-19 21:35:51 +00:00
|
|
|
|
if (typeof(invite[3]) != 'undefined') {
|
|
|
|
|
var sentTo = document.createElement('span');
|
|
|
|
|
sentTo.setAttribute('style', 'color: grey; margin-left: 2%; font-style: italic; font-size: 75%;');
|
2020-05-05 10:37:13 +00:00
|
|
|
|
if (invite[3].includes('Failed to send to')) {
|
|
|
|
|
sentTo.appendChild(document.createTextNode(invite[3]));
|
|
|
|
|
} else {
|
|
|
|
|
sentTo.appendChild(document.createTextNode('Sent to ' + invite[3]));
|
|
|
|
|
}
|
2020-04-19 21:35:51 +00:00
|
|
|
|
listCode.appendChild(sentTo);
|
|
|
|
|
};
|
2020-04-11 14:20:25 +00:00
|
|
|
|
var listDelete = document.createElement('button');
|
|
|
|
|
listDelete.onclick = function(){deleteInvite(invite[0])};
|
2020-04-17 14:24:56 +00:00
|
|
|
|
listDelete.classList.add('btn', 'btn-outline-danger');
|
2020-04-11 14:20:25 +00:00
|
|
|
|
listDelete.appendChild(document.createTextNode('Delete'));
|
|
|
|
|
listRight.appendChild(listDelete);
|
|
|
|
|
};
|
|
|
|
|
listItem.appendChild(listRight);
|
|
|
|
|
links.appendChild(listItem);
|
|
|
|
|
};
|
2020-04-13 19:02:00 +00:00
|
|
|
|
function updateInvite(invite) {
|
|
|
|
|
var expiry = document.getElementById(invite[0] + '_expiry');
|
|
|
|
|
expiry.textContent = invite[1];
|
|
|
|
|
}
|
|
|
|
|
function removeInvite(code) {
|
|
|
|
|
var item = document.getElementById(code);
|
|
|
|
|
item.parentNode.removeChild(item);
|
|
|
|
|
}
|
2020-04-11 14:20:25 +00:00
|
|
|
|
function generateInvites(empty = false) {
|
2020-04-13 19:02:00 +00:00
|
|
|
|
// document.getElementById('invites').textContent = '';
|
2020-04-11 14:20:25 +00:00
|
|
|
|
if (empty === false) {
|
2020-07-03 20:07:04 +00:00
|
|
|
|
var req = new XMLHttpRequest();
|
|
|
|
|
req.open("GET", "/getInvites", true);
|
|
|
|
|
req.setRequestHeader("Authorization", "Basic " + btoa(window.token + ":"));
|
|
|
|
|
req.responseType = 'json';
|
|
|
|
|
req.onreadystatechange = function() {
|
|
|
|
|
if (this.readyState == 4) {
|
|
|
|
|
var data = this.response;
|
2020-04-11 14:20:25 +00:00
|
|
|
|
if (data['invites'].length == 0) {
|
2020-04-13 19:02:00 +00:00
|
|
|
|
document.getElementById('invites').textContent = '';
|
|
|
|
|
addItem(parseInvite([], true));
|
2020-04-11 14:20:25 +00:00
|
|
|
|
} else {
|
2020-04-13 19:02:00 +00:00
|
|
|
|
data['invites'].forEach(function(invite) {
|
|
|
|
|
var match = false;
|
|
|
|
|
var items = document.getElementById('invites').children;
|
|
|
|
|
for (var i = 0; i < items.length; i++) {
|
|
|
|
|
if (items[i].id == invite['code']) {
|
|
|
|
|
match = true;
|
|
|
|
|
updateInvite(parseInvite(invite));
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
if (match == false) {
|
|
|
|
|
addItem(parseInvite(invite));
|
|
|
|
|
};
|
2020-04-11 14:20:25 +00:00
|
|
|
|
});
|
2020-04-13 19:02:00 +00:00
|
|
|
|
var items = document.getElementById('invites').children;
|
|
|
|
|
for (var i = 0; i < items.length; i++) {
|
|
|
|
|
var exists = false;
|
|
|
|
|
data['invites'].forEach(function(invite) {
|
|
|
|
|
if (items[i].id == invite['code']) {
|
|
|
|
|
exists = true;
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
if (exists == false) {
|
|
|
|
|
removeInvite(items[i].id);
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
};
|
2020-07-03 20:07:04 +00:00
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
req.send();
|
2020-04-11 14:20:25 +00:00
|
|
|
|
} else if (empty === true) {
|
2020-04-13 19:02:00 +00:00
|
|
|
|
document.getElementById('invites').textContent = '';
|
|
|
|
|
addItem(parseInvite([], true));
|
2020-04-11 14:20:25 +00:00
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
function deleteInvite(code) {
|
|
|
|
|
var send = JSON.stringify({ "code": code });
|
2020-07-03 20:07:04 +00:00
|
|
|
|
var req = new XMLHttpRequest();
|
|
|
|
|
req.open("POST", "/deleteInvite", true);
|
|
|
|
|
req.setRequestHeader("Authorization", "Basic " + btoa(window.token + ":"));
|
|
|
|
|
req.setRequestHeader('Content-Type', 'application/json; charset=UTF-8');
|
|
|
|
|
req.onreadystatechange = function() {
|
|
|
|
|
if (this.readyState == 4) {
|
|
|
|
|
generateInvites();
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
req.send(send);
|
2020-04-11 14:20:25 +00:00
|
|
|
|
};
|
|
|
|
|
function addOptions(le, sel) {
|
|
|
|
|
for (v = 0; v <= le; v++) {
|
|
|
|
|
var opt = document.createElement('option');
|
2020-07-03 20:07:04 +00:00
|
|
|
|
opt.appendChild(document.createTextNode(v));
|
|
|
|
|
opt.value = v;
|
|
|
|
|
sel.appendChild(opt);
|
2020-04-11 14:20:25 +00:00
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
function toClipboard(str) {
|
2020-04-20 19:37:39 +00:00
|
|
|
|
const el = document.createElement('textarea');
|
|
|
|
|
el.value = str;
|
2020-07-04 21:17:49 +00:00
|
|
|
|
el.setAttribute('readOnly', '');
|
2020-04-20 19:37:39 +00:00
|
|
|
|
el.style.position = 'absolute';
|
|
|
|
|
el.style.left = '-9999px';
|
|
|
|
|
document.body.appendChild(el);
|
|
|
|
|
const selected =
|
|
|
|
|
document.getSelection().rangeCount > 0
|
2020-04-11 14:20:25 +00:00
|
|
|
|
? document.getSelection().getRangeAt(0)
|
2020-04-20 19:37:39 +00:00
|
|
|
|
: false;
|
|
|
|
|
el.select();
|
|
|
|
|
document.execCommand('copy');
|
|
|
|
|
document.body.removeChild(el);
|
|
|
|
|
if (selected) {
|
|
|
|
|
document.getSelection().removeAllRanges();
|
|
|
|
|
document.getSelection().addRange(selected);
|
2020-04-11 14:20:25 +00:00
|
|
|
|
}
|
|
|
|
|
};
|
2020-07-03 20:07:04 +00:00
|
|
|
|
|
2020-07-02 16:59:15 +00:00
|
|
|
|
document.getElementById('inviteForm').onsubmit = function() {
|
2020-05-05 10:37:13 +00:00
|
|
|
|
var button = document.getElementById('generateSubmit');
|
|
|
|
|
button.disabled = true;
|
|
|
|
|
button.innerHTML =
|
|
|
|
|
'<span class="spinner-border spinner-border-sm" role="status" aria-hidden="true" style="margin-right: 0.5rem;"></span>' +
|
|
|
|
|
'Loading...';
|
2020-07-03 20:07:04 +00:00
|
|
|
|
send_object = serializeForm('inviteForm');
|
|
|
|
|
console.log(send_object);
|
2020-05-21 21:10:52 +00:00
|
|
|
|
if (document.getElementById('send_to_address') != null) {
|
2020-07-03 20:07:04 +00:00
|
|
|
|
if (send_object['send_to_address_enabled']) {
|
|
|
|
|
send_object['email'] = send_object['send_to_address'];
|
|
|
|
|
delete send_object['send_to_address'];
|
|
|
|
|
delete send_object['send_to_address_enabled'];
|
2020-05-12 19:44:04 +00:00
|
|
|
|
}
|
2020-04-19 21:35:51 +00:00
|
|
|
|
}
|
|
|
|
|
var send = JSON.stringify(send_object);
|
2020-07-03 20:07:04 +00:00
|
|
|
|
var req = new XMLHttpRequest();
|
|
|
|
|
req.open("POST", "/generateInvite", true);
|
|
|
|
|
req.setRequestHeader("Authorization", "Basic " + btoa(window.token + ":"));
|
|
|
|
|
req.setRequestHeader('Content-Type', 'application/json; charset=UTF-8');
|
|
|
|
|
req.onreadystatechange = function() {
|
|
|
|
|
if (this.readyState == 4) {
|
2020-05-05 10:37:13 +00:00
|
|
|
|
button.textContent = 'Generate';
|
|
|
|
|
button.disabled = false;
|
2020-07-03 20:07:04 +00:00
|
|
|
|
generateInvites();
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
req.send(send);
|
2020-04-11 14:20:25 +00:00
|
|
|
|
return false;
|
2020-07-02 16:59:15 +00:00
|
|
|
|
};
|
2020-07-03 20:07:04 +00:00
|
|
|
|
document.getElementById('loginForm').onsubmit = function() {
|
2020-04-11 14:20:25 +00:00
|
|
|
|
window.token = "";
|
2020-07-03 20:07:04 +00:00
|
|
|
|
var details = serializeForm('loginForm');
|
2020-05-05 10:37:13 +00:00
|
|
|
|
var errorArea = document.getElementById('loginErrorArea');
|
|
|
|
|
errorArea.textContent = '';
|
|
|
|
|
var button = document.getElementById('loginSubmit');
|
|
|
|
|
button.disabled = true;
|
|
|
|
|
button.innerHTML =
|
|
|
|
|
'<span class="spinner-border spinner-border-sm" role="status" aria-hidden="true" style="margin-right: 0.5rem;"></span>' +
|
|
|
|
|
'Loading...';
|
2020-07-03 20:07:04 +00:00
|
|
|
|
var req = new XMLHttpRequest();
|
|
|
|
|
req.responseType = 'json';
|
|
|
|
|
req.onreadystatechange = function() {
|
|
|
|
|
if (this.readyState == 4) {
|
|
|
|
|
if (this.status == 401) {
|
2020-05-05 10:37:13 +00:00
|
|
|
|
button.disabled = false;
|
|
|
|
|
button.textContent = 'Login';
|
2020-04-11 14:20:25 +00:00
|
|
|
|
var wrongPassword = document.createElement('div');
|
2020-04-13 19:02:00 +00:00
|
|
|
|
wrongPassword.classList.add('alert', 'alert-danger');
|
2020-04-11 14:20:25 +00:00
|
|
|
|
wrongPassword.setAttribute('role', 'alert');
|
|
|
|
|
wrongPassword.appendChild(document.createTextNode('Incorrect username or password.'));
|
2020-05-05 10:37:13 +00:00
|
|
|
|
errorArea.appendChild(wrongPassword);
|
2020-04-11 14:20:25 +00:00
|
|
|
|
} else {
|
2020-07-03 20:07:04 +00:00
|
|
|
|
var data = this.response;
|
|
|
|
|
window.token = data['token'];
|
2020-04-11 14:20:25 +00:00
|
|
|
|
generateInvites();
|
|
|
|
|
var interval = setInterval(function() { generateInvites(); }, 60 * 1000);
|
|
|
|
|
var hour = document.getElementById('hours');
|
|
|
|
|
addOptions(24, hour);
|
|
|
|
|
hour.selected = "0";
|
|
|
|
|
var minutes = document.getElementById('minutes');
|
|
|
|
|
addOptions(59, minutes);
|
|
|
|
|
minutes.selected = "30";
|
2020-07-03 20:07:04 +00:00
|
|
|
|
loginModal.hide();
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
req.open("GET", "/getToken", true);
|
|
|
|
|
req.setRequestHeader("Authorization", "Basic " + btoa(details['username'] + ":" + details['password']));
|
|
|
|
|
req.send();
|
2020-04-11 14:20:25 +00:00
|
|
|
|
return false;
|
2020-07-03 20:07:04 +00:00
|
|
|
|
};
|
|
|
|
|
document.getElementById('openDefaultsWizard').onclick = function() {
|
|
|
|
|
this.disabled = true
|
2020-06-08 12:33:04 +00:00
|
|
|
|
this.innerHTML =
|
|
|
|
|
'<span class="spinner-border spinner-border-sm" role="status" aria-hidden="true" style="margin-right: 0.5rem;"></span>' +
|
|
|
|
|
'Loading...';
|
2020-07-03 20:07:04 +00:00
|
|
|
|
var req = new XMLHttpRequest();
|
|
|
|
|
req.responseType = 'json';
|
|
|
|
|
req.open("GET", "/getUsers", true);
|
|
|
|
|
req.setRequestHeader("Authorization", "Basic " + btoa(window.token + ":"));
|
|
|
|
|
req.onreadystatechange = function() {
|
|
|
|
|
if (this.readyState == 4) {
|
|
|
|
|
if (this.status == 200) {
|
|
|
|
|
var users = req.response['users'];
|
2020-06-08 12:33:04 +00:00
|
|
|
|
var radioList = document.getElementById('defaultUserRadios');
|
|
|
|
|
radioList.textContent = '';
|
|
|
|
|
if (document.getElementById('setDefaultUser')) {
|
|
|
|
|
document.getElementById('setDefaultUser').remove();
|
|
|
|
|
};
|
|
|
|
|
for (var i = 0; i < users.length; i++) {
|
|
|
|
|
var user = users[i]
|
|
|
|
|
var radio = document.createElement('div');
|
|
|
|
|
radio.classList.add('radio');
|
|
|
|
|
if (i == 0) {
|
|
|
|
|
var checked = 'checked';
|
|
|
|
|
} else {
|
|
|
|
|
var checked = '';
|
|
|
|
|
};
|
|
|
|
|
radio.innerHTML =
|
|
|
|
|
'<label><input type="radio" name="defaultRadios" id="default_' +
|
|
|
|
|
user['name'] + '" style="margin-right: 1rem;"' + checked + '>' +
|
|
|
|
|
user['name'] + '</label>';
|
|
|
|
|
radioList.appendChild(radio);
|
|
|
|
|
}
|
|
|
|
|
var button = document.getElementById('openDefaultsWizard');
|
|
|
|
|
button.disabled = false;
|
|
|
|
|
button.innerHTML = 'Set new account defaults';
|
|
|
|
|
var submitButton = document.getElementById('storeDefaults');
|
|
|
|
|
submitButton.disabled = false;
|
|
|
|
|
submitButton.textContent = 'Submit';
|
|
|
|
|
if (submitButton.classList.contains('btn-success')) {
|
|
|
|
|
submitButton.classList.remove('btn-success');
|
|
|
|
|
submitButton.classList.add('btn-primary');
|
|
|
|
|
} else if (submitButton.classList.contains('btn-danger')) {
|
|
|
|
|
submitButton.classList.remove('btn-danger');
|
|
|
|
|
submitButton.classList.add('btn-primary');
|
2020-06-30 17:57:04 +00:00
|
|
|
|
};
|
2020-07-03 20:07:04 +00:00
|
|
|
|
settingsModal.hide();
|
|
|
|
|
userDefaultsModal.show();
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
req.send();
|
2020-06-08 12:33:04 +00:00
|
|
|
|
};
|
|
|
|
|
document.getElementById('storeDefaults').onclick = function () {
|
|
|
|
|
this.disabled = true;
|
|
|
|
|
this.innerHTML =
|
|
|
|
|
'<span class="spinner-border spinner-border-sm" role="status" aria-hidden="true" style="margin-right: 0.5rem;"></span>' +
|
|
|
|
|
'Loading...';
|
|
|
|
|
var button = document.getElementById('storeDefaults');
|
|
|
|
|
var radios = document.getElementsByName('defaultRadios');
|
|
|
|
|
for (var i = 0; i < radios.length; i++) {
|
|
|
|
|
if (radios[i].checked) {
|
|
|
|
|
var data = {'username':radios[i].id.slice(8), 'homescreen':false};
|
|
|
|
|
if (document.getElementById('storeDefaultHomescreen').checked) {
|
|
|
|
|
data['homescreen'] = true;
|
|
|
|
|
}
|
2020-07-03 20:07:04 +00:00
|
|
|
|
var req = new XMLHttpRequest();
|
|
|
|
|
req.open("POST", "/setDefaults", true);
|
|
|
|
|
req.setRequestHeader("Authorization", "Basic " + btoa(window.token + ":"));
|
|
|
|
|
req.setRequestHeader('Content-Type', 'application/json; charset=UTF-8');
|
|
|
|
|
req.onreadystatechange = function() {
|
|
|
|
|
if (this.readyState == 4) {
|
|
|
|
|
if (this.status == 200 || this.status == 204) {
|
|
|
|
|
button.textContent = 'Success';
|
|
|
|
|
if (button.classList.contains('btn-danger')) {
|
|
|
|
|
button.classList.remove('btn-danger');
|
|
|
|
|
} else if (button.classList.contains('btn-primary')) {
|
|
|
|
|
button.classList.remove('btn-primary');
|
|
|
|
|
};
|
|
|
|
|
button.classList.add('btn-success');
|
|
|
|
|
button.disabled = false;
|
|
|
|
|
setTimeout(function(){$('#userDefaults').modal('hide');}, 1000);
|
|
|
|
|
} else {
|
|
|
|
|
button.textContent = 'Failed';
|
2020-06-08 12:33:04 +00:00
|
|
|
|
button.classList.remove('btn-primary');
|
2020-07-03 20:07:04 +00:00
|
|
|
|
button.classList.add('btn-danger');
|
|
|
|
|
setTimeout(function(){
|
|
|
|
|
var button = document.getElementById('storeDefaults');
|
|
|
|
|
button.textContent = 'Submit';
|
|
|
|
|
button.classList.remove('btn-danger');
|
|
|
|
|
button.classList.add('btn-primary');
|
|
|
|
|
button.disabled = false;
|
|
|
|
|
}, 1000);
|
2020-06-08 12:33:04 +00:00
|
|
|
|
};
|
2020-07-03 20:07:04 +00:00
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
req.send(JSON.stringify(data));
|
|
|
|
|
};
|
|
|
|
|
};
|
2020-06-08 12:33:04 +00:00
|
|
|
|
};
|
2020-07-03 20:07:04 +00:00
|
|
|
|
|
|
|
|
|
// $.ajax('/setDefaults', {
|
|
|
|
|
// data : JSON.stringify(data),
|
|
|
|
|
// contentType : 'application/json',
|
|
|
|
|
// type : 'POST',
|
|
|
|
|
// xhrFields : {
|
|
|
|
|
// withCredentials: true
|
|
|
|
|
// },
|
|
|
|
|
// beforeSend : function (xhr) {
|
|
|
|
|
// xhr.setRequestHeader("Authorization", "Basic " + btoa(window.token + ":"));
|
|
|
|
|
// },
|
|
|
|
|
// success: function() {
|
|
|
|
|
// button.textContent = 'Success';
|
|
|
|
|
// if (button.classList.contains('btn-danger')) {
|
|
|
|
|
// button.classList.remove('btn-danger');
|
|
|
|
|
// } else if (button.classList.contains('btn-primary')) {
|
|
|
|
|
// button.classList.remove('btn-primary');
|
|
|
|
|
// };
|
|
|
|
|
// button.classList.add('btn-success');
|
|
|
|
|
// button.disabled = false;
|
|
|
|
|
// setTimeout(function(){$('#userDefaults').modal('hide');}, 1000);
|
|
|
|
|
// },
|
|
|
|
|
// error: function() {
|
|
|
|
|
// button.textContent = 'Failed';
|
|
|
|
|
// button.classList.remove('btn-primary');
|
|
|
|
|
// button.classList.add('btn-danger');
|
|
|
|
|
// setTimeout(function(){
|
|
|
|
|
// var button = document.getElementById('storeDefaults');
|
|
|
|
|
// button.textContent = 'Submit';
|
|
|
|
|
// button.classList.remove('btn-danger');
|
|
|
|
|
// button.classList.add('btn-primary');
|
|
|
|
|
// button.disabled = false;
|
|
|
|
|
// }, 1000);
|
|
|
|
|
// }
|
|
|
|
|
// });
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// };
|
2020-04-20 19:37:39 +00:00
|
|
|
|
document.getElementById('openUsers').onclick = function () {
|
2020-05-05 10:37:13 +00:00
|
|
|
|
this.disabled = true;
|
|
|
|
|
this.innerHTML =
|
|
|
|
|
'<span class="spinner-border spinner-border-sm" role="status" aria-hidden="true" style="margin-right: 0.5rem;"></span>' +
|
|
|
|
|
'Loading...';
|
2020-07-03 20:07:04 +00:00
|
|
|
|
var req = new XMLHttpRequest();
|
|
|
|
|
req.open("GET", "/getUsers", true);
|
|
|
|
|
req.responseType = 'json';
|
|
|
|
|
req.setRequestHeader("Authorization", "Basic " + btoa(window.token + ":"));
|
|
|
|
|
req.onreadystatechange = function() {
|
|
|
|
|
if (this.readyState == 4) {
|
|
|
|
|
if (this.status == 200) {
|
2020-04-20 19:37:39 +00:00
|
|
|
|
var list = document.getElementById('userList');
|
|
|
|
|
list.textContent = '';
|
|
|
|
|
if (document.getElementById('saveUsers')) {
|
2020-06-08 12:33:04 +00:00
|
|
|
|
document.getElementById('saveUsers').remove();
|
2020-04-20 19:37:39 +00:00
|
|
|
|
};
|
2020-07-03 20:07:04 +00:00
|
|
|
|
var users = req.response['users'];
|
2020-04-20 19:37:39 +00:00
|
|
|
|
for (var i = 0; i < users.length; i++) {
|
|
|
|
|
var user = users[i]
|
2020-07-04 21:17:49 +00:00
|
|
|
|
var entry = document.createElement('div');
|
|
|
|
|
entry.classList.add('form-group', 'list-group-item', 'py-1');
|
2020-04-20 19:37:39 +00:00
|
|
|
|
entry.id = 'user_' + user['name'];
|
2020-07-04 21:17:49 +00:00
|
|
|
|
var label = document.createElement('label');
|
|
|
|
|
label.classList.add('d-inline-block');
|
|
|
|
|
label.setAttribute('for', 'address_' + user['email']);
|
|
|
|
|
label.appendChild(document.createTextNode(user['name']));
|
|
|
|
|
entry.appendChild(label);
|
|
|
|
|
var address = document.createElement('input');
|
|
|
|
|
address.setAttribute('type', 'email');
|
|
|
|
|
address.readOnly = true;
|
|
|
|
|
address.classList.add('form-control-plaintext', 'text-muted', 'd-inline-block');
|
|
|
|
|
//address.setAttribute('style', 'margin-left: 2%; margin-right: 2%; color: grey;');
|
2020-04-20 19:37:39 +00:00
|
|
|
|
address.classList.add('addressText');
|
|
|
|
|
address.id = 'address_' + user['email'];
|
|
|
|
|
if (typeof(user['email']) != 'undefined') {
|
2020-07-04 21:17:49 +00:00
|
|
|
|
address.value = user['email'];
|
|
|
|
|
address.setAttribute('style', 'width: auto; margin-left: 2%;');
|
2020-04-20 19:37:39 +00:00
|
|
|
|
};
|
|
|
|
|
var editButton = document.createElement('i');
|
2020-07-04 21:17:49 +00:00
|
|
|
|
editButton.classList.add('fa', 'fa-edit', 'd-inline-block', 'icon-button');
|
|
|
|
|
editButton.setAttribute('style', 'margin-left: 2%;');
|
2020-04-20 19:37:39 +00:00
|
|
|
|
editButton.onclick = function() {
|
|
|
|
|
this.classList.remove('fa', 'fa-edit');
|
2020-07-04 21:17:49 +00:00
|
|
|
|
// var input = document.createElement('input');
|
|
|
|
|
// input.setAttribute('type', 'email');
|
|
|
|
|
// input.classList.add('email-input');
|
|
|
|
|
//var addressElement = this.parentNode.getElementsByClassName('addressText')[0];
|
|
|
|
|
var addressElement = this.parentNode.getElementsByClassName('form-control-plaintext')[0];
|
|
|
|
|
addressElement.classList.remove('form-control-plaintext', 'text-muted');
|
|
|
|
|
addressElement.classList.add('form-control');
|
|
|
|
|
addressElement.readOnly = false;
|
|
|
|
|
if (addressElement.value == '') {
|
|
|
|
|
// input.value = addressElement.textContent;
|
|
|
|
|
// } else {
|
|
|
|
|
addressElement.placeholder = 'Email Address';
|
|
|
|
|
address.setAttribute('style', 'width: auto; margin-left: 2%;');
|
2020-04-20 19:37:39 +00:00
|
|
|
|
};
|
2020-07-04 21:17:49 +00:00
|
|
|
|
// this.parentNode.replaceChild(input, addressElement);
|
2020-04-20 19:37:39 +00:00
|
|
|
|
if (document.getElementById('saveUsers') == null) {
|
|
|
|
|
var footer = document.getElementById('userFooter')
|
|
|
|
|
var saveUsers = document.createElement('input');
|
|
|
|
|
saveUsers.classList.add('btn', 'btn-primary');
|
|
|
|
|
saveUsers.setAttribute('type', 'button');
|
|
|
|
|
saveUsers.value = 'Save Changes';
|
|
|
|
|
saveUsers.id = 'saveUsers';
|
|
|
|
|
saveUsers.onclick = function() {
|
|
|
|
|
var send = {}
|
|
|
|
|
var entries = document.getElementById('userList').children;
|
|
|
|
|
for (var i = 0; i < entries.length; i++) {
|
|
|
|
|
var entry = entries[i];
|
|
|
|
|
if (typeof(entry.getElementsByTagName('input')[0]) != 'undefined') {
|
|
|
|
|
var name = entry.id.replace(/user_/g, '')
|
|
|
|
|
var address = entry.getElementsByTagName('input')[0].value;
|
|
|
|
|
send[name] = address
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
send = JSON.stringify(send);
|
2020-07-03 20:07:04 +00:00
|
|
|
|
var req = new XMLHttpRequest();
|
|
|
|
|
req.open("POST", "/modifyUsers", true);
|
|
|
|
|
req.setRequestHeader("Authorization", "Basic " + btoa(window.token + ":"));
|
|
|
|
|
req.setRequestHeader('Content-Type', 'application/json; charset=UTF-8');
|
|
|
|
|
req.onreadystatechange = function() {
|
|
|
|
|
if (this.readyState == 4) {
|
|
|
|
|
if (this.status == 200 || this.status == 204) {
|
|
|
|
|
usersModal.hide();
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
req.send(send);
|
2020-04-20 19:37:39 +00:00
|
|
|
|
};
|
|
|
|
|
footer.appendChild(saveUsers);
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
entry.appendChild(editButton);
|
2020-07-04 21:17:49 +00:00
|
|
|
|
entry.appendChild(address);
|
2020-04-20 19:37:39 +00:00
|
|
|
|
list.appendChild(entry);
|
|
|
|
|
};
|
2020-05-05 10:37:13 +00:00
|
|
|
|
var button = document.getElementById('openUsers');
|
|
|
|
|
button.disabled = false;
|
|
|
|
|
button.innerHTML = 'Users <i class="fa fa-user"></i>';
|
2020-07-03 20:07:04 +00:00
|
|
|
|
settingsModal.hide();
|
|
|
|
|
usersModal.show();
|
2020-04-20 19:37:39 +00:00
|
|
|
|
};
|
|
|
|
|
}
|
2020-07-03 20:07:04 +00:00
|
|
|
|
};
|
|
|
|
|
req.send();
|
2020-04-20 19:37:39 +00:00
|
|
|
|
};
|
2020-07-03 20:07:04 +00:00
|
|
|
|
|
2020-04-11 14:20:25 +00:00
|
|
|
|
generateInvites(empty = true);
|
2020-07-03 20:07:04 +00:00
|
|
|
|
loginModal.show()
|
2020-06-30 15:17:40 +00:00
|
|
|
|
|
|
|
|
|
var config = {};
|
|
|
|
|
var modifiedConfig = {};
|
|
|
|
|
|
|
|
|
|
document.getElementById('openSettings').onclick = function () {
|
|
|
|
|
restart_setting_changed = false;
|
2020-07-03 20:07:04 +00:00
|
|
|
|
var req = new XMLHttpRequest();
|
|
|
|
|
req.open("GET", "/getConfig", true);
|
|
|
|
|
req.responseType = 'json';
|
|
|
|
|
req.setRequestHeader("Authorization", "Basic " + btoa(window.token + ":"));
|
|
|
|
|
req.onreadystatechange = function() {
|
|
|
|
|
if (this.readyState == 4 && this.status == 200) {
|
|
|
|
|
var settingsList = document.getElementById('settingsList');
|
|
|
|
|
settingsList.textContent = '';
|
|
|
|
|
config = this.response;
|
|
|
|
|
for (var section of Object.keys(config)) {
|
|
|
|
|
var sectionCollapse = document.createElement('div');
|
|
|
|
|
sectionCollapse.classList.add('collapse');
|
|
|
|
|
sectionCollapse.id = section;
|
|
|
|
|
|
|
|
|
|
var sectionTitle = config[section]['meta']['name'];
|
|
|
|
|
var sectionDescription = config[section]['meta']['description'];
|
|
|
|
|
var entryListID = section + '_entryList';
|
|
|
|
|
var sectionFooter = section + '_footer';
|
2020-06-30 15:17:40 +00:00
|
|
|
|
|
2020-07-03 20:07:04 +00:00
|
|
|
|
var innerCollapse = `
|
|
|
|
|
<div class="card card-body">
|
|
|
|
|
<small class="text-muted">${sectionDescription}</small>
|
|
|
|
|
<div class="${entryListID}">
|
2020-06-30 15:17:40 +00:00
|
|
|
|
</div>
|
2020-07-03 20:07:04 +00:00
|
|
|
|
</div>
|
|
|
|
|
`;
|
2020-06-30 15:17:40 +00:00
|
|
|
|
|
2020-07-03 20:07:04 +00:00
|
|
|
|
sectionCollapse.innerHTML = innerCollapse;
|
|
|
|
|
|
|
|
|
|
for (var entry of Object.keys(config[section])) {
|
|
|
|
|
if (entry != 'meta') {
|
|
|
|
|
var entryName = config[section][entry]['name'];
|
|
|
|
|
var required = false;
|
|
|
|
|
if (config[section][entry]['required']) {
|
|
|
|
|
entryName += ' <sup class="text-danger">*</sup>';
|
|
|
|
|
required = true;
|
|
|
|
|
};
|
|
|
|
|
if (config[section][entry]['requires_restart']) {
|
|
|
|
|
entryName += ' <sup class="text-danger">R</sup>';
|
|
|
|
|
};
|
|
|
|
|
if (config[section][entry].hasOwnProperty('description')) {
|
|
|
|
|
var tooltip = `
|
|
|
|
|
<a class="text-muted" href="#" data-toggle="tooltip" data-placement="right" title="${config[section][entry]['description']}"><i class="fa fa-question-circle-o"></i></a>
|
|
|
|
|
`;
|
|
|
|
|
entryName += ' ';
|
|
|
|
|
entryName += tooltip;
|
|
|
|
|
};
|
|
|
|
|
var entryValue = config[section][entry]['value'];
|
|
|
|
|
var entryType = config[section][entry]['type'];
|
|
|
|
|
var entryGroup = document.createElement('div');
|
|
|
|
|
if (entryType == 'bool') {
|
|
|
|
|
entryGroup.classList.add('form-check');
|
|
|
|
|
if (entryValue.toString() == 'true') {
|
|
|
|
|
var checked = true;
|
|
|
|
|
} else {
|
|
|
|
|
var checked = false;
|
2020-06-30 17:57:04 +00:00
|
|
|
|
};
|
2020-07-03 20:07:04 +00:00
|
|
|
|
entryGroup.innerHTML = `
|
|
|
|
|
<input class="form-check-input" type="checkbox" value="" id="${section}_${entry}">
|
|
|
|
|
<label class="form-check-label" for="${section}_${entry}">${entryName}</label>
|
|
|
|
|
`;
|
|
|
|
|
entryGroup.getElementsByClassName('form-check-input')[0].required = required;
|
|
|
|
|
entryGroup.getElementsByClassName('form-check-input')[0].checked = checked;
|
|
|
|
|
entryGroup.getElementsByClassName('form-check-input')[0].onclick = function() {
|
|
|
|
|
var state = this.checked;
|
|
|
|
|
for (var sect of Object.keys(config)) {
|
|
|
|
|
for (var ent of Object.keys(config[sect])) {
|
|
|
|
|
if ((sect + '_' + config[sect][ent]['depends_true']) == this.id) {
|
|
|
|
|
document.getElementById(sect + '_' + ent).disabled = !state;
|
|
|
|
|
} else if ((sect + '_' + config[sect][ent]['depends_false']) == this.id) {
|
|
|
|
|
document.getElementById(sect + '_' + ent).disabled = state;
|
2020-06-30 15:17:40 +00:00
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
};
|
2020-07-03 20:07:04 +00:00
|
|
|
|
};
|
|
|
|
|
} else if ((entryType == 'text') || (entryType == 'email') || (entryType == 'password') || (entryType == 'number')) {
|
|
|
|
|
entryGroup.classList.add('form-group');
|
|
|
|
|
entryGroup.innerHTML = `
|
|
|
|
|
<label for="${section}_${entry}">${entryName}</label>
|
|
|
|
|
<input type="${entryType}" class="form-control" id="${section}_${entry}" aria-describedby="${entry}" value="${entryValue}">
|
|
|
|
|
`;
|
|
|
|
|
entryGroup.getElementsByClassName('form-control')[0].required = required;
|
|
|
|
|
} else if (entryType == 'select') {
|
|
|
|
|
entryGroup.classList.add('form-group');
|
|
|
|
|
var entryOptions = config[section][entry]['options'];
|
|
|
|
|
var innerGroup = `
|
|
|
|
|
<label for="${section}_${entry}">${entryName}</label>
|
|
|
|
|
<select class="form-control" id="${section}_${entry}">
|
|
|
|
|
`;
|
|
|
|
|
for (var i = 0; i < entryOptions.length; i++) {
|
|
|
|
|
if (entryOptions[i] == entryValue) {
|
|
|
|
|
var selected = 'selected';
|
|
|
|
|
} else {
|
|
|
|
|
var selected = '';
|
|
|
|
|
}
|
|
|
|
|
innerGroup += `
|
|
|
|
|
<option value="${entryOptions[i]}" ${selected}>${entryOptions[i]}</option>
|
2020-06-30 15:17:40 +00:00
|
|
|
|
`;
|
|
|
|
|
};
|
2020-07-03 20:07:04 +00:00
|
|
|
|
innerGroup += '</select>';
|
|
|
|
|
entryGroup.innerHTML = innerGroup;
|
|
|
|
|
entryGroup.getElementsByClassName('form-control')[0].required = required;
|
|
|
|
|
|
2020-06-30 15:17:40 +00:00
|
|
|
|
};
|
2020-07-03 20:07:04 +00:00
|
|
|
|
sectionCollapse.getElementsByClassName(entryListID)[0].appendChild(entryGroup);
|
2020-06-30 15:17:40 +00:00
|
|
|
|
};
|
|
|
|
|
};
|
2020-07-03 20:07:04 +00:00
|
|
|
|
var sectionButton = document.createElement('button');
|
|
|
|
|
sectionButton.setAttribute('type', 'button');
|
|
|
|
|
sectionButton.classList.add('list-group-item', 'list-group-item-action');
|
|
|
|
|
sectionButton.appendChild(document.createTextNode(sectionTitle));
|
|
|
|
|
sectionButton.id = section + '_button';
|
|
|
|
|
sectionButton.setAttribute('data-toggle', 'collapse');
|
|
|
|
|
sectionButton.setAttribute('data-target', '#' + section);
|
|
|
|
|
settingsList.appendChild(sectionButton);
|
|
|
|
|
settingsList.appendChild(sectionCollapse);
|
2020-06-30 15:17:40 +00:00
|
|
|
|
};
|
2020-07-03 20:07:04 +00:00
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
req.send();
|
|
|
|
|
settingsModal.show();
|
2020-06-30 15:17:40 +00:00
|
|
|
|
};
|
|
|
|
|
|
2020-07-05 13:38:07 +00:00
|
|
|
|
triggerTooltips();
|
2020-07-03 20:07:04 +00:00
|
|
|
|
//
|
|
|
|
|
// $('#settingsMenu').on('shown.bs.modal', function() {
|
|
|
|
|
// $("a[data-toggle='tooltip']").each(function (i, obj) {
|
|
|
|
|
// $(obj).tooltip();
|
|
|
|
|
// });
|
|
|
|
|
// });
|
|
|
|
|
//
|
2020-06-30 15:17:40 +00:00
|
|
|
|
function sendConfig(modalId) {
|
|
|
|
|
var modal = document.getElementById(modalId);
|
|
|
|
|
var send = JSON.stringify(modifiedConfig);
|
2020-07-03 20:07:04 +00:00
|
|
|
|
var req = new XMLHttpRequest();
|
|
|
|
|
req.open("POST", "/modifyConfig", true);
|
|
|
|
|
req.setRequestHeader("Authorization", "Basic " + btoa(window.token + ":"));
|
|
|
|
|
req.setRequestHeader('Content-Type', 'application/json; charset=UTF-8');
|
|
|
|
|
req.onreadystatechange = function() {
|
|
|
|
|
if (this.readyState == 4) {
|
|
|
|
|
if (this.status == 200 || this.status == 204) {
|
2020-07-05 13:38:07 +00:00
|
|
|
|
createModal(modalId, true).hide();
|
2020-07-03 20:07:04 +00:00
|
|
|
|
if (modalId != 'settingsMenu') {
|
|
|
|
|
settingsModal.hide();
|
|
|
|
|
};
|
2020-06-30 15:17:40 +00:00
|
|
|
|
};
|
2020-07-03 20:07:04 +00:00
|
|
|
|
};
|
|
|
|
|
// fail: function(xhr, textStatus, errorThrown) {
|
|
|
|
|
// var footer = modal.getElementsByClassName('modal-dialog')[0].getElementsByClassName('modal-content')[0].getElementsByClassName('modal-footer')[0];
|
|
|
|
|
// var alert = document.createElement('div');
|
|
|
|
|
// alert.classList.add('alert', 'alert-danger');
|
|
|
|
|
// alert.setAttribute('role', 'alert');
|
|
|
|
|
// alert.appendChild(document.createTextNode('Error: ' + errorThrown));
|
|
|
|
|
// footer.appendChild(alert);
|
|
|
|
|
// },
|
|
|
|
|
};
|
|
|
|
|
req.send(send);
|
2020-06-30 15:17:40 +00:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
document.getElementById('settingsSave').onclick = function() {
|
|
|
|
|
modifiedConfig = {};
|
2020-06-30 20:24:07 +00:00
|
|
|
|
var restart_setting_changed = false;
|
2020-06-30 15:17:40 +00:00
|
|
|
|
var settings_changed = false;
|
|
|
|
|
|
|
|
|
|
for (var section of Object.keys(config)) {
|
|
|
|
|
for (var entry of Object.keys(config[section])) {
|
|
|
|
|
if (entry != 'meta') {
|
|
|
|
|
var entryID = section + '_' + entry;
|
|
|
|
|
var el = document.getElementById(entryID);
|
|
|
|
|
if (el.type == 'checkbox') {
|
|
|
|
|
var value = el.checked.toString();
|
|
|
|
|
} else {
|
|
|
|
|
var value = el.value.toString();
|
|
|
|
|
};
|
|
|
|
|
if (value != config[section][entry]['value'].toString()) {
|
|
|
|
|
if (!modifiedConfig.hasOwnProperty(section)) {
|
|
|
|
|
modifiedConfig[section] = {};
|
|
|
|
|
};
|
|
|
|
|
modifiedConfig[section][entry] = value;
|
|
|
|
|
settings_changed = true;
|
2020-06-30 20:24:07 +00:00
|
|
|
|
if (config[section][entry]['requires_restart']) {
|
|
|
|
|
restart_setting_changed = true;
|
|
|
|
|
};
|
2020-06-30 15:17:40 +00:00
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
// if (restart_setting_changed) {
|
2020-06-30 20:24:07 +00:00
|
|
|
|
if (restart_setting_changed) {
|
2020-06-30 15:17:40 +00:00
|
|
|
|
document.getElementById('applyRestarts').onclick = function(){sendConfig('restartModal');};
|
2020-07-03 20:07:04 +00:00
|
|
|
|
settingsModal.hide();
|
|
|
|
|
restartModal.show();
|
2020-06-30 20:24:07 +00:00
|
|
|
|
} else if (settings_changed) {
|
|
|
|
|
sendConfig('settingsMenu');
|
2020-06-30 15:17:40 +00:00
|
|
|
|
} else {
|
2020-07-03 20:07:04 +00:00
|
|
|
|
settingsModal.hide();
|
2020-06-30 15:17:40 +00:00
|
|
|
|
};
|
|
|
|
|
};
|