aboutsummaryrefslogtreecommitdiffstats
path: root/packages/trpc/routers/bookmarks.ts (follow)
Commit message (Collapse)AuthorAgeFilesLines
* fix: remove queue triggers outside of updateTags transactionMohamed Bassem2025-12-071-15/+19
|
* fix: lazy load js-tiktoken in prompts module (#2176)Mohamed Bassem2025-11-281-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * feat: lazy load tiktoken to reduce memory footprint The js-tiktoken module loads a large encoding dictionary into memory immediately on import. This change defers the loading of the encoding until it's actually needed by using a lazy getter pattern. This reduces memory usage for processes that import this module but don't actually use the token encoding functions. * fix: use createRequire for lazy tiktoken import in ES module The previous implementation used bare require() which fails at runtime in ES modules (ReferenceError: require is not defined). This fixes it by using createRequire from Node's 'module' package, which creates a require function that works in ES module contexts. * refactor: convert tiktoken lazy loading to async dynamic imports Changed from createRequire to async import() for lazy loading tiktoken, making buildTextPrompt and buildSummaryPrompt async. This is cleaner for ES modules and properly defers the large tiktoken encoding data until it's actually needed. Updated all callers to await these async functions: - packages/trpc/routers/bookmarks.ts - apps/workers/workers/inference/tagging.ts - apps/workers/workers/inference/summarize.ts - apps/web/components/settings/AISettings.tsx (converted to useEffect) * feat: add untruncated prompt builders for UI previews Added buildTextPromptUntruncated and buildSummaryPromptUntruncated functions that don't require token counting or truncation. These are synchronous and don't load tiktoken, making them perfect for UI previews where exact token limits aren't needed. Updated AISettings.tsx to use these untruncated versions, eliminating the need for useEffect/useState and avoiding unnecessary tiktoken loading in the browser. * fix * fix --------- Co-authored-by: Claude <noreply@anthropic.com>
* fix: Propagate group ids in queue calls (#2177)Mohamed Bassem2025-11-271-12/+34
| | | | | * fix: Propagate group ids * fix tests
* feat: Add collaborative lists (#2146)Mohamed Bassem2025-11-171-246/+52
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * feat: Add collaborative lists backend implementation This commit implements the core backend functionality for collaborative lists, allowing multiple users to share and interact with bookmark lists. Database changes: - Add listCollaborators table to track users with access to lists and their roles (viewer/editor) - Add addedBy field to bookmarksInLists to track who added bookmarks - Add relations for collaborative list functionality Access control updates: - Update List model to support role-based access (owner/editor/viewer) - Add methods to check and enforce permissions for list operations - Update Bookmark model to allow access through collaborative lists - Modify bookmark queries to include bookmarks from collaborative lists List collaboration features: - Add/remove/update collaborators - Get list of collaborators - Get lists shared with current user - Only manual lists can have collaborators tRPC procedures: - addCollaborator: Add a user as a collaborator to a list - removeCollaborator: Remove a collaborator from a list - updateCollaboratorRole: Change a collaborator's role - getCollaborators: Get all collaborators for a list - getSharedWithMe: Get all lists shared with the current user - cloneBookmark: Clone a bookmark to the current user's collection Implementation notes: - Editors can add/remove bookmarks from the list (must own the bookmark) - Viewers can only view bookmarks in the list - Only the list owner can manage collaborators and list metadata - Smart lists cannot have collaborators (only manual lists) - Users cannot edit bookmarks they don't own, even in shared lists * feat: Add collaborative lists frontend UI This commit implements the frontend user interface for collaborative lists, allowing users to view shared bookmarks and manage list collaborators. New pages: - /dashboard/shared: Shows bookmarks from lists shared with the user - Displays bookmarks from all collaborative lists - Uses SharedBookmarks component - Shows empty state when no lists are shared Navigation: - Added "Shared with you" link to sidebar with Users icon - Positioned after "Home" in main navigation - Available in both desktop and mobile sidebar Collaborator management: - ManageCollaboratorsModal component for managing list collaborators - Add collaborators by user ID with viewer/editor role - View current collaborators with their roles - Update collaborator roles inline - Remove collaborators - Shows empty state when no collaborators - Integrated into ListOptions dropdown menu - Accessible via "Manage Collaborators" menu item Components created: - SharedBookmarks.tsx: Server component fetching shared lists/bookmarks - ManageCollaboratorsModal.tsx: Client component with tRPC mutations - /dashboard/shared/page.tsx: Route for shared bookmarks page UI features: - Role selector for viewer/editor permissions - Real-time collaborator list updates - Toast notifications for success/error states - Loading states for async operations - Responsive design matching existing UI patterns Implementation notes: - Uses existing tRPC endpoints (getSharedWithMe, getCollaborators, etc.) - Follows established modal patterns from ShareListModal - Integrates seamlessly with existing list UI - Currently uses user ID for adding collaborators (email lookup TBD) * fix typecheck * add collaborator by email * add shared list in the sidebar * fix perm issue * hide UI components from non list owners * list leaving * fix shared bookmarks showing up in homepage * fix getBookmark access check * e2e tests * hide user specific fields from shared lists * simplify bookmark perm checks * disable editable fields in bookmark preview * hide lists if they don't have options * fix list ownership * fix highlights * move tests to trpc * fix alignment of leave list * make tag lists unclickable * allow editors to remove from list * add a badge for shared lists * remove bookmarks of user when they're removed from a list * fix tests * show owner in the manage collab modal * fix hasCollab * drop shared with you * i18n * beta badge * correctly invalidate caches on collab change * reduce unnecessary changes * Add ratelimits * stop manually removing bookmarks on remove * some fixes * fixes * remove unused function * improve tests --------- Co-authored-by: Claude <noreply@anthropic.com>
* feat: Add support for user uploaded files (#2100)Mohamed Bassem2025-11-081-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * feat: add user file upload support for bookmarks Add a new "user-uploaded" asset type that allows users to upload and attach their own files to bookmarks from the attachment box in the bookmark preview page. Changes: - Add USER_UPLOADED asset type to database schema - Add userUploaded to zAssetTypesSchema for type safety - Update attachment permissions to allow attaching/detaching user files - Add fileName field to asset schema for displaying custom filenames - Add "Upload File" button in AttachmentBox component - Display actual filename for user-uploaded files - Allow any file type for user uploads (respects existing upload limits) - Add Upload icon for user-uploaded files Fixes #1863 related asset attachment improvements * fix: ensure fileName is returned and remove edit button for user uploads - Fix attachAsset mutation to fetch and return complete asset with fileName instead of just returning the input (which lacks fileName) - Remove replace/edit button for user-uploaded files - users can only delete and re-upload instead - This ensures the filename displays correctly in the UI immediately after upload Fixes fileName propagation issue for user-uploaded assets * fix asset file name * remove filename from attach asset api --------- Co-authored-by: Claude <noreply@anthropic.com>
* feat: Add source field to track bookmark creation sources (#2037)Mohamed Bassem2025-10-121-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * feat: Add source field to track bookmark creation sources Add a new 'source' field to the bookmarks table to track where bookmarks were created from. Possible values: api, web, cli, mobile, singlefile, rss. Changes: - Add source field to bookmarks table schema - Update Zod schemas to include source field - Update tRPC createBookmark procedure to store source - Update all callsites to pass appropriate source value: - api: Default to "api" if not provided - singlefile: Set to "singlefile" - rss: Set to "rss" in feedWorker - cli: Set to "cli" - mobile: Set to "mobile" in all mobile app bookmark creation - browser-extension: Set to "web" - web: Set to "web" in all web app bookmark creation - Create migration file for database schema change Fixes #2036 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Mohamed Bassem <MohamedBassem@users.noreply.github.com> * feat: Add extension source type for browser extension - Add 'extension' to bookmark source enum - Update browser extension to use 'extension' instead of 'web' Co-authored-by: Mohamed Bassem <MohamedBassem@users.noreply.github.com> * fix CI * fix CI * fix the migration file * add import source * make source nullish --------- Co-authored-by: claude[bot] <41898282+claude[bot]@users.noreply.github.com> Co-authored-by: Mohamed Bassem <MohamedBassem@users.noreply.github.com>
* feat: Revamp import experience (#2001)Mohamed Bassem2025-10-041-1/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * WIP: import v2 * remove new session button * don't redirect after import * store and lint to root list * models + tests * redesign the progress * simplify the import session for ow * drop status from session schema * split the import session page * i18n * fix test * remove pagination * fix some colors in darkmode * one last fix * add privacy filter * privacy check * fix interactivity of import progress * fix test
* refactor: Move callsites to liteque to be behind a pluginMohamed Bassem2025-09-141-10/+10
|
* refactor: strongly type the search plugin interfaceMohamed Bassem2025-09-141-5/+6
|
* fix: fix tag flicker caused by tag sortingMohamed Bassem2025-09-071-4/+8
|
* refactor: Extract quota logic into its own classMohamed Bassem2025-09-061-21/+12
|
* refactor: Extract meilisearch as a pluginMohamedBassem2025-07-271-8/+7
|
* Revert "fix: Fix the types of the bookmark types in the db query"Mohamed Bassem2025-07-131-3/+3
| | | | This reverts commit 4ba3e8047a5b1f160169617187436c09e91662ec.
* fix: Fix the types of the bookmark types in the db queryMohamed Bassem2025-07-131-3/+3
|
* fix: Add ratelimiting to bookmark recrawl and summarizationMohamed Bassem2025-07-121-1/+15
|
* fix: Prioritize crawling user added links over bulk imports. fixes #1717Mohamed Bassem2025-07-121-20/+47
|
* feat: Store large html content in the asset dbMohamed Bassem2025-07-061-6/+15
|
* feat: Add per user bookmark count quotaMohamed Bassem2025-07-041-1/+24
|
* fix(tags): normalise leading hashes in tag names (#1317) (#1351)Mostafa Wahied2025-06-221-3/+6
| | | | | | | | | | | * fix(tags): normalise leading hashes in tag names (#1317) * move the transformation to zod * fix openapi spec --------- Co-authored-by: Mohamed Bassem <me@mbassem.com>
* fix: Fix webhook not firing on deletion. Fixes #1613Mohamed Bassem2025-06-211-1/+1
|
* feat: Generate RSS feeds from lists (#1507)Mohamed Bassem2025-05-311-255/+7
| | | | | | | | | | | * refactor: Move bookmark utils from shared-react to shared * Expose RSS feeds for lists * Add e2e tests * Slightly improve the look of the share dialog * allow specifying a limit in the rss endpoint
* feat: Add "deleted" webhook event (#1464)Salvatore Gentile2025-05-241-0/+1
|
* feat: Add AI auto summarization. Fixes #1163Mohamed Bassem2025-05-181-0/+1
|
* fix(search): add new relevance sort order (#1392)xuatz2025-05-181-3/+19
| | | | | | | | | | | * fix(search): add new relevance sort order * address pr comments * some minor fixes --------- Co-authored-by: Mohamed Bassem <me@mbassem.com>
* feat: Implement generic rule engine (#1318)Mohamed Bassem2025-04-271-0/+27
| | | | | | | | | | | | | | | | | * Add schema for the new rule engine * Add rule engine backend logic * Implement the worker logic and event firing * Implement the UI changesfor the rule engine * Ensure that when a referenced list or tag are deleted, the corresponding event/action is * Dont show smart lists in rule engine events * Add privacy validations for attached tag and list ids * Move the rules logic into a models
* fix: Add includeContent to search endpoint and document it in the docsMohamed Bassem2025-04-161-3/+1
|
* fix: Dont download html content by default in the bookmark grid. Fixes #1198Mohamed Bassem2025-04-131-11/+53
|
* feat: Allow editing the extracted content of an asset bookmarkMohamed Bassem2025-04-131-0/+20
|
* chore: Rename hoarder packages to karakeepMohamedBassem2025-04-121-12/+12
|
* fix: Deprecate the updateBookmarkText trpc endpoint and replace it with ↵MohamedBassem2025-04-081-1/+2
| | | | updateBookmark
* feat: Allow editing bookmark detailsMohamedBassem2025-04-081-26/+115
|
* feat(workers): Adds publisher and author og:meta tags to Bookmark (#1141)erik-nilcoast2025-03-221-0/+2
|
* fix: Harden getBookmarks endpoint against inconsistent bookmarks. Fixes #1094Mohamed Bassem2025-03-091-64/+58
|
* fix: Move away from JSON outputs to structured outputs. Fixes #1047Mohamed Bassem2025-03-021-1/+1
|
* refactor: Move the list logic into a separate modelMohamed Bassem2025-03-021-25/+4
|
* feat: Add a setting page to manage assets. Fixes #730Mohamed Bassem2025-02-231-151/+2
|
* feat: Add PDF screenshot generation and display (#995)Ahmad Mujahid2025-02-171-0/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Updated pdf2json to 3.1.5 * Extract and store a screenshot from PDF files using pdf2pic * Installing graphicsmagick and ghostscript * Generate Missing PDF screenshot with tidyAssets worker for backward support * Display PDF screenshot instead of the PDF in web if it exists. * Display PDF screenshot in mobile app if exists. * Updated pnpm-lock.yaml * Removed console.log * Revert the unnecessary changes in package.json * Revert pnpm-lock changes * Prevent rendering PDF files if the screenshot is not generated * refactor: replace useEffect with useMemo for section initialization * feat: show PDF file download button and handle large PDFs by defaulting to screenshot view * feat: add file size to openapi spec * feature: Add Assets preprocessing in fix mode to admin actions * i18n: add reprocess_assets_fix_mode translation * i18n: Add missing ar translations * A bunch of fixes * Fix openspec schema --------- Co-authored-by: Mohamed Bassem <me@mbassem.com>
* fix: Dont rearchive singlefile uploads and consider them as archivesMohamed Bassem2025-02-021-0/+6
|
* feat: Update the last modifiedAt timestamp when tags of the bookmark changeMohamed Bassem2025-02-011-0/+9
|
* feat: Add a new modifiedAt field to bookmarks table. Fixes #952Mohamed Bassem2025-02-011-13/+24
|
* feat: Change webhooks to be configurable by usersMohamed Bassem2025-01-191-0/+6
|
* feat: Add Bookmark Sorting Feature (#812)Daksh Pareek2025-01-121-11/+39
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * feat: add bookmark sorting by creation date - Add sort order toggle in GlobalActions component - Implement ascending/descending sort functionality - Update translations for sorting feature in all languages - Add sort order icons and dropdown menu - Maintain sort preference in URL params * feat: add bookmark sorting by creation date - Add sort order toggle in GlobalActions component - Implement ascending/descending sort functionality - Update translations for sorting feature in all languages - Add sort order icons and dropdown menu - Maintain sort preference in URL params during session Note: Sort order resets to default on page refresh, server-side persistence can be implemented in future enhancement * feat: Add global sort by date feature with shared sort order state - Implement global sort order functionality using a shared Zustand store (`useSortOrder` hook). - Update `getBookmarks` and `searchBookmarks` endpoints to accept a `sortOrder` parameter. - Refactor code to import `ZSortOrder` from shared types (`bookmarks.ts`), ensuring consistency across the codebase. - Update components (`UpdatableBookmarksGrid`, `bookmark-search`) to use the shared `useSortOrder` hook. - Remove unused `zSortBy` definition from `packages/shared/types/bookmarks.ts` to avoid confusion. - Ensure consistent naming conventions by prefixing Zod inferred types with `Z`. - Clean up code and address previous PR feedback comments. * tiny fixes and fixing TS errors --------- Co-authored-by: Mohamed Bassem <me@mbassem.com>
* feat: Support customizing the summarization prompt. Fixes #731Mohamed Bassem2025-01-121-0/+12
|
* feat: Add support for singlefile extension uploads. #172Mohamed Bassem2025-01-111-5/+36
|
* feat: Expose the search functionality in the REST APIMohamed Bassem2025-01-051-19/+9
|
* fix: Change search endpoint to accept query as raw stringMohamed Bassem2025-01-041-5/+7
|
* feat: Add support for smart lists (#802)Mohamed Bassem2025-01-021-0/+30
| | | | | | | | | | | | | | | | | | | * feat: Add support for smart lists * i18n * Fix update list endpoint * Add a test for smart lists * Add header to the query explainer * Hide remove from lists in the smart context list * Add proper validation to list form --------- Co-authored-by: Deepak Kapoor <41769111+orthdron@users.noreply.github.com>
* feat: Introduce advanced search capabilities (#753)Mohamed Bassem2024-12-311-1/+15
| | | | | | | | | | | | | | | | | | | | | | | | | * feat: Implement search filtering in the backend * feat: Implement search language parser * rename matcher name * Add ability to interleve text * More fixes * be more tolerable to parsing errors * Add a search query explainer widget * Handle date parsing gracefully * Fix the lockfile * Encode query search param * Fix table body error * Fix error when writing quotes
* refactor: Move asset preprocessing to its own worker out of the inference workerMohamed Bassem2024-12-261-2/+8
|
* feat: Add basic pagination to searchBookmarks tRPCMohamed Bassem2024-12-221-2/+33
|