mirror of
https://github.com/mickael-kerjean/filestash
synced 2025-12-25 17:53:56 +01:00
maintain (api): config endpoint refactoring
This commit is contained in:
parent
9a6af501e4
commit
1e562aa8e8
2 changed files with 8 additions and 5 deletions
|
|
@ -130,7 +130,7 @@ export function Form({
|
|||
const key = Object.keys(form)[0];
|
||||
if (selectedTab !== i) return null;
|
||||
|
||||
const auth = window.CONFIG["auth"].split(/\s*,\s*/);
|
||||
const auth = window.CONFIG["auth"];
|
||||
if (auth.indexOf(key) !== -1 || auth.indexOf(form[key].label.value) !== -1) {
|
||||
return hasUserInteracted === false && enabledBackends.length > 1 ? (
|
||||
<Button
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ import (
|
|||
"os"
|
||||
"os/exec"
|
||||
"os/user"
|
||||
"regexp"
|
||||
"strings"
|
||||
"sync"
|
||||
)
|
||||
|
|
@ -361,7 +362,7 @@ func (this *Configuration) Export() interface{} {
|
|||
RefreshAfterUpload bool `json:"refresh_after_upload"`
|
||||
FilePageDefaultSort string `json:"default_sort"`
|
||||
FilePageDefaultView string `json:"default_view"`
|
||||
AuthMiddleware interface{} `json:"auth"`
|
||||
AuthMiddleware []string `json:"auth"`
|
||||
Thumbnailer []string `json:"thumbnailer"`
|
||||
EnableChromecast bool `json:"enable_chromecast"`
|
||||
}{
|
||||
|
|
@ -380,11 +381,13 @@ func (this *Configuration) Export() interface{} {
|
|||
RefreshAfterUpload: this.Get("general.refresh_after_upload").Bool(),
|
||||
FilePageDefaultSort: this.Get("general.filepage_default_sort").String(),
|
||||
FilePageDefaultView: this.Get("general.filepage_default_view").String(),
|
||||
AuthMiddleware: func() string {
|
||||
AuthMiddleware: func() []string {
|
||||
if this.Get("middleware.identity_provider.type").String() == "" {
|
||||
return ""
|
||||
return []string{}
|
||||
}
|
||||
return this.Get("middleware.attribute_mapping.related_backend").String()
|
||||
return regexp.MustCompile("\\s*,\\s*").Split(
|
||||
this.Get("middleware.attribute_mapping.related_backend").String(), -1,
|
||||
)
|
||||
}(),
|
||||
Thumbnailer: func() []string {
|
||||
tMap := Hooks.Get.Thumbnailer()
|
||||
|
|
|
|||
Loading…
Reference in a new issue