mirror of
https://github.com/filebrowser/filebrowser.git
synced 2024-06-07 23:00:43 +00:00
updates
This commit is contained in:
parent
8f94827723
commit
b1f13f1a4a
@ -9,15 +9,17 @@ import (
|
||||
|
||||
// Config is the add-on configuration set on Caddyfile
|
||||
type Config struct {
|
||||
Styles string
|
||||
Styles string
|
||||
Args []string
|
||||
|
||||
Hugo bool
|
||||
Args []string
|
||||
Command string
|
||||
Content string
|
||||
}
|
||||
|
||||
// ParseCMS parses the configuration file
|
||||
func ParseCMS(c *setup.Controller) (*Config, error) {
|
||||
conf := &Config{Hugo: true}
|
||||
conf := &Config{Hugo: true, Content: "content"}
|
||||
|
||||
for c.Next() {
|
||||
for c.NextBlock() {
|
||||
@ -40,6 +42,13 @@ func ParseCMS(c *setup.Controller) (*Config, error) {
|
||||
if err != nil {
|
||||
return conf, err
|
||||
}
|
||||
case "content":
|
||||
if !c.NextArg() {
|
||||
return nil, c.ArgErr()
|
||||
}
|
||||
conf.Content = c.Val()
|
||||
conf.Content = strings.TrimPrefix(conf.Content, "/")
|
||||
conf.Content = strings.TrimSuffix(conf.Content, "/")
|
||||
case "command":
|
||||
if !c.NextArg() {
|
||||
return nil, c.ArgErr()
|
||||
|
@ -7,16 +7,6 @@ import (
|
||||
"github.com/hacdias/staticmin/config"
|
||||
)
|
||||
|
||||
type editor struct {
|
||||
Name string
|
||||
Class string
|
||||
IsPost bool
|
||||
Mode string
|
||||
Content string
|
||||
FrontMatter interface{}
|
||||
Config *config.Config
|
||||
}
|
||||
|
||||
// ServeHTTP serves the editor page
|
||||
func ServeHTTP(w http.ResponseWriter, r *http.Request, c *config.Config) (int, error) {
|
||||
filename := strings.Replace(r.URL.Path, "/admin/edit/", "", 1)
|
||||
|
@ -16,6 +16,16 @@ import (
|
||||
"github.com/spf13/hugo/parser"
|
||||
)
|
||||
|
||||
type editor struct {
|
||||
Name string
|
||||
Class string
|
||||
IsPost bool
|
||||
Mode string
|
||||
Content string
|
||||
FrontMatter interface{}
|
||||
Config *config.Config
|
||||
}
|
||||
|
||||
// GET handles the GET method on editor page
|
||||
func GET(w http.ResponseWriter, r *http.Request, c *config.Config, filename string) (int, error) {
|
||||
// Check if the file format is supported. If not, send a "Not Acceptable"
|
||||
|
@ -20,7 +20,8 @@
|
||||
<nav>
|
||||
<ul>
|
||||
<li><a href="/"><i class="fa fa-home fa-lg"></i> Home</a></li>
|
||||
<li><a data-pjax href="/admin/browse/content/"><i class="fa fa-newspaper-o"></i> Content</a></li>
|
||||
{{ if and (Defined . "Config")}}<li><a data-pjax href="/admin/browse/{{ .Config.Content }}/"><i class="fa fa-newspaper-o"></i> Content</a></li>{{ end }}
|
||||
{{ if and (Defined . "User") }}<li><a data-pjax href="/admin/browse/{{ .Config.User }}/"><i class="fa fa-newspaper-o"></i> Content</a></li>{{ end }}
|
||||
<li><a data-pjax href="/admin/browse/"><i class="fa fa-folder-o"></i> Browse</a></li>
|
||||
<li><a data-pjax href="/admin/settings/"><i class="fa fa-cog"></i> Settings</a></li>
|
||||
<li><a data-pjax id="logout" href="#logout"><i class="fa fa-sign-out"></i> Logout</a></li>
|
||||
|
Loading…
Reference in New Issue
Block a user