mirror of
https://github.com/filebrowser/filebrowser.git
synced 2024-06-07 23:00:43 +00:00
use user defined frontmatter and stylesheet #23
This commit is contained in:
parent
35a9798278
commit
0b5a318728
@ -7,9 +7,9 @@
|
||||
<link href='https://fonts.googleapis.com/css?family=Roboto:400,500' rel='stylesheet' type='text/css'>
|
||||
<link rel="stylesheet" href="{{ .Config.AbsoluteURL }}/_filemanagerinternal/css/styles.css">
|
||||
|
||||
{{ if ne .Config.StyleSheet "" }}
|
||||
{{ if ne .User.StyleSheet "" }}
|
||||
<style>
|
||||
{{ CSS .Config.StyleSheet }}
|
||||
{{ CSS .User.StyleSheet }}
|
||||
</style>
|
||||
{{ end }}
|
||||
</head>
|
||||
|
@ -37,9 +37,7 @@ type UserConfig struct {
|
||||
Rules []*Rule `json:"-"` // Access rules
|
||||
}
|
||||
|
||||
// TODO: USE USER StyleSheet
|
||||
// TODO: USE USER FRONTMATTER
|
||||
// TODO: USE USER ROOT
|
||||
// REVIEW: USE USER ROOT
|
||||
|
||||
// Rule is a dissalow/allow rule
|
||||
type Rule struct {
|
||||
|
@ -15,7 +15,7 @@ import (
|
||||
)
|
||||
|
||||
// Update is used to update a file that was edited
|
||||
func (i *Info) Update(w http.ResponseWriter, r *http.Request, c *config.Config) (int, error) {
|
||||
func (i *Info) Update(w http.ResponseWriter, r *http.Request, c *config.Config, u *config.UserConfig) (int, error) {
|
||||
var data map[string]interface{}
|
||||
kind := r.Header.Get("kind")
|
||||
|
||||
@ -45,7 +45,7 @@ func (i *Info) Update(w http.ResponseWriter, r *http.Request, c *config.Config)
|
||||
mainContent = strings.TrimSpace(mainContent)
|
||||
file = []byte(mainContent)
|
||||
case "complete":
|
||||
if file, code, err = ParseCompleteFile(data, i.Name, c.FrontMatter); err != nil {
|
||||
if file, code, err = ParseCompleteFile(data, i.Name, u.FrontMatter); err != nil {
|
||||
return http.StatusInternalServerError, err
|
||||
}
|
||||
default:
|
||||
|
@ -116,7 +116,7 @@ func (f FileManager) ServeHTTP(w http.ResponseWriter, r *http.Request) (int, err
|
||||
}
|
||||
|
||||
// Update a file
|
||||
return fi.Update(w, r, c)
|
||||
return fi.Update(w, r, c, user)
|
||||
case http.MethodPost:
|
||||
// Upload a new file
|
||||
if r.Header.Get("Upload") == "true" {
|
||||
|
Loading…
Reference in New Issue
Block a user