Koreader plugin fixes#52
Open
vanadium23 wants to merge 73 commits intomainfrom
Open
Conversation
- Add HighlightRepo interface with Store and GetByDocumentID methods - Add Highlight interface with Sync (returns count) and Fetch methods - Include mockgen directive for automatic mock generation - Also create entity.Highlight struct as dependency (blocking issue fix) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Add comprehensive tests for all Highlight struct fields - Verify JSON tags match KOReader field names (text, note, page, chapter, time, drawer, color, device, device_id) - Verify AuthDeviceName and HighlightHash are excluded from JSON serialization Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Create highlight_annotations table with UUID primary key - Store all KOReader highlight fields (text, note, page, chapter, drawer, color) - Track device info (koreader_device, koreader_device_id, auth_device_name) - Add unique constraint on (koreader_partial_md5, highlight_hash) for deduplication - Add indexes for document lookup and time-based queries Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…ation - Add HighlightSyncUseCase with Sync and Fetch methods - Generate MD5 hash from text:page:timestamp for deduplication - Continue on Store errors (idempotent for duplicates) - Add unit tests with mocked repository Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…deduplication - Add HighlightDatabaseRepo with Store and GetByDocumentID methods - Use ON CONFLICT DO NOTHING for idempotent highlight storage - Store all highlight fields including metadata (drawer, color, chapter) - Order highlights by highlight_time on retrieval - Add unit tests with pgxmock for repository operations Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Add highlightRoutes struct with Highlight interface and logger - Add newHighlightRoutes constructor with POST /highlights and GET /highlights/:document - Add highlightSyncRequest struct for JSON binding with document, title, author, highlights - Implement syncHighlights handler with device authentication via context - Implement fetchHighlights handler to retrieve highlights by document - Return synced/total counts on successful sync (API-04) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Add highlight package import - Update NewRouter signature to accept highlight.Highlight parameter - Register highlight routes under /syncs with authDeviceMiddleware (API-03) - Route POST /highlights and GET /highlights/:document through newHighlightRoutes Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Add highlight package import - Create highlightSync use case with HighlightDatabaseRepo - Pass highlightSync to v1.NewRouter for route registration Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- SUMMARY.md created with execution results - STATE.md updated with position, decisions, metrics - ROADMAP.md updated with plan progress - REQUIREMENTS.md updated with completed requirements Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Phase 2: Web UI research for displaying highlights on book detail page. - Analyzed existing code patterns (books.go, router.go, book.html) - Documented extension pattern following stats implementation - Identified all code changes needed (3 files: books.go, router.go, book.html) - Mapped requirements to implementation approaches Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Define visual and interaction contract for Phase 2 Web UI: - Spacing scale (multiples of 4px) - Typography conventions (inherit from existing) - Color contract (CSS variables) - Copywriting for empty state - Component inventory for highlights section - Accessibility requirements Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Create 3 parallel execution plans for Web UI phase: - 02-01: Wire highlight dependency through router and fetch highlights - 02-02: Add highlights template section to book.html - 02-03: Add CSS styling for highlights All plans in Wave 1 (independent, can run parallel). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Add .highlights-section with margin-top: 2rem, padding: 1rem - Add .highlight-card with left border, padding-left, margin-bottom - Add .highlight-text with font-style: italic - Add .highlight-note with muted color using var(--text-color-alt) - Add .highlight-meta with font-size: 0.875rem and muted color Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Add highlights section after reading stats in book.html - Display highlight text, note (optional), page/chapter (optional) - Include empty state message when no highlights synced - Read-only display with semantic HTML (section, article, blockquote) - Follows existing template patterns (hgroup with h3 heading) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Add highlight.Highlight field to booksRoutes struct - Update newBooksRoutes constructor to accept highlight parameter - Fetch highlights in viewBook handler using Fetch method - Pass highlights to book template for display Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Add highlight package import - Update NewRouter signature to accept highlight.Highlight - Pass highlight to newBooksRoutes call Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Add notes.go with GET/POST/PUT handlers for /notes endpoints - Add notes_test.go with integration tests for Notes API - Implement notesBasicAuth middleware using device credentials - NoteResponse struct matches Nextcloud Notes API format - Handlers use notes.FormatHighlights for content formatting
Add Phase 4 planning for KOReader Lua plugin that exports highlights to Kompanion's /syncs/highlights API endpoint. - Create single plan with 3 tasks: _meta.lua, target.lua, main.lua - Plugin uses Provider system to integrate with exporter.koplugin - Implements Basic Auth with device credentials - Uses BaseExporter's makeJsonRequest for HTTP calls Requirements: LUA-01, LUA-02, LUA-03, LUA-04 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Create kompanion.koplugin directory structure - Add _meta.lua with plugin name, fullname, and description - KOReader will use this for plugin discovery Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Inherit from BaseExporter with name="kompanion" and is_remote=true - Implement isReadyToExport() checking url and device_password only - Implement getMenuTable() with Setup, Enable toggle, and Help - Implement showSetupDialog() with exactly 2 fields (D-06 compliance): * Server URL * Device Password (password field) - Device name read automatically from G_reader_settings (D-06) - Implement createRequestBody() matching Kompanion API format - Implement export() with POST to /syncs/highlights endpoint - Use Basic Auth with device_id:device_password - Show success toast with synced count from response (D-13) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Create main.lua with Provider:register call - Registers "kompanion" as exporter target - Makes Kompanion appear in "Export highlights" menu Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Created koreader/kompanion.koplugin with 3 files - D-06 compliance: automatic device name from G_reader_settings - D-13 compliance: success toast shows synced count - All tasks committed atomically Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Allow users to configure device name manually instead of reading it automatically from KOReader settings. This gives flexibility to use a different device name than the one configured in KOReader. Setup dialog now has 3 fields: - Server URL - Device Name (new) - Device Password Co-Authored-By: Claude <noreply@anthropic.com>
…ight extraction Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…r plugin Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- WidgetContainer-based plugin (not BaseExporter) - Direct highlight extraction from DocSettings - Tools menu integration (not Export highlights submenu) - Support for both annotations and legacy formats
- Change fullname to "Kompanion Highlights" for Tools menu - Update description to reflect direct sync capability - Replaces Phase 4 exporter-based approach Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Use WidgetContainer base class (not BaseExporter) for Tools menu integration - Add Setup dialog for URL, Device Name, Device Password configuration - Implement highlight extraction for both new (annotations) and legacy (highlight+bookmarks) formats - Add HTTP POST to /syncs/highlights with Basic Auth - Show success/error toasts with synced count from API response - Support network wait via NetworkMgr:willRerunWhenOnline - Persist settings in G_reader_settings Replaces Phase 4 Provider-based approach which proved unreliable. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The target.lua file was part of the broken Provider-based approach. Phase 5 uses WidgetContainer directly in main.lua instead. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Create SUMMARY.md with full execution details - Update ROADMAP.md marking Phase 5 complete - Mark Phase 4 as deprecated (replaced by Phase 5) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
KOReader sync API uses custom headers (x-auth-user, x-auth-key with MD5 hash) instead of HTTP Basic Auth. Also adds: - sorting_hint for Tools menu placement - pcall wrapper for HTTP requests - Defensive nil checks for settings
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.