Files
pages/internal/server/routes/ui.go
T
Anya Tokugawa 02fb77f72b
Build and publish container images / images (push) Successful in 9m2s
Release container images / release (push) Successful in 21s
feat(slides): add sandboxed Reveal.js viewer and editor preview
2026-11-08 22:10:52 +09:00

110 lines
3.6 KiB
Go

package routes
import "net/http"
type UIHandlers struct {
Home http.HandlerFunc
NewPage http.HandlerFunc
SemanticEditor http.HandlerFunc
SemanticPage http.HandlerFunc
RawView http.HandlerFunc
TextWindow http.HandlerFunc
LinkManager http.HandlerFunc
Health http.HandlerFunc
Tree http.HandlerFunc
Browser http.HandlerFunc
Preview http.HandlerFunc
PlainView http.HandlerFunc
MarkdownView http.HandlerFunc
Slides http.HandlerFunc
CompileMarkdown http.HandlerFunc
CompileDiagram http.HandlerFunc
Config http.HandlerFunc
AdapterConfig http.HandlerFunc
VimConfig http.HandlerFunc
SystemExtensions http.HandlerFunc
Periodical http.HandlerFunc
Upload http.HandlerFunc
Children http.HandlerFunc
Bookmarks http.HandlerFunc
PreviewCache http.HandlerFunc
Search http.HandlerFunc
Archive http.HandlerFunc
EmailHTML http.HandlerFunc
PDFPage http.HandlerFunc
OpenWith http.HandlerFunc
City http.HandlerFunc
Print http.HandlerFunc
Notifications http.HandlerFunc
}
func handleIfNotNil(
mux *http.ServeMux,
pattern string,
h http.HandlerFunc,
) {
if h != nil {
mux.HandleFunc(pattern, h)
}
}
func RegisterUIRoutes(
mux *http.ServeMux,
h UIHandlers,
) {
handleIfNotNil(mux, "/", h.Home)
handleIfNotNil(mux, "/:/new", h.NewPage)
handleIfNotNil(mux, "/new", func(w http.ResponseWriter, r *http.Request) {
http.Redirect(w, r, "/:/new", http.StatusFound)
})
handleIfNotNil(mux, "/e/", h.SemanticEditor)
handleIfNotNil(mux, "/v/bookmarks", h.Bookmarks)
handleIfNotNil(mux, "/v/diary", h.Periodical)
handleIfNotNil(mux, "/v/diary/", h.Periodical)
handleIfNotNil(mux, "/v/blog", h.Periodical)
handleIfNotNil(mux, "/v/blog/", h.Periodical)
handleIfNotNil(mux, "/v/raw/", h.RawView)
handleIfNotNil(mux, "/v/text/", h.TextWindow)
handleIfNotNil(mux, "/l/", h.LinkManager)
handleIfNotNil(mux, "/health", h.Health)
handleIfNotNil(mux, "/v/tree", h.Tree)
handleIfNotNil(mux, "/v/tree/", h.Tree)
handleIfNotNil(mux, "/v/browser", h.Browser)
handleIfNotNil(mux, "/v/browser/", h.Browser)
handleIfNotNil(mux, "/v/preview", h.Preview)
handleIfNotNil(mux, "/v/preview/", h.Preview)
handleIfNotNil(mux, "/v/plain", h.PlainView)
handleIfNotNil(mux, "/v/plain/", h.PlainView)
handleIfNotNil(mux, "/v/upload", h.Upload)
handleIfNotNil(mux, "/v/children", h.Children)
handleIfNotNil(mux, "/v/preview-cache/", h.PreviewCache)
handleIfNotNil(mux, "/v/search", h.Search)
handleIfNotNil(mux, "/v/archive", h.Archive)
handleIfNotNil(mux, "/v/email-html", h.EmailHTML)
handleIfNotNil(mux, "/v/pdf-page", h.PDFPage)
handleIfNotNil(mux, "/v/open-with", h.OpenWith)
handleIfNotNil(mux, "/v/city", h.City)
handleIfNotNil(mux, "/v/city/", h.City)
handleIfNotNil(mux, "/v/notifications", h.Notifications)
handleIfNotNil(mux, "/v/notification", h.Notifications)
handleIfNotNil(mux, "/_/view/print/", h.Print)
handleIfNotNil(mux, "/v/markdown", h.MarkdownView)
handleIfNotNil(mux, "/v/markdown/", h.MarkdownView)
handleIfNotNil(mux, "/v/slides", h.Slides)
handleIfNotNil(mux, "/v/slides/", h.Slides)
handleIfNotNil(mux, "/:/compile/markdown", h.CompileMarkdown)
handleIfNotNil(mux, "/:/compile/markdown/", h.CompileMarkdown)
handleIfNotNil(mux, "/:/compile/diagram/", h.CompileDiagram)
handleIfNotNil(mux, "/-/sys/config", h.Config)
handleIfNotNil(mux, "/-/sys/config/adapters", h.AdapterConfig)
handleIfNotNil(mux, "/-/sys/config/vim", h.VimConfig)
handleIfNotNil(mux, "/_/api/v1/extension/", h.SystemExtensions)
}