Add content suggestion service for bookmark metadata extraction#30
Merged
Conversation
Add an opt-in content suggestion service that extracts page metadata (title, description, tags, favicon) from bookmark URLs. The service runs alongside the existing WebSocket signaling server on the same Fly.io instance, keeping both within the free tier. Server changes: - Refactor signaling server to HTTP+WS on same port - Add POST /api/suggest endpoint for metadata extraction - Add GET /api/health endpoint - Add metadata.js module (HTML parsing, OG tags, keyword extraction) - Update Dockerfile to include new module Client changes: - Add content-suggestion service with localStorage settings - Add useContentSuggestion React hook - Integrate "Suggest" button into BookmarkForm and InboxItem - Add Services settings page with toggle, privacy disclosure, and custom URLs for both suggestion and signaling servers - Suggestions are opt-in with explicit privacy notice on first enable https://claude.ai/code/session_01EFjPe8FV9ChZvAsgUrZ8rY
… and tests Rename: - signaling-server/ -> services/ - Package name: hypermark-signaling -> hypermark-services - Fly app: hypermark-signaling -> hypermark-services - Update vitest coverage exclude path Security hardening: - Add SSRF protection: block private/reserved IPs (RFC 1918, link-local, loopback, shared address space, IPv6) via DNS pre-resolution - Add per-IP rate limiting (default 30 req/min) with X-RateLimit headers - Add DISABLE_SUGGESTIONS=true env var for signaling-only mode - Return 403 for blocked URLs, 429 for rate limit exceeded Client fixes: - Wire up custom signaling URL from localStorage into SignalingClient (previously the Settings UI saved it but SignalingClient never read it) Tests (80 new): - services/tests/metadata.test.js: 62 tests covering title/description/tag extraction, favicon parsing, meta content helpers, SSRF IP blocking, hostname validation, entity decoding, truncation - src/services/content-suggestion.test.js: 18 tests covering toggle, URL configuration, fetch calls, error handling, health checks Documentation: - services/README.md: deployment, configuration, API reference, security details, signaling-only mode instructions https://claude.ai/code/session_01EFjPe8FV9ChZvAsgUrZ8rY
✅ Deploy Preview for hypermarkk ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
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.
Summary
This PR adds an optional content suggestion service that automatically extracts and suggests metadata (title, description, tags, favicon) when users add bookmarks. The feature is opt-in with privacy-first design: it's stateless, sends only the URL, and users can self-host or disable entirely.
Key Changes
Backend (Signaling Server)
server.jsto serve both WebSocket signaling and HTTP APIs on the same port/api/suggestendpoint for metadata extraction/api/healthendpoint for service health checksmetadata.jsmodule that extracts page metadata using only Node.js built-in APIs:<title>)/favicon.icoFrontend (React)
useContentSuggestionhook for managing suggestion state and requestscontent-suggestion.jsservice with:fetchSuggestions()andtestSuggestionService()functionsServiceConfigViewcomponent for configuring service URLs with privacy disclosureBookmarkFormto show "Suggest" button and apply suggestions to empty fieldsInboxItemto show "Suggest" button in focus mode with loading stateSettingsViewto include service configuration sectionConfiguration
.env.exampleentries forVITE_SUGGESTION_URL(optional)metadata.jsImplementation Details
https://claude.ai/code/session_01EFjPe8FV9ChZvAsgUrZ8rY