⚡️⚡️⚡️ Self-hosted collaborative bookmark manager to collect, read, annotate, and fully preserve what matters, all in one place.
TypeScript bookmarkbookmark-managercollaborationnextjsreact-nativeread-it-laterself-hostedtypescript
Merge branch 'feat/handle-files' into dev
Daniel104c79cd998a
diff --cc components/LinkCard.tsxindex c61487c2,748cb2b0..2f734f9a--- a/components/LinkCard.tsx+++ b/components/LinkCard.tsx@@@ -106,9 -121,11 +106,10 @@@ export default function LinkCard({ linktoast.dismiss(load);response.ok && toast.success(`Link Deleted.`);- setExpandDropdown(false);};- const url = isValidUrl(link.url) ? new URL(link.url) : undefined;+ const url =+ isValidUrl(link.url || "") && link.url ? new URL(link.url) : undefined;const formattedDate = new Date(link.createdAt as string).toLocaleString("en-US",@@@ -141,150 -157,94 +142,150 @@@icon={faEllipsis}title="More"className="w-5 h-5"- id={"expand-dropdown" + link.id}+ id={"expand-dropdown" + collection.id}/></div>+ <ul className="dropdown-content z-[20] menu shadow bg-base-200 border border-neutral-content rounded-box w-44 mr-1">+ {permissions === true ? (+ <li>+ <div+ role="button"+ tabIndex={0}+ onClick={() => {+ (document?.activeElement as HTMLElement)?.blur();+ pinLink();+ }}+ >+ {link?.pinnedBy && link.pinnedBy[0]+ ? "Unpin"+ : "Pin to Dashboard"}+ </div>+ </li>+ ) : undefined}+ {permissions === true || permissions?.canUpdate ? (+ <li>+ <div+ role="button"+ tabIndex={0}+ onClick={() => {+ (document?.activeElement as HTMLElement)?.blur();+ setEditLinkModal(true);+ }}+ >+ Edit+ </div>+ </li>+ ) : undefined}+ {permissions === true ? (+ <li>+ <div+ role="button"+ tabIndex={0}+ onClick={() => {+ (document?.activeElement as HTMLElement)?.blur();+ updateArchive();+ }}+ >+ Refresh Link+ </div>+ </li>+ ) : undefined}+ {permissions === true || permissions?.canDelete ? (+ <li>+ <div+ role="button"+ tabIndex={0}+ onClick={(e) => {+ (document?.activeElement as HTMLElement)?.blur();+ e.shiftKey ? deleteLink() : setDeleteLinkModal(true);+ }}+ >+ Delete+ </div>+ </li>+ ) : undefined}+ </ul>+ </div>+ ) : undefined}++ <div+ onClick={() => router.push("/links/" + link.id)}+ className="flex items-start cursor-pointer gap-5 sm:gap-10 h-full w-full p-4"+ >+ {url && account.displayLinkIcons && (+ <Image+ src={`https://t2.gstatic.com/faviconV2?client=SOCIAL&type=FAVICON&fallback_opts=TYPE,SIZE,URL&url=${url.origin}&size=32`}+ width={64}+ height={64}+ alt=""+ className={`${+ account.blurredFavicons ? "blur-sm " : ""+ } absolute w-12 duration-100 bg-white rounded-md p-1 bottom-5 right-5 select-none z-10`}+ draggable="false"+ onError={(e) => {+ const target = e.target as HTMLElement;+ target.style.display = "none";+ }}+ />)}- <div- onClick={() => router.push("/links/" + link.id)}- className="flex items-start cursor-pointer gap-5 sm:gap-10 h-full w-full p-4"- >- {url && account.displayLinkIcons && (- <Image- src={`https://t2.gstatic.com/faviconV2?client=SOCIAL&type=FAVICON&fallback_opts=TYPE,SIZE,URL&url=${url.origin}&size=32`}- width={64}- height={64}- alt=""- className={`${- account.blurredFavicons ? "blur-sm " : ""- }absolute w-16 group-hover:opacity-80 duration-100 rounded-2xl bottom-5 right-5 opacity-60 select-none z-10`}- draggable="false"- onError={(e) => {- const target = e.target as HTMLElement;- target.style.display = "none";+ <div className="flex justify-between gap-5 w-full h-full z-0">+ <div className="flex flex-col justify-between w-full">+ <div className="flex items-baseline gap-1">+ <p className="text-sm text-neutral">{count + 1}</p>+ <p className="text-lg truncate capitalize w-full pr-8">+ {unescapeString(link.name || link.description)}+ </p>+ </div>+ <Link+ href={`/collections/${link.collection.id}`}+ onClick={(e) => {+ e.stopPropagation();}}- />- )}-- <div className="flex justify-between gap-5 w-full h-full z-0">- <div className="flex flex-col justify-between w-full">- <div className="flex items-baseline gap-1">- <p className="text-sm text-gray-500 dark:text-gray-300">- {count + 1}- </p>- <p className="text-lg text-black dark:text-white truncate capitalize w-full pr-8">- {unescapeString(link.name || link.description)}- </p>- </div>- <Link- href={`/collections/${link.collection.id}`}- onClick={(e) => {- e.stopPropagation();- }}- className="flex items-center gap-1 max-w-full w-fit my-1 hover:opacity-70 duration-100"- >- <FontAwesomeIcon- icon={faFolder}- className="w-4 h-4 mt-1 drop-shadow"- style={{ color: collection?.color }}- />- <p className="text-black dark:text-white truncate capitalize w-full">- {collection?.name}- </p>- </Link>-- {/* {link.tags[0] ? (- <div className="flex gap-3 items-center flex-wrap my-2 truncate relative">- <div className="flex gap-1 items-center flex-nowrap">- {link.tags.map((e, i) => (- <Link- href={"/tags/" + e.id}- key={i}- onClick={(e) => {- e.stopPropagation();- }}- className="px-2 bg-sky-200 text-black dark:text-white dark:bg-sky-900 text-xs rounded-3xl cursor-pointer hover:opacity-60 duration-100 truncate max-w-[19rem]"- >- {e.name}- </Link>- ))}- </div>- <div className="absolute w-1/2 top-0 bottom-0 right-0 bg-gradient-to-r from-transparent to-slate-100 dark:to-neutral-800 to-35%"></div>+ className="flex items-center gap-1 max-w-full w-fit my-1 hover:opacity-70 duration-100"+ >+ <FontAwesomeIcon+ icon={faFolder}+ className="w-4 h-4 mt-1 drop-shadow"+ style={{ color: collection?.color }}+ />+ <p className="truncate capitalize w-full">{collection?.name}</p>+ </Link>++ {/* {link.tags[0] ? (+ <div className="flex gap-3 items-center flex-wrap my-2 truncate relative">+ <div className="flex gap-1 items-center flex-nowrap">+ {link.tags.map((e, i) => (+ <Link+ href={"/tags/" + e.id}+ key={i}+ onClick={(e) => {+ e.stopPropagation();+ }}+ className="btn btn-xs btn-outline truncate max-w-[19rem]"+ >+ {e.name}+ </Link>+ ))}</div>- ) : undefined} */}-- <Link- href={link.url || ""}- target="_blank"- onClick={(e) => {- e.stopPropagation();- }}- className="flex items-center gap-1 max-w-full w-fit text-gray-500 dark:text-gray-300 hover:opacity-70 duration-100"- >- <FontAwesomeIcon icon={faLink} className="mt-1 w-4 h-4" />- <p className="truncate w-full">{shortendURL}</p>- </Link>- <div className="flex items-center gap-1 text-gray-500 dark:text-gray-300">- <FontAwesomeIcon icon={faCalendarDays} className="w-4 h-4" />- <p>{formattedDate}</p>+ <div className="absolute w-1/2 top-0 bottom-0 right-0 bg-gradient-to-r from-transparent to-base-200 to-35%"></div></div>+ ) : undefined} */}++ <Link- href={link.url}++ href={link.url || ""}+ target="_blank"+ onClick={(e) => {+ e.stopPropagation();+ }}+ className="flex items-center gap-1 max-w-full w-fit text-neutral hover:opacity-70 duration-100"+ >+ <FontAwesomeIcon icon={faLink} className="mt-1 w-4 h-4" />+ <p className="truncate w-full">{shortendURL}</p>+ </Link>+ <div className="flex items-center gap-1 text-neutral">+ <FontAwesomeIcon icon={faCalendarDays} className="w-4 h-4" />+ <p>{formattedDate}</p></div></div></div>diff --cc components/Modal/Link/AddOrEditLink.tsxindex 7e8827a1,207c2b9e..23a69860--- a/components/Modal/Link/AddOrEditLink.tsx+++ b/components/Modal/Link/AddOrEditLink.tsx@@@ -138,11 -139,11 +139,11 @@@ export default function AddOrEditLink(<div className="flex flex-col gap-3 sm:w-[35rem] w-80">{method === "UPDATE" ? (<div- className="text-gray-500 dark:text-gray-300 break-all w-full flex gap-2"+ className="text-neutral break-all w-full flex gap-2"- title={link.url}+ title={link.url || ""}><FontAwesomeIcon icon={faLink} className="w-6 h-6" />- <Link href={link.url} target="_blank" className="w-full">+ <Link href={link.url || ""} target="_blank" className="w-full">{link.url}</Link></div>@@@ -151,12 -152,11 +152,12 @@@{method === "CREATE" ? (<div className="grid grid-flow-row-dense sm:grid-cols-5 gap-3"><div className="sm:col-span-3 col-span-5">- <p className="text-black dark:text-white mb-2">Address (URL)</p>+ <p className="mb-2">Address (URL)</p><TextInput- value={link.url}+ value={link.url || ""}onChange={(e) => setLink({ ...link, url: e.target.value })}placeholder="e.g. http://example.com/"+ className="bg-base-200"/></div><div className="sm:col-span-2 col-span-5">diff --cc components/Modal/Link/PreservedFormats.tsxindex 04a4ad11,914accfe..d1bc5bf1--- a/components/Modal/Link/PreservedFormats.tsx+++ b/components/Modal/Link/PreservedFormats.tsx@@@ -97,12 -96,12 +96,12 @@@ export default function PreservedFormat<FontAwesomeIcon icon={faFileImage} className="w-6 h-6" /></div>- <p className="text-black dark:text-white">Screenshot</p>+ <p>Screenshot</p></div>- <div className="flex text-black dark:text-white gap-1">+ <div className="flex gap-1"><div- onClick={() => handleDownload(ArchivedFormat.screenshot)}+ onClick={() => handleDownload(ArchivedFormat.png)}className="cursor-pointer hover:opacity-60 duration-100 p-2 rounded-md"><FontAwesomeIcondiff --cc pages/links/[id].tsxindex e12f6dfe,5ab22069..b7200a0a--- a/pages/links/[id].tsx+++ b/pages/links/[id].tsx@@@ -9,8 -9,9 +9,8 @@@ import} from "@/types/global";import Image from "next/image";import ColorThief, { RGBColor } from "colorthief";-import { useTheme } from "next-themes";import unescapeString from "@/lib/client/unescapeString";- import isValidUrl from "@/lib/client/isValidUrl";+ import isValidUrl from "@/lib/shared/isValidUrl";import DOMPurify from "dompurify";import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";import { faBoxesStacked, faFolder } from "@fortawesome/free-solid-svg-icons";diff --cc pages/public/links/[id].tsxindex 5185467f,5f774a69..2dc62688--- a/pages/public/links/[id].tsx+++ b/pages/public/links/[id].tsx@@@ -9,8 -9,9 +9,8 @@@ import} from "@/types/global";import Image from "next/image";import ColorThief, { RGBColor } from "colorthief";-import { useTheme } from "next-themes";import unescapeString from "@/lib/client/unescapeString";- import isValidUrl from "@/lib/client/isValidUrl";+ import isValidUrl from "@/lib/shared/isValidUrl";import DOMPurify from "dompurify";import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";import { faBoxesStacked, faFolder } from "@fortawesome/free-solid-svg-icons";