1
0
Fork 0
forked from jriou/coller

feat: Option to serve Bootstrap from the filesystem

Signed-off-by: Julien Riou <julien@riou.xyz>
This commit is contained in:
Julien Riou 2025-09-16 09:36:10 +02:00
commit ff92e30232
Signed by: jriou
GPG key ID: 9A099EDA51316854
8 changed files with 94 additions and 6 deletions

View file

@ -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)