Skip to content

⚡️⚡️⚡️ Self-hosted collaborative bookmark manager to collect, read, annotate, and fully preserve what matters, all in one place.

WIP

daniel31x130cc1fd8407d2
diff --git a/components/LinkViews/LinkComponents/LinkActions.tsx b/components/LinkViews/LinkComponents/LinkActions.tsx
index ac162251..833cef51 100644
--- a/components/LinkViews/LinkComponents/LinkActions.tsx
+++ b/components/LinkViews/LinkComponents/LinkActions.tsx
@@ -28,8 +28,8 @@ export default function LinkActions({ link, btnStyle }: Props) {
const pinLink = usePinLink();
- const [editLinkModal, setEditLinkModal] = useState(false);
const [linkModal, setLinkModal] = useState(false);
+ const [editLinkModal, setEditLinkModal] = useState(false);
const [deleteLinkModal, setDeleteLinkModal] = useState(false);
const deleteLink = useDeleteLink();
diff --git a/components/LinkViews/LinkComponents/LinkCard.tsx b/components/LinkViews/LinkComponents/LinkCard.tsx
index 75b94359..0e8a93b6 100644
--- a/components/LinkViews/LinkComponents/LinkCard.tsx
+++ b/components/LinkViews/LinkComponents/LinkCard.tsx
@@ -16,7 +16,6 @@ import {
} from "@/lib/shared/formatStats";
import LinkIcon from "./LinkIcon";
import useOnScreen from "@/hooks/useOnScreen";
-import { generateLinkHref } from "@/lib/client/generateLinkHref";
import usePermissions from "@/hooks/usePermissions";
import toast from "react-hot-toast";
import LinkTypeBadge from "./LinkTypeBadge";
@@ -28,6 +27,7 @@ import { useRouter } from "next/router";
import useLocalSettingsStore from "@/store/localSettings";
import LinkPin from "./LinkPin";
import LinkFormats from "./LinkFormats";
+import openLink from "@/lib/client/openLink";
type Props = {
link: LinkIncludingShortenedCollectionAndTags;
@@ -166,9 +166,7 @@ export default function LinkCard({ link, columns, editMode }: Props) {
>
<div
className="rounded-2xl cursor-pointer h-full flex flex-col justify-between"
- onClick={() =>
- !editMode && window.open(generateLinkHref(link, user), "_blank")
- }
+ onClick={() => !editMode && openLink(link, user)}
>
{show.image && (
<div>
diff --git a/components/LinkViews/LinkComponents/LinkList.tsx b/components/LinkViews/LinkComponents/LinkList.tsx
index 1fa60b38..5e6314ba 100644
--- a/components/LinkViews/LinkComponents/LinkList.tsx
+++ b/components/LinkViews/LinkComponents/LinkList.tsx
@@ -10,7 +10,6 @@ import LinkDate from "@/components/LinkViews/LinkComponents/LinkDate";
import LinkCollection from "@/components/LinkViews/LinkComponents/LinkCollection";
import LinkIcon from "@/components/LinkViews/LinkComponents/LinkIcon";
import { isPWA } from "@/lib/client/utils";
-import { generateLinkHref } from "@/lib/client/generateLinkHref";
import usePermissions from "@/hooks/usePermissions";
import toast from "react-hot-toast";
import LinkTypeBadge from "./LinkTypeBadge";
@@ -23,6 +22,7 @@ import LinkPin from "./LinkPin";
import { useRouter } from "next/router";
import { atLeastOneFormatAvailable } from "@/lib/shared/formatStats";
import LinkFormats from "./LinkFormats";
+import openLink from "@/lib/client/openLink";
type Props = {
link: LinkIncludingShortenedCollectionAndTags;
@@ -113,9 +113,7 @@ export default function LinkCardCompact({ link, editMode }: Props) {
>
<div
className="flex items-center cursor-pointer w-full min-h-12"
- onClick={() =>
- !editMode && window.open(generateLinkHref(link, user), "_blank")
- }
+ onClick={() => !editMode && openLink(link, user)}
>
{show.icon && (
<div className="shrink-0">
diff --git a/components/LinkViews/LinkComponents/LinkMasonry.tsx b/components/LinkViews/LinkComponents/LinkMasonry.tsx
index 5438d7ec..5211a381 100644
--- a/components/LinkViews/LinkComponents/LinkMasonry.tsx
+++ b/components/LinkViews/LinkComponents/LinkMasonry.tsx
@@ -17,7 +17,6 @@ import {
import Link from "next/link";
import LinkIcon from "./LinkIcon";
import useOnScreen from "@/hooks/useOnScreen";
-import { generateLinkHref } from "@/lib/client/generateLinkHref";
import usePermissions from "@/hooks/usePermissions";
import toast from "react-hot-toast";
import LinkTypeBadge from "./LinkTypeBadge";
@@ -30,6 +29,7 @@ import clsx from "clsx";
import LinkPin from "./LinkPin";
import { useRouter } from "next/router";
import LinkFormats from "./LinkFormats";
+import openLink from "@/lib/client/openLink";
type Props = {
link: LinkIncludingShortenedCollectionAndTags;
@@ -161,9 +161,7 @@ export default function LinkMasonry({ link, editMode, columns }: Props) {
>
<div
className="rounded-2xl cursor-pointer"
- onClick={() =>
- !editMode && window.open(generateLinkHref(link, user), "_blank")
- }
+ onClick={() => !editMode && openLink(link, user)}
>
{show.image && formatAvailable(link, "preview") && (
<div>
diff --git a/lib/client/openLink.ts b/lib/client/openLink.ts
new file mode 100644
index 00000000..42d81c92
--- /dev/null
+++ b/lib/client/openLink.ts
@@ -0,0 +1,18 @@
+import {
+ AccountSettings,
+ LinkIncludingShortenedCollectionAndTags,
+} from "@/types/global";
+import { generateLinkHref } from "./generateLinkHref";
+import { LinksRouteTo } from "@prisma/client";
+
+const openLink = (
+ link: LinkIncludingShortenedCollectionAndTags,
+ user: AccountSettings
+) => {
+ if (user.linksRouteTo === LinksRouteTo.DETAILS) {
+ } else {
+ window.open(generateLinkHref(link, user), "_blank");
+ }
+};
+
+export default openLink;
diff --git a/pages/settings/preference.tsx b/pages/settings/preference.tsx
index 1875683e..b8d0565b 100644
--- a/pages/settings/preference.tsx
+++ b/pages/settings/preference.tsx
@@ -351,6 +351,22 @@ export default function Appearance() {
<span className="label-text">{t("open_original_content")}</span>
</label>
+ <label
+ className="label cursor-pointer flex gap-2 justify-start w-fit"
+ tabIndex={0}
+ role="button"
+ >
+ <input
+ type="radio"
+ name="link-preference-radio"
+ className="radio checked:bg-primary"
+ value="Original"
+ checked={linksRouteTo === LinksRouteTo.DETAILS}
+ onChange={() => setLinksRouteTo(LinksRouteTo.DETAILS)}
+ />
+ <span className="label-text">{t("show_link_details")}</span>
+ </label>
+
<label
className="label cursor-pointer flex gap-2 justify-start w-fit"
tabIndex={0}
diff --git a/prisma/migrations/20250102211704_modify_links_route_to_enum/migration.sql b/prisma/migrations/20250102211704_modify_links_route_to_enum/migration.sql
new file mode 100644
index 00000000..4eb4083c
--- /dev/null
+++ b/prisma/migrations/20250102211704_modify_links_route_to_enum/migration.sql
@@ -0,0 +1,2 @@
+-- AlterEnum
+ALTER TYPE "LinksRouteTo" ADD VALUE 'DETAILS';
diff --git a/prisma/schema.prisma b/prisma/schema.prisma
index d8969ac0..499c28cf 100644
--- a/prisma/schema.prisma
+++ b/prisma/schema.prisma
@@ -76,6 +76,7 @@ enum LinksRouteTo {
READABLE
MONOLITH
SCREENSHOT
+ DETAILS
}
model WhitelistedUser {