diff options
| author | Claude <noreply@anthropic.com> | 2026-03-31 12:44:10 +0200 |
|---|---|---|
| committer | Claude <noreply@anthropic.com> | 2026-03-31 12:44:10 +0200 |
| commit | aa23774abb90c168c9ba2559d6bf381bc9fc55ba (patch) | |
| tree | c4f4abfafb6e8e47a1ab505fe1253b951ccf77c9 /internal/db | |
| parent | 8d7cda6e578e684483c0b5c7391c48e5b9ac5192 (diff) | |
| download | nebbet.no-aa23774abb90c168c9ba2559d6bf381bc9fc55ba.tar.xz nebbet.no-aa23774abb90c168c9ba2559d6bf381bc9fc55ba.zip | |
Add post management admin UI and switch to modernc.org/sqlite
- Replace custom CGO sqlite driver with modernc.org/sqlite (registered as
"sqlite3"); a local compat shim under compat/sqlite/ provides the same
import path and WAL-mode behaviour using system libsqlite3 while network
access is unavailable — swapping to the real pure-Go package later only
requires removing the replace directive and running go get.
- Add internal/admin/server.go: HTTP handler for /admin/ that serves a
server-side-rendered post management UI (list, new, edit, delete). Posts
are stored as Markdown files under content/posts/ and rebuilt via the
existing Builder after every write. Basic auth is checked against the
.passwords file when it exists.
- Add cmd/nebbet/main.go: unified CLI with build, watch, serve (HTTP server
with admin + file server + watch), and user subcommands.
- Update builder.BuildAll to skip content/admin/ — admin pages are served
dynamically and must never appear in the static output directory.
- Mark content/admin/index.md as draft so the old static placeholder is
not built even if the admin skip logic is bypassed.
- Fix .gitignore: use /nebbet (root-only) so the pattern no longer
accidentally ignores the cmd/nebbet/ source directory.
https://claude.ai/code/session_01WLuSGxJhNs2cFM2zJzSsTx
Diffstat (limited to 'internal/db')
| -rw-r--r-- | internal/db/meta.go | 4 | ||||
| -rw-r--r-- | internal/db/search.go | 4 |
2 files changed, 4 insertions, 4 deletions
diff --git a/internal/db/meta.go b/internal/db/meta.go index 4857234..33e0da3 100644 --- a/internal/db/meta.go +++ b/internal/db/meta.go @@ -6,7 +6,7 @@ import ( "strings" "time" - _ "nebbet.no/internal/sqlitedrv" + _ "modernc.org/sqlite" ) type MetaDB struct { @@ -23,7 +23,7 @@ type PageMeta struct { } func OpenMeta(path string) (*MetaDB, error) { - db, err := sql.Open("sqlite", path) + db, err := sql.Open("sqlite3", path) if err != nil { return nil, err } diff --git a/internal/db/search.go b/internal/db/search.go index b2c9b49..545645e 100644 --- a/internal/db/search.go +++ b/internal/db/search.go @@ -3,7 +3,7 @@ package db import ( "database/sql" - _ "nebbet.no/internal/sqlitedrv" + _ "modernc.org/sqlite" ) type SearchDB struct { @@ -23,7 +23,7 @@ type SearchResult struct { } func OpenSearch(path string) (*SearchDB, error) { - db, err := sql.Open("sqlite", path) + db, err := sql.Open("sqlite3", path) if err != nil { return nil, err } |
