Skip to content

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

format

Isaac Wise94be3a7448c9
diff --git a/components/CollectionCard.tsx b/components/CollectionCard.tsx
index d68df690..1da6d9eb 100644
--- a/components/CollectionCard.tsx
+++ b/components/CollectionCard.tsx
@@ -1,5 +1,8 @@
import Link from "next/link";
-import { AccountSettings, CollectionIncludingMembersAndLinkCount } from "@/types/global";
+import {
+ AccountSettings,
+ CollectionIncludingMembersAndLinkCount,
+} from "@/types/global";
import React, { useEffect, useState } from "react";
import ProfilePhoto from "./ProfilePhoto";
import usePermissions from "@/hooks/usePermissions";
@@ -33,7 +36,9 @@ export default function CollectionCard({ collection, className }: Props) {
const permissions = usePermissions(collection.id as number);
- const [collectionOwner, setCollectionOwner] = useState<Partial<AccountSettings>>({});
+ const [collectionOwner, setCollectionOwner] = useState<
+ Partial<AccountSettings>
+ >({});
useEffect(() => {
const fetchOwner = async () => {
@@ -151,9 +156,11 @@ export default function CollectionCard({ collection, className }: Props) {
<Link
href={`/collections/${collection.id}`}
style={{
- backgroundImage: `linear-gradient(45deg, ${collection.color}30 10%, ${settings.theme === "dark" ? "oklch(var(--b2))" : "oklch(var(--b2))"
- } 50%, ${settings.theme === "dark" ? "oklch(var(--b2))" : "oklch(var(--b2))"
- } 100%)`,
+ backgroundImage: `linear-gradient(45deg, ${collection.color}30 10%, ${
+ settings.theme === "dark" ? "oklch(var(--b2))" : "oklch(var(--b2))"
+ } 50%, ${
+ settings.theme === "dark" ? "oklch(var(--b2))" : "oklch(var(--b2))"
+ } 100%)`,
}}
className="card card-compact shadow-md hover:shadow-none duration-200 border border-neutral-content"
>
diff --git a/components/CollectionListing.tsx b/components/CollectionListing.tsx
index 1e14b8f9..a8b8f431 100644
--- a/components/CollectionListing.tsx
+++ b/components/CollectionListing.tsx
@@ -231,10 +231,11 @@ const renderItem = (
return (
<div ref={provided.innerRef} {...provided.draggableProps} className="mb-1">
<div
- 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`}
+ 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`}
>
{Icon(item as ExtendedTreeItem, onExpand, onCollapse)}
diff --git a/components/Dropdown.tsx b/components/Dropdown.tsx
index 0089bc85..d1944c81 100644
--- a/components/Dropdown.tsx
+++ b/components/Dropdown.tsx
@@ -4,15 +4,15 @@ import ClickAwayHandler from "./ClickAwayHandler";
type MenuItem =
| {
- name: string;
- onClick: MouseEventHandler;
- href?: string;
- }
+ name: string;
+ onClick: MouseEventHandler;
+ href?: string;
+ }
| {
- name: string;
- onClick?: MouseEventHandler;
- href: string;
- }
+ name: string;
+ onClick?: MouseEventHandler;
+ href: string;
+ }
| undefined;
type Props = {
@@ -60,46 +60,50 @@ export default function Dropdown({
}
}, [points, dropdownHeight]);
- return !points || pos && (
- <ClickAwayHandler
- onMount={(e) => {
- setDropdownHeight(e.height);
- setDropdownWidth(e.width);
- }}
- style={
- points
- ? {
- position: "fixed",
- top: `${pos?.y}px`,
- left: `${pos?.x}px`,
- }
- : undefined
- }
- onClickOutside={onClickOutside}
- className={`${className || ""
+ return (
+ !points ||
+ (pos && (
+ <ClickAwayHandler
+ onMount={(e) => {
+ setDropdownHeight(e.height);
+ setDropdownWidth(e.width);
+ }}
+ style={
+ points
+ ? {
+ position: "fixed",
+ top: `${pos?.y}px`,
+ left: `${pos?.x}px`,
+ }
+ : undefined
+ }
+ onClickOutside={onClickOutside}
+ className={`${
+ className || ""
} py-1 shadow-md border border-neutral-content bg-base-200 rounded-md flex flex-col z-20`}
- >
- {items.map((e, i) => {
- const inner = e && (
- <div className="cursor-pointer rounded-md">
- <div className="flex items-center gap-2 py-1 px-2 hover:bg-base-100 duration-100">
- <p className="select-none">{e.name}</p>
+ >
+ {items.map((e, i) => {
+ const inner = e && (
+ <div className="cursor-pointer rounded-md">
+ <div className="flex items-center gap-2 py-1 px-2 hover:bg-base-100 duration-100">
+ <p className="select-none">{e.name}</p>
+ </div>
</div>
- </div>
- );
+ );
- return e && e.href ? (
- <Link key={i} href={e.href}>
- {inner}
- </Link>
- ) : (
- e && (
- <div key={i} onClick={e.onClick}>
+ return e && e.href ? (
+ <Link key={i} href={e.href}>
{inner}
- </div>
- )
- );
- })}
- </ClickAwayHandler>
+ </Link>
+ ) : (
+ e && (
+ <div key={i} onClick={e.onClick}>
+ {inner}
+ </div>
+ )
+ );
+ })}
+ </ClickAwayHandler>
+ ))
);
}
diff --git a/components/InputSelect/CollectionSelection.tsx b/components/InputSelect/CollectionSelection.tsx
index 31caa038..0f708fbc 100644
--- a/components/InputSelect/CollectionSelection.tsx
+++ b/components/InputSelect/CollectionSelection.tsx
@@ -10,11 +10,11 @@ type Props = {
onChange: (newValue: unknown, actionMeta: ActionMeta<unknown>) => void;
showDefaultValue?: boolean;
defaultValue?:
- | {
- label: string;
- value?: number;
- }
- | undefined;
+ | {
+ label: string;
+ value?: number;
+ }
+ | undefined;
creatable?: boolean;
};
@@ -107,7 +107,7 @@ export default function CollectionSelection({
components={{
Option: customOption,
}}
- // menuPosition="fixed"
+ // menuPosition="fixed"
/>
);
} else {
@@ -123,7 +123,7 @@ export default function CollectionSelection({
components={{
Option: customOption,
}}
- // menuPosition="fixed"
+ // menuPosition="fixed"
/>
);
}
diff --git a/components/LinkViews/LinkComponents/LinkActions.tsx b/components/LinkViews/LinkComponents/LinkActions.tsx
index 41f40c52..e8974797 100644
--- a/components/LinkViews/LinkComponents/LinkActions.tsx
+++ b/components/LinkViews/LinkComponents/LinkActions.tsx
@@ -79,8 +79,9 @@ export default function LinkActions({
return (
<>
<div
- className={`dropdown dropdown-left absolute ${position || "top-3 right-3"
- } ${alignToTop ? "" : "dropdown-end"} z-20`}
+ className={`dropdown dropdown-left absolute ${
+ position || "top-3 right-3"
+ } ${alignToTop ? "" : "dropdown-end"} z-20`}
>
<div
tabIndex={0}
@@ -91,8 +92,9 @@ export default function LinkActions({
<i title="More" className="bi-three-dots text-xl" />
</div>
<ul
- className={`dropdown-content z-[20] menu shadow bg-base-200 border border-neutral-content rounded-box w-44 mr-1 ${alignToTop ? "" : "translate-y-10"
- }`}
+ className={`dropdown-content z-[20] menu shadow bg-base-200 border border-neutral-content rounded-box w-44 mr-1 ${
+ alignToTop ? "" : "translate-y-10"
+ }`}
>
<li>
<div
@@ -122,20 +124,21 @@ export default function LinkActions({
</div>
</li>
)}
- {permissions === true || permissions?.canUpdate && (
- <li>
- <div
- role="button"
- tabIndex={0}
- onClick={() => {
- (document?.activeElement as HTMLElement)?.blur();
- setEditLinkModal(true);
- }}
- >
- {t("edit_link")}
- </div>
- </li>
- )}
+ {permissions === true ||
+ (permissions?.canUpdate && (
+ <li>
+ <div
+ role="button"
+ tabIndex={0}
+ onClick={() => {
+ (document?.activeElement as HTMLElement)?.blur();
+ setEditLinkModal(true);
+ }}
+ >
+ {t("edit_link")}
+ </div>
+ </li>
+ ))}
{link.type === "url" && (
<li>
<div
@@ -150,20 +153,21 @@ export default function LinkActions({
</div>
</li>
)}
- {permissions === true || permissions?.canDelete && (
- <li>
- <div
- role="button"
- tabIndex={0}
- onClick={(e) => {
- (document?.activeElement as HTMLElement)?.blur();
- e.shiftKey ? deleteLink() : setDeleteLinkModal(true);
- }}
- >
- {t("delete")}
- </div>
- </li>
- )}
+ {permissions === true ||
+ (permissions?.canDelete && (
+ <li>
+ <div
+ role="button"
+ tabIndex={0}
+ onClick={(e) => {
+ (document?.activeElement as HTMLElement)?.blur();
+ e.shiftKey ? deleteLink() : setDeleteLinkModal(true);
+ }}
+ >
+ {t("delete")}
+ </div>
+ </li>
+ ))}
</ul>
</div>
diff --git a/components/LinkViews/LinkList.tsx b/components/LinkViews/LinkList.tsx
index efb10c4e..0abffc9f 100644
--- a/components/LinkViews/LinkList.tsx
+++ b/components/LinkViews/LinkList.tsx
@@ -91,8 +91,9 @@ export default function LinkCardCompact({
return (
<>
<div
- className={`${selectedStyle} border relative items-center flex ${!showInfo && !isPWA() ? "hover:bg-base-300 p-3" : "py-3"
- } duration-200 rounded-lg w-full`}
+ className={`${selectedStyle} border relative items-center flex ${
+ !showInfo && !isPWA() ? "hover:bg-base-300 p-3" : "py-3"
+ } duration-200 rounded-lg w-full`}
onClick={() =>
selectable
? handleCheckboxClick(link)
@@ -152,8 +153,8 @@ export default function LinkCardCompact({
collection={collection}
position="top-3 right-3"
flipDropdown={flipDropdown}
- // toggleShowInfo={() => setShowInfo(!showInfo)}
- // linkInfo={showInfo}
+ // toggleShowInfo={() => setShowInfo(!showInfo)}
+ // linkInfo={showInfo}
/>
</div>
<div
diff --git a/components/MobileNavigation.tsx b/components/MobileNavigation.tsx
index 34bb96aa..7b754ce3 100644
--- a/components/MobileNavigation.tsx
+++ b/components/MobileNavigation.tsx
@@ -9,7 +9,7 @@ import { useTranslation } from "next-i18next";
type Props = {};
-export default function MobileNavigation({ }: Props) {
+export default function MobileNavigation({}: Props) {
const { t } = useTranslation();
const [newLinkModal, setNewLinkModal] = useState(false);
const [newCollectionModal, setNewCollectionModal] = useState(false);
@@ -21,8 +21,9 @@ export default function MobileNavigation({ }: Props) {
className={`fixed bottom-0 left-0 right-0 z-30 duration-200 sm:hidden`}
>
<div
- className={`w-full flex bg-base-100 ${isIphone() && isPWA() ? "pb-5" : ""
- } border-solid border-t-neutral-content border-t`}
+ className={`w-full flex bg-base-100 ${
+ isIphone() && isPWA() ? "pb-5" : ""
+ } border-solid border-t-neutral-content border-t`}
>
<MobileNavigationButton href={`/dashboard`} icon={"bi-house"} />
<MobileNavigationButton
@@ -83,9 +84,7 @@ export default function MobileNavigation({ }: Props) {
<MobileNavigationButton href={`/collections`} icon={"bi-folder"} />
</div>
</div>
- {newLinkModal && (
- <NewLinkModal onClose={() => setNewLinkModal(false)} />
- )}
+ {newLinkModal && <NewLinkModal onClose={() => setNewLinkModal(false)} />}
{newCollectionModal && (
<NewCollectionModal onClose={() => setNewCollectionModal(false)} />
)}
diff --git a/components/ModalContent/EditCollectionSharingModal.tsx b/components/ModalContent/EditCollectionSharingModal.tsx
index 76f0a47d..d3b86277 100644
--- a/components/ModalContent/EditCollectionSharingModal.tsx
+++ b/components/ModalContent/EditCollectionSharingModal.tsx
@@ -2,7 +2,11 @@ import React, { useEffect, useState } from "react";
import TextInput from "@/components/TextInput";
import useCollectionStore from "@/store/collections";
import toast from "react-hot-toast";
-import { AccountSettings, CollectionIncludingMembersAndLinkCount, Member } from "@/types/global";
+import {
+ AccountSettings,
+ CollectionIncludingMembersAndLinkCount,
+ Member,
+} from "@/types/global";
import getPublicUserData from "@/lib/client/getPublicUserData";
import useAccountStore from "@/store/account";
import usePermissions from "@/hooks/usePermissions";
@@ -62,7 +66,9 @@ export default function EditCollectionSharingModal({
const [memberUsername, setMemberUsername] = useState("");
- const [collectionOwner, setCollectionOwner] = useState<Partial<AccountSettings>>({});
+ const [collectionOwner, setCollectionOwner] = useState<
+ Partial<AccountSettings>
+ >({});
useEffect(() => {
const fetchOwner = async () => {
diff --git a/components/ModalContent/PreservedFormatsModal.tsx b/components/ModalContent/PreservedFormatsModal.tsx
index c70f8c08..4c9caec1 100644
--- a/components/ModalContent/PreservedFormatsModal.tsx
+++ b/components/ModalContent/PreservedFormatsModal.tsx
@@ -38,7 +38,9 @@ export default function PreservedFormatsModal({ onClose, activeLink }: Props) {
let isPublic = router.pathname.startsWith("/public") ? true : undefined;
- const [collectionOwner, setCollectionOwner] = useState<Partial<AccountSettings>>({});
+ const [collectionOwner, setCollectionOwner] = useState<
+ Partial<AccountSettings>
+ >({});
useEffect(() => {
const fetchOwner = async () => {
@@ -143,9 +145,9 @@ export default function PreservedFormatsModal({ onClose, activeLink }: Props) {
<p className="text-xl font-thin">{t("preserved_formats")}</p>
<div className="divider mb-2 mt-1"></div>
{screenshotAvailable(link) ||
- pdfAvailable(link) ||
- readabilityAvailable(link) ||
- monolithAvailable(link) ? (
+ pdfAvailable(link) ||
+ readabilityAvailable(link) ||
+ monolithAvailable(link) ? (
<p className="mb-3">{t("available_formats")}</p>
) : (
""
@@ -206,21 +208,25 @@ export default function PreservedFormatsModal({ onClose, activeLink }: Props) {
<p className="text-center text-2xl">{t("preservation_in_queue")}</p>
<p className="text-center text-lg">{t("check_back_later")}</p>
</div>
- ) : !isReady() && atLeastOneFormatAvailable() && (
- <div className={`w-full h-full flex flex-col justify-center p-5`}>
- <BeatLoader
- color="oklch(var(--p))"
- className="mx-auto mb-3"
- size={20}
- />
- <p className="text-center">{t("there_are_more_formats")}</p>
- <p className="text-center text-sm">{t("check_back_later")}</p>
- </div>
+ ) : (
+ !isReady() &&
+ atLeastOneFormatAvailable() && (
+ <div className={`w-full h-full flex flex-col justify-center p-5`}>
+ <BeatLoader
+ color="oklch(var(--p))"
+ className="mx-auto mb-3"
+ size={20}
+ />
+ <p className="text-center">{t("there_are_more_formats")}</p>
+ <p className="text-center text-sm">{t("check_back_later")}</p>
+ </div>
+ )
)}
<div
- className={`flex flex-col sm:flex-row gap-3 items-center justify-center ${isReady() ? "sm:mt " : ""
- }`}
+ className={`flex flex-col sm:flex-row gap-3 items-center justify-center ${
+ isReady() ? "sm:mt " : ""
+ }`}
>
<Link
href={`https://web.archive.org/web/${link?.url?.replace(
diff --git a/components/Navbar.tsx b/components/Navbar.tsx
index d4907ac2..da5a0d00 100644
--- a/components/Navbar.tsx
+++ b/components/Navbar.tsx
@@ -120,9 +120,7 @@ export default function Navbar() {
</ClickAwayHandler>
</div>
)}
- {newLinkModal && (
- <NewLinkModal onClose={() => setNewLinkModal(false)} />
- )}
+ {newLinkModal && <NewLinkModal onClose={() => setNewLinkModal(false)} />}
{newCollectionModal && (
<NewCollectionModal onClose={() => setNewCollectionModal(false)} />
)}
diff --git a/components/NoLinksFound.tsx b/components/NoLinksFound.tsx
index b42516a7..a8ec44db 100644
--- a/components/NoLinksFound.tsx
+++ b/components/NoLinksFound.tsx
@@ -39,9 +39,7 @@ export default function NoLinksFound({ text }: Props) {
</span>
</div>
</div>
- {newLinkModal && (
- <NewLinkModal onClose={() => setNewLinkModal(false)} />
- )}
+ {newLinkModal && <NewLinkModal onClose={() => setNewLinkModal(false)} />}
</div>
);
}
diff --git a/components/PreserverdFormatRow.tsx b/components/PreserverdFormatRow.tsx
index d35bfe65..6125c505 100644
--- a/components/PreserverdFormatRow.tsx
+++ b/components/PreserverdFormatRow.tsx
@@ -90,18 +90,20 @@ export default function PreservedFormatRow({
</div>
<div className="flex gap-1">
- {downloadable || false && (
- <div
- onClick={() => handleDownload()}
- className="btn btn-sm btn-square"
- >
- <i className="bi-cloud-arrow-down text-xl text-neutral" />
- </div>
- )}
+ {downloadable ||
+ (false && (
+ <div
+ onClick={() => handleDownload()}
+ className="btn btn-sm btn-square"
+ >
+ <i className="bi-cloud-arrow-down text-xl text-neutral" />
+ </div>
+ ))}
<Link
- href={`${isPublic ? "/public" : ""
- }/preserved/${link?.id}?format=${format}`}
+ href={`${
+ isPublic ? "/public" : ""
+ }/preserved/${link?.id}?format=${format}`}
target="_blank"
className="btn btn-sm btn-square"
>
diff --git a/components/ProfileDropdown.tsx b/components/ProfileDropdown.tsx
index 400969bf..5b1604c6 100644
--- a/components/ProfileDropdown.tsx
+++ b/components/ProfileDropdown.tsx
@@ -32,8 +32,9 @@ export default function ProfileDropdown() {
/>
</div>
<ul
- className={`dropdown-content z-[1] menu shadow bg-base-200 border border-neutral-content rounded-box ${isAdmin ? "w-48" : "w-40"
- } mt-1`}
+ className={`dropdown-content z-[1] menu shadow bg-base-200 border border-neutral-content rounded-box ${
+ isAdmin ? "w-48" : "w-40"
+ } mt-1`}
>
<li>
<Link
diff --git a/components/ReadableView.tsx b/components/ReadableView.tsx
index 7b827a27..5843b720 100644
--- a/components/ReadableView.tsx
+++ b/components/ReadableView.tsx
@@ -192,7 +192,8 @@ export default function ReadableView({ link }: Props) {
>
<i className="bi-link-45deg"></i>
- {isValidUrl(link?.url || "") && new URL(link?.url as string).host}
+ {isValidUrl(link?.url || "") &&
+ new URL(link?.url as string).host}
</Link>
)}
</div>
@@ -229,10 +230,10 @@ export default function ReadableView({ link }: Props) {
<p className="min-w-fit text-sm text-neutral">
{date
? new Date(date).toLocaleString("en-US", {
- year: "numeric",
- month: "long",
- day: "numeric",
- })
+ year: "numeric",
+ month: "long",
+ day: "numeric",
+ })
: undefined}
</p>
@@ -257,8 +258,9 @@ export default function ReadableView({ link }: Props) {
></div>
) : (
<div
- className={`w-full h-full flex flex-col justify-center p-10 ${link?.readable === "pending" || !link?.readable ? "skeleton" : ""
- }`}
+ className={`w-full h-full flex flex-col justify-center p-10 ${
+ link?.readable === "pending" || !link?.readable ? "skeleton" : ""
+ }`}
>
<svg
xmlns="http://www.w3.org/2000/svg"
diff --git a/components/ToggleDarkMode.tsx b/components/ToggleDarkMode.tsx
index fe12cb39..9404d419 100644
--- a/components/ToggleDarkMode.tsx
+++ b/components/ToggleDarkMode.tsx
@@ -10,7 +10,9 @@ export default function ToggleDarkMode({ className }: Props) {
const { t } = useTranslation();
const { settings, updateSettings } = useLocalSettingsStore();
- const [theme, setTheme] = useState<string | null>(localStorage.getItem("theme"));
+ const [theme, setTheme] = useState<string | null>(
+ localStorage.getItem("theme")
+ );
const handleToggle = (e: ChangeEvent<HTMLInputElement>) => {
setTheme(e.target.checked ? "dark" : "light");
diff --git a/layouts/CenteredForm.tsx b/layouts/CenteredForm.tsx
index b40c545b..5367dd62 100644
--- a/layouts/CenteredForm.tsx
+++ b/layouts/CenteredForm.tsx
@@ -25,8 +25,9 @@ export default function CenteredForm({
<div className="m-auto flex flex-col gap-2 w-full">
{settings.theme && (
<Image
- src={`/linkwarden_${settings.theme === "dark" ? "dark" : "light"
- }.png`}
+ src={`/linkwarden_${
+ settings.theme === "dark" ? "dark" : "light"
+ }.png`}
width={640}
height={136}
alt="Linkwarden"
diff --git a/lib/api/controllers/dashboard/getDashboardDataV2.ts b/lib/api/controllers/dashboard/getDashboardDataV2.ts
index 11e13034..fa952c5a 100644
--- a/lib/api/controllers/dashboard/getDashboardDataV2.ts
+++ b/lib/api/controllers/dashboard/getDashboardDataV2.ts
@@ -3,15 +3,15 @@ import { LinkRequestQuery, Order, Sort } from "@/types/global";
type Response<D> =
| {
- data: D;
- message: string;
- status: number;
- }
+ data: D;
+ message: string;
+ status: number;
+ }
| {
- data: D;
- message: string;
- status: number;
- };
+ data: D;
+ message: string;
+ status: number;
+ };
export default async function getDashboardData(
userId: number,
diff --git a/lib/api/controllers/migration/exportData.ts b/lib/api/controllers/migration/exportData.ts
index 7d242e3c..3829c59e 100644
--- a/lib/api/controllers/migration/exportData.ts
+++ b/lib/api/controllers/migration/exportData.ts
@@ -26,7 +26,7 @@ export default async function exportData(userId: number) {
if (Array.isArray(data)) {
data.forEach((item) => redactIds(item));
} else if (data !== null && typeof data === "object") {
- const fieldsToRedact = ['id', 'parentId', 'collectionId', 'ownerId'];
+ const fieldsToRedact = ["id", "parentId", "collectionId", "ownerId"];
fieldsToRedact.forEach((field) => {
if (field in data) {
@@ -37,7 +37,10 @@ export default async function exportData(userId: number) {
// Recursively call redactIds for each property that is an object or an array
Object.keys(data).forEach((key) => {
const value = (data as any)[key];
- if (value !== null && (typeof value === "object" || Array.isArray(value))) {
+ if (
+ value !== null &&
+ (typeof value === "object" || Array.isArray(value))
+ ) {
redactIds(value);
}
});
diff --git a/lib/api/controllers/migration/importFromHTMLFile.ts b/lib/api/controllers/migration/importFromHTMLFile.ts
index b2b58a14..59a27878 100644
--- a/lib/api/controllers/migration/importFromHTMLFile.ts
+++ b/lib/api/controllers/migration/importFromHTMLFile.ts
@@ -63,7 +63,8 @@ async function processBookmarks(
) as Element;
if (collectionName) {
- const collectionNameContent = (collectionName.children[0] as TextNode)?.content;
+ const collectionNameContent = (collectionName.children[0] as TextNode)
+ ?.content;
if (collectionNameContent) {
collectionId = await createCollection(
userId,
@@ -274,4 +275,3 @@ function processNodes(nodes: Node[]) {
nodes.forEach(findAndProcessDL);
return nodes;
}
-
diff --git a/lib/api/controllers/migration/importFromWallabag.ts b/lib/api/controllers/migration/importFromWallabag.ts
index f482f398..b723d3fa 100644
--- a/lib/api/controllers/migration/importFromWallabag.ts
+++ b/lib/api/controllers/migration/importFromWallabag.ts
@@ -84,23 +84,23 @@ export default async function importFromWallabag(
tags:
link.tags && link.tags[0]
? {
- connectOrCreate: link.tags.map((tag) => ({
- where: {
- name_ownerId: {
- name: tag.trim(),
- ownerId: userId,
+ connectOrCreate: link.tags.map((tag) => ({
+ where: {
+ name_ownerId: {
+ name: tag.trim(),
+ ownerId: userId,
+ },
},
- },
- create: {
- name: tag.trim(),
- owner: {
- connect: {
- id: userId,
+ create: {
+ name: tag.trim(),
+ owner: {
+ connect: {
+ id: userId,
+ },
},
},
- },
- })),
- }
+ })),
+ }
: undefined,
},
});
diff --git a/lib/api/controllers/users/userId/deleteUserById.ts b/lib/api/controllers/users/userId/deleteUserById.ts
index af3eb884..a4818939 100644
--- a/lib/api/controllers/users/userId/deleteUserById.ts
+++ b/lib/api/controllers/users/userId/deleteUserById.ts
@@ -24,10 +24,7 @@ export default async function deleteUserById(
if (!isServerAdmin) {
if (user.password) {
- const isPasswordValid = bcrypt.compareSync(
- body.password,
- user.password
- );
+ const isPasswordValid = bcrypt.compareSync(body.password, user.password);
if (!isPasswordValid && !isServerAdmin) {
return {
diff --git a/lib/api/storage/readFile.ts b/lib/api/storage/readFile.ts
index a8eee587..fc9d2e75 100644
--- a/lib/api/storage/readFile.ts
+++ b/lib/api/storage/readFile.ts
@@ -28,10 +28,10 @@ export default async function readFile(filePath: string) {
try {
let returnObject:
| {
- file: Buffer | string;
- contentType: ReturnContentTypes;
- status: number;
- }
+ file: Buffer | string;
+ contentType: ReturnContentTypes;
+ status: number;
+ }
| undefined;
const headObjectAsync = util.promisify(
diff --git a/lib/client/utils.ts b/lib/client/utils.ts
index 010372c0..c1aa219a 100644
--- a/lib/client/utils.ts
+++ b/lib/client/utils.ts
@@ -7,10 +7,15 @@ export function isPWA() {
}
export function isIphone() {
- return /iPhone/.test(navigator.userAgent) && !(window as unknown as { MSStream?: any }).MSStream;
+ return (
+ /iPhone/.test(navigator.userAgent) &&
+ !(window as unknown as { MSStream?: any }).MSStream
+ );
}
-export function dropdownTriggerer(e: React.FocusEvent<HTMLElement> | React.MouseEvent<HTMLElement>) {
+export function dropdownTriggerer(
+ e: React.FocusEvent<HTMLElement> | React.MouseEvent<HTMLElement>
+) {
let targetEl = e.currentTarget;
if (targetEl && targetEl.matches(":focus")) {
setTimeout(function () {
diff --git a/lib/shared/getArchiveValidity.ts b/lib/shared/getArchiveValidity.ts
index fdf04574..fc553f83 100644
--- a/lib/shared/getArchiveValidity.ts
+++ b/lib/shared/getArchiveValidity.ts
@@ -39,7 +39,9 @@ export function monolithAvailable(
);
}
-export function previewAvailable(link: LinkIncludingShortenedCollectionAndTags) {
+export function previewAvailable(
+ link: LinkIncludingShortenedCollectionAndTags
+) {
return (
link &&
link.preview &&
diff --git a/next-i18next.config.js b/next-i18next.config.js
index 06c3d23b..b78b3b88 100644
--- a/next-i18next.config.js
+++ b/next-i18next.config.js
@@ -2,7 +2,7 @@
module.exports = {
i18n: {
defaultLocale: "en",
- locales: ["en","it"],
+ locales: ["en", "it"],
},
reloadOnPrerender: process.env.NODE_ENV === "development",
};
diff --git a/pages/admin.tsx b/pages/admin.tsx
index 4f603e69..362a78ef 100644
--- a/pages/admin.tsx
+++ b/pages/admin.tsx
@@ -104,9 +104,7 @@ export default function Admin() {
<p>{t("no_users_found")}</p>
)}
- {newUserModal && (
- <NewUserModal onClose={() => setNewUserModal(false)} />
- )}
+ {newUserModal && <NewUserModal onClose={() => setNewUserModal(false)} />}
</div>
);
}
diff --git a/pages/api/v1/archives/[linkId].ts b/pages/api/v1/archives/[linkId].ts
index bd7e8562..e2a08d14 100644
--- a/pages/api/v1/archives/[linkId].ts
+++ b/pages/api/v1/archives/[linkId].ts
@@ -189,8 +189,12 @@ export default async function Index(req: NextApiRequest, res: NextApiResponse) {
where: { id: linkId },
data: {
preview: isPDF ? "unavailable" : undefined,
- image: isImage ? `archives/${collectionPermissions.id}/${linkId + suffix}` : null,
- pdf: isPDF ? `archives/${collectionPermissions.id}/${linkId + suffix}` : null,
+ image: isImage
+ ? `archives/${collectionPermissions.id}/${linkId + suffix}`
+ : null,
+ pdf: isPDF
+ ? `archives/${collectionPermissions.id}/${linkId + suffix}`
+ : null,
lastPreserved: new Date().toISOString(),
},
});
diff --git a/pages/collections/[id].tsx b/pages/collections/[id].tsx
index ed0fa38a..baede3d4 100644
--- a/pages/collections/[id].tsx
+++ b/pages/collections/[id].tsx
@@ -54,7 +54,9 @@ export default function Index() {
const { account } = useAccountStore();
- const [collectionOwner, setCollectionOwner] = useState<Partial<AccountSettings>>({});
+ const [collectionOwner, setCollectionOwner] = useState<
+ Partial<AccountSettings>
+ >({});
useEffect(() => {
const fetchOwner = async () => {
@@ -108,8 +110,9 @@ export default function Index() {
<div
className="h-[60rem] p-5 flex gap-3 flex-col"
style={{
- backgroundImage: `linear-gradient(${activeCollection?.color}20 10%, ${settings.theme === "dark" ? "#262626" : "#f3f4f6"
- } 13rem, ${settings.theme === "dark" ? "#171717" : "#ffffff"} 100%)`,
+ backgroundImage: `linear-gradient(${activeCollection?.color}20 10%, ${
+ settings.theme === "dark" ? "#262626" : "#f3f4f6"
+ } 13rem, ${settings.theme === "dark" ? "#171717" : "#ffffff"} 100%)`,
}}
>
{activeCollection && (
@@ -210,7 +213,7 @@ export default function Index() {
/>
)}
{activeCollection.members
- .sort((a, b) => (a.userId) - (b.userId))
+ .sort((a, b) => a.userId - b.userId)
.map((e, i) => {
return (
<ProfilePhoto
@@ -233,20 +236,20 @@ export default function Index() {
<p className="text-neutral text-sm">
{activeCollection.members.length > 0 &&
- activeCollection.members.length === 1
+ activeCollection.members.length === 1
? t("by_author_and_other", {
- author: collectionOwner.name,
- count: activeCollection.members.length,
- })
- : activeCollection.members.length > 0 &&
- activeCollection.members.length !== 1
- ? t("by_author_and_others", {
author: collectionOwner.name,
count: activeCollection.members.length,
})
+ : activeCollection.members.length > 0 &&
+ activeCollection.members.length !== 1
+ ? t("by_author_and_others", {
+ author: collectionOwner.name,
+ count: activeCollection.members.length,
+ })
: t("by_author", {
- author: collectionOwner.name,
- })}
+ author: collectionOwner.name,
+ })}
</p>
</div>
</div>
@@ -291,15 +294,15 @@ export default function Index() {
setSortBy={setSortBy}
editMode={
permissions === true ||
- permissions?.canUpdate ||
- permissions?.canDelete
+ permissions?.canUpdate ||
+ permissions?.canDelete
? editMode
: undefined
}
setEditMode={
permissions === true ||
- permissions?.canUpdate ||
- permissions?.canDelete
+ permissions?.canUpdate ||
+ permissions?.canDelete
? setEditMode
: undefined
}
@@ -307,11 +310,11 @@ export default function Index() {
<p>
{activeCollection?._count?.links === 1
? t("showing_count_result", {
- count: activeCollection?._count?.links,
- })
+ count: activeCollection?._count?.links,
+ })
: t("showing_count_results", {
- count: activeCollection?._count?.links,
- })}
+ count: activeCollection?._count?.links,
+ })}
</p>
</LinkListOptions>
diff --git a/pages/dashboard.tsx b/pages/dashboard.tsx
index 01735ac7..c86ded5b 100644
--- a/pages/dashboard.tsx
+++ b/pages/dashboard.tsx
@@ -60,7 +60,10 @@ export default function Dashboard() {
handleNumberOfLinksToShow();
}, [width]);
- const importBookmarks = async (e: React.ChangeEvent<HTMLInputElement>, format: MigrationFormat) => {
+ const importBookmarks = async (
+ e: React.ChangeEvent<HTMLInputElement>,
+ format: MigrationFormat
+ ) => {
const file: File | null = e.target.files && e.target.files[0];
if (file) {
@@ -324,9 +327,7 @@ export default function Dashboard() {
)}
</div>
</div>
- {newLinkModal && (
- <NewLinkModal onClose={() => setNewLinkModal(false)} />
- )}
+ {newLinkModal && <NewLinkModal onClose={() => setNewLinkModal(false)} />}
</MainLayout>
);
}
diff --git a/pages/login.tsx b/pages/login.tsx
index 4eb59c8c..e1b530c6 100644
--- a/pages/login.tsx
+++ b/pages/login.tsx
@@ -224,9 +224,9 @@ export default function Login({
loading={submitLoader}
>
{value.name.toLowerCase() === "google" ||
- value.name.toLowerCase() === "apple" && (
+ (value.name.toLowerCase() === "apple" && (
<i className={"bi-" + value.name.toLowerCase()}></i>
- )}
+ ))}
{value.name}
</Button>
</React.Fragment>
diff --git a/pages/public/collections/[id].tsx b/pages/public/collections/[id].tsx
index 5ce0f419..4eb0b8de 100644
--- a/pages/public/collections/[id].tsx
+++ b/pages/public/collections/[id].tsx
@@ -37,7 +37,9 @@ export default function PublicCollections() {
const router = useRouter();
- const [collectionOwner, setCollectionOwner] = useState<Partial<AccountSettings>>({});
+ const [collectionOwner, setCollectionOwner] = useState<
+ Partial<AccountSettings>
+ >({});
const [searchFilter, setSearchFilter] = useState({
name: true,
@@ -103,8 +105,9 @@ export default function PublicCollections() {
<div
className="h-96"
style={{
- backgroundImage: `linear-gradient(${collection?.color}30 10%, ${settings.theme === "dark" ? "#262626" : "#f3f4f6"
- } 13rem, ${settings.theme === "dark" ? "#171717" : "#ffffff"} 100%)`,
+ backgroundImage: `linear-gradient(${collection?.color}30 10%, ${
+ settings.theme === "dark" ? "#262626" : "#f3f4f6"
+ } 13rem, ${settings.theme === "dark" ? "#171717" : "#ffffff"} 100%)`,
}}
>
{collection && (
@@ -175,20 +178,20 @@ export default function PublicCollections() {
<p className="text-neutral text-sm">
{collection.members.length > 0 &&
- collection.members.length === 1
+ collection.members.length === 1
? t("by_author_and_other", {
- author: collectionOwner.name,
- count: collection.members.length,
- })
- : collection.members.length > 0 &&
- collection.members.length !== 1
- ? t("by_author_and_others", {
author: collectionOwner.name,
count: collection.members.length,
})
+ : collection.members.length > 0 &&
+ collection.members.length !== 1
+ ? t("by_author_and_others", {
+ author: collectionOwner.name,
+ count: collection.members.length,
+ })
: t("by_author", {
- author: collectionOwner.name,
- })}
+ author: collectionOwner.name,
+ })}
</p>
</div>
</div>
@@ -212,11 +215,11 @@ export default function PublicCollections() {
placeholder={
collection._count?.links === 1
? t("search_count_link", {
- count: collection._count?.links,
- })
+ count: collection._count?.links,
+ })
: t("search_count_links", {
- count: collection._count?.links,
- })
+ count: collection._count?.links,
+ })
}
/>
</LinkListOptions>
diff --git a/pages/register.tsx b/pages/register.tsx
index 6e7fc1e9..282558b4 100644
--- a/pages/register.tsx
+++ b/pages/register.tsx
@@ -133,9 +133,9 @@ export default function Register({
loading={submitLoader}
>
{value.name.toLowerCase() === "google" ||
- value.name.toLowerCase() === "apple" && (
+ (value.name.toLowerCase() === "apple" && (
<i className={"bi-" + value.name.toLowerCase()}></i>
- )}
+ ))}
{value.name}
</Button>
</React.Fragment>
@@ -149,8 +149,8 @@ export default function Register({
text={
process.env.NEXT_PUBLIC_STRIPE
? t("trial_offer_desc", {
- count: Number(process.env.NEXT_PUBLIC_TRIAL_PERIOD_DAYS || 14),
- })
+ count: Number(process.env.NEXT_PUBLIC_TRIAL_PERIOD_DAYS || 14),
+ })
: t("register_desc")
}
data-testid="registration-form"
diff --git a/pages/settings/account.tsx b/pages/settings/account.tsx
index 04842141..0939d124 100644
--- a/pages/settings/account.tsx
+++ b/pages/settings/account.tsx
@@ -29,19 +29,19 @@ export default function Account() {
!objectIsEmpty(account)
? account
: ({
- // @ts-ignore
- id: null,
- name: "",
- username: "",
- email: "",
- emailVerified: null,
- password: undefined,
- image: "",
- isPrivate: true,
- // @ts-ignore
- createdAt: null,
- whitelistedUsers: [],
- } as unknown as AccountSettings)
+ // @ts-ignore
+ id: null,
+ name: "",
+ username: "",
+ email: "",
+ emailVerified: null,
+ password: undefined,
+ image: "",
+ isPrivate: true,
+ // @ts-ignore
+ createdAt: null,
+ whitelistedUsers: [],
+ } as unknown as AccountSettings)
);
const { t } = useTranslation();
@@ -102,7 +102,10 @@ export default function Account() {
setSubmitLoader(false);
};
- const importBookmarks = async (e: ChangeEvent<HTMLInputElement>, format: MigrationFormat) => {
+ const importBookmarks = async (
+ e: ChangeEvent<HTMLInputElement>,
+ format: MigrationFormat
+ ) => {
setSubmitLoader(true);
const file = e.target.files?.[0];
@@ -421,7 +424,8 @@ export default function Account() {
<p>
{t("delete_account_warning")}
- {process.env.NEXT_PUBLIC_STRIPE && " " + t("cancel_subscription_notice")}
+ {process.env.NEXT_PUBLIC_STRIPE &&
+ " " + t("cancel_subscription_notice")}
</p>
</div>
diff --git a/types/global.ts b/types/global.ts
index 3f5cae0d..3a7e6968 100644
--- a/types/global.ts
+++ b/types/global.ts
@@ -81,7 +81,7 @@ export enum Sort {
DescriptionZA,
}
-export type Order = { [key: string]: 'asc' | 'desc' };
+export type Order = { [key: string]: "asc" | "desc" };
export type LinkRequestQuery = {
sort: Sort;