Files
Anya Tokugawa c1175d389f Implement Knowledge City platform, organizer and DAV integration
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.
2026-09-27 14:44:43 +09:00

72 lines
871 B
Go

package server
import (
"net/http"
)
type ExplorerNode struct {
Path string
Children []ExplorerNode
}
func (s *Server) buildExplorerTree(
domainUUID string,
path string,
depth int,
) []ExplorerNode {
if depth > 4 {
return nil
}
children, err :=
s.store.ListChildrenInDomain(domainUUID, path)
if err != nil {
return nil
}
var out []ExplorerNode
for _, child := range children {
node := ExplorerNode{
Path: child,
}
node.Children =
s.buildExplorerTree(
domainUUID,
child,
depth+1,
)
out = append(out, node)
}
return out
}
func (s *Server) handleExplorer(
w http.ResponseWriter,
r *http.Request,
) {
tree :=
s.buildExplorerTree(
s.domainUUIDForRequest(r),
"/",
0,
)
s.renderWithContext(
w,
r,
"explorer.gohtml",
map[string]any{
"Title": "Explorer",
"Tree": tree,
},
)
}