impl. Kroki, compile path, and code-editor feature
This commit is contained in:
1 parent
c1bc8f0c03
commit
94d56f9a8f
49 files changed
+40652
-389
No files matched your search
@@ -0,0 +1,52 @@
|
||||
package server
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
"strings"
|
||||
)
|
||||
|
||||
func (s *Server) handleBrowser(
|
||||
w http.ResponseWriter,
|
||||
r *http.Request,
|
||||
) {
|
||||
|
||||
currentPath :=
|
||||
strings.TrimPrefix(
|
||||
r.URL.Path,
|
||||
"/v/browser",
|
||||
)
|
||||
|
||||
if currentPath == "" || currentPath == "/" {
|
||||
currentPath = "/"
|
||||
}
|
||||
|
||||
if !strings.HasPrefix(currentPath, "/") {
|
||||
currentPath = "/" + currentPath
|
||||
}
|
||||
|
||||
entries, err :=
|
||||
s.store.ListBrowserEntries(
|
||||
currentPath,
|
||||
)
|
||||
|
||||
if err != nil {
|
||||
http.Error(w, err.Error(), 500)
|
||||
return
|
||||
}
|
||||
|
||||
s.render(
|
||||
w,
|
||||
"browser.gohtml",
|
||||
map[string]any{
|
||||
"NavItems": resolveNavItems(
|
||||
s.getSystemNavItems(),
|
||||
NavContext{
|
||||
Path: currentPath,
|
||||
},
|
||||
),
|
||||
"Path": currentPath,
|
||||
"Breadcrumbs": buildBreadcrumbs(currentPath),
|
||||
"Entries": entries,
|
||||
},
|
||||
)
|
||||
}
|
||||
Reference in new issue
Block a user