Commit Graph
781 Commits
Author SHA1 Message Date
john-okeefe 891b1f3a3e refactor(profile): remove wood themes from profile settings
- Remove wood-light, wood-dark, wood-mahogany from theme dropdown
- Wood paneling is now browser-only (localStorage preference)
- Users select wood paneling from header dropdown, not profile
- Profile form only controls server-synced color themes
2026-02-24 12:58:57 -05:00
john-okeefe 9eebf6675b refactor(css): remove wood theme CSS variables
- Remove .theme-wood-light, .theme-wood-dark, .theme-wood-mahogany
- Wood paneling will use separate background utilities
2026-02-24 12:58:29 -05:00
john-okeefe 6407c2f299 refactor(tailwind): remove wood themes from safelist
- Remove theme-wood-light, theme-wood-dark, theme-wood-mahogany
- Wood themes no longer exist as color themes
2026-02-24 12:58:12 -05:00
john-okeefe 3d3af8bd92 refactor(theme): remove wood themes from core theme system
- Remove wood-light, wood-dark, wood-mahogany from ThemeType
- Remove wood theme gradient logic from applyTheme()
- Wood themes will be reimplemented as separate paneling feature
- Paneling will target dashboard bookshelf background only
2026-02-24 12:57:54 -05:00
john-okeefe 67f08ba75e docs(wood-paneling): fix line reference and build commands
- Phase 5: Change line number to structural reference (before closing brace)
- Fix all TypeScript build commands from 'npm run build' to 'npm run build:ts'
- Ensures plan aligns with actual package.json scripts
- Prevents execution failures during implementation
2026-02-24 12:55:17 -05:00
john-okeefe ee3e2147c2 docs(wood-paneling): fix JavaScript violations and add profile form updates
- Add Phase 1b to remove wood themes from profile_form.templ
- Add woodPanelingInit.ts to Phase 2 for early initialization
- Remove inline JavaScript from Phase 7, use TypeScript instead
- Update Critical Requirements to prohibit inline scripts entirely
- Update Files Summary with new files and modifications
- All changes align with PROJECT_GUIDELINES.md requirements
2026-02-24 12:35:06 -05:00
john-okeefe f2577ef96d chore: update gitignore for IDE support
- Add .zed/ to gitignore (Zed editor config)
- Add .opencode/ to gitignore (opencode tool data)
- Remove .zed/settings.json from version control
- Keeps repository clean of IDE-specific files
2026-02-24 12:01:04 -05:00
john-okeefe e8bb1496cf docs(wood-paneling): comprehensive plan update with TypeScript and documentation
- Add Implementation Principles section (critical requirements)
- Add Git Commit Strategy section (sequential commands, verification)
- Split implementation into 10 detailed phases (0-10)
- Convert all JavaScript to TypeScript (no inline scripts except simple init)
- Use CSS variable classes instead of inline styles for indicators
- Add explicit verification steps after each file edit
- Add documentation phase (Phase 9) for user-facing features
- Add final testing phase (Phase 10) with comprehensive checklist
- Preserve admin template sidebar layout instructions
- All git commits structured sequentially (no && chaining)
- Post-edit verification mandatory after each file change

Addresses issues found during analysis:
- Missing documentation updates
- Inline JavaScript should be TypeScript
- No explicit git commit structure
- Missing post-edit verification checkpoints
- Use CSS variables already defined in input.css
2026-02-24 11:55:43 -05:00
john-okeefe 9b4eee0c1f docs: add git workflow guidelines for sequential command execution 2026-02-24 10:46:30 -05:00
john-okeefe 665e2533f6 build: compile templates and JavaScript after theme fixes
- Regenerate admin_library_templ.go with admin sidebar integration
- Regenerate admin_users_templ.go with sidebar layout and theme fixes
- Regenerate bookshelf_templ.go with dynamic theme rendering
- Regenerate index_templ.go with progressive enhancement script
- Regenerate login_templ.go with progressive enhancement script
- Regenerate register_templ.go with progressive enhancement script
- Compile header.js with consolidated theme logic
2026-02-24 10:26:31 -05:00
john-okeefe 65b737ec2c fix(theme): ensure theme.js loaded before header.js
- Add theme.js script include to header template
- Fixes theme selector not working on pages using Header component
- Ensures applyTheme() is defined before changeThemeTo() calls it
2026-02-24 10:25:10 -05:00
john-okeefe 7a420ef975 refactor(theme): fix theme consistency and persistence
- Apply server-side theme rendering to authenticated pages
  - bookshelf.templ: use dynamic theme-{ user.Theme }
  - admin pages: use dynamic theme rendering
- Add progressive enhancement for public pages
  - index.templ, login.templ, register.templ: inline localStorage check
  - Prevents theme flash on page load
- Consolidate wood theme logic into theme.ts
  - Move wood gradient handling from header.ts to theme.ts
  - Apply wood themes consistently via applyTheme()
- Export applyTheme to window for use by header.ts
- Fix theme selector by adding theme.js to header template
2026-02-24 10:25:06 -05:00
john-okeefe 4be69861bd refactor(admin): integrate reusable sidebar into admin pages
- Update admin.templ to use @AdminSidebar component
- Update admin_library.templ to use @AdminSidebar component
- Update admin_users.templ to use @AdminSidebar component
- Add sidebar layout wrapper to admin_users.templ (previously missing)
- Fix theme rendering to use user.Theme in all admin templates
- Remove duplicated sidebar markup across admin pages
2026-02-24 10:24:50 -05:00
john-okeefe 3b0fee4281 feat(frontend): add reusable admin sidebar component
- Create AdminSidebar component for admin panel navigation
- Support active state highlighting based on currentPath
- Consistent navigation across all admin pages
- Replaces duplicated sidebar markup in admin templates
2026-02-24 10:24:21 -05:00
john-okeefe 79d10b5b37 docs: add theme fix and admin sidebar implementation plans
- Add THEME_FIX_PLAN.md: comprehensive plan for theme system consistency
- Add ADMIN_SIDEBAR_PLAN.md: reusable admin sidebar component plan
- Add WOOD_PANELING_PLAN.md: wood paneling and full-width layout plan
2026-02-24 10:24:05 -05:00
john-okeefe 97d22687ed docs(theme): add comprehensive theme system consistency fix plan
- Document root cause of theme flashing issue
- Detail implementation plan for server-side theme rendering
- Include testing checklist and rollback strategy
- Cover wood theme gradient persistence fix
2026-02-24 08:05:04 -05:00
john-okeefe e16c277caa docs: remove completed admin library implementation plan
-- Delete ADMIN_LIBRARY_IMPROVEMENTS_PLAN.md
-- All features from the plan have been implemented
-- Plan is no longer needed as reference
2026-02-23 20:24:20 -05:00
john-okeefe e68a53651a refactor(devops): reorganize rebuild targets for clarity
-- Rename 'build' to 'rebuild' for clarity (rebuilds all containers)
-- Rename 'build-force' to 'rebuild-force' for consistency
-- Add 'rebuild-app-force' target for app-only rebuild without cache
-- Add 'rebuild-force-db' target that DELETES database for clean rebuild
-- Improve help text to clarify what each target does
-- Remove circular dependency (rebuild no longer depends on clean)
-- All rebuild targets now preserve database unless explicitly stated
2026-02-23 20:24:16 -05:00
john-okeefe e7f30a00c0 style(templates): fix code formatting with consistent indentation
-- Reformat all generated template Go files with consistent indentation
-- Standardize code style across templates/
-- No functional changes, formatting only
-- Generated by templ tool during development
2026-02-23 20:24:10 -05:00
john-okeefe 85ba3d4060 feat(frontend): add delete confirmation modal for library management
-- Add dedicated delete confirmation modal to admin/library page
-- Refactor deleteLibrary() to use modal instead of inline confirm()
-- Add showDeleteModal(), hideDeleteModal(), confirmDeleteLibrary() functions
-- Modal displays clear warning about what gets deleted
-- Improves UX by making the confirmation dialog more prominent and informative
2026-02-23 20:23:56 -05:00
john-okeefe be49bc13a7 test(bruno): add manual API contract test for folder browsing
- Create bruno/library/browse-folders.yml
- Single manual test case for admin context
- Unit/integration tests cover all scenarios (no auth, user, admin)
- Bruno provides quick manual API contract verification

Fixes: Issue 2 (manual testing)
2026-02-23 17:03:49 -05:00
john-okeefe f91b1bf54b docs(api): document library folder browsing endpoint
- Add docs/developer/api/libraries/browse-folders.md
- Document security features (path traversal protection, admin-only)
- Include usage examples and error responses
- Clarify browses server filesystem, not client's

docs(user): add admin library folder browser documentation

- Add docs/user/admin-library-management.md
- Document how to use the folder browser UI
- Include security notes and manual entry instructions
- Explain server filesystem browsing behavior

Fixes: Issue 2 (documentation)
2026-02-23 17:03:35 -05:00
john-okeefe 22e10fa460 test(backend): add unit and integration tests for folder browsing
- Add unit tests in internal/services/library_service_test.go
  - Test path traversal protection
  - Test non-existent path handling
  - Test file vs directory validation
  - Test successful directory listing
- Add integration tests in cmd/server/tests/library_browse_test.go
  - Use setupTestServer() helper from test_helpers.go
  - Test no authentication returns 401
  - Test regular user returns 403 forbidden
  - Test admin can browse directories
  - Test path traversal blocking
- All tests use table-driven approach with t.Run()

Fixes: Issue 2 (tests)
2026-02-23 17:03:03 -05:00
john-okeefe 2af035d87f feat(backend): add server-side directory browsing API
- Add BrowseDirectories() to library service with path traversal protection
- Add BrowseDirectories handler with proper error handling
- Register GET /api/libraries/browse endpoint (admin-only)
- Returns current path, parent path, and list of subdirectories
- Security: blocks "..", validates path exists, checks is directory

Fixes: Issue 2 (backend)
2026-02-23 17:02:52 -05:00
john-okeefe c333c82c6b fix(frontend): add data parameter support to apiDelete
- Add optional data parameter to apiDelete() with generic type safety
- Enables DELETE requests with request bodies (needed for folder deletion)
- 100% backward compatible (optional parameter)
- Supports type-safe request body passing

Part of: Issue 1
2026-02-23 17:02:35 -05:00
john-okeefe 509423b46e feat(frontend): implement library edit functionality
- Reuse Create Library modal for edit mode
- Add hidden library-id input to track create vs edit
- Update handleCreateLibrarySubmit to detect mode and use PUT vs POST
- Implement editLibrary() to populate modal with existing data
- Pass library data to Edit button via data attributes
- Reset modal title when opening for create mode

Fixes: Issue 3
2026-02-23 17:02:01 -05:00
john-okeefe a137d3ea76 docs: add admin library page improvements implementation plan
- Document 4 improvements to /admin/library page
- Issue 1: Fix folder list display bugs (toggle logic, DELETE request body)
- Issue 2: Add server-side folder browser with full-stack implementation
- Issue 3: Implement edit library functionality
- Issue 4: Clarify delete confirmation message

Key changes:
- Add os import for BrowseDirectories service function
- Use event delegation pattern for folder browser UI
- Add DeleteFolderRequest interface for type safety
- Include comprehensive testing strategy (unit, integration, Bruno)
- Follow PROJECT_GUIDELINES.md throughout
- Procedural/imperative style, no OOP
- Progressive enhancement maintained
2026-02-23 16:12:25 -05:00
john-okeefe ce50312e1b feat(frontend): Add TypeScript for admin library page
Add web/src/library.ts with complete functionality for /admin/library
page interactivity.

Features:
- reloadLibraries() - fetch and render library list after changes
- renderLibraries() - SSR replacement with proper data.data handling
- loadUserVisibility() - load and display user library permissions
- setLibraryVisibility() - toggle library visibility for users
- handleCreateLibrarySubmit() - form submission with fetch API
- deleteLibrary() - delete with confirmation
- showLibraryFolders() - folder management
- addLibraryFolder() / removeLibraryFolder() - folder CRUD
- editLibrary() - placeholder for future implementation
- Modal controls (show/hide)
- Event delegation for dynamic buttons
- XSS protection with escapeHtmlLocal()

TypeScript Features:
- Proper type definitions (Library, User, LibraryFolder)
- Async/await with error handling
- Procedural style (no OOP, per PROJECT_GUIDELINES)
- Exports functions to window for global access

Bug Fixes:
- Fixed data.data API response handling
- Replaced broken HTMX form with fetch()
- Proper error messages with toast notifications

Lines: 394
2026-02-22 21:07:06 -05:00
john-okeefe f39cf3904d fix(frontend): Remove ES6 exports from api.ts
Remove ES6 export statement from api.ts that was causing CommonJS
compilation in browsers, breaking window.api initialization.

Issue: TypeScript compiled 'export { ... }' to CommonJS format
(exports.apiGet = ...), which browsers don't support.

Fix: Remove export statement, rely on existing window.api assignment.
This produces browser-compatible JavaScript.

Before: export { getAuthHeader, apiGet, ... } → CommonJS exports
After: (window as any).api = { ... } → browser global

Resolves: 'Uncaught ReferenceError: exports is not defined'
Resolves: 'Uncaught TypeError: window.api is undefined'
2026-02-22 21:06:47 -05:00
john-okeefe 638f1a901d feat(frontend): Convert admin library to SSR with TypeScript
Complete refactor of /admin/library page to use server-side rendering
and TypeScript, fixing broken Create Library button and improving UX.

Backend Integration:
- Update template signature to accept libraries and users parameters
- Add SSR rendering of library list (no empty state)
- Add SSR rendering of user select dropdown
- Data fetched in router handler and passed to template

TypeScript Conversion:
- Create web/src/library.ts (394 lines) - complete rewrite of inline JS
- Convert all inline JavaScript to TypeScript
- Fix critical data.data API response bug
- Replace broken HTMX form with fetch() API calls
- Implement event delegation for dynamic button clicks
- Add missing editLibrary() function (placeholder)
- Add proper error handling with toast notifications

Template Changes:
- Remove 229 lines of inline JavaScript
- Update Create Library button: onclick → data-action
- Update form: remove HTMX attributes, add onsubmit handler
- Remove duplicate script tags from <head> section
- Keep all script loading at end of <body> for performance

Bug Fixes:
- Fix API response handling: data → data.data
- Replace broken hx-headers (JavaScript not supported in HTMX)
- Fix modal z-index and visibility classes

Progressive Enhancement:
- Page works without JavaScript (SSR content visible)
- JavaScript enhances with interactive features
- Follows PROJECT_GUIDELINES: procedural style, no OOP
2026-02-22 21:06:36 -05:00
john-okeefe f096b86032 feat(router): SSR libraries and users on /admin/library page
Update the /admin/library route handler to fetch and pass data to
template for server-side rendering, improving page load performance.

Changes:
- Fetch all libraries using ListLibrariesData() helper
- Fetch all users for visibility management
- Convert database rows to template types (LibraryData, User)
- Pass data to AdminLibrary template for SSR
- Follows existing pattern from dashboard and custom-section pages

Benefits:
- Faster initial page load (no AJAX fetch)
- Better UX (content visible immediately)
- Progressive enhancement (works without JS)
2026-02-22 21:06:20 -05:00
john-okeefe 3174ec16bc feat(backend): Add SSR data helper for admin library page
Add ListLibrariesData() method to LibraryHandler to support
server-side rendering of all libraries on the /admin/library page.

This follows the existing pattern of GetUserVisibleLibrariesData() and
GetLibraryTypeData() methods, which return data structures instead of
JSON for template rendering.

Changes:
- Add ListLibrariesData() method (3 lines)
- Returns []database.ListLibrariesRow for template consumption
- Called by frontend route handler for SSR
2026-02-22 21:05:57 -05:00
john-okeefe f7e1eab31d refactor(templates): fix admin sidebar navigation link
Update admin dashboard sidebar to point to user administration page
instead of profile settings:
- Change link from /profile to /admin/users
- Update label from 'Profile Settings' to 'User Administration'

This completes the admin navigation refactoring to use dedicated
admin pages instead of the main user profile page.
2026-02-22 19:48:50 -05:00
john-okeefe cb04dbb542 fix(devops): force container recreation on rebuild to ensure template changes appear
Add --force-recreate flag to all build targets that create containers:
- build: Force recreation when building all containers
- rebuild-app: Force recreation of app container only (fixes template update issue)
- build-force: Force recreation even when using --no-cache
- test-env-up: Force recreation in test environment

This fixes a critical issue where 'make rebuild-app' would build a new image
but continue running the old container, causing template changes to not appear.

Root cause: podman-compose up --build doesn't recreate containers if they're
already running, even when a new image is built. The --force-recreate flag
ensures containers are recreated with the new image.

BuildKit caching still works as expected - cache is used during image build,
while --force-recreate ensures the new image is actually deployed.

Changes:
- build: Add --force-recreate flag
- rebuild-app: Add --force-recreate flag, update success message
- build-force: Add --force-recreate flag
- test-env-up: Add --force-recreate flag

Verified: Template changes now appear immediately after rebuild.
2026-02-22 19:48:36 -05:00
john-okeefe 37cb279a15 chore(templates): regenerate Go code after template changes
Run templ generate to update *_templ.go files after admin header
refactoring and template signature changes.
2026-02-22 19:06:32 -05:00
john-okeefe fd08e8c613 fix(router): update AdminUsers call to match new signature
Fix function call to pass currentUser as first parameter instead of
templateUsers, matching the refactored AdminUsers template signature.
2026-02-22 19:06:29 -05:00
john-okeefe 844910a54b refactor(templates): complete admin header extraction
- Add theme.js to admin_users page for proper theme support
- Pass currentUser to Header instead of hardcoded Admin user
- Fix currentUserID reference bug (use currentUser.ID)
- Remove duplicate theme loading script (now in Header)
- Complete header refactoring for admin_users page
2026-02-22 19:06:18 -05:00
john-okeefe d4d93bc0e3 feat(auth): add interactive password requirements validation to registration
- Add password requirements checklist with visual indicators (✓/○)
- Implement real-time validation for length, case, numbers, special chars
- Add confirm password field with matching validation
- Disable submit button until all requirements are met
- Add TypeScript client-side validation with password manager compatibility
2026-02-22 18:40:22 -05:00
john-okeefe d28aa5af4b refactor(templates): extract shared header from admin pages
- Replace inline nav code with @Header component in admin.templ
- Replace inline nav code with @Header component in admin_library.templ
- DRY up navigation, theme switcher, and user menu across admin pages
2026-02-22 18:40:18 -05:00
john-okeefe 55440e0dc8 feat(devops): improve Docker build caching and add dev workflow targets
- Optimize Dockerfile layer caching with --mount=type=cache for Go modules and npm
- Reorganize Dockerfile layers for better cache hit rates
- Improve .dockerignore organization with categorized comments
- Add Makefile targets: up, down, rebuild-app, restart, ps
- Enhance Makefile help output with categorized sections
2026-02-22 18:40:16 -05:00
john-okeefe 48937e9777 feat(auth): improve registration form theming and add name fields
- Add theme.js script for proper theme support
- Update form to use CSS variables (--bg-primary, --text-secondary, etc.)
- Replace hardcoded colors with theming system
- Add optional first_name and last_name fields
- Update button to use .btn-primary class
- All form inputs now properly themed
2026-02-22 16:51:27 -05:00
john-okeefe 807d7b36ef refactor: update sevenzip import to use vendored package
Updated import path from github.com/bodgit/sevenzip to
bookhoard/internal/sevenzip to use the vendored package.
2026-02-22 16:29:28 -05:00
john-okeefe 82efb0d635 chore: remove go4.org dependency and associated telemetry packages
Removed go4.org and its transitive dependencies from go.mod and go.sum:
- go4.org (unused dependency)
- google.golang.org/api/* packages
- google.golang.org/genproto/* packages
- cloud.google.com/go/* packages
- gocloud.dev/* packages

Total reduction: ~4.9 MB of unnecessary telemetry dependencies.
All functionality preserved through vendored sevenzip package.
2026-02-22 16:29:25 -05:00
john-okeefe 46ae45ee92 feat: vendor bodgit/sevenzip package to remove go4.org dependency
Vendored the sevenzip package to eliminate dependency chain:
- sevenzip -> go4.org -> 25+ Google/Cloud/telemetry packages

Changes:
- Added internal/sevenzip/ with full package source
- Inlined go4.org/readerutil into multireaderat.go
- Updated all internal imports to use bookhoard/internal/sevenzip
- Preserved .cb7 comic archive support

This reduces bloat by ~4.9 MB and removes unused telemetry
dependencies while maintaining all functionality.
2026-02-22 16:29:21 -05:00
john-okeefe c6cf038c8e chore(deps): upgrade @tailwindcss/forms to v0.5.11
- Upgrade @tailwindcss/forms from 0.5.7 to 0.5.11 (latest)
- Regenerate minified CSS with new forms plugin
- Build and tests passing
2026-02-22 13:32:51 -05:00
john-okeefe 94e179d9bf removed finished plans
- Carousel has been implemented and tested
- API Consolidation has been implemented and tested
2026-02-22 13:18:03 -05:00
john-okeefe 87e28d18ff chore(deps): upgrade indirect dependencies
Upgrades indirect dependencies:
- davecgh/go-spew: v1.1.1 → v1.1.2
- kr/pretty: v0.3.0 → v0.3.1
- pmezard/go-difflib: v1.0.0 → v1.0.1
- stretchr/objx: v0.5.2 → v0.5.3
- xyproto/randomstring: v1.0.5 → v1.2.0

Also upgrades related cloud, opentelemetry, and grpc
dependencies to their latest compatible versions.

Build and all tests passing.
2026-02-22 13:13:43 -05:00
john-okeefe 9e420b63ad chore(deps): upgrade core dependencies
- pgx/v5: v5.4.3 → v5.8.0
- golang-jwt/jwt/v5: v5.3.0 → v5.3.1
- echo/v4: v4.13.4 → v4.15.1
- google/uuid: v1.4.0 → v1.6.0
- golang.org/x/crypto: v0.46.0 → v0.48.0
- golang.org/x/text: v0.33.0 → v0.34.0

Also updates indirect dependencies including puddle/v2, brotli,
regexp2, and other transitive deps.

Build and tests passing with pgx v5.8.0 (internal/anynil package
removed but not used by our code).
2026-02-22 13:11:06 -05:00
john-okeefe 31e286a14b fix(handlers): check user existence before deletion in DeleteUser
Add explicit check to verify target user exists in database before
attempting deletion. Previously, the handler would return 200 OK when
trying to delete non-existent users.

Changes:
- Add userFound flag to track if target user was found in user list
- Explicitly check pgtype.UUID.Bytes against all users' IDs
- Return 404 Not Found if user doesn't exist (before last admin check)
- Supports both JSON and HTML (HTMX) response formats

This fixes the failing test:
- TestDeleteUserConsolidated/DELETE_/api/auth/profile/:id_-_Delete_non-existent_user

The check uses the existing ListUsers result, so no additional database
query is required. The pgtype.UUID.Bytes comparison ensures exact
16-byte UUID matching.
2026-02-22 12:17:50 -05:00
john-okeefe 19e389f966 test: fix password mismatch test to use valid complex passwords
The test was using simple passwords ('password1', 'password2') that
failed complexity validation before the mismatch check could run.

Changed to use valid complex passwords that don't match:
- new_password: 'NewPassword123!'
- confirm_password: 'DifferentPass123!'

This properly tests the mismatch validation path. All 4 subtests in
TestUpdatePasswordAdminMode now pass.
2026-02-22 11:43:42 -05:00