mirror of
https://github.com/Starlio-app/StarlioX
synced 2024-11-25 09:16:21 +03:00
delete autoupdate and lang
This commit is contained in:
parent
9082744466
commit
7c75974bfe
2 changed files with 30 additions and 47 deletions
|
@ -20,9 +20,7 @@ func Database() {
|
|||
if exists == false {
|
||||
sqlTable := `
|
||||
CREATE TABLE IF NOT EXISTS settings (
|
||||
lang TEXT DEFAULT 'en',
|
||||
autostart INTEGER DEFAULT 0,
|
||||
autoupdate INTEGER DEFAULT 0,
|
||||
autochangewallpaper INTEGER DEFAULT 0
|
||||
);`
|
||||
_, CreateTableErr := db.Exec(sqlTable)
|
||||
|
@ -30,12 +28,12 @@ func Database() {
|
|||
panic(CreateTableErr)
|
||||
}
|
||||
|
||||
stmt, InsertErr := db.Prepare("INSERT INTO settings(lang, autostart, autoupdate) values(?,?,?)")
|
||||
stmt, InsertErr := db.Prepare("INSERT INTO settings(autostart, autochangewallpaper) values(?,?)")
|
||||
if InsertErr != nil {
|
||||
panic(InsertErr)
|
||||
}
|
||||
|
||||
_, ExecErr := stmt.Exec("en", 0, 0)
|
||||
_, ExecErr := stmt.Exec(0, 0)
|
||||
if ExecErr != nil {
|
||||
panic(ExecErr)
|
||||
}
|
||||
|
|
|
@ -2,10 +2,6 @@ $.ajax({
|
|||
url: "http://localhost:8080/api/get/settings",
|
||||
type: "GET",
|
||||
success: function(data){
|
||||
if(data["autoupdate"] === 1){
|
||||
$("#updateSwitch").attr("checked", "true");
|
||||
$("#updateText").text("On");
|
||||
}
|
||||
if(data["autostart"] === 1) {
|
||||
$("#autorunSwitch").attr("checked", "true");
|
||||
$("#autorunText").text("On");
|
||||
|
@ -18,41 +14,6 @@ $.ajax({
|
|||
|
||||
})
|
||||
|
||||
$("#updateSwitch").click(function(){
|
||||
$.ajax({
|
||||
url: "http://localhost:8080/api/get/settings",
|
||||
type: "GET",
|
||||
success: function(data){
|
||||
if(data["autoupdate"] === 1){
|
||||
$.ajax({
|
||||
url: "http://localhost:8080/api/update/settings",
|
||||
type: "POST",
|
||||
data: {
|
||||
autoupdate: 0
|
||||
},
|
||||
success: function(){
|
||||
$("#updateSwitch").removeAttr("checked");
|
||||
$("#updateText").text("Off");
|
||||
}
|
||||
})
|
||||
} else {
|
||||
$.ajax({
|
||||
url: "http://localhost:8080/api/update/settings",
|
||||
type: "POST",
|
||||
data: {
|
||||
autoupdate: 1
|
||||
},
|
||||
success: function(){
|
||||
$("#updateSwitch").attr("checked", "true");
|
||||
$("#updateText").text("On");
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
});
|
||||
})
|
||||
|
||||
|
||||
$("#autorunSwitch").click(function(){
|
||||
$.ajax({
|
||||
url: "http://localhost:8080/api/get/settings",
|
||||
|
@ -66,9 +27,21 @@ $("#autorunSwitch").click(function(){
|
|||
autostart: 0
|
||||
},
|
||||
success: function(){
|
||||
$.ajax({
|
||||
url: "http://localhost:8080/api/update/del/startapp",
|
||||
type: "POST",
|
||||
success: function(data){
|
||||
$(".toast-body").text(data.message);
|
||||
let toastLiveExample = document.getElementById('liveToast')
|
||||
let toast = new bootstrap.Toast(toastLiveExample)
|
||||
toast.show()
|
||||
if(data.status) {
|
||||
$("#autorunSwitch").removeAttr("checked");
|
||||
$("#autorunText").text("Off");
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
} else {
|
||||
$.ajax({
|
||||
|
@ -78,9 +51,21 @@ $("#autorunSwitch").click(function(){
|
|||
autostart: 1
|
||||
},
|
||||
success: function(){
|
||||
$.ajax({
|
||||
url: "http://localhost:8080/api/update/add/startapp",
|
||||
type: "POST",
|
||||
success: function(data){
|
||||
$(".toast-body").text(data.message);
|
||||
let toastLiveExample = document.getElementById('liveToast')
|
||||
let toast = new bootstrap.Toast(toastLiveExample)
|
||||
toast.show()
|
||||
if(data.status) {
|
||||
$("#autorunSwitch").attr("checked", "true");
|
||||
$("#autorunText").text("On");
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue