add features: object based control, and GC(periodic delete) zombie object
This commit is contained in:
1 parent
6ad039c536
commit
4da7d4e42d
18 files changed
+939
-75
No files matched your search
@@ -2,22 +2,17 @@ package server
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
"strings"
|
||||
)
|
||||
|
||||
type HomeObject struct {
|
||||
UUID string
|
||||
Path string
|
||||
Kind string
|
||||
}
|
||||
|
||||
func (s *Server) handleHome(
|
||||
w http.ResponseWriter,
|
||||
r *http.Request,
|
||||
) {
|
||||
|
||||
objects, err :=
|
||||
s.store.ListObjects()
|
||||
s.store.ListRecentObjects(
|
||||
30,
|
||||
)
|
||||
|
||||
if err != nil {
|
||||
|
||||
@@ -30,46 +25,11 @@ func (s *Server) handleHome(
|
||||
return
|
||||
}
|
||||
|
||||
var semanticObjects []HomeObject
|
||||
|
||||
for _, o := range objects {
|
||||
|
||||
path := o.UUID
|
||||
|
||||
if path == "" {
|
||||
continue
|
||||
}
|
||||
|
||||
if strings.HasPrefix(
|
||||
path,
|
||||
"/system/",
|
||||
) {
|
||||
continue
|
||||
}
|
||||
|
||||
if strings.HasPrefix(
|
||||
path,
|
||||
"/o/",
|
||||
) {
|
||||
continue
|
||||
}
|
||||
|
||||
semanticObjects = append(
|
||||
semanticObjects,
|
||||
HomeObject{
|
||||
UUID: o.UUID,
|
||||
Path: path,
|
||||
Kind: o.Kind,
|
||||
},
|
||||
)
|
||||
}
|
||||
|
||||
s.render(
|
||||
w,
|
||||
"home.gohtml",
|
||||
map[string]any{
|
||||
"Title": "Pages Wiki",
|
||||
"Objects": semanticObjects,
|
||||
"Objects": objects,
|
||||
},
|
||||
)
|
||||
}
|
||||
Reference in new issue
Block a user