Add --web-root switch
This commit is contained in:
parent
2743c96694
commit
c5ce51f242
5 changed files with 56 additions and 38 deletions
|
@ -64,6 +64,7 @@ type Config struct {
|
|||
AttachmentExpiryDuration time.Duration
|
||||
KeepaliveInterval time.Duration
|
||||
ManagerInterval time.Duration
|
||||
WebRootIsApp bool
|
||||
AtSenderInterval time.Duration
|
||||
FirebaseKeepaliveInterval time.Duration
|
||||
SMTPSenderAddr string
|
||||
|
|
|
@ -83,7 +83,7 @@ var (
|
|||
webFs embed.FS
|
||||
webFsCached = &util.CachingEmbedFS{ModTime: time.Now(), FS: webFs}
|
||||
webSiteDir = "/site"
|
||||
webHomeIndex = "/home.html" // Landing page, only if "web-index: home"
|
||||
webHomeIndex = "/home.html" // Landing page, only if "web-root: home"
|
||||
webAppIndex = "/app.html" // React app
|
||||
|
||||
//go:embed docs
|
||||
|
@ -300,7 +300,11 @@ func (s *Server) handleInternal(w http.ResponseWriter, r *http.Request, v *visit
|
|||
}
|
||||
|
||||
func (s *Server) handleHome(w http.ResponseWriter, r *http.Request) error {
|
||||
r.URL.Path = webHomeIndex
|
||||
if s.config.WebRootIsApp {
|
||||
r.URL.Path = webAppIndex
|
||||
} else {
|
||||
r.URL.Path = webHomeIndex
|
||||
}
|
||||
return s.handleStatic(w, r)
|
||||
}
|
||||
|
||||
|
|
|
@ -126,6 +126,11 @@
|
|||
#
|
||||
# manager-interval: "1m"
|
||||
|
||||
# Defines if the root route (/) is pointing to the landing page (as on ntfy.sh) or the
|
||||
# web app. If you self-host, you don't want to change this. Can be "app" (default) or "home".
|
||||
#
|
||||
# web-root: app
|
||||
|
||||
# Rate limiting: Total number of topics before the server rejects new topics.
|
||||
#
|
||||
# global-topic-limit: 15000
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue