fix incorrect gui refresh if theme is changed
implement custom clientstore add new Password page if password is set force entering password to successfully receive the token add a new unsafe api call for init call only
This commit is contained in:
49
apiGo/database/settings/DBSettings.go
Normal file
49
apiGo/database/settings/DBSettings.go
Normal file
@ -0,0 +1,49 @@
|
||||
package settings
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"openmediacenter/apiGo/database"
|
||||
)
|
||||
|
||||
func GetPassword() *string {
|
||||
pwd := LoadSettings().Pasword
|
||||
if pwd == "-1" {
|
||||
return nil
|
||||
} else {
|
||||
return &pwd
|
||||
}
|
||||
}
|
||||
|
||||
type SettingsType struct {
|
||||
DarkMode bool
|
||||
Pasword string
|
||||
Mediacenter_name string
|
||||
VideoPath string
|
||||
}
|
||||
|
||||
func LoadSettings() *SettingsType {
|
||||
query := "SELECT DarkMode, password, mediacenter_name, video_path from settings"
|
||||
|
||||
type RawSettingsType struct {
|
||||
DarkMode int
|
||||
Pasword string
|
||||
Mediacenter_name string
|
||||
VideoPath string
|
||||
}
|
||||
|
||||
result := RawSettingsType{}
|
||||
|
||||
err := database.QueryRow(query).Scan(&result.DarkMode, &result.Pasword, &result.Mediacenter_name, &result.VideoPath)
|
||||
if err != nil {
|
||||
fmt.Println("error while parsing db data: " + err.Error())
|
||||
}
|
||||
|
||||
res := SettingsType{
|
||||
DarkMode: result.DarkMode != 0,
|
||||
Pasword: result.Pasword,
|
||||
Mediacenter_name: result.Mediacenter_name,
|
||||
VideoPath: result.VideoPath,
|
||||
}
|
||||
|
||||
return &res
|
||||
}
|
Reference in New Issue
Block a user