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, }, ) }