Capture accumulated application, UI, CLI, regression tests and design documentation changes, including task project mapping and default CalDAV list naming. Keep deployment data, backups, local credentials and build artifacts out of Git. Move the Compose enrollment token to an ignored local environment file.
107 lines
3.5 KiB
Go
107 lines
3.5 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
|
|
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, "/:/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)
|
|
}
|