⚡️⚡️⚡️ 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
Rebased to dev and ran formatting
dereulenspiegelcf02b7a09991
diff --git a/components/CollectionListing.tsx b/components/CollectionListing.tsxindex d97b6953..6504dd65 100644--- a/components/CollectionListing.tsx+++ b/components/CollectionListing.tsx@@ -246,10 +246,11 @@ const renderItem = (return (<div ref={provided.innerRef} {...provided.draggableProps} className="mb-1"><div- className={`${currentPath === `/collections/${collection.id}`+ className={`${+ currentPath === `/collections/${collection.id}`? "bg-primary/20 is-active": "hover:bg-neutral/20"- } duration-100 flex gap-1 items-center pr-2 pl-1 rounded-md`}+ } duration-100 flex gap-1 items-center pr-2 pl-1 rounded-md`}>{Dropdown(item as ExtendedTreeItem, onExpand, onCollapse)}diff --git a/components/ImportDropdown.tsx b/components/ImportDropdown.tsxindex 43fd2705..c210e089 100644--- a/components/ImportDropdown.tsx+++ b/components/ImportDropdown.tsx@@ -6,7 +6,7 @@ import { useTranslation } from "next-i18next";import { dropdownTriggerer } from "@/lib/client/utils";type Props = {};-const ImportDropdown = ({ }: Props) => {+const ImportDropdown = ({}: Props) => {const { t } = useTranslation();return (<div className="dropdown dropdown-bottom">@@ -93,7 +93,9 @@ const ImportDropdown = ({ }: Props) => {id="import-omnivore-file"accept=".zip"className="hidden"- onChange={(e) => importBookmarksBinary(e, MigrationFormat.omnivore)}+ onChange={(e) =>+ importBookmarksBinary(e, MigrationFormat.omnivore)+ }/></label></li>diff --git a/lib/api/archiveHandler.ts b/lib/api/archiveHandler.tsindex 9f3d1066..c4cb5bd8 100644--- a/lib/api/archiveHandler.ts+++ b/lib/api/archiveHandler.ts@@ -150,7 +150,7 @@ export default async function archiveHandler(link: LinksAndCollectionAndOwner) {preview: !finalLink.preview ? "unavailable" : undefined,aiTagged:user.aiTaggingMethod !== AiTaggingMethod.DISABLED &&- !finalLink.aiTagged+ !finalLink.aiTagged? true: undefined,},diff --git a/lib/client/importBookmarks.ts b/lib/client/importBookmarks.tsindex 1577de14..6398bfa0 100644--- a/lib/client/importBookmarks.ts+++ b/lib/client/importBookmarks.ts@@ -2,64 +2,64 @@ import { MigrationFormat, MigrationRequest } from "@/types/global";import { toast } from "react-hot-toast";const importBookmarks = async (- e: React.ChangeEvent<HTMLInputElement>,- format: MigrationFormat+ e: React.ChangeEvent<HTMLInputElement>,+ format: MigrationFormat) => {- const file: File | null = e.target.files && e.target.files[0];+ const file: File | null = e.target.files && e.target.files[0];- if (file) {- const reader = new FileReader();- reader.readAsText(file, "UTF-8");- reader.onload = async function (e) {- const load = toast.loading("Importing...");+ if (file) {+ const reader = new FileReader();+ reader.readAsText(file, "UTF-8");+ reader.onload = async function (e) {+ const load = toast.loading("Importing...");- const request: string = e.target?.result as string;+ const request: string = e.target?.result as string;- const body: MigrationRequest = {- format,- data: request,- };+ const body: MigrationRequest = {+ format,+ data: request,+ };- try {- const response = await fetch("/api/v1/migration", {- method: "POST",- body: JSON.stringify(body),- });+ try {+ const response = await fetch("/api/v1/migration", {+ method: "POST",+ body: JSON.stringify(body),+ });- if (!response.ok) {- const errorData = await response.json();- toast.dismiss(load);+ if (!response.ok) {+ const errorData = await response.json();+ toast.dismiss(load);- toast.error(- errorData.response ||- "Failed to import bookmarks. Please try again."- );- return;- }+ toast.error(+ errorData.response ||+ "Failed to import bookmarks. Please try again."+ );+ return;+ }- await response.json();- toast.dismiss(load);- toast.success("Imported the Bookmarks! Reloading the page...");+ await response.json();+ toast.dismiss(load);+ toast.success("Imported the Bookmarks! Reloading the page...");- setTimeout(() => {- location.reload();- }, 2000);- } catch (error) {- console.error("Request failed", error);- toast.dismiss(load);- toast.error(- "An error occurred while importing bookmarks. Please check the logs for more info."- );- }- };+ setTimeout(() => {+ location.reload();+ }, 2000);+ } catch (error) {+ console.error("Request failed", error);+ toast.dismiss(load);+ toast.error(+ "An error occurred while importing bookmarks. Please check the logs for more info."+ );+ }+ };- reader.onerror = function (e) {- console.log("Error reading file:", e);- toast.error(- "Failed to read the file. Please make sure the file is correct and try again."- );- };- }+ reader.onerror = function (e) {+ console.log("Error reading file:", e);+ toast.error(+ "Failed to read the file. Please make sure the file is correct and try again."+ );+ };+ }};-export default importBookmarks;\ No newline at end of file+export default importBookmarks;diff --git a/lib/client/importBookmarksBinary.ts b/lib/client/importBookmarksBinary.tsindex 224436d6..d9e59767 100644--- a/lib/client/importBookmarksBinary.ts+++ b/lib/client/importBookmarksBinary.ts@@ -31,7 +31,7 @@ const importBookmarksBinary = async (toast.error(errorData.response ||- "Failed to import bookmarks. Please try again."+ "Failed to import bookmarks. Please try again.");return;}diff --git a/pages/api/v1/migration/upload/[format].ts b/pages/api/v1/migration/upload/[format].tsindex b5417f87..0a032981 100644--- a/pages/api/v1/migration/upload/[format].ts+++ b/pages/api/v1/migration/upload/[format].ts@@ -36,4 +36,4 @@ export default async function users(req: NextApiRequest, res: NextApiResponse) {data = await importFromOmnivore(user.id, importData);if (data) return res.status(data.status).json({ response: data.response });-}\ No newline at end of file+}diff --git a/pages/dashboard.tsx b/pages/dashboard.tsxindex c87be4e2..0ac49ade 100644--- a/pages/dashboard.tsx+++ b/pages/dashboard.tsx@@ -52,7 +52,7 @@ export default function Dashboard() {account.referredBy === null &&// if user is using Linkwarden for more than 3 daysnew Date().getTime() - new Date(account.createdAt).getTime() >- 3 * 24 * 60 * 60 * 1000+ 3 * 24 * 60 * 60 * 1000) {setTimeout(() => {setShowsSurveyModal(true);