mirror of
https://github.com/yusing/godoxy.git
synced 2026-04-24 01:38:50 +02:00
feat(loading_page): move loading page css to style.css and serve as static asset
This commit is contained in:
@@ -47,6 +47,10 @@ func isFaviconPath(path string) bool {
|
||||
return path == "/favicon.ico"
|
||||
}
|
||||
|
||||
func isLoadingPageCSSPath(path string) bool {
|
||||
return path == "/style.css"
|
||||
}
|
||||
|
||||
func (w *Watcher) redirectToStartEndpoint(rw http.ResponseWriter, r *http.Request) {
|
||||
uri := "/"
|
||||
if w.cfg.StartEndpoint != "" {
|
||||
@@ -96,6 +100,13 @@ func (w *Watcher) wakeFromHTTP(rw http.ResponseWriter, r *http.Request) (shouldN
|
||||
return false
|
||||
}
|
||||
|
||||
if isLoadingPageCSSPath(r.URL.Path) {
|
||||
rw.Header().Set("Content-Type", "text/css")
|
||||
rw.WriteHeader(http.StatusOK)
|
||||
rw.Write(cssBytes)
|
||||
return false
|
||||
}
|
||||
|
||||
// Check if start endpoint is configured and request path matches
|
||||
if w.cfg.StartEndpoint != "" && r.URL.Path != w.cfg.StartEndpoint {
|
||||
http.Error(rw, "Forbidden: Container can only be started via configured start endpoint", http.StatusForbidden)
|
||||
|
||||
Reference in New Issue
Block a user