feat: Option to serve Bootstrap from the filesystem
All checks were successful
/ pre-commit (push) Successful in 1m7s
All checks were successful
/ pre-commit (push) Successful in 1m7s
Signed-off-by: Julien Riou <julien@riou.xyz>
This commit is contained in:
parent
b62a807f89
commit
ff92e30232
8 changed files with 94 additions and 6 deletions
|
@ -196,6 +196,7 @@ type PageData struct {
|
|||
URL string
|
||||
Note *Note
|
||||
EnableUploadFileButton bool
|
||||
BootstrapDirectory string
|
||||
}
|
||||
|
||||
type HomeHandler struct {
|
||||
|
@ -430,10 +431,11 @@ func (s *Server) Start() error {
|
|||
"string": func(b []byte) string { return string(b) },
|
||||
}
|
||||
p := PageData{
|
||||
Title: s.config.Title,
|
||||
Expirations: s.config.Expirations,
|
||||
Expiration: s.config.Expiration,
|
||||
Languages: s.config.Languages,
|
||||
Title: s.config.Title,
|
||||
Expirations: s.config.Expirations,
|
||||
Expiration: s.config.Expiration,
|
||||
Languages: s.config.Languages,
|
||||
BootstrapDirectory: s.config.BootstrapDirectory,
|
||||
}
|
||||
|
||||
if s.config.ShowVersion {
|
||||
|
@ -470,6 +472,10 @@ func (s *Server) Start() error {
|
|||
}
|
||||
r.Path("/{id:[a-zA-Z0-9]+}.html").Handler(webNoteHandler).Methods("GET")
|
||||
|
||||
if s.config.BootstrapDirectory != "" {
|
||||
r.PathPrefix("/static/bootstrap/").Handler(http.StripPrefix("/static/bootstrap/", http.FileServer(http.Dir(s.config.BootstrapDirectory))))
|
||||
}
|
||||
|
||||
r.Path("/").Handler(&HomeHandler{Templates: templates, PageData: p}).Methods("GET")
|
||||
|
||||
addr := fmt.Sprintf("%s:%d", s.config.ListenAddress, s.config.ListenPort)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue