diff options
| author | kamtschatka <simon.schatka@gmx.at> | 2024-06-22 18:52:40 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-06-22 17:52:40 +0100 |
| commit | be1b7f7e1c0cb3d905e13aa1a95e295b816cbdeb (patch) | |
| tree | 6a0556a1bfd4fee1a10c99f88bd39a316107b631 /apps/web | |
| parent | ccfff6b1954030a273b0612f3772ec00a82422c8 (diff) | |
| download | karakeep-be1b7f7e1c0cb3d905e13aa1a95e295b816cbdeb.tar.zst | |
feature: add support for PDF links. Fixes #28 (#216)
* feature request: pdf support #28
Added a new sourceUrl column to the asset bookmarks
Added transforming a link bookmark pointing at a pdf to an asset bookmark
made sure the "View Original" link is also shown for asset bookmarks that have a sourceURL
updated gitignore for IDEA
* remove pdf parsing from the crawler
* extract the http logic into its own function to avoid duplicating the post-processing actions (openai/index)
* Add 5s timeout to the content type fetch
---------
Co-authored-by: MohamedBassem <me@mbassem.com>
Diffstat (limited to 'apps/web')
| -rw-r--r-- | apps/web/components/dashboard/preview/BookmarkPreview.tsx | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/apps/web/components/dashboard/preview/BookmarkPreview.tsx b/apps/web/components/dashboard/preview/BookmarkPreview.tsx index be11b47b..6a1068af 100644 --- a/apps/web/components/dashboard/preview/BookmarkPreview.tsx +++ b/apps/web/components/dashboard/preview/BookmarkPreview.tsx @@ -65,6 +65,16 @@ function CreationTime({ createdAt }: { createdAt: Date }) { ); } +function getSourceUrl(bookmark: ZBookmark) { + if (bookmark.content.type === "link") { + return bookmark.content.url; + } + if (bookmark.content.type === "asset") { + return bookmark.content.sourceUrl; + } + return null; +} + export default function BookmarkPreview({ bookmarkId, initialData, @@ -112,6 +122,8 @@ export default function BookmarkPreview({ } } + const sourceUrl = getSourceUrl(bookmark); + return ( <div className="grid h-full grid-rows-3 gap-2 overflow-hidden bg-background lg:grid-cols-3 lg:grid-rows-none"> <div className="row-span-2 h-full w-full overflow-auto p-2 md:col-span-2 lg:row-auto"> @@ -120,9 +132,9 @@ export default function BookmarkPreview({ <div className="lg:col-span1 row-span-1 flex flex-col gap-4 overflow-auto bg-accent p-4 lg:row-auto"> <div className="flex w-full flex-col items-center justify-center gap-y-2"> <EditableTitle bookmark={bookmark} /> - {bookmark.content.type == "link" && ( + {sourceUrl && ( <Link - href={bookmark.content.url} + href={sourceUrl} className="flex items-center gap-2 text-gray-400" > <span>View Original</span> |
