impl. Kroki, compile path, and code-editor feature

This commit is contained in:
Anya Tokugawa committed 2026-06-18 00:06:16 +09:00
1 parent c1bc8f0c03
commit 94d56f9a8f
49 files changed
+40652 -389

No files matched your search

+55
View File
@@ -0,0 +1,55 @@
package server
import (
"net/http"
"strings"
)
func (s *Server) handlePlainView(
w http.ResponseWriter,
r *http.Request,
) {
path :=
strings.TrimPrefix(
r.URL.Path,
"/v/plain",
)
if path == "" {
path = "/"
}
if !strings.HasPrefix(path, "/") {
path = "/" + path
}
objectUUID, err :=
s.store.ResolvePath(
path,
)
if err != nil {
http.NotFound(w, r)
return
}
latest, err :=
s.store.GetLatestRevision(
objectUUID,
)
if err != nil {
http.Error(w, err.Error(), 500)
return
}
w.Header().Set(
"Content-Type",
"text/plain; charset=utf-8",
)
_, _ = w.Write(
[]byte(latest.Body),
)
}