mirror of
https://github.com/Starlio-app/StarlioX
synced 2024-12-23 13:43:46 +03:00
delete autoupdate and lang
This commit is contained in:
parent
7c75974bfe
commit
8014e7a7ff
1 changed files with 4 additions and 21 deletions
|
@ -27,15 +27,14 @@ var SettingsGet = func(w http.ResponseWriter, r *http.Request) {
|
|||
}
|
||||
}(query)
|
||||
|
||||
var lang string
|
||||
var autostart, autoupdate, autochangewallpaper int
|
||||
var autostart, autochangewallpaper int
|
||||
|
||||
for query.Next() {
|
||||
err := query.Scan(&lang, &autostart, &autoupdate, &autochangewallpaper)
|
||||
err := query.Scan(&autostart, &autochangewallpaper)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
var data = map[string]interface{}{"lang": lang, "autostart": autostart, "autoupdate": autoupdate, "autochangewallpaper": autochangewallpaper}
|
||||
var data = map[string]interface{}{"autostart": autostart, "autochangewallpaper": autochangewallpaper}
|
||||
utils.Respond(w, data)
|
||||
}
|
||||
}
|
||||
|
@ -46,23 +45,14 @@ var SettingsUpdate = func(w http.ResponseWriter, r *http.Request) {
|
|||
panic(errOpen)
|
||||
}
|
||||
|
||||
lang := r.FormValue("lang")
|
||||
autostart := r.FormValue("autostart")
|
||||
autoupdate := r.FormValue("autoupdate")
|
||||
autochangewallpaper := r.FormValue("autochangewallpaper")
|
||||
|
||||
if lang == "" && autostart == "" && autoupdate == "" && autochangewallpaper == "" {
|
||||
if autostart == "" && autochangewallpaper == "" {
|
||||
utils.Respond(w, utils.Message(false, "All fields are required"))
|
||||
return
|
||||
}
|
||||
|
||||
if lang != "" {
|
||||
_, err := db.Exec("UPDATE settings SET lang = ?", lang)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
|
||||
if autostart != "" {
|
||||
_, err := db.Exec("UPDATE settings SET autostart = ?", autostart)
|
||||
if err != nil {
|
||||
|
@ -70,13 +60,6 @@ var SettingsUpdate = func(w http.ResponseWriter, r *http.Request) {
|
|||
}
|
||||
}
|
||||
|
||||
if autoupdate != "" {
|
||||
_, err := db.Exec("UPDATE settings SET autoupdate = ?", autoupdate)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
|
||||
if autochangewallpaper != "" {
|
||||
_, err := db.Exec("UPDATE settings SET autochangewallpaper = ?", autochangewallpaper)
|
||||
if err != nil {
|
||||
|
|
Loading…
Add table
Reference in a new issue