Skip to content

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

format

Isaace024b324ed93
diff --git a/components/ConfirmationModal.tsx b/components/ConfirmationModal.tsx
index f34bba44..e58af7b1 100644
--- a/components/ConfirmationModal.tsx
+++ b/components/ConfirmationModal.tsx
@@ -45,5 +45,5 @@ export default function ConfirmationModal({
</Button>
</div>
</Modal>
- )
+ );
}
diff --git a/hooks/useArchivalTags.ts b/hooks/useArchivalTags.ts
index 62b98573..9f3850b5 100644
--- a/hooks/useArchivalTags.ts
+++ b/hooks/useArchivalTags.ts
@@ -83,14 +83,14 @@ const useArchivalTags = (initialTags: Tag[]) => {
prev.map((t) =>
t.label === tagToDelete.label
? {
- ...t,
- archiveAsScreenshot: null,
- archiveAsMonolith: null,
- archiveAsPDF: null,
- archiveAsReadable: null,
- archiveAsWaybackMachine: null,
- aiTag: null,
- }
+ ...t,
+ archiveAsScreenshot: null,
+ archiveAsMonolith: null,
+ archiveAsPDF: null,
+ archiveAsReadable: null,
+ archiveAsWaybackMachine: null,
+ aiTag: null,
+ }
: t
)
);
@@ -115,29 +115,29 @@ const useArchivalTags = (initialTags: Tag[]) => {
icon: string;
label: string;
}[] = [
- { type: "aiTag", icon: "bi-tag", label: t("ai_tagging") },
- {
- type: "archiveAsScreenshot",
- icon: "bi-file-earmark-image",
- label: t("screenshot"),
- },
- {
- type: "archiveAsMonolith",
- icon: "bi-filetype-html",
- label: t("webpage"),
- },
- { type: "archiveAsPDF", icon: "bi-file-earmark-pdf", label: t("pdf") },
- {
- type: "archiveAsReadable",
- icon: "bi-file-earmark-text",
- label: t("readable"),
- },
- {
- type: "archiveAsWaybackMachine",
- icon: "bi-archive",
- label: t("archive_org_snapshot"),
- },
- ];
+ { type: "aiTag", icon: "bi-tag", label: t("ai_tagging") },
+ {
+ type: "archiveAsScreenshot",
+ icon: "bi-file-earmark-image",
+ label: t("screenshot"),
+ },
+ {
+ type: "archiveAsMonolith",
+ icon: "bi-filetype-html",
+ label: t("webpage"),
+ },
+ { type: "archiveAsPDF", icon: "bi-file-earmark-pdf", label: t("pdf") },
+ {
+ type: "archiveAsReadable",
+ icon: "bi-file-earmark-text",
+ label: t("readable"),
+ },
+ {
+ type: "archiveAsWaybackMachine",
+ icon: "bi-archive",
+ label: t("archive_org_snapshot"),
+ },
+ ];
return {
ARCHIVAL_OPTIONS,
diff --git a/lib/api/controllers/tags/createOrUpdateTags.ts b/lib/api/controllers/tags/createOrUpdateTags.ts
index 3d010450..cec9410f 100644
--- a/lib/api/controllers/tags/createOrUpdateTags.ts
+++ b/lib/api/controllers/tags/createOrUpdateTags.ts
@@ -1,48 +1,46 @@
-
-
import { prisma } from "@/lib/api/db";
import { PostTagSchemaType } from "@/lib/shared/schemaValidation";
import { TagIncludingLinkCount } from "@/types/global";
export default async function createOrUpdateTags(
- userId: number,
- tags: PostTagSchemaType["tags"]
+ userId: number,
+ tags: PostTagSchemaType["tags"]
): Promise<TagIncludingLinkCount[]> {
- const updatedTags: TagIncludingLinkCount[] = [];
+ const updatedTags: TagIncludingLinkCount[] = [];
- for (const tag of tags) {
- const updatedTag = await prisma.tag.upsert({
- where: {
- name_ownerId: {
- name: tag.label,
- ownerId: userId,
- },
- },
- update: {
- archiveAsScreenshot: tag.archiveAsScreenshot,
- archiveAsMonolith: tag.archiveAsMonolith,
- archiveAsPDF: tag.archiveAsPDF,
- archiveAsReadable: tag.archiveAsReadable,
- archiveAsWaybackMachine: tag.archiveAsWaybackMachine,
- aiTag: tag.aiTag,
- },
- create: {
- name: tag.label,
- ownerId: userId,
- archiveAsScreenshot: tag.archiveAsScreenshot,
- archiveAsMonolith: tag.archiveAsMonolith,
- archiveAsPDF: tag.archiveAsPDF,
- archiveAsReadable: tag.archiveAsReadable,
- archiveAsWaybackMachine: tag.archiveAsWaybackMachine,
- aiTag: tag.aiTag,
- },
- include: {
- _count: true,
- },
- });
+ for (const tag of tags) {
+ const updatedTag = await prisma.tag.upsert({
+ where: {
+ name_ownerId: {
+ name: tag.label,
+ ownerId: userId,
+ },
+ },
+ update: {
+ archiveAsScreenshot: tag.archiveAsScreenshot,
+ archiveAsMonolith: tag.archiveAsMonolith,
+ archiveAsPDF: tag.archiveAsPDF,
+ archiveAsReadable: tag.archiveAsReadable,
+ archiveAsWaybackMachine: tag.archiveAsWaybackMachine,
+ aiTag: tag.aiTag,
+ },
+ create: {
+ name: tag.label,
+ ownerId: userId,
+ archiveAsScreenshot: tag.archiveAsScreenshot,
+ archiveAsMonolith: tag.archiveAsMonolith,
+ archiveAsPDF: tag.archiveAsPDF,
+ archiveAsReadable: tag.archiveAsReadable,
+ archiveAsWaybackMachine: tag.archiveAsWaybackMachine,
+ aiTag: tag.aiTag,
+ },
+ include: {
+ _count: true,
+ },
+ });
- updatedTags.push(updatedTag);
- }
+ updatedTags.push(updatedTag);
+ }
- return updatedTags;
+ return updatedTags;
}
diff --git a/lib/shared/schemaValidation.ts b/lib/shared/schemaValidation.ts
index b9b91ef4..cf7184fd 100644
--- a/lib/shared/schemaValidation.ts
+++ b/lib/shared/schemaValidation.ts
@@ -41,12 +41,12 @@ export const PostUserSchema = () => {
username: emailEnabled
? z.string().optional()
: z
- .string()
- .trim()
- .toLowerCase()
- .min(3)
- .max(50)
- .regex(/^[a-z0-9_-]{3,50}$/),
+ .string()
+ .trim()
+ .toLowerCase()
+ .min(3)
+ .max(50)
+ .regex(/^[a-z0-9_-]{3,50}$/),
invite: z.boolean().optional(),
});
};
diff --git a/pages/api/v1/links/[id]/archive/index.ts b/pages/api/v1/links/[id]/archive/index.ts
index 9c1199fc..3edf82c1 100644
--- a/pages/api/v1/links/[id]/archive/index.ts
+++ b/pages/api/v1/links/[id]/archive/index.ts
@@ -48,14 +48,15 @@ export default async function links(req: NextApiRequest, res: NextApiResponse) {
if (
link?.lastPreserved &&
getTimezoneDifferenceInMinutes(new Date(), link?.lastPreserved) <
- RE_ARCHIVE_LIMIT
+ RE_ARCHIVE_LIMIT
)
return res.status(400).json({
- response: `This link is currently being saved or has already been preserved. Please retry in ${RE_ARCHIVE_LIMIT -
+ response: `This link is currently being saved or has already been preserved. Please retry in ${
+ RE_ARCHIVE_LIMIT -
Math.floor(
getTimezoneDifferenceInMinutes(new Date(), link?.lastPreserved)
)
- } minutes or create a new one.`,
+ } minutes or create a new one.`,
});
if (!link.url || !isValidUrl(link.url))
diff --git a/pages/api/v1/links/archive/index.ts b/pages/api/v1/links/archive/index.ts
index c83b05d1..81ea2b9a 100644
--- a/pages/api/v1/links/archive/index.ts
+++ b/pages/api/v1/links/archive/index.ts
@@ -23,8 +23,9 @@ export default async function links(req: NextApiRequest, res: NextApiResponse) {
const dataValidation = LinkArchiveActionSchema.safeParse(req.body);
if (!dataValidation.success) {
return res.status(400).json({
- response: `Error: ${dataValidation.error.issues[0].message
- } [${dataValidation.error.issues[0].path.join(", ")}]`,
+ response: `Error: ${
+ dataValidation.error.issues[0].message
+ } [${dataValidation.error.issues[0].path.join(", ")}]`,
});
}
@@ -100,24 +101,24 @@ export default async function links(req: NextApiRequest, res: NextApiResponse) {
> =
archivalTags.length > 0
? {
- archiveAsScreenshot: archivalTags.some(
- (tag) => tag.archiveAsScreenshot
- ),
- archiveAsMonolith: archivalTags.some(
- (tag) => tag.archiveAsMonolith
- ),
- archiveAsPDF: archivalTags.some((tag) => tag.archiveAsPDF),
- archiveAsReadable: archivalTags.some(
- (tag) => tag.archiveAsReadable
- ),
- }
+ archiveAsScreenshot: archivalTags.some(
+ (tag) => tag.archiveAsScreenshot
+ ),
+ archiveAsMonolith: archivalTags.some(
+ (tag) => tag.archiveAsMonolith
+ ),
+ archiveAsPDF: archivalTags.some((tag) => tag.archiveAsPDF),
+ archiveAsReadable: archivalTags.some(
+ (tag) => tag.archiveAsReadable
+ ),
+ }
: {
- archiveAsScreenshot:
- link.createdBy?.archiveAsScreenshot || false,
- archiveAsMonolith: link.createdBy?.archiveAsMonolith || false,
- archiveAsPDF: link.createdBy?.archiveAsPDF || false,
- archiveAsReadable: link.createdBy?.archiveAsReadable || false,
- };
+ archiveAsScreenshot:
+ link.createdBy?.archiveAsScreenshot || false,
+ archiveAsMonolith: link.createdBy?.archiveAsMonolith || false,
+ archiveAsPDF: link.createdBy?.archiveAsPDF || false,
+ archiveAsReadable: link.createdBy?.archiveAsReadable || false,
+ };
const needsReprocessing =
(link.image === "unavailable" && shouldArchive.archiveAsScreenshot) ||
@@ -132,7 +133,7 @@ export default async function links(req: NextApiRequest, res: NextApiResponse) {
data: {
image:
shouldArchive.archiveAsScreenshot &&
- link.image === "unavailable"
+ link.image === "unavailable"
? null
: link.image,
pdf:
@@ -141,12 +142,12 @@ export default async function links(req: NextApiRequest, res: NextApiResponse) {
: link.pdf,
readable:
shouldArchive.archiveAsReadable &&
- link.readable === "unavailable"
+ link.readable === "unavailable"
? null
: link.readable,
monolith:
shouldArchive.archiveAsMonolith &&
- link.monolith === "unavailable"
+ link.monolith === "unavailable"
? null
: link.monolith,
},
diff --git a/pages/api/v1/rss/index.ts b/pages/api/v1/rss/index.ts
index 28610c35..733570e0 100644
--- a/pages/api/v1/rss/index.ts
+++ b/pages/api/v1/rss/index.ts
@@ -33,8 +33,9 @@ export default async function handler(
if (!dataValidation.success) {
return res.status(400).json({
- response: `Error: ${dataValidation.error.issues[0].message
- } [${dataValidation.error.issues[0].path.join(", ")}]`,
+ response: `Error: ${
+ dataValidation.error.issues[0].message
+ } [${dataValidation.error.issues[0].path.join(", ")}]`,
});
}
diff --git a/pages/api/v1/tags/index.ts b/pages/api/v1/tags/index.ts
index 95b1bb23..adb92650 100644
--- a/pages/api/v1/tags/index.ts
+++ b/pages/api/v1/tags/index.ts
@@ -21,8 +21,9 @@ export default async function tags(req: NextApiRequest, res: NextApiResponse) {
if (!dataValidation.success) {
return res.status(400).json({
- response: `Error: ${dataValidation.error.issues[0].message
- } [${dataValidation.error.issues[0].path.join(", ")}]`,
+ response: `Error: ${
+ dataValidation.error.issues[0].message
+ } [${dataValidation.error.issues[0].path.join(", ")}]`,
});
}
diff --git a/pages/settings/preference.tsx b/pages/settings/preference.tsx
index 7e245d5c..a186d0b9 100644
--- a/pages/settings/preference.tsx
+++ b/pages/settings/preference.tsx
@@ -152,7 +152,7 @@ export default function Preference() {
newTag.archiveAsPDF !== originalTag.archiveAsPDF ||
newTag.archiveAsReadable !== originalTag.archiveAsReadable ||
newTag.archiveAsWaybackMachine !==
- originalTag.archiveAsWaybackMachine ||
+ originalTag.archiveAsWaybackMachine ||
newTag.aiTag !== originalTag.aiTag
);
});
@@ -211,10 +211,11 @@ export default function Preference() {
].map(({ theme, icon, bgColor, textColor, activeColor }) => (
<div
key={theme}
- className={`w-full text-center outline-solid outline-neutral-content outline h-20 duration-100 rounded-xl flex items-center justify-center cursor-pointer select-none ${bgColor} ${localStorage.getItem("theme") === theme
- ? `outline-primary ${activeColor}`
- : textColor
- }`}
+ className={`w-full text-center outline-solid outline-neutral-content outline h-20 duration-100 rounded-xl flex items-center justify-center cursor-pointer select-none ${bgColor} ${
+ localStorage.getItem("theme") === theme
+ ? `outline-primary ${activeColor}`
+ : textColor
+ }`}
onClick={() => updateSettings({ theme })}
>
<i className={`${icon} text-3xl`}></i>
@@ -355,8 +356,9 @@ export default function Preference() {
</div>
</div>
<div
- className={`mb-3 ${aiTaggingMethod === AiTaggingMethod.DISABLED ? "opacity-50" : ""
- }`}
+ className={`mb-3 ${
+ aiTaggingMethod === AiTaggingMethod.DISABLED ? "opacity-50" : ""
+ }`}
>
<Checkbox
label={t("generate_tags_for_existing_links")}
@@ -441,7 +443,11 @@ export default function Preference() {
</div>
</div>
<div className="p-3">
- <TagSelection isArchivalTagSelection onChange={addTags} options={options} />
+ <TagSelection
+ isArchivalTagSelection
+ onChange={addTags}
+ options={options}
+ />
<div className="flex flex-col gap-2">
{archivalTags &&
archivalTags.filter(isArchivalTag).map((tag) => (