add features: object based control, and GC(periodic delete) zombie object

This commit is contained in:
Anya Tokugawa committed 2026-05-31 20:07:37 +09:00
1 parent 6ad039c536
commit 4da7d4e42d
18 files changed
+939 -75

No files matched your search

+88 -27
View File
@@ -44,7 +44,7 @@ Draft
<main class="container">
<section class="card">
<section>
<h1>Pages Wiki</h1>
@@ -70,35 +70,70 @@ Create / Edit
</div>
<p class="hint">
Examples:
</p>
<ul>
<li>/pageswiki/network/bgp</li>
<li>/notes/todo</li>
<li>/dc/cooling</li>
</ul>
</section>
<section class="card">
<section>
<h2>Recent Objects</h2>
<ul class="object-list">
<table class="recent-table">
<thead>
<tr>
<th>Primary Link</th>
<th>Size</th>
<th>Updated</th>
<th>Object UUID</th>
</tr>
</thead>
<tbody>
{{ range .Objects }}
<li>
<a href="/e/{{ .UUID }}">
{{ .UUID }}
<tr>
<td>
{{ if .Path }}
<a href="{{ .Path }}">
{{ .Path }}
</a>
</li>
{{ else }}
<span class="muted">
unlinked
</span>
{{ end }}
</ul>
</td>
<td class="mono">
{{ formatBytes .Size }}
</td>
<td class="mono">
{{ formatUnix .UpdatedAt }}
</td>
<td class="mono muted">
<a href="/o/uuid:{{ .UUID }}">
{{ .UUID }}
</a>
</td>
</tr>
{{ end }}
</tbody>
</table>
</section>
@@ -160,6 +195,14 @@ document
<style>
main.container {
padding: 1.25rem;
}
section {
margin-bottom: 2rem;
}
.create-path-box {
display: flex;
gap: 0.5rem;
@@ -168,9 +211,9 @@ document
.create-path-box input {
flex: 1;
background: #111;
background: #0b0b0b;
color: #eee;
border: 1px solid #333;
border: 1px solid #222;
padding: 0.6rem;
font-family: monospace;
}
@@ -179,18 +222,36 @@ document
padding: 0.6rem 1rem;
}
.hint {
margin-top: 1rem;
.recent-table {
width: 100%;
border-collapse: collapse;
}
.recent-table th {
text-align: left;
font-weight: normal;
color: #888;
border-bottom: 1px solid rgba(255,255,255,0.08);
padding: 0.45rem 0.35rem;
}
.object-list {
margin: 0;
padding-left: 1.2rem;
.recent-table td {
border-bottom: 1px solid rgba(255,255,255,0.035);
padding: 0.38rem 0.35rem;
}
.object-list li {
margin: 0.2rem 0;
.recent-table tr:hover {
background: rgba(255,255,255,0.025);
}
.mono {
font-family:
"JetBrains Mono",
monospace;
}
.muted {
color: #777;
}
</style>
+79
View File
@@ -0,0 +1,79 @@
{{ define "object_editor.gohtml" }}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>{{ .Title }}</title>
<link rel="stylesheet" href="/o/path:/system/static/css/main.css">
<link rel="stylesheet" href="/o/path:/system/static/css/modes.css">
</head>
<body class="mode-editor">
<header class="topbar">
<div class="brand">
<a href="/">Pages Wiki</a>
</div>
<nav>
<a href="/o/{{ .ObjectURI }}">View</a>
<a href="/o/r/{{ .ObjectURI }}">History</a>
<a href="/l?object_uuid={{ .ObjectUUID }}">Link</a>
</nav>
</header>
<main class="container">
<section>
<div class="path-label">
Object:
<code>{{ .ObjectURI }}</code>
</div>
<div class="editor-toolbar">
<button
type="button"
onclick="PagesEditor.saveNow()"
>
Save
</button>
</div>
<div class="editor-grid">
<textarea
id="editor"
class="editor"
>{{ .Body }}</textarea>
<article
id="preview"
class="preview"
></article>
</div>
<input
type="hidden"
id="object-uuid"
value="{{ .ObjectUUID }}"
>
<input
type="hidden"
id="edit-type"
value="html"
>
</section>
</main>
<script src="/o/path:/system/static/js/editor.js"></script>
</body>
</html>
{{ end }}
+71
View File
@@ -0,0 +1,71 @@
{{ define "object_view.gohtml" }}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>{{ .Title }}</title>
<link rel="stylesheet" href="/o/path:/system/static/css/main.css">
<link rel="stylesheet" href="/o/path:/system/static/css/modes.css">
</head>
<body>
<header class="topbar">
<div class="brand">
<a href="/">Pages Wiki</a>
</div>
<nav>
<a href="/o/e/{{ .ObjectURI }}">Edit</a>
<a href="/o/r/{{ .ObjectURI }}">History</a>
<a href="/l?object_uuid={{ .ObjectUUID }}">Link</a>
<a href="#" onclick="deleteObject('{{ .ObjectUUID }}'); return false;">Delete</a>
</nav>
</header>
<main class="container">
<section>
<div class="path-label">
Object:
<code>{{ .ObjectURI }}</code>
</div>
<article class="page-html">
{{ .RenderedHTML }}
</article>
</section>
</main>
<script>
async function deleteObject(uuid) {
if (!confirm("Delete object?\n\n" + uuid)) {
return
}
const res = await fetch(
"/_/api/v1/object/delete",
{
method: "POST",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify({
object_uuid: uuid,
}),
},
)
if (!res.ok) {
alert("delete failed")
return
}
location.href = "/"
}
</script>
</body>
</html>
{{ end }}