Skip to content

Enhance link management with folders, audits, and admin UI#3

Merged
kiyarose merged 19 commits into
mainfrom
kr/v2
May 8, 2026
Merged

Enhance link management with folders, audits, and admin UI#3
kiyarose merged 19 commits into
mainfrom
kr/v2

Conversation

@kiyarose
Copy link
Copy Markdown
Member

@kiyarose kiyarose commented May 8, 2026

This pull request introduces major improvements to Plummer, focusing on multi-domain support, enhanced data storage and migration, and a significant expansion of the user-facing HTML pages. The changes include a new host-scoped key format for links and folders, robust compatibility and migration logic for legacy data, and new or improved UI pages for errors, folders, and the home screen. Several utility and constants modules have also been added to centralize shared logic and configuration.

Multi-domain support and storage changes:

  • Migrated link and folder storage in Cloudflare KV to use host-scoped keys (link:{host}:{slug} and folder:{host}:{folderSlug}), with automatic migration and compatibility logic for legacy keys and local development environments. This enables true multi-domain/subdomain support and ensures smooth upgrades for existing installations. [1] [2]
  • Added documentation and configuration guidance for multi-domain support, including the new ALLOWED_HOSTS_JSON variable and admin UI dropdown for host selection.

New utility and constants modules:

  • Introduced src/constants.js to centralize reserved slugs, admin realm, app version, and security headers for consistent use across the codebase.
  • Added src/audit.js for audit logging, including actor extraction, audit key generation, and listing audit events with lexicographically sortable timestamps.

New and improved HTML pages:

  • Added comprehensive error and status pages (src/pages/errors.js) for password protection, expired/inactive/deleted links, not found, and misconfiguration, each with clear messaging and consistent styling.
  • Implemented a new folder listing page (src/pages/folders.js) that displays all links in a folder, with status and expiry columns, and improved UI/UX.
  • Redesigned the home page (src/pages/home.js) with a new hero section, feature cards, and a footer displaying the app version, providing a more engaging landing experience.

Note

Medium Risk
Moderate risk due to a large refactor of routing/KV persistence (new host-scoped keys with migration), plus new link lifecycle states and scheduled purging that could impact redirects or data retention if misconfigured.

Overview
Adds multi-host support by changing KV storage to host-scoped keys (link:{host}:{slug} and folder:{host}:{folderSlug}) with automatic migration/fallback logic, and enforces an allowlist via ALLOWED_HOSTS_JSON.

Overhauls the worker into modular routing/pages and expands link management: folders with optional password-protected listings, link edit/rename, active/inactive/deleted states with soft-delete + 3‑day purge (cron scheduled handler), plus an audit log stored in KV and exposed via /api/audit and shown in the admin UI.

Updates wrangler.toml/README for the new config and adds a few debug endpoints (including a FORCE_DELETE_KEY-gated hard delete) to diagnose KV key/migration issues.

Reviewed by Cursor Bugbot for commit 4c5fa03. Bugbot is set up for automated code reviews on this repo. Configure here.

Kiya Rose and others added 11 commits May 8, 2026 00:10
Implements modular worker structure plus multi-host keys/domains, editable links, inactive/soft-delete states, folder directory listings, and audit logging with scheduled purge.

Co-authored-by: Cursor <cursoragent@cursor.com>
Remove manual deletion, require inactive before scheduling purge, preserve ports in host allowlist, and add missing folder/audit management in /admin.

Co-authored-by: Cursor <cursoragent@cursor.com>
When Host includes a port (e.g. localhost:8787), fall back to no-port keys for links/folders and migrate them to the ported host key.

Co-authored-by: Cursor <cursoragent@cursor.com>
If a host-scoped key miss occurs, fall back to legacy and a scoped scan by {host,slug}, then migrate to the canonical key.

Co-authored-by: Cursor <cursoragent@cursor.com>
Use request URL host as fallback when Host header is missing to ensure host-scoped KV lookups work in wrangler dev and proxies.

Co-authored-by: Cursor <cursoragent@cursor.com>
Adds GET /api/debug/link for diagnosing host/slug KV key mismatches in local dev.

Co-authored-by: Cursor <cursoragent@cursor.com>
When x-plummer-debug: 1 is present, include computed host/key in 404 responses to diagnose KV mismatches.

Co-authored-by: Cursor <cursoragent@cursor.com>
Comment out the share.sillylittle.tech route to keep Host/origin consistent in wrangler dev, preventing host-scoped KV mismatches.

Co-authored-by: Cursor <cursoragent@cursor.com>
Redesign folders UI with a sidebar list (Default + per-domain folders) and a + button that opens a create-folder modal. Active folder filters the links table and persists per domain.

Co-authored-by: Cursor <cursoragent@cursor.com>
feat: v2.1 domains, edit, folders, audit
@kiyarose kiyarose requested a review from Copilot May 8, 2026 05:34
@kiyarose kiyarose self-assigned this May 8, 2026
@kiyarose kiyarose added the enhancement New feature or request label May 8, 2026
@github-project-automation github-project-automation Bot moved this to Planning Phase in Product Launchpad May 8, 2026
@cloudflare-workers-and-pages
Copy link
Copy Markdown

cloudflare-workers-and-pages Bot commented May 8, 2026

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
plummer d76d32b Commit Preview URL

Branch Preview URL
May 08 2026, 07:24 AM

@kiyarose
Copy link
Copy Markdown
Member Author

kiyarose commented May 8, 2026

bugbot run

Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 2 potential issues.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 4c5fa03. Configure here.

Comment thread src/audit.js
Comment thread src/router.js
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR refactors Plummer into a more modular Worker with host-scoped KV keys to support multi-domain usage, adds folders and audit logging, expands the admin UI, and introduces new shared HTML page primitives plus improved home/error pages.

Changes:

  • Migrate link/folder storage to host-scoped KV keys with compatibility/migration logic for legacy keys.
  • Add folders + public folder listing pages, and an audit log (KV-backed) surfaced in the admin UI.
  • Split routing/security/utilities into dedicated modules and add a scheduled purge for tombstoned links.

Reviewed changes

Copilot reviewed 16 out of 16 changed files in this pull request and generated 15 comments.

Show a summary per file
File Description
wrangler.toml.local.bac Adds a local template including ALLOWED_HOSTS_JSON and cron trigger.
wrangler.toml.cloud.bac Adds a production template including routing, ALLOWED_HOSTS_JSON and cron trigger.
wrangler.toml Updates base Wrangler config with ALLOWED_HOSTS_JSON and cron trigger.
src/util.js Introduces shared helpers (HTML escaping, sha256, timing-safe compare, URL validation).
src/security.js Adds Basic Auth verification and a security-header wrapper.
src/router.js New router implementing admin UI, REST API, redirects, folders, debug endpoints, and audits.
src/pages/shared.js Shared HTML wrapper, theme toggle, and global styling primitives.
src/pages/home.js Redesigned home page and adds version footer.
src/pages/folders.js Public folder listing page.
src/pages/errors.js New/expanded error/status pages (password, expired, inactive, deleted, not found, misconfigured).
src/pages/admin.js Major admin UI expansion: host selector, folders UI, audit table, edit modal, soft-delete scheduling.
src/kv.js New KV layer: host normalization, host-scoped keys, legacy compatibility/migration, listing helpers.
src/index.js Worker entrypoint now delegates to router, adds scheduled purge, applies security headers.
src/constants.js Centralizes reserved slugs, security headers, version, and realm.
src/audit.js Adds audit event storage + listing in KV, and actor extraction from request headers.
README.md Updates storage docs and adds ALLOWED_HOSTS_JSON configuration guidance.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/router.js
Comment thread src/router.js
Comment thread src/router.js
Comment thread src/router.js Outdated
Comment thread src/pages/admin.js Outdated
Comment thread src/pages/shared.js Outdated
Comment thread src/audit.js Outdated
Comment thread src/pages/admin.js Outdated
Comment thread src/kv.js
Comment thread src/audit.js Outdated
@kiyarose kiyarose moved this from Planning Phase to In progress in Product Launchpad May 8, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 16 out of 16 changed files in this pull request and generated 9 comments.

Comment thread src/pages/admin.js
Comment thread src/router.js Outdated
Comment thread src/router.js Outdated
Comment thread src/pages/admin.js Outdated
Comment thread src/index.js
Comment thread src/kv.js
Comment thread src/audit.js
Comment thread wrangler.toml.cloud.bac
Comment thread wrangler.toml.local.bac
kiyarose and others added 3 commits May 8, 2026 02:16
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
- Require admin auth for debug routes.
- Fix tombstone purge scheduling, rename action buttons, and /admin setup UX.

Co-authored-by: Cursor <cursoragent@cursor.com>
@kiyarose kiyarose merged commit c8ad80c into main May 8, 2026
1 check passed
@github-project-automation github-project-automation Bot moved this from In progress to Archived in Product Launchpad May 8, 2026
@kiyarose kiyarose deleted the kr/v2 branch May 8, 2026 07:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

Status: Archived

Development

Successfully merging this pull request may close these issues.

2 participants