aboutsummaryrefslogtreecommitdiffstats
path: root/pkg
diff options
context:
space:
mode:
Diffstat (limited to 'pkg')
-rw-r--r--pkg/html/status.go (renamed from pkg/html/notfound.go)8
-rw-r--r--pkg/site/fs.go5
2 files changed, 13 insertions, 0 deletions
diff --git a/pkg/html/notfound.go b/pkg/html/status.go
index ceb521f..569a236 100644
--- a/pkg/html/notfound.go
+++ b/pkg/html/status.go
@@ -23,3 +23,11 @@ func NotFoundSitePage(host string) Node {
P(Text(fmt.Sprintf("The site %s is unknown", host))),
)
}
+
+func ForbiddenDisabledPage(host string) Node {
+ return Page("Forbidden",
+ H1(Text("Forbidden")),
+
+ P(Text(fmt.Sprintf("Site %s is disabled", host))),
+ )
+}
diff --git a/pkg/site/fs.go b/pkg/site/fs.go
index c9bbe21..b4a941d 100644
--- a/pkg/site/fs.go
+++ b/pkg/site/fs.go
@@ -21,6 +21,11 @@ func NewSiteFileServer(root http.FileSystem, siteConfig *config.SiteConfig) *Sit
}
func (fs *SiteFileServer) ServeHTTP(w http.ResponseWriter, r *http.Request) {
+ if fs.siteConfig.Flags&config.FlagDisable != 0 {
+ html.ForbiddenDisabledPage(fs.siteConfig.Host).Render(w)
+ return
+ }
+
path := filepath.Clean(r.URL.Path)
file, err := fs.root.Open(path)