Commit Graph
9 Commits
Author SHA1 Message Date
Bkk1234 d7927d4759 build(docker): keep dev database out of the image, warn when ADMIN_TOKEN is unset
- .dockerignore: exclude data/*.sqlite*, data/backups, data/projects.migrated.json so a
  fresh container always seeds from data/projects.json (the dev DB was being baked in)
- publish.mjs: log a hint that requests through a published port are not loopback, so a
  container without ADMIN_TOKEN cannot write
- .env.example / README / AGENTS.md: document the ADMIN_TOKEN requirement for containers

Verified with docker 27.4.0: image build, PORT env (8110/8112 incl. .env), seed 6 rows,
PUT with x-admin-token, VACUUM INTO backup, SQLite on a Windows bind mount
(integrity_check ok), persistence across restart, compose up with PORT + volume override.
2026-11-23 00:39:44 +07:00
Bkk1234 0fa0406770 fix(api): report writable the same way PUT decides, return backup path
- GET /api/projects now returns writable: canWrite(req) + token_required, so the
  backoffice no longer claims it can save when ADMIN_TOKEN is set (PUT answered 403)
- PUT response exposes database + backup (forward-slash relative paths), drop the
  dead payload.backup assignment
- fail fast with a Thai hint when the database cannot be opened (permissions or
  corrupt file) instead of an unhandled stack trace
- AGENTS.md: document the two response fields
2026-11-23 00:33:30 +07:00
Bkk1234 5fb095b872 feat(storage): move project data to SQLite via node:sqlite
- server/db.mjs: schema (site + projects), transactional replace, WAL, VACUUM INTO backups (keep 10), JSON export, first-run seed from data/projects.json
- publish.mjs: read/write through the database, export mirror JSON for git/static/offline, validate duplicate project_id
- ui/data.js: read live data from /api/projects first, fall back to data/projects.json
- Dockerfile/compose/.env.example: DB_PATH, drop experimental sqlite warning flag
- docs: AGENTS.md + README describe the database layer and traps
2026-11-23 00:24:47 +07:00
Bkk1234 64d4a9e703 Revert "feat(home): link the homepage of every local project in the workspace"
This reverts commit db7724b237.
2026-11-20 14:33:15 +07:00
Bkk1234 db7724b237 feat(home): link the homepage of every local project in the workspace
- server: GET /api/local-projects scans sibling folders for index.html
  (title from <title>/<h1>, generic titles fall back to the folder name,
  sorted by newest edit) and GET /projects/<folder>/ serves that folder
- both endpoints are loopback-only; node_modules/.git/.hermes blocked and
  path traversal rejected; WORKSPACE_DIR=none disables the feature
- home: new 'โปรเจคในเครื่อง' list (2 columns >=700px) that hides itself when
  the API is absent, so the live static site never shows fake rows
- SW skips /projects/* so other projects' files are never cached; version 2026.11.19.5
- docs: README/AGENTS/DESIGN cover the endpoints, the loopback rule and the layout
2026-11-20 14:26:54 +07:00
Bkk1234 a629e67ca4 feat(admin): verify the backoffice password with PBKDF2, not plaintext compare
- ui/auth.js: derive PBKDF2-HMAC-SHA256(name:password) with a per-deploy salt
  (250k iterations) and compare against the verifier in constant time
- config/admin-credentials.json holds salt/iterations/verifier only — no password
- server/set-admin-password.mjs generates/rotates that file (CLI or hidden prompt)
- login is async now: button shows a pending state; config load errors surface in the form
- SW precaches the credentials file; version bumped to 2026.11.19.4
- docs: README/AGENTS explain rotation and the residual limits of a client-side gate
2026-11-19 11:32:48 +07:00
Bkk1234 f9dffbd132 chore: replace footer columns with a single copyright line
- footer is now '© hobbypj 2026' centred on one row; brand/note/contact columns removed
- site-level contact_email retired end to end (schema, payload, server validation,
  admin field, footer link logic); project-level contact_email untouched
- content-only change: service worker version unchanged (network-first)
2026-11-19 11:24:59 +07:00
Bkk1234 ebaefc8fb7 chore: remove SSL auto-renew notice from page
- drop the SSL note from hero meta, footer column and meta description
- footer becomes two columns; ssl_note removed from data schema, payload and server serializer
- content-only change: service worker version unchanged (network-first)
2026-11-19 01:35:33 +07:00
Bkk1234 c00bc62272 feat: hobby project landing page (PWA + SPA) with admin backoffice
- landing page: welcome hero, live search, project card grid (10 projects from owner list)
- warm brown/white theme (fastwork-inspired layout), embedded K2D Thai font
- PWA: manifest, PIL-generated icons, versioned service worker with auto-update
- backoffice at #/admin: edit name/description/url, reorder, delete, publish
- server/publish.mjs: zero-dependency static server + PUT api/projects with
  validation, JSON write, git commit and push; loopback-only unless ADMIN_TOKEN
- docs: README, DESIGN.md (color/type contract), AGENTS.md
2026-11-19 01:03:13 +07:00