mirror of
https://github.com/Starlio-app/StarlioX
synced 2025-02-24 23:31:26 +03:00
Now it is possible to turn off error logging
Signed-off-by: Redume <Danilivasenko09@gmail.com>
This commit is contained in:
parent
760459b7f2
commit
a5561d76e6
5 changed files with 168 additions and 32 deletions
|
@ -5,19 +5,20 @@ $(document).ready(async function() {
|
|||
const $wallpaperSwitch = $("#settings_autoSetWallpaperSwitch");
|
||||
const $wallpaperSwitchTogglerName = $("#settings_autoSetWallpaperTogglerName");
|
||||
|
||||
$.ajax({
|
||||
url: "http://localhost:3000/api/get/settings",
|
||||
type: "GET",
|
||||
success: function(data) {
|
||||
if (data["wallpaper"] === 1) {
|
||||
$wallpaperSwitch.attr("checked", "true");
|
||||
$wallpaperSwitchTogglerName.text("On");
|
||||
}
|
||||
if (data["startup"] === 1) {
|
||||
$startupSwitch.attr("checked", "true");
|
||||
$startupSwitchTogglerName.text("On");
|
||||
}
|
||||
},
|
||||
const $loggingSwitch = $("#settings_saveLoggSwitch");
|
||||
const $loggingSwitchTogglerName = $("#settings_saveLoggTogglerName");
|
||||
|
||||
getSettings().then((data) => {
|
||||
if (data["wallpaper"] === 1) {
|
||||
$wallpaperSwitch.attr("checked", "true");
|
||||
$wallpaperSwitchTogglerName.text("On");
|
||||
} else if (data["startup"] === 1) {
|
||||
$startupSwitch.attr("checked", "true");
|
||||
$startupSwitchTogglerName.text("On");
|
||||
} else if (data["save_logg"] === 1) {
|
||||
$loggingSwitch.attr("checked", "true");
|
||||
$loggingSwitchTogglerName.text("On");
|
||||
}
|
||||
});
|
||||
|
||||
$wallpaperSwitch.click(async function() {
|
||||
|
@ -116,16 +117,78 @@ $(document).ready(async function() {
|
|||
},
|
||||
});
|
||||
});
|
||||
|
||||
$loggingSwitch.click(async function() {
|
||||
$.ajax({
|
||||
url: "http://localhost:3000/api/get/settings",
|
||||
type: "GET",
|
||||
success: function (data) {
|
||||
if (data["save_logg"] === 1) {
|
||||
$.ajax({
|
||||
url: "http://localhost:3000/api/update/settings",
|
||||
type: "POST",
|
||||
data: {
|
||||
"save_logg": 0,
|
||||
},
|
||||
success: function (data) {
|
||||
if(data["status"]) {
|
||||
$loggingSwitchTogglerName.text("Off");
|
||||
$loggingSwitch.removeAttr("checked");
|
||||
|
||||
toast(data.message);
|
||||
} else {
|
||||
toast("Failed to apply settings.");
|
||||
}
|
||||
},
|
||||
});
|
||||
} else {
|
||||
$.ajax({
|
||||
url: "http://localhost:3000/api/update/settings",
|
||||
type: "POST",
|
||||
data: {
|
||||
"save_logg": 1,
|
||||
},
|
||||
success: function (data) {
|
||||
if(data["status"]) {
|
||||
$loggingSwitchTogglerName.text("On");
|
||||
$loggingSwitch.attr("checked", "true");
|
||||
|
||||
toast(data.message);
|
||||
} else {
|
||||
toast("Failed to apply settings.");
|
||||
}
|
||||
},
|
||||
});
|
||||
}
|
||||
},
|
||||
})
|
||||
});
|
||||
});
|
||||
|
||||
/**
|
||||
* @param {String} message
|
||||
*/
|
||||
|
||||
function toast(message) {
|
||||
if (message === null) {
|
||||
return "Required parameter 'message' is missing.";
|
||||
}
|
||||
|
||||
$(".toast-body").text(message);
|
||||
let toastLiveExample = document.getElementById('liveToast');
|
||||
let toast = new bootstrap.Toast(toastLiveExample);
|
||||
toast.show();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {Number} i
|
||||
*/
|
||||
|
||||
function editStartup(i) {
|
||||
if (i !== 1 || i !== 0 || i === null) {
|
||||
return "Required parameter 'i' is missing.";
|
||||
}
|
||||
|
||||
return $.ajax({
|
||||
url: "http://localhost:3000/api/update/startup",
|
||||
type: "POST",
|
||||
|
@ -133,4 +196,11 @@ function editStartup(i) {
|
|||
"startup": i
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
function getSettings() {
|
||||
return $.ajax({
|
||||
url: "http://localhost:3000/api/get/settings",
|
||||
type: "GET",
|
||||
});
|
||||
}
|
Loading…
Add table
Reference in a new issue