mirror of
https://github.com/filebrowser/filebrowser.git
synced 2024-06-07 23:00:43 +00:00
This commit is contained in:
parent
022891e51e
commit
91a6848586
4
hugo.go
4
hugo.go
@ -21,7 +21,6 @@ import (
|
|||||||
"github.com/hacdias/caddy-filemanager"
|
"github.com/hacdias/caddy-filemanager"
|
||||||
"github.com/hacdias/caddy-filemanager/assets"
|
"github.com/hacdias/caddy-filemanager/assets"
|
||||||
"github.com/hacdias/caddy-filemanager/frontmatter"
|
"github.com/hacdias/caddy-filemanager/frontmatter"
|
||||||
"github.com/hacdias/caddy-filemanager/handlers"
|
|
||||||
"github.com/hacdias/caddy-filemanager/utils/variables"
|
"github.com/hacdias/caddy-filemanager/utils/variables"
|
||||||
"github.com/hacdias/caddy-hugo/utils/commands"
|
"github.com/hacdias/caddy-hugo/utils/commands"
|
||||||
"github.com/mholt/caddy/caddyhttp/httpserver"
|
"github.com/mholt/caddy/caddyhttp/httpserver"
|
||||||
@ -161,6 +160,7 @@ func (h Hugo) Schedule(w http.ResponseWriter, r *http.Request) (int, error) {
|
|||||||
return http.StatusInternalServerError, err
|
return http.StatusInternalServerError, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
format := rune(r.Header.Get("Rune")[0])
|
||||||
scheduler := cron.New()
|
scheduler := cron.New()
|
||||||
scheduler.AddFunc(t.Format("05 04 15 02 01 *"), func() {
|
scheduler.AddFunc(t.Format("05 04 15 02 01 *"), func() {
|
||||||
filename := r.URL.Path
|
filename := r.URL.Path
|
||||||
@ -199,7 +199,7 @@ func (h Hugo) Schedule(w http.ResponseWriter, r *http.Request) (int, error) {
|
|||||||
delete(front.(map[string]interface{}), "Draft")
|
delete(front.(map[string]interface{}), "Draft")
|
||||||
}
|
}
|
||||||
|
|
||||||
fm, err := handlers.ParseFrontMatter(front, h.FileManager.Configs[0].FrontMatter)
|
fm, err := frontmatter.Marshal(front, format)
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Println(err)
|
log.Println(err)
|
||||||
|
9
setup.go
9
setup.go
@ -158,15 +158,8 @@ func parse(c *caddy.Controller, root string) (*Config, *filemanager.FileManager,
|
|||||||
|
|
||||||
fm = &filemanager.FileManager{Configs: fmConfig}
|
fm = &filemanager.FileManager{Configs: fmConfig}
|
||||||
fm.Configs[0].HugoEnabled = true
|
fm.Configs[0].HugoEnabled = true
|
||||||
|
|
||||||
format := getFrontMatter(cfg)
|
|
||||||
|
|
||||||
cfg.WebDavURL = fm.Configs[0].WebDavURL
|
cfg.WebDavURL = fm.Configs[0].WebDavURL
|
||||||
|
|
||||||
for _, user := range fm.Configs[0].Users {
|
|
||||||
user.FrontMatter = format
|
|
||||||
}
|
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return cfg, fm, err
|
return cfg, fm, err
|
||||||
}
|
}
|
||||||
@ -210,7 +203,7 @@ func getFrontMatter(conf *Config) string {
|
|||||||
log.Println(err)
|
log.Println(err)
|
||||||
fmt.Printf("Can't get the default frontmatter from the configuration. %s will be used.\n", format)
|
fmt.Printf("Can't get the default frontmatter from the configuration. %s will be used.\n", format)
|
||||||
} else {
|
} else {
|
||||||
bytes = frontmatter.AppendRune(bytes, format)
|
bytes = frontmatter.AppendRune(bytes, frontmatter.StringFormatToRune(format))
|
||||||
f, err := frontmatter.Unmarshal(bytes)
|
f, err := frontmatter.Unmarshal(bytes)
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
Loading…
Reference in New Issue
Block a user