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
|
@ -50,13 +50,19 @@
|
|||
<label class="form-check-label" for="settings_autoSetWallpaperTogglerName" id="settings_autoSetWallpaperTogglerName">Off</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="settings">
|
||||
<p class="title"><strong>Create log files</strong></p>
|
||||
<p class="desc">Every Nasa will create files in which errors will be written that will help developers when correcting errors.</p>
|
||||
<div class="form-check form-switch">
|
||||
<input class="form-check-input" type="checkbox" role="switch" id="settings_saveLoggSwitch">
|
||||
<label class="form-check-label" for="settings_autoSetWallpaperTogglerName" id="settings_saveLoggTogglerName">Off</label>
|
||||
</div> </div>
|
||||
<div class="settings">
|
||||
<p class="title"><strong>Create an application shortcut</strong></p>
|
||||
<p class="desc">EveryNasa will create an application shortcut on your desktop.</p>
|
||||
<button type="button" class="btn btn-outline-primary" id="createLabelButton">Create</button>
|
||||
</div>
|
||||
</header>
|
||||
</header>
|
||||
</div>
|
||||
<div class="toast-container position-fixed bottom-0 end-0 p-3">
|
||||
<div id="liveToast" class="toast" role="alert" aria-live="assertive" aria-atomic="true">
|
||||
|
|
|
@ -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