Former-commit-id: e4a5da856ccf794aa1517ca44e8ee47d83ef0f2d
This commit is contained in:
Henrique Dias
2017-01-18 18:20:56 +00:00
parent b29d284591
commit 3b9c687af7
7 changed files with 69 additions and 31 deletions

View File

@@ -66,7 +66,6 @@ func Parse(c *caddy.Controller) ([]Config, error) {
cfg.Scope = "."
cfg.FileSystem = webdav.Dir(cfg.Scope)
cfg.BaseURL = ""
cfg.FrontMatter = "yaml"
cfg.HugoEnabled = false
cfg.Users = map[string]*User{}
cfg.AllowCommands = true
@@ -102,15 +101,6 @@ func Parse(c *caddy.Controller) ([]Config, error) {
for c.NextBlock() {
switch c.Val() {
case "frontmatter":
if !c.NextArg() {
return configs, c.ArgErr()
}
user.FrontMatter = c.Val()
if user.FrontMatter != "yaml" && user.FrontMatter != "json" && user.FrontMatter != "toml" {
return configs, c.Err("frontmatter type not supported")
}
case "before_save":
if cfg.BeforeSave, err = CommandRunner(c); err != nil {
return configs, err
@@ -239,7 +229,6 @@ func Parse(c *caddy.Controller) ([]Config, error) {
user.AllowEdit = cfg.AllowEdit
user.AllowNew = cfg.AllowEdit
user.Commands = cfg.Commands
user.FrontMatter = cfg.FrontMatter
user.Scope = cfg.Scope
user.FileSystem = cfg.FileSystem
user.Rules = cfg.Rules

View File

@@ -12,7 +12,6 @@ type User struct {
FileSystem webdav.FileSystem `json:"-"` // The virtual file system the user have access
Handler *webdav.Handler `json:"-"` // The WebDav HTTP Handler
StyleSheet string `json:"-"` // Costum stylesheet
FrontMatter string `json:"-"` // Default frontmatter to save files in
AllowNew bool // Can create files and folders
AllowEdit bool // Can edit/rename files
AllowCommands bool // Can execute commands