Skip to content

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

added seed script + renamed table fields + added field

daniel31x1398106b9f25da
diff --git a/components/ModalContent/NewLinkModal.tsx b/components/ModalContent/NewLinkModal.tsx
index 50288f83..03deba09 100644
--- a/components/ModalContent/NewLinkModal.tsx
+++ b/components/ModalContent/NewLinkModal.tsx
@@ -25,9 +25,10 @@ export default function NewLinkModal({ onClose }: Props) {
description: "",
type: "url",
tags: [],
- screenshotPath: "",
- pdfPath: "",
- readabilityPath: "",
+ preview: "",
+ image: "",
+ pdf: "",
+ readable: "",
textContent: "",
collection: {
name: "",
diff --git a/components/ModalContent/PreservedFormatsModal.tsx b/components/ModalContent/PreservedFormatsModal.tsx
index 3a4929bd..b9b51c6e 100644
--- a/components/ModalContent/PreservedFormatsModal.tsx
+++ b/components/ModalContent/PreservedFormatsModal.tsx
@@ -70,12 +70,12 @@ export default function PreservedFormatsModal({ onClose, activeLink }: Props) {
const isReady = () => {
return (
collectionOwner.archiveAsScreenshot ===
- (link && link.pdfPath && link.pdfPath !== "pending") &&
+ (link && link.pdf && link.pdf !== "pending") &&
collectionOwner.archiveAsPDF ===
- (link && link.pdfPath && link.pdfPath !== "pending") &&
+ (link && link.pdf && link.pdf !== "pending") &&
link &&
- link.readabilityPath &&
- link.readabilityPath !== "pending"
+ link.readable &&
+ link.readable !== "pending"
);
};
@@ -107,7 +107,7 @@ export default function PreservedFormatsModal({ onClose, activeLink }: Props) {
clearInterval(interval);
}
};
- }, [link?.screenshotPath, link?.pdfPath, link?.readabilityPath]);
+ }, [link?.image, link?.pdf, link?.readable]);
const updateArchive = async () => {
const load = toast.loading("Sending request...");
@@ -154,7 +154,7 @@ export default function PreservedFormatsModal({ onClose, activeLink }: Props) {
name={"Screenshot"}
icon={"bi-file-earmark-image"}
format={
- link?.screenshotPath?.endsWith("png")
+ link?.image?.endsWith("png")
? ArchivedFormat.png
: ArchivedFormat.jpeg
}
diff --git a/components/ModalContent/UploadFileModal.tsx b/components/ModalContent/UploadFileModal.tsx
index f45f40d3..497bc91e 100644
--- a/components/ModalContent/UploadFileModal.tsx
+++ b/components/ModalContent/UploadFileModal.tsx
@@ -27,9 +27,10 @@ export default function UploadFileModal({ onClose }: Props) {
description: "",
type: "url",
tags: [],
- screenshotPath: "",
- pdfPath: "",
- readabilityPath: "",
+ preview: "",
+ image: "",
+ pdf: "",
+ readable: "",
textContent: "",
collection: {
name: "",
diff --git a/components/PreserverdFormatRow.tsx b/components/PreserverdFormatRow.tsx
index 393bee82..d88ec90e 100644
--- a/components/PreserverdFormatRow.tsx
+++ b/components/PreserverdFormatRow.tsx
@@ -43,7 +43,7 @@ export default function PreservedFormatRow({
})();
let interval: any;
- if (link?.screenshotPath === "pending" || link?.pdfPath === "pending") {
+ if (link?.image === "pending" || link?.pdf === "pending") {
interval = setInterval(async () => {
const data = await getLink(link.id as number, isPublic);
setLink(
@@ -61,7 +61,7 @@ export default function PreservedFormatRow({
clearInterval(interval);
}
};
- }, [link?.screenshotPath, link?.pdfPath, link?.readabilityPath]);
+ }, [link?.image, link?.pdf, link?.readable]);
const handleDownload = () => {
const path = `/api/v1/archives/${link?.id}?format=${format}`;
diff --git a/components/ReadableView.tsx b/components/ReadableView.tsx
index 92ad9a00..f8eb3b67 100644
--- a/components/ReadableView.tsx
+++ b/components/ReadableView.tsx
@@ -62,12 +62,12 @@ export default function ReadableView({ link }: Props) {
let interval: any;
if (
link &&
- (link?.screenshotPath === "pending" ||
- link?.pdfPath === "pending" ||
- link?.readabilityPath === "pending" ||
- !link?.screenshotPath ||
- !link?.pdfPath ||
- !link?.readabilityPath)
+ (link?.image === "pending" ||
+ link?.pdf === "pending" ||
+ link?.readable === "pending" ||
+ !link?.image ||
+ !link?.pdf ||
+ !link?.readable)
) {
interval = setInterval(() => getLink(link.id as number), 5000);
} else {
@@ -81,7 +81,7 @@ export default function ReadableView({ link }: Props) {
clearInterval(interval);
}
};
- }, [link?.screenshotPath, link?.pdfPath, link?.readabilityPath]);
+ }, [link?.image, link?.pdf, link?.readable]);
const rgbToHex = (r: number, g: number, b: number): string =>
"#" +
@@ -225,7 +225,7 @@ export default function ReadableView({ link }: Props) {
</div>
<div className="flex flex-col gap-5 h-full">
- {link?.readabilityPath?.startsWith("archives") ? (
+ {link?.readable?.startsWith("archives") ? (
<div
className="line-break px-1 reader-view"
dangerouslySetInnerHTML={{
@@ -235,9 +235,7 @@ export default function ReadableView({ link }: Props) {
) : (
<div
className={`w-full h-full flex flex-col justify-center p-10 ${
- link?.readabilityPath === "pending" || !link?.readabilityPath
- ? "skeleton"
- : ""
+ link?.readable === "pending" || !link?.readable ? "skeleton" : ""
}`}
>
<svg
diff --git a/lib/api/archiveHandler.ts b/lib/api/archiveHandler.ts
index 037b42de..889cedcb 100644
--- a/lib/api/archiveHandler.ts
+++ b/lib/api/archiveHandler.ts
@@ -46,18 +46,15 @@ export default async function archiveHandler(link: LinksAndCollectionAndOwner) {
where: { id: link.id },
data: {
type: linkType,
- screenshotPath:
- user.archiveAsScreenshot &&
- !link.screenshotPath?.startsWith("archive")
+ image:
+ user.archiveAsScreenshot && !link.image?.startsWith("archive")
? "pending"
: undefined,
- pdfPath:
- user.archiveAsPDF && !link.pdfPath?.startsWith("archive")
+ pdf:
+ user.archiveAsPDF && !link.pdf?.startsWith("archive")
? "pending"
: undefined,
- readabilityPath: !link.readabilityPath?.startsWith("archive")
- ? "pending"
- : undefined,
+ readable: !link.readable?.startsWith("archive") ? "pending" : undefined,
lastPreserved: new Date().toISOString(),
},
});
@@ -107,7 +104,7 @@ export default async function archiveHandler(link: LinksAndCollectionAndOwner) {
await prisma.link.update({
where: { id: link.id },
data: {
- readabilityPath: `archives/${targetLink.collectionId}/${link.id}_readability.json`,
+ readable: `archives/${targetLink.collectionId}/${link.id}_readability.json`,
textContent: articleText,
},
});
@@ -156,10 +153,10 @@ export default async function archiveHandler(link: LinksAndCollectionAndOwner) {
await prisma.link.update({
where: { id: link.id },
data: {
- screenshotPath: user.archiveAsScreenshot
+ image: user.archiveAsScreenshot
? `archives/${linkExists.collectionId}/${link.id}.png`
: undefined,
- pdfPath: user.archiveAsPDF
+ pdf: user.archiveAsPDF
? `archives/${linkExists.collectionId}/${link.id}.pdf`
: undefined,
},
@@ -179,13 +176,13 @@ export default async function archiveHandler(link: LinksAndCollectionAndOwner) {
await prisma.link.update({
where: { id: link.id },
data: {
- readabilityPath: !finalLink.readabilityPath?.startsWith("archives")
+ readable: !finalLink.readable?.startsWith("archives")
? "unavailable"
: undefined,
- screenshotPath: !finalLink.screenshotPath?.startsWith("archives")
+ image: !finalLink.image?.startsWith("archives")
? "unavailable"
: undefined,
- pdfPath: !finalLink.pdfPath?.startsWith("archives")
+ pdf: !finalLink.pdf?.startsWith("archives")
? "unavailable"
: undefined,
},
@@ -245,7 +242,7 @@ const imageHandler = async ({ url, id }: Link, extension: string) => {
await prisma.link.update({
where: { id },
data: {
- screenshotPath: `archives/${linkExists.collectionId}/${id}.${extension}`,
+ image: `archives/${linkExists.collectionId}/${id}.${extension}`,
},
});
}
@@ -269,7 +266,7 @@ const pdfHandler = async ({ url, id }: Link) => {
await prisma.link.update({
where: { id },
data: {
- pdfPath: `archives/${linkExists.collectionId}/${id}.pdf`,
+ pdf: `archives/${linkExists.collectionId}/${id}.pdf`,
},
});
}
diff --git a/lib/shared/getArchiveValidity.ts b/lib/shared/getArchiveValidity.ts
index d2146d3f..b84535d6 100644
--- a/lib/shared/getArchiveValidity.ts
+++ b/lib/shared/getArchiveValidity.ts
@@ -1,26 +1,23 @@
export function screenshotAvailable(link: any) {
return (
link &&
- link.screenshotPath &&
- link.screenshotPath !== "pending" &&
- link.screenshotPath !== "unavailable"
+ link.image &&
+ link.image !== "pending" &&
+ link.image !== "unavailable"
);
}
export function pdfAvailable(link: any) {
return (
- link &&
- link.pdfPath &&
- link.pdfPath !== "pending" &&
- link.pdfPath !== "unavailable"
+ link && link.pdf && link.pdf !== "pending" && link.pdf !== "unavailable"
);
}
export function readabilityAvailable(link: any) {
return (
link &&
- link.readabilityPath &&
- link.readabilityPath !== "pending" &&
- link.readabilityPath !== "unavailable"
+ link.readable &&
+ link.readable !== "pending" &&
+ link.readable !== "unavailable"
);
}
diff --git a/package.json b/package.json
index 27bf41aa..e025244a 100644
--- a/package.json
+++ b/package.json
@@ -6,6 +6,9 @@
"author": "Daniel31X13 <[email protected]>",
"license": "AGPL-3.0",
"private": true,
+ "prisma": {
+ "seed": "node ./prisma/seed.js"
+ },
"scripts": {
"dev": "next dev",
"worker": "ts-node --skip-project scripts/worker.ts",
diff --git a/pages/api/v1/archives/[linkId].ts b/pages/api/v1/archives/[linkId].ts
index 07760be7..d36c6a4a 100644
--- a/pages/api/v1/archives/[linkId].ts
+++ b/pages/api/v1/archives/[linkId].ts
@@ -125,7 +125,7 @@ export default async function Index(req: NextApiRequest, res: NextApiResponse) {
// await prisma.link.update({
// where: { id: linkId },
// data: {
- // screenshotPath: `archives/${collectionPermissions?.id}/${
+ // image: `archives/${collectionPermissions?.id}/${
// linkId + suffix
// }`,
// lastPreserved: new Date().toISOString(),
diff --git a/pages/api/v1/auth/[...nextauth].ts b/pages/api/v1/auth/[...nextauth].ts
index b18a3fbe..40ee66c4 100644
--- a/pages/api/v1/auth/[...nextauth].ts
+++ b/pages/api/v1/auth/[...nextauth].ts
@@ -1,20 +1,22 @@
-import {prisma} from "@/lib/api/db";
+import { prisma } from "@/lib/api/db";
import NextAuth from "next-auth/next";
import CredentialsProvider from "next-auth/providers/credentials";
-import {AuthOptions} from "next-auth";
+import { AuthOptions } from "next-auth";
import bcrypt from "bcrypt";
import EmailProvider from "next-auth/providers/email";
-import {PrismaAdapter} from "@auth/prisma-adapter";
-import {Adapter} from "next-auth/adapters";
+import { PrismaAdapter } from "@auth/prisma-adapter";
+import { Adapter } from "next-auth/adapters";
import sendVerificationRequest from "@/lib/api/sendVerificationRequest";
-import {Provider} from "next-auth/providers";
+import { Provider } from "next-auth/providers";
import verifySubscription from "@/lib/api/verifySubscription";
import FortyTwoProvider from "next-auth/providers/42-school";
import AppleProvider from "next-auth/providers/apple";
import AtlassianProvider from "next-auth/providers/atlassian";
import Auth0Provider from "next-auth/providers/auth0";
import AuthentikProvider from "next-auth/providers/authentik";
-import BattleNetProvider, {BattleNetIssuer} from "next-auth/providers/battlenet";
+import BattleNetProvider, {
+ BattleNetIssuer,
+} from "next-auth/providers/battlenet";
import BoxProvider from "next-auth/providers/box";
import CognitoProvider from "next-auth/providers/cognito";
import CoinbaseProvider from "next-auth/providers/coinbase";
@@ -61,22 +63,24 @@ import WordpressProvider from "next-auth/providers/wordpress";
import YandexProvider from "next-auth/providers/yandex";
import ZitadelProvider from "next-auth/providers/zitadel";
import ZohoProvider from "next-auth/providers/zoho";
-import ZoomProvider from "next-auth/providers/zoom"
+import ZoomProvider from "next-auth/providers/zoom";
import * as process from "process";
const emailEnabled =
process.env.EMAIL_FROM && process.env.EMAIL_SERVER ? true : false;
-const newSsoUsersDisabled = process.env.DISABLE_NEW_SSO_USERS === 'true';
-;
-
+const newSsoUsersDisabled = process.env.DISABLE_NEW_SSO_USERS === "true";
const adapter = PrismaAdapter(prisma);
const STRIPE_SECRET_KEY = process.env.STRIPE_SECRET_KEY;
const providers: Provider[] = [];
-if (process.env.NEXT_PUBLIC_CREDENTIALS_ENABLED === 'true' || process.env.NEXT_PUBLIC_CREDENTIALS_ENABLED === undefined) { // undefined is for backwards compatibility
+if (
+ process.env.NEXT_PUBLIC_CREDENTIALS_ENABLED === "true" ||
+ process.env.NEXT_PUBLIC_CREDENTIALS_ENABLED === undefined
+) {
+ // undefined is for backwards compatibility
providers.push(
CredentialsProvider({
type: "credentials",
@@ -85,7 +89,7 @@ if (process.env.NEXT_PUBLIC_CREDENTIALS_ENABLED === 'true' || process.env.NEXT_P
console.log("User log in attempt...");
if (!credentials) return null;
- const {username, password} = credentials as {
+ const { username, password } = credentials as {
username: string;
password: string;
};
@@ -93,19 +97,19 @@ if (process.env.NEXT_PUBLIC_CREDENTIALS_ENABLED === 'true' || process.env.NEXT_P
const user = await prisma.user.findFirst({
where: emailEnabled
? {
- OR: [
- {
- username: username.toLowerCase(),
- },
- {
- email: username?.toLowerCase(),
- },
- ],
- emailVerified: {not: null},
- }
+ OR: [
+ {
+ username: username.toLowerCase(),
+ },
+ {
+ email: username?.toLowerCase(),
+ },
+ ],
+ emailVerified: { not: null },
+ }
: {
- username: username.toLowerCase(),
- },
+ username: username.toLowerCase(),
+ },
});
let passwordMatches: boolean = false;
@@ -115,11 +119,11 @@ if (process.env.NEXT_PUBLIC_CREDENTIALS_ENABLED === 'true' || process.env.NEXT_P
}
if (passwordMatches) {
- return {id: user?.id};
+ return { id: user?.id };
} else return null as any;
},
})
- )
+ );
}
if (emailEnabled) {
@@ -136,7 +140,7 @@ if (emailEnabled) {
}
// 42 School
-if (process.env.NEXT_PUBLIC_FORTYTWO_ENABLED === 'true') {
+if (process.env.NEXT_PUBLIC_FORTYTWO_ENABLED === "true") {
providers.push(
FortyTwoProvider({
id: "42-school",
@@ -150,20 +154,20 @@ if (process.env.NEXT_PUBLIC_FORTYTWO_ENABLED === 'true') {
email: profile.email,
image: profile.image_url,
username: profile.id.toString(),
- }
+ };
},
})
);
const _linkAccount = adapter.linkAccount;
adapter.linkAccount = (account) => {
- const {"not-before-policy": _, refresh_expires_in, ...data} = account;
+ const { "not-before-policy": _, refresh_expires_in, ...data } = account;
return _linkAccount ? _linkAccount(data) : undefined;
- }
+ };
}
// Apple
-if (process.env.NEXT_PUBLIC_APPLE_ENABLED === 'true') {
+if (process.env.NEXT_PUBLIC_APPLE_ENABLED === "true") {
providers.push(
AppleProvider({
clientId: process.env.APPLE_CLIENT_ID!,
@@ -175,29 +179,29 @@ if (process.env.NEXT_PUBLIC_APPLE_ENABLED === 'true') {
email: profile.email,
image: null,
username: profile.sub,
- }
+ };
},
-
})
);
const _linkAccount = adapter.linkAccount;
adapter.linkAccount = (account) => {
- const {"not-before-policy": _, refresh_expires_in, ...data} = account;
+ const { "not-before-policy": _, refresh_expires_in, ...data } = account;
return _linkAccount ? _linkAccount(data) : undefined;
- }
+ };
}
// Atlassian
-if (process.env.NEXT_PUBLIC_ATLASSIAN_ENABLED === 'true') {
+if (process.env.NEXT_PUBLIC_ATLASSIAN_ENABLED === "true") {
providers.push(
AtlassianProvider({
clientId: process.env.ATLASSIAN_CLIENT_ID!,
clientSecret: process.env.ATLASSIAN_CLIENT_SECRET!,
authorization: {
params: {
- scope: "write:jira-work read:jira-work read:jira-user offline_access read:me"
- }
+ scope:
+ "write:jira-work read:jira-work read:jira-user offline_access read:me",
+ },
},
profile(profile) {
return {
@@ -206,37 +210,37 @@ if (process.env.NEXT_PUBLIC_ATLASSIAN_ENABLED === 'true') {
email: profile.email,
image: profile.picture,
username: profile.account_id,
- }
+ };
},
})
);
const _linkAccount = adapter.linkAccount;
adapter.linkAccount = (account) => {
- const {"not-before-policy": _, refresh_expires_in, ...data} = account;
+ const { "not-before-policy": _, refresh_expires_in, ...data } = account;
return _linkAccount ? _linkAccount(data) : undefined;
- }
+ };
}
// Auth0
-if(process.env.NEXT_PUBLIC_AUTH0_ENABLED === 'true') {
+if (process.env.NEXT_PUBLIC_AUTH0_ENABLED === "true") {
providers.push(
Auth0Provider({
clientId: process.env.AUTH0_CLIENT_ID!,
clientSecret: process.env.AUTH0_CLIENT_SECRET!,
- issuer: process.env.AUTH0_ISSUER
+ issuer: process.env.AUTH0_ISSUER,
})
);
const _linkAccount = adapter.linkAccount;
adapter.linkAccount = (account) => {
- const {"not-before-policy": _, refresh_expires_in, ...data} = account;
+ const { "not-before-policy": _, refresh_expires_in, ...data } = account;
return _linkAccount ? _linkAccount(data) : undefined;
- }
+ };
}
// Authentik
-if (process.env.NEXT_PUBLIC_AUTHENTIK_ENABLED === 'true') {
+if (process.env.NEXT_PUBLIC_AUTHENTIK_ENABLED === "true") {
providers.push(
AuthentikProvider({
clientId: process.env.AUTHENTIK_CLIENT_ID!,
@@ -255,46 +259,46 @@ if (process.env.NEXT_PUBLIC_AUTHENTIK_ENABLED === 'true') {
const _linkAccount = adapter.linkAccount;
adapter.linkAccount = (account) => {
- const {"not-before-policy": _, refresh_expires_in, ...data} = account;
+ const { "not-before-policy": _, refresh_expires_in, ...data } = account;
return _linkAccount ? _linkAccount(data) : undefined;
- }
+ };
}
// Battle.net
-if(process.env.NEXT_PUBLIC_BATTLENET_ENABLED === 'true') {
+if (process.env.NEXT_PUBLIC_BATTLENET_ENABLED === "true") {
providers.push(
BattleNetProvider({
clientId: process.env.BATTLENET_CLIENT_ID!,
clientSecret: process.env.BATTLENET_CLIENT_SECRET!,
- issuer: process.env.BATLLENET_ISSUER as BattleNetIssuer
+ issuer: process.env.BATLLENET_ISSUER as BattleNetIssuer,
})
);
const _linkAccount = adapter.linkAccount;
adapter.linkAccount = (account) => {
- const {"not-before-policy": _, refresh_expires_in, ...data} = account;
+ const { "not-before-policy": _, refresh_expires_in, ...data } = account;
return _linkAccount ? _linkAccount(data) : undefined;
- }
+ };
}
// Box
-if(process.env.NEXT_PUBLIC_BOX_ENABLED === 'true') {
+if (process.env.NEXT_PUBLIC_BOX_ENABLED === "true") {
providers.push(
BoxProvider({
clientId: process.env.BOX_CLIENT_ID,
- clientSecret: process.env.BOX_CLIENT_SECRET
+ clientSecret: process.env.BOX_CLIENT_SECRET,
})
);
const _linkAccount = adapter.linkAccount;
adapter.linkAccount = (account) => {
- const {"not-before-policy": _, refresh_expires_in, ...data} = account;
+ const { "not-before-policy": _, refresh_expires_in, ...data } = account;
return _linkAccount ? _linkAccount(data) : undefined;
- }
+ };
}
// Cognito
-if(process.env.NEXT_PUBLIC_COGNITO_ENABLED === 'true') {
+if (process.env.NEXT_PUBLIC_COGNITO_ENABLED === "true") {
providers.push(
CognitoProvider({
clientId: process.env.COGNITO_CLIENT_ID!,
@@ -305,61 +309,61 @@ if(process.env.NEXT_PUBLIC_COGNITO_ENABLED === 'true') {
const _linkAccount = adapter.linkAccount;
adapter.linkAccount = (account) => {
- const {"not-before-policy": _, refresh_expires_in, ...data} = account;
+ const { "not-before-policy": _, refresh_expires_in, ...data } = account;
return _linkAccount ? _linkAccount(data) : undefined;
- }
+ };
}
// Coinbase
-if(process.env.NEXT_PUBLIC_COINBASE_ENABLED === 'true') {
+if (process.env.NEXT_PUBLIC_COINBASE_ENABLED === "true") {
providers.push(
CoinbaseProvider({
clientId: process.env.COINBASE_CLIENT_ID,
- clientSecret: process.env.COINBASE_CLIENT_SECRET
+ clientSecret: process.env.COINBASE_CLIENT_SECRET,
})
);
const _linkAccount = adapter.linkAccount;
adapter.linkAccount = (account) => {
- const {"not-before-policy": _, refresh_expires_in, ...data} = account;
+ const { "not-before-policy": _, refresh_expires_in, ...data } = account;
return _linkAccount ? _linkAccount(data) : undefined;
- }
+ };
}
// Discord
-if(process.env.NEXT_PUBLIC_DISCORD_ENABLED === 'true') {
+if (process.env.NEXT_PUBLIC_DISCORD_ENABLED === "true") {
providers.push(
DiscordProvider({
clientId: process.env.DISCORD_CLIENT_ID!,
- clientSecret: process.env.DISCORD_CLIENT_SECRET!
+ clientSecret: process.env.DISCORD_CLIENT_SECRET!,
})
);
const _linkAccount = adapter.linkAccount;
adapter.linkAccount = (account) => {
- const {"not-before-policy": _, refresh_expires_in, ...data} = account;
+ const { "not-before-policy": _, refresh_expires_in, ...data } = account;
return _linkAccount ? _linkAccount(data) : undefined;
- }
+ };
}
// Dropbox
-if(process.env.NEXT_PUBLIC_DROPBOX_ENABLED === 'true') {
+if (process.env.NEXT_PUBLIC_DROPBOX_ENABLED === "true") {
providers.push(
DropboxProvider({
clientId: process.env.DROPBOX_CLIENT_ID,
- clientSecret: process.env.DROPBOX_CLIENT_SECRET
+ clientSecret: process.env.DROPBOX_CLIENT_SECRET,
})
);
const _linkAccount = adapter.linkAccount;
adapter.linkAccount = (account) => {
- const {"not-before-policy": _, refresh_expires_in, ...data} = account;
+ const { "not-before-policy": _, refresh_expires_in, ...data } = account;
return _linkAccount ? _linkAccount(data) : undefined;
- }
+ };
}
// Duende IdentityServer6
-if(process.env.NEXT_PUBLIC_DUENDE_IDS6_ENABLED === 'true') {
+if (process.env.NEXT_PUBLIC_DUENDE_IDS6_ENABLED === "true") {
providers.push(
DuendeIDS6Provider({
clientId: process.env.DUENDE_IDS6_ID!,
@@ -370,78 +374,78 @@ if(process.env.NEXT_PUBLIC_DUENDE_IDS6_ENABLED === 'true') {
const _linkAccount = adapter.linkAccount;
adapter.linkAccount = (account) => {
- const {"not-before-policy": _, refresh_expires_in, ...data} = account;
+ const { "not-before-policy": _, refresh_expires_in, ...data } = account;
return _linkAccount ? _linkAccount(data) : undefined;
- }
+ };
}
// EVE Online
-if(process.env.NEXT_PUBLIC_EVEONLINE_ENABLED === 'true') {
+if (process.env.NEXT_PUBLIC_EVEONLINE_ENABLED === "true") {
providers.push(
EVEOnlineProvider({
clientId: process.env.EVE_CLIENT_ID!,
- clientSecret: process.env.EVE_CLIENT_SECRET!
+ clientSecret: process.env.EVE_CLIENT_SECRET!,
})
);
const _linkAccount = adapter.linkAccount;
adapter.linkAccount = (account) => {
- const {"not-before-policy": _, refresh_expires_in, ...data} = account;
+ const { "not-before-policy": _, refresh_expires_in, ...data } = account;
return _linkAccount ? _linkAccount(data) : undefined;
- }
+ };
}
// Facebook
-if(process.env.NEXT_PUBLIC_FACEBOOK_ENABLED === 'true') {
+if (process.env.NEXT_PUBLIC_FACEBOOK_ENABLED === "true") {
providers.push(
FacebookProvider({
clientId: process.env.FACEBOOK_CLIENT_ID!,
- clientSecret: process.env.FACEBOOK_CLIENT_SECRET!
+ clientSecret: process.env.FACEBOOK_CLIENT_SECRET!,
})
);
const _linkAccount = adapter.linkAccount;
adapter.linkAccount = (account) => {
- const {"not-before-policy": _, refresh_expires_in, ...data} = account;
+ const { "not-before-policy": _, refresh_expires_in, ...data } = account;
return _linkAccount ? _linkAccount(data) : undefined;
- }
+ };
}
// FACEIT
-if(process.env.NEXT_PUBLIC_FACEIT_ENABLED === 'true') {
+if (process.env.NEXT_PUBLIC_FACEIT_ENABLED === "true") {
providers.push(
FaceItProvider({
clientId: process.env.FACEIT_CLIENT_ID,
- clientSecret: process.env.FACEIT_CLIENT_SECRET
+ clientSecret: process.env.FACEIT_CLIENT_SECRET,
})
);
const _linkAccount = adapter.linkAccount;
adapter.linkAccount = (account) => {
- const {"not-before-policy": _, refresh_expires_in, ...data} = account;
+ const { "not-before-policy": _, refresh_expires_in, ...data } = account;
return _linkAccount ? _linkAccount(data) : undefined;
- }
+ };
}
// Foursquare
-if(process.env.NEXT_PUBLIC_FOURSQUARE_ENABLED === 'true') {
+if (process.env.NEXT_PUBLIC_FOURSQUARE_ENABLED === "true") {
providers.push(
FourSquareProvider({
clientId: process.env.FOURSQUARE_CLIENT_ID,
clientSecret: process.env.FOURSQUARE_CLIENT_SECRET,
- apiVersion: process.env.FOURSQUARE_APIVERSION
+ apiVersion: process.env.FOURSQUARE_APIVERSION,
})
);
const _linkAccount = adapter.linkAccount;
adapter.linkAccount = (account) => {
- const {"not-before-policy": _, refresh_expires_in, ...data} = account;
+ const { "not-before-policy": _, refresh_expires_in, ...data } = account;
return _linkAccount ? _linkAccount(data) : undefined;
- }
+ };
}
// Freshbooks
-if(process.env.NEXT_PUBLIC_FRESHBOOKS_ENABLED === 'true') {
+if (process.env.NEXT_PUBLIC_FRESHBOOKS_ENABLED === "true") {
providers.push(
FreshbooksProvider({
clientId: process.env.FRESHBOOKS_CLIENT_ID,
@@ -451,132 +455,132 @@ if(process.env.NEXT_PUBLIC_FRESHBOOKS_ENABLED === 'true') {
const _linkAccount = adapter.linkAccount;
adapter.linkAccount = (account) => {
- const {"not-before-policy": _, refresh_expires_in, ...data} = account;
+ const { "not-before-policy": _, refresh_expires_in, ...data } = account;
return _linkAccount ? _linkAccount(data) : undefined;
- }
+ };
}
// FusionAuth
-if(process.env.NEXT_PUBLIC_FUSIONAUTH_ENABLED === 'true') {
+if (process.env.NEXT_PUBLIC_FUSIONAUTH_ENABLED === "true") {
providers.push(
FusionAuthProvider({
id: "fusionauth",
name: "FusionAuth",
- issuer: process.env.FUSIONAUTH_ISSUER,
+ issuer: process.env.FUSIONAUTH_ISSUER,
clientId: process.env.FUSIONAUTH_CLIENT_ID!,
clientSecret: process.env.FUSIONAUTH_SECRET!,
- tenantId: process.env.FUSIONAUTH_TENANT_ID
- }),
+ tenantId: process.env.FUSIONAUTH_TENANT_ID,
+ })
);
const _linkAccount = adapter.linkAccount;
adapter.linkAccount = (account) => {
- const {"not-before-policy": _, refresh_expires_in, ...data} = account;
+ const { "not-before-policy": _, refresh_expires_in, ...data } = account;
return _linkAccount ? _linkAccount(data) : undefined;
- }
+ };
}
// GitHub
-if(process.env.NEXT_PUBLIC_GITHUB_ENABLED === 'true') {
+if (process.env.NEXT_PUBLIC_GITHUB_ENABLED === "true") {
providers.push(
GitHubProvider({
clientId: process.env.GITHUB_ID!,
- clientSecret: process.env.GITHUB_SECRET!
+ clientSecret: process.env.GITHUB_SECRET!,
})
);
const _linkAccount = adapter.linkAccount;
adapter.linkAccount = (account) => {
- const {"not-before-policy": _, refresh_expires_in, ...data} = account;
+ const { "not-before-policy": _, refresh_expires_in, ...data } = account;
return _linkAccount ? _linkAccount(data) : undefined;
- }
+ };
}
// GitLab
-if(process.env.NEXT_PUBLIC_GITLAB_ENABLED === 'true') {
+if (process.env.NEXT_PUBLIC_GITLAB_ENABLED === "true") {
providers.push(
GitlabProvider({
clientId: process.env.GITLAB_CLIENT_ID!,
- clientSecret: process.env.GITLAB_CLIENT_SECRET!
+ clientSecret: process.env.GITLAB_CLIENT_SECRET!,
})
);
const _linkAccount = adapter.linkAccount;
adapter.linkAccount = (account) => {
- const {"not-before-policy": _, refresh_expires_in, ...data} = account;
+ const { "not-before-policy": _, refresh_expires_in, ...data } = account;
return _linkAccount ? _linkAccount(data) : undefined;
- }
+ };
}
// Google
-if(process.env.NEXT_PUBLIC_GOOGLE_ENABLED === 'true') {
+if (process.env.NEXT_PUBLIC_GOOGLE_ENABLED === "true") {
providers.push(
GoogleProvider({
clientId: process.env.GOOGLE_CLIENT_ID!,
- clientSecret: process.env.GOOGLE_CLIENT_SECRET!
+ clientSecret: process.env.GOOGLE_CLIENT_SECRET!,
})
);
const _linkAccount = adapter.linkAccount;
adapter.linkAccount = (account) => {
- const {"not-before-policy": _, refresh_expires_in, ...data} = account;
+ const { "not-before-policy": _, refresh_expires_in, ...data } = account;
return _linkAccount ? _linkAccount(data) : undefined;
- }
+ };
}
// HubSpot
-if(process.env.NEXT_PUBLIC_HUBSPOT_ENABLED === 'true') {
+if (process.env.NEXT_PUBLIC_HUBSPOT_ENABLED === "true") {
providers.push(
HubspotProvider({
clientId: process.env.HUBSPOT_CLIENT_ID!,
- clientSecret: process.env.HUBSPOT_CLIENT_SECRET!
+ clientSecret: process.env.HUBSPOT_CLIENT_SECRET!,
})
);
const _linkAccount = adapter.linkAccount;
adapter.linkAccount = (account) => {
- const {"not-before-policy": _, refresh_expires_in, ...data} = account;
+ const { "not-before-policy": _, refresh_expires_in, ...data } = account;
return _linkAccount ? _linkAccount(data) : undefined;
- }
+ };
}
// IdentityServer4
-if(process.env.NEXT_PUBLIC_IDS4_ENABLED === 'true') {
+if (process.env.NEXT_PUBLIC_IDS4_ENABLED === "true") {
providers.push(
IdentityServer4Provider({
id: "identity-server4",
name: "IdentityServer4",
- issuer: process.env.IdentityServer4_Issuer,
+ issuer: process.env.IdentityServer4_Issuer,
clientId: process.env.IdentityServer4_CLIENT_ID,
- clientSecret: process.env.IdentityServer4_CLIENT_SECRET
+ clientSecret: process.env.IdentityServer4_CLIENT_SECRET,
})
);
const _linkAccount = adapter.linkAccount;
adapter.linkAccount = (account) => {
- const {"not-before-policy": _, refresh_expires_in, ...data} = account;
+ const { "not-before-policy": _, refresh_expires_in, ...data } = account;
return _linkAccount ? _linkAccount(data) : undefined;
- }
+ };
}
// Kakao
-if(process.env.NEXT_PUBLIC_KAKAO_ENABLED === 'true') {
+if (process.env.NEXT_PUBLIC_KAKAO_ENABLED === "true") {
providers.push(
KakaoProvider({
clientId: process.env.KAKAO_CLIENT_ID!,
- clientSecret: process.env.KAKAO_CLIENT_SECRET!
+ clientSecret: process.env.KAKAO_CLIENT_SECRET!,
})
);
const _linkAccount = adapter.linkAccount;
adapter.linkAccount = (account) => {
- const {"not-before-policy": _, refresh_expires_in, ...data} = account;
+ const { "not-before-policy": _, refresh_expires_in, ...data } = account;
return _linkAccount ? _linkAccount(data) : undefined;
- }
+ };
}
// Keycloak
-if (process.env.NEXT_PUBLIC_KEYCLOAK_ENABLED === 'true') {
+if (process.env.NEXT_PUBLIC_KEYCLOAK_ENABLED === "true") {
providers.push(
KeycloakProvider({
clientId: process.env.KEYCLOAK_CLIENT_ID!,
@@ -594,176 +598,176 @@ if (process.env.NEXT_PUBLIC_KEYCLOAK_ENABLED === 'true') {
);
const _linkAccount = adapter.linkAccount;
adapter.linkAccount = (account) => {
- const {"not-before-policy": _, refresh_expires_in, ...data} = account;
+ const { "not-before-policy": _, refresh_expires_in, ...data } = account;
return _linkAccount ? _linkAccount(data) : undefined;
};
}
// LINE
-if(process.env.NEXT_PUBLIC_LINE_ENABLED === 'true') {
+if (process.env.NEXT_PUBLIC_LINE_ENABLED === "true") {
providers.push(
LineProvider({
clientId: process.env.LINE_CLIENT_ID!,
- clientSecret: process.env.LINE_CLIENT_SECRET!
+ clientSecret: process.env.LINE_CLIENT_SECRET!,
})
);
const _linkAccount = adapter.linkAccount;
adapter.linkAccount = (account) => {
- const {"not-before-policy": _, refresh_expires_in, ...data} = account;
+ const { "not-before-policy": _, refresh_expires_in, ...data } = account;
return _linkAccount ? _linkAccount(data) : undefined;
- }
+ };
}
// LinkedIn
-if(process.env.NEXT_PUBLIC_LINKEDIN_ENABLED === 'true') {
+if (process.env.NEXT_PUBLIC_LINKEDIN_ENABLED === "true") {
providers.push(
LinkedInProvider({
clientId: process.env.LINKEDIN_CLIENT_ID!,
- clientSecret: process.env.LINKEDIN_CLIENT_SECRET!
+ clientSecret: process.env.LINKEDIN_CLIENT_SECRET!,
})
);
const _linkAccount = adapter.linkAccount;
adapter.linkAccount = (account) => {
- const {"not-before-policy": _, refresh_expires_in, ...data} = account;
+ const { "not-before-policy": _, refresh_expires_in, ...data } = account;
return _linkAccount ? _linkAccount(data) : undefined;
- }
+ };
}
// Mailchimp
-if(process.env.NEXT_PUBLIC_MAILCHIMP_ENABLED === 'true') {
+if (process.env.NEXT_PUBLIC_MAILCHIMP_ENABLED === "true") {
providers.push(
MailchimpProvider({
clientId: process.env.MAILCHIMP_CLIENT_ID,
- clientSecret: process.env.MAILCHIMP_CLIENT_SECRET
+ clientSecret: process.env.MAILCHIMP_CLIENT_SECRET,
})
);
const _linkAccount = adapter.linkAccount;
adapter.linkAccount = (account) => {
- const {"not-before-policy": _, refresh_expires_in, ...data} = account;
+ const { "not-before-policy": _, refresh_expires_in, ...data } = account;
return _linkAccount ? _linkAccount(data) : undefined;
- }
+ };
}
// Mail.ru
-if(process.env.NEXT_PUBLIC_MAILRU_ENABLED === 'true') {
+if (process.env.NEXT_PUBLIC_MAILRU_ENABLED === "true") {
providers.push(
MailRuProvider({
clientId: process.env.MAILRU_CLIENT_ID,
- clientSecret: process.env.MAILRU_CLIENT_SECRET
+ clientSecret: process.env.MAILRU_CLIENT_SECRET,
})
);
const _linkAccount = adapter.linkAccount;
adapter.linkAccount = (account) => {
- const {"not-before-policy": _, refresh_expires_in, ...data} = account;
+ const { "not-before-policy": _, refresh_expires_in, ...data } = account;
return _linkAccount ? _linkAccount(data) : undefined;
- }
+ };
}
// Naver
-if(process.env.NEXT_PUBLIC_NAVER_ENABLED === 'true') {
+if (process.env.NEXT_PUBLIC_NAVER_ENABLED === "true") {
providers.push(
NaverProvider({
clientId: process.env.NAVER_CLIENT_ID!,
- clientSecret: process.env.NAVER_CLIENT_SECRET!
+ clientSecret: process.env.NAVER_CLIENT_SECRET!,
})
);
const _linkAccount = adapter.linkAccount;
adapter.linkAccount = (account) => {
- const {"not-before-policy": _, refresh_expires_in, ...data} = account;
+ const { "not-before-policy": _, refresh_expires_in, ...data } = account;
return _linkAccount ? _linkAccount(data) : undefined;
- }
+ };
}
// Netlify
-if(process.env.NEXT_PUBLIC_NETLIFY_ENABLED === 'true') {
+if (process.env.NEXT_PUBLIC_NETLIFY_ENABLED === "true") {
providers.push(
NetlifyProvider({
clientId: process.env.NETLIFY_CLIENT_ID,
- clientSecret: process.env.NETLIFY_CLIENT_SECRET
+ clientSecret: process.env.NETLIFY_CLIENT_SECRET,
})
);
const _linkAccount = adapter.linkAccount;
adapter.linkAccount = (account) => {
- const {"not-before-policy": _, refresh_expires_in, ...data} = account;
+ const { "not-before-policy": _, refresh_expires_in, ...data } = account;
return _linkAccount ? _linkAccount(data) : undefined;
- }
+ };
}
// Okta
-if(process.env.NEXT_PUBLIC_OKTA_ENABLED === 'true') {
+if (process.env.NEXT_PUBLIC_OKTA_ENABLED === "true") {
providers.push(
OktaProvider({
clientId: process.env.OKTA_CLIENT_ID!,
clientSecret: process.env.OKTA_CLIENT_SECRET!,
- issuer: process.env.OKTA_ISSUER
+ issuer: process.env.OKTA_ISSUER,
})
);
const _linkAccount = adapter.linkAccount;
adapter.linkAccount = (account) => {
- const {"not-before-policy": _, refresh_expires_in, ...data} = account;
+ const { "not-before-policy": _, refresh_expires_in, ...data } = account;
return _linkAccount ? _linkAccount(data) : undefined;
- }
+ };
}
// OneLogin
-if(process.env.NEXT_PUBLIC_ONELOGIN_ENABLED === 'true') {
+if (process.env.NEXT_PUBLIC_ONELOGIN_ENABLED === "true") {
providers.push(
OneLoginProvider({
clientId: process.env.ONELOGIN_CLIENT_ID,
clientSecret: process.env.ONELOGIN_CLIENT_SECRET,
- issuer: process.env.ONELOGIN_ISSUER
+ issuer: process.env.ONELOGIN_ISSUER,
})
);
const _linkAccount = adapter.linkAccount;
adapter.linkAccount = (account) => {
- const {"not-before-policy": _, refresh_expires_in, ...data} = account;
+ const { "not-before-policy": _, refresh_expires_in, ...data } = account;
return _linkAccount ? _linkAccount(data) : undefined;
- }
+ };
}
// Osso
-if(process.env.NEXT_PUBLIC_OSSO_ENABLED === 'true') {
+if (process.env.NEXT_PUBLIC_OSSO_ENABLED === "true") {
providers.push(
OssoProvider({
clientId: process.env.OSSO_CLIENT_ID,
clientSecret: process.env.OSSO_CLIENT_SECRET,
- issuer: process.env.OSSO_ISSUER
+ issuer: process.env.OSSO_ISSUER,
})
);
const _linkAccount = adapter.linkAccount;
adapter.linkAccount = (account) => {
- const {"not-before-policy": _, refresh_expires_in, ...data} = account;
+ const { "not-before-policy": _, refresh_expires_in, ...data } = account;
return _linkAccount ? _linkAccount(data) : undefined;
- }
+ };
}
// osu!
-if(process.env.NEXT_PUBLIC_OSU_ENABLED === 'true') {
+if (process.env.NEXT_PUBLIC_OSU_ENABLED === "true") {
providers.push(
OsuProvider({
clientId: process.env.OSU_CLIENT_ID!,
- clientSecret: process.env.OSU_CLIENT_SECRET!
+ clientSecret: process.env.OSU_CLIENT_SECRET!,
})
);
const _linkAccount = adapter.linkAccount;
adapter.linkAccount = (account) => {
- const {"not-before-policy": _, refresh_expires_in, ...data} = account;
+ const { "not-before-policy": _, refresh_expires_in, ...data } = account;
return _linkAccount ? _linkAccount(data) : undefined;
- }
+ };
}
// Patreon
-if(process.env.NEXT_PUBLIC_PATREON_ENABLED === 'true') {
+if (process.env.NEXT_PUBLIC_PATREON_ENABLED === "true") {
providers.push(
PatreonProvider({
clientId: process.env.PATREON_ID!,
@@ -773,29 +777,29 @@ if(process.env.NEXT_PUBLIC_PATREON_ENABLED === 'true') {
const _linkAccount = adapter.linkAccount;
adapter.linkAccount = (account) => {
- const {"not-before-policy": _, refresh_expires_in, ...data} = account;
+ const { "not-before-policy": _, refresh_expires_in, ...data } = account;
return _linkAccount ? _linkAccount(data) : undefined;
- }
+ };
}
// Pinterest
-if(process.env.NEXT_PUBLIC_PINTEREST_ENABLED === 'true') {
+if (process.env.NEXT_PUBLIC_PINTEREST_ENABLED === "true") {
providers.push(
PinterestProvider({
clientId: process.env.PINTEREST_ID!,
- clientSecret: process.env.PINTEREST_SECRET!
+ clientSecret: process.env.PINTEREST_SECRET!,
})
);
const _linkAccount = adapter.linkAccount;
adapter.linkAccount = (account) => {
- const {"not-before-policy": _, refresh_expires_in, ...data} = account;
+ const { "not-before-policy": _, refresh_expires_in, ...data } = account;
return _linkAccount ? _linkAccount(data) : undefined;
- }
+ };
}
// Pipedrive
-if(process.env.NEXT_PUBLIC_PIPEDRIVE_ENABLED === 'true') {
+if (process.env.NEXT_PUBLIC_PIPEDRIVE_ENABLED === "true") {
providers.push(
PipedriveProvider({
clientId: process.env.PIPEDRIVE_CLIENT_ID!,
@@ -805,29 +809,29 @@ if(process.env.NEXT_PUBLIC_PIPEDRIVE_ENABLED === 'true') {
const _linkAccount = adapter.linkAccount;
adapter.linkAccount = (account) => {
- const {"not-before-policy": _, refresh_expires_in, ...data} = account;
+ const { "not-before-policy": _, refresh_expires_in, ...data } = account;
return _linkAccount ? _linkAccount(data) : undefined;
- }
+ };
}
// Reddit
-if(process.env.NEXT_PUBLIC_REDDIT_ENABLED === 'true') {
+if (process.env.NEXT_PUBLIC_REDDIT_ENABLED === "true") {
providers.push(
RedditProvider({
clientId: process.env.REDDIT_CLIENT_ID,
- clientSecret: process.env.REDDIT_CLIENT_SECRET
+ clientSecret: process.env.REDDIT_CLIENT_SECRET,
})
);
const _linkAccount = adapter.linkAccount;
adapter.linkAccount = (account) => {
- const {"not-before-policy": _, refresh_expires_in, ...data} = account;
+ const { "not-before-policy": _, refresh_expires_in, ...data } = account;
return _linkAccount ? _linkAccount(data) : undefined;
- }
+ };
}
// Salesforce
-if(process.env.NEXT_PUBLIC_SALESFORCE_ENABLED === 'true') {
+if (process.env.NEXT_PUBLIC_SALESFORCE_ENABLED === "true") {
providers.push(
SalesforceProvider({
clientId: process.env.SALESFORCE_CLIENT_ID!,
@@ -837,45 +841,45 @@ if(process.env.NEXT_PUBLIC_SALESFORCE_ENABLED === 'true') {
const _linkAccount = adapter.linkAccount;
adapter.linkAccount = (account) => {
- const {"not-before-policy": _, refresh_expires_in, ...data} = account;
+ const { "not-before-policy": _, refresh_expires_in, ...data } = account;
return _linkAccount ? _linkAccount(data) : undefined;
- }
+ };
}
// Slack
-if(process.env.NEXT_PUBLIC_SLACK_ENABLED === 'true') {
+if (process.env.NEXT_PUBLIC_SLACK_ENABLED === "true") {
providers.push(
SlackProvider({
clientId: process.env.SLACK_CLIENT_ID!,
- clientSecret: process.env.SLACK_CLIENT_SECRET!
+ clientSecret: process.env.SLACK_CLIENT_SECRET!,
})
);
const _linkAccount = adapter.linkAccount;
adapter.linkAccount = (account) => {
- const {"not-before-policy": _, refresh_expires_in, ...data} = account;
+ const { "not-before-policy": _, refresh_expires_in, ...data } = account;
return _linkAccount ? _linkAccount(data) : undefined;
- }
+ };
}
// Spotify
-if(process.env.NEXT_PUBLIC_SPOTIFY_ENABLED === 'true') {
+if (process.env.NEXT_PUBLIC_SPOTIFY_ENABLED === "true") {
providers.push(
SpotifyProvider({
clientId: process.env.SPOTIFY_CLIENT_ID!,
- clientSecret: process.env.SPOTIFY_CLIENT_SECRET!
+ clientSecret: process.env.SPOTIFY_CLIENT_SECRET!,
})
);
const _linkAccount = adapter.linkAccount;
adapter.linkAccount = (account) => {
- const {"not-before-policy": _, refresh_expires_in, ...data} = account;
+ const { "not-before-policy": _, refresh_expires_in, ...data } = account;
return _linkAccount ? _linkAccount(data) : undefined;
- }
+ };
}
// Strava
-if(process.env.NEXT_PUBLIC_STRAVA_ENABLED === 'true') {
+if (process.env.NEXT_PUBLIC_STRAVA_ENABLED === "true") {
providers.push(
StravaProvider({
clientId: process.env.STRAVA_CLIENT_ID!,
@@ -885,126 +889,126 @@ if(process.env.NEXT_PUBLIC_STRAVA_ENABLED === 'true') {
const _linkAccount = adapter.linkAccount;
adapter.linkAccount = (account) => {
- const {"not-before-policy": _, refresh_expires_in, ...data} = account;
+ const { "not-before-policy": _, refresh_expires_in, ...data } = account;
return _linkAccount ? _linkAccount(data) : undefined;
- }
+ };
}
// Todoist
-if(process.env.NEXT_PUBLIC_TODOIST_ENABLED === 'true') {
+if (process.env.NEXT_PUBLIC_TODOIST_ENABLED === "true") {
providers.push(
TodoistProvider({
clientId: process.env.TODOIST_ID!,
- clientSecret: process.env.TODOIST_SECRET!
+ clientSecret: process.env.TODOIST_SECRET!,
})
);
const _linkAccount = adapter.linkAccount;
adapter.linkAccount = (account) => {
- const {"not-before-policy": _, refresh_expires_in, ...data} = account;
+ const { "not-before-policy": _, refresh_expires_in, ...data } = account;
return _linkAccount ? _linkAccount(data) : undefined;
- }
+ };
}
// Twitch
-if(process.env.NEXT_PUBLIC_TWITCH_ENABLED === 'true') {
+if (process.env.NEXT_PUBLIC_TWITCH_ENABLED === "true") {
providers.push(
TwitchProvider({
clientId: process.env.TWITCH_CLIENT_ID!,
- clientSecret: process.env.TWITCH_CLIENT_SECRET!
+ clientSecret: process.env.TWITCH_CLIENT_SECRET!,
})
);
const _linkAccount = adapter.linkAccount;
adapter.linkAccount = (account) => {
- const {"not-before-policy": _, refresh_expires_in, ...data} = account;
+ const { "not-before-policy": _, refresh_expires_in, ...data } = account;
return _linkAccount ? _linkAccount(data) : undefined;
- }
+ };
}
// United Effects
-if(process.env.NEXT_PUBLIC_UNITED_EFFECTS_ENABLED === 'true') {
+if (process.env.NEXT_PUBLIC_UNITED_EFFECTS_ENABLED === "true") {
providers.push(
UnitedEffectsProvider({
clientId: process.env.UNITED_EFFECTS_CLIENT_ID!,
clientSecret: process.env.UNITED_EFFECTS_CLIENT_SECRET!,
- issuer: process.env.UNITED_EFFECTS_ISSUER!
+ issuer: process.env.UNITED_EFFECTS_ISSUER!,
})
);
const _linkAccount = adapter.linkAccount;
adapter.linkAccount = (account) => {
- const {"not-before-policy": _, refresh_expires_in, ...data} = account;
+ const { "not-before-policy": _, refresh_expires_in, ...data } = account;
return _linkAccount ? _linkAccount(data) : undefined;
- }
+ };
}
// VK
-if(process.env.NEXT_PUBLIC_VK_ENABLED === 'true') {
+if (process.env.NEXT_PUBLIC_VK_ENABLED === "true") {
providers.push(
VkProvider({
clientId: process.env.VK_CLIENT_ID!,
- clientSecret: process.env.VK_CLIENT_SECRET!
+ clientSecret: process.env.VK_CLIENT_SECRET!,
})
);
const _linkAccount = adapter.linkAccount;
adapter.linkAccount = (account) => {
- const {"not-before-policy": _, refresh_expires_in, ...data} = account;
+ const { "not-before-policy": _, refresh_expires_in, ...data } = account;
return _linkAccount ? _linkAccount(data) : undefined;
- }
+ };
}
// Wikimedia
-if(process.env.NEXT_PUBLIC_WIKIMEDIA_ENABLED === 'true') {
+if (process.env.NEXT_PUBLIC_WIKIMEDIA_ENABLED === "true") {
providers.push(
WikimediaProvider({
clientId: process.env.WIKIMEDIA_CLIENT_ID!,
- clientSecret: process.env.WIKIMEDIA_CLIENT_SECRET!
+ clientSecret: process.env.WIKIMEDIA_CLIENT_SECRET!,
})
);
const _linkAccount = adapter.linkAccount;
adapter.linkAccount = (account) => {
- const {"not-before-policy": _, refresh_expires_in, ...data} = account;
+ const { "not-before-policy": _, refresh_expires_in, ...data } = account;
return _linkAccount ? _linkAccount(data) : undefined;
- }
+ };
}
// Wordpress.com
-if(process.env.NEXT_PUBLIC_WORDPRESS_ENABLED === 'true') {
+if (process.env.NEXT_PUBLIC_WORDPRESS_ENABLED === "true") {
providers.push(
WordpressProvider({
clientId: process.env.WORDPRESS_CLIENT_ID,
- clientSecret: process.env.WORDPRESS_CLIENT_SECRET
+ clientSecret: process.env.WORDPRESS_CLIENT_SECRET,
})
);
const _linkAccount = adapter.linkAccount;
adapter.linkAccount = (account) => {
- const {"not-before-policy": _, refresh_expires_in, ...data} = account;
+ const { "not-before-policy": _, refresh_expires_in, ...data } = account;
return _linkAccount ? _linkAccount(data) : undefined;
- }
+ };
}
// Yandex
-if(process.env.NEXT_PUBLIC_YANDEX_ENABLED === 'true') {
+if (process.env.NEXT_PUBLIC_YANDEX_ENABLED === "true") {
providers.push(
YandexProvider({
clientId: process.env.YANDEX_CLIENT_ID!,
- clientSecret: process.env.YANDEX_CLIENT_SECRET!
+ clientSecret: process.env.YANDEX_CLIENT_SECRET!,
})
);
const _linkAccount = adapter.linkAccount;
adapter.linkAccount = (account) => {
- const {"not-before-policy": _, refresh_expires_in, ...data} = account;
+ const { "not-before-policy": _, refresh_expires_in, ...data } = account;
return _linkAccount ? _linkAccount(data) : undefined;
- }
+ };
}
// Zitadel
-if(process.env.NEXT_PUBLIC_ZITADEL_ENABLED === 'true') {
+if (process.env.NEXT_PUBLIC_ZITADEL_ENABLED === "true") {
providers.push(
ZitadelProvider({
issuer: process.env.ZITADEL_ISSUER,
@@ -1015,41 +1019,41 @@ if(process.env.NEXT_PUBLIC_ZITADEL_ENABLED === 'true') {
const _linkAccount = adapter.linkAccount;
adapter.linkAccount = (account) => {
- const {"not-before-policy": _, refresh_expires_in, ...data} = account;
+ const { "not-before-policy": _, refresh_expires_in, ...data } = account;
return _linkAccount ? _linkAccount(data) : undefined;
- }
+ };
}
// Zoho
-if(process.env.NEXT_PUBLIC_ZOHO_ENABLED === 'true') {
+if (process.env.NEXT_PUBLIC_ZOHO_ENABLED === "true") {
providers.push(
ZohoProvider({
clientId: process.env.ZOHO_CLIENT_ID,
- clientSecret: process.env.ZOHO_CLIENT_SECRET
+ clientSecret: process.env.ZOHO_CLIENT_SECRET,
})
);
const _linkAccount = adapter.linkAccount;
adapter.linkAccount = (account) => {
- const {"not-before-policy": _, refresh_expires_in, ...data} = account;
+ const { "not-before-policy": _, refresh_expires_in, ...data } = account;
return _linkAccount ? _linkAccount(data) : undefined;
- }
+ };
}
// Zoom
-if(process.env.NEXT_PUBLIC_ZOOM_ENABLED_ENABLED === 'true') {
+if (process.env.NEXT_PUBLIC_ZOOM_ENABLED_ENABLED === "true") {
providers.push(
ZoomProvider({
clientId: process.env.ZOOM_CLIENT_ID!,
- clientSecret: process.env.ZOOM_CLIENT_SECRET!
+ clientSecret: process.env.ZOOM_CLIENT_SECRET!,
})
);
const _linkAccount = adapter.linkAccount;
adapter.linkAccount = (account) => {
- const {"not-before-policy": _, refresh_expires_in, ...data} = account;
+ const { "not-before-policy": _, refresh_expires_in, ...data } = account;
return _linkAccount ? _linkAccount(data) : undefined;
- }
+ };
}
export const authOptions: AuthOptions = {
@@ -1064,8 +1068,9 @@ export const authOptions: AuthOptions = {
verifyRequest: "/confirmation",
},
callbacks: {
- async signIn({user, account, profile, email, credentials}) {
- if (account?.provider !== "credentials") { // registration via SSO can be separately disabled
+ async signIn({ user, account, profile, email, credentials }) {
+ if (account?.provider !== "credentials") {
+ // registration via SSO can be separately disabled
const existingUser = await prisma.account.findFirst({
where: {
providerAccountId: account?.providerAccountId,
@@ -1077,14 +1082,14 @@ export const authOptions: AuthOptions = {
}
return true;
},
- async jwt({token, trigger, user}) {
+ async jwt({ token, trigger, user }) {
token.sub = token.sub ? Number(token.sub) : undefined;
if (trigger === "signIn" || trigger === "signUp")
token.id = user?.id as number;
return token;
},
- async session({session, token}) {
+ async session({ session, token }) {
session.user.id = token.id;
if (STRIPE_SECRET_KEY) {
diff --git a/pages/api/v1/links/[id]/archive/index.ts b/pages/api/v1/links/[id]/archive/index.ts
index d5e475e3..04f0d280 100644
--- a/pages/api/v1/links/[id]/archive/index.ts
+++ b/pages/api/v1/links/[id]/archive/index.ts
@@ -73,9 +73,9 @@ const deleteArchivedFiles = async (link: Link & { collection: Collection }) => {
id: link.id,
},
data: {
- screenshotPath: null,
- pdfPath: null,
- readabilityPath: null,
+ image: null,
+ pdf: null,
+ readable: null,
},
});
diff --git a/prisma/migrations/20231221174844_rename_fields_and_add_preview/migration.sql b/prisma/migrations/20231221174844_rename_fields_and_add_preview/migration.sql
new file mode 100644
index 00000000..69a3395c
--- /dev/null
+++ b/prisma/migrations/20231221174844_rename_fields_and_add_preview/migration.sql
@@ -0,0 +1,13 @@
+/*
+ Warnings:
+
+ - You are about to drop the column `pdf` on the `Link` table. All the data in the column will be lost.
+ - You are about to drop the column `readable` on the `Link` table. All the data in the column will be lost.
+ - You are about to drop the column `screenshotPath` on the `Link` table. All the data in the column will be lost.
+
+*/
+-- AlterTable
+ALTER TABLE "Link" RENAME COLUMN "screenshotPath" TO "image";
+ALTER TABLE "Link" RENAME COLUMN "pdfPath" TO "pdf";
+ALTER TABLE "Link" RENAME COLUMN "readabilityPath" TO "readable";
+ALTER TABLE "Link" ADD COLUMN "preview" TEXT;
diff --git a/prisma/schema.prisma b/prisma/schema.prisma
index 6ea1bda5..3f105394 100644
--- a/prisma/schema.prisma
+++ b/prisma/schema.prisma
@@ -20,16 +20,16 @@ model Account {
scope String?
id_token String?
session_state String?
- user User @relation(fields: [userId], references: [id], onDelete: Cascade)
+ user User @relation(fields: [userId], references: [id], onDelete: Cascade)
@@unique([provider, providerAccountId])
}
model User {
- id Int @id @default(autoincrement())
+ id Int @id @default(autoincrement())
name String
- username String? @unique
- email String? @unique
+ username String? @unique
+ email String? @unique
emailVerified DateTime?
image String?
accounts Account[]
@@ -41,45 +41,45 @@ model User {
whitelistedUsers WhitelistedUser[]
apiKeys ApiKey[]
subscriptions Subscription?
- archiveAsScreenshot Boolean @default(true)
- archiveAsPDF Boolean @default(true)
- archiveAsWaybackMachine Boolean @default(false)
- isPrivate Boolean @default(false)
- createdAt DateTime @default(now())
- updatedAt DateTime @updatedAt @default(now())
+ archiveAsScreenshot Boolean @default(true)
+ archiveAsPDF Boolean @default(true)
+ archiveAsWaybackMachine Boolean @default(false)
+ isPrivate Boolean @default(false)
+ createdAt DateTime @default(now())
+ updatedAt DateTime @default(now()) @updatedAt
}
model WhitelistedUser {
- id Int @id @default(autoincrement())
- username String @default("")
- User User? @relation(fields: [userId], references: [id])
- userId Int?
- createdAt DateTime @default(now())
- updatedAt DateTime @updatedAt @default(now())
+ id Int @id @default(autoincrement())
+ username String @default("")
+ User User? @relation(fields: [userId], references: [id])
+ userId Int?
+ createdAt DateTime @default(now())
+ updatedAt DateTime @default(now()) @updatedAt
}
model VerificationToken {
- identifier String
- token String @unique
- expires DateTime
- createdAt DateTime @default(now())
- updatedAt DateTime @updatedAt @default(now())
+ identifier String
+ token String @unique
+ expires DateTime
+ createdAt DateTime @default(now())
+ updatedAt DateTime @default(now()) @updatedAt
@@unique([identifier, token])
}
model Collection {
- id Int @id @default(autoincrement())
+ id Int @id @default(autoincrement())
name String
- description String @default("")
- color String @default("#0ea5e9")
- isPublic Boolean @default(false)
+ description String @default("")
+ color String @default("#0ea5e9")
+ isPublic Boolean @default(false)
owner User @relation(fields: [ownerId], references: [id])
ownerId Int
members UsersAndCollections[]
links Link[]
- createdAt DateTime @default(now())
- updatedAt DateTime @updatedAt @default(now())
+ createdAt DateTime @default(now())
+ updatedAt DateTime @default(now()) @updatedAt
@@unique([name, ownerId])
}
@@ -93,64 +93,65 @@ model UsersAndCollections {
canUpdate Boolean
canDelete Boolean
createdAt DateTime @default(now())
- updatedAt DateTime @updatedAt @default(now())
+ updatedAt DateTime @default(now()) @updatedAt
@@id([userId, collectionId])
}
model Link {
- id Int @id @default(autoincrement())
- name String
- type String @default("url")
- description String @default("")
- pinnedBy User[]
- collection Collection @relation(fields: [collectionId], references: [id])
- collectionId Int
- tags Tag[]
- url String?
- textContent String?
- screenshotPath String?
- pdfPath String?
- readabilityPath String?
- lastPreserved DateTime?
- createdAt DateTime @default(now())
- updatedAt DateTime @updatedAt @default(now())
+ id Int @id @default(autoincrement())
+ name String
+ type String @default("url")
+ description String @default("")
+ pinnedBy User[]
+ collection Collection @relation(fields: [collectionId], references: [id])
+ collectionId Int
+ tags Tag[]
+ url String?
+ textContent String?
+ preview String?
+ image String?
+ pdf String?
+ readable String?
+ lastPreserved DateTime?
+ createdAt DateTime @default(now())
+ updatedAt DateTime @default(now()) @updatedAt
}
model Tag {
- id Int @id @default(autoincrement())
- name String
- links Link[]
- owner User @relation(fields: [ownerId], references: [id])
- ownerId Int
- createdAt DateTime @default(now())
- updatedAt DateTime @updatedAt @default(now())
+ id Int @id @default(autoincrement())
+ name String
+ links Link[]
+ owner User @relation(fields: [ownerId], references: [id])
+ ownerId Int
+ createdAt DateTime @default(now())
+ updatedAt DateTime @default(now()) @updatedAt
@@unique([name, ownerId])
}
model Subscription {
- id Int @id @default(autoincrement())
+ id Int @id @default(autoincrement())
active Boolean
- stripeSubscriptionId String @unique
+ stripeSubscriptionId String @unique
currentPeriodStart DateTime
currentPeriodEnd DateTime
- user User @relation(fields: [userId], references: [id])
- userId Int @unique
- createdAt DateTime @default(now())
- updatedAt DateTime @updatedAt @default(now())
+ user User @relation(fields: [userId], references: [id])
+ userId Int @unique
+ createdAt DateTime @default(now())
+ updatedAt DateTime @default(now()) @updatedAt
}
model ApiKey {
- id Int @id @default(autoincrement())
- name String
- user User @relation(fields: [userId], references: [id])
- userId Int
- token String @unique
- expires DateTime
- lastUsedAt DateTime?
- createdAt DateTime @default(now())
- updatedAt DateTime @updatedAt @default(now())
+ id Int @id @default(autoincrement())
+ name String
+ user User @relation(fields: [userId], references: [id])
+ userId Int
+ token String @unique
+ expires DateTime
+ lastUsedAt DateTime?
+ createdAt DateTime @default(now())
+ updatedAt DateTime @default(now()) @updatedAt
@@unique([token, userId])
}
diff --git a/prisma/seed.js b/prisma/seed.js
new file mode 100644
index 00000000..91765ec8
--- /dev/null
+++ b/prisma/seed.js
@@ -0,0 +1,571 @@
+// A dirty script to seed the database with some data
+
+const { PrismaClient } = require("@prisma/client");
+const bcrypt = require("bcrypt");
+const prisma = new PrismaClient();
+
+async function main() {
+ const saltRounds = 10;
+ const defaultPassword = "11111111";
+ const hashedPassword = bcrypt.hashSync(defaultPassword, saltRounds);
+
+ // Subscription dates
+ const currentPeriodStart = new Date();
+ const currentPeriodEnd = new Date();
+ currentPeriodEnd.setFullYear(currentPeriodEnd.getFullYear() + 10);
+
+ // Operations to be executed within a transaction
+ const transaction = await prisma.$transaction(async (prisma) => {
+ // Create users with subscriptions
+ const user1 = await prisma.user.create({
+ data: {
+ name: "John Doe",
+ username: "user1",
+ email: "[email protected]",
+ emailVerified: new Date(),
+ password: hashedPassword,
+ subscriptions: {
+ create: {
+ stripeSubscriptionId: "sub_4323",
+ active: true,
+ currentPeriodStart,
+ currentPeriodEnd,
+ },
+ },
+ },
+ });
+
+ const user2 = await prisma.user.create({
+ data: {
+ name: "Mary Smith",
+ username: "user2",
+ email: "[email protected]",
+ emailVerified: new Date(),
+ password: hashedPassword,
+ subscriptions: {
+ create: {
+ stripeSubscriptionId: "sub_5435",
+ active: true,
+ currentPeriodStart,
+ currentPeriodEnd,
+ },
+ },
+ },
+ });
+
+ const user3 = await prisma.user.create({
+ data: {
+ name: "Linda Jones",
+ username: "user3",
+ email: "[email protected]",
+ emailVerified: new Date(),
+ password: hashedPassword,
+ subscriptions: {
+ create: {
+ stripeSubscriptionId: "sub_6435",
+ active: true,
+ currentPeriodStart,
+ currentPeriodEnd,
+ },
+ },
+ },
+ });
+
+ const user4 = await prisma.user.create({
+ data: {
+ name: "Betty Sanchez",
+ username: "user4",
+ email: "[email protected]",
+ emailVerified: new Date(),
+ password: hashedPassword,
+ subscriptions: {
+ create: {
+ stripeSubscriptionId: "sub_7868",
+ active: true,
+ currentPeriodStart,
+ currentPeriodEnd,
+ },
+ },
+ },
+ });
+
+ const user5 = await prisma.user.create({
+ data: {
+ name: "Jeffrey Edwards",
+ username: "user5",
+ email: "[email protected]",
+ emailVerified: new Date(),
+ password: hashedPassword,
+ subscriptions: {
+ create: {
+ stripeSubscriptionId: "sub_5653",
+ active: true,
+ currentPeriodStart,
+ currentPeriodEnd,
+ },
+ },
+ },
+ });
+
+ // Define and create collections
+ const collectionsUser1 = [
+ {
+ name: "Health and Wellness",
+ description: "Latest articles on health and wellness.",
+ ownerId: user1.id,
+ color: "#ff1100",
+ },
+ {
+ name: "Research",
+ description: "Latest articles on research.",
+ ownerId: user1.id,
+ color: "#000dff",
+ },
+ {
+ name: "Technology",
+ description: "Latest articles on technology.",
+ ownerId: user1.id,
+ color: "#0080ff",
+ },
+ {
+ name: "Personal Finance",
+ description: "Latest articles on personal finance.",
+ ownerId: user1.id,
+ color: "#00ff40",
+ },
+ {
+ name: "Productivity",
+ description: "Latest articles on productivity.",
+ ownerId: user1.id,
+ color: "#ff00f7",
+ },
+ {
+ name: "Recipes",
+ description: "Latest recipes.",
+ ownerId: user1.id,
+ color: "#eeff00",
+ },
+ ];
+
+ const collectionsUser2 = [
+ {
+ name: "Project Alpha",
+ description: "Articles for Project Alpha.",
+ ownerId: user2.id,
+ },
+ ];
+
+ const user1Collections = await Promise.all(
+ collectionsUser1.map((c) => prisma.collection.create({ data: c }))
+ );
+
+ const user2Collections = await Promise.all(
+ collectionsUser2.map((c) => prisma.collection.create({ data: c }))
+ );
+
+ // Share one collection between users with permissions
+ await Promise.allSettled([
+ prisma.usersAndCollections.create({
+ data: {
+ userId: user1.id,
+ collectionId: user2Collections[0].id,
+ canCreate: true,
+ canUpdate: true,
+ canDelete: true,
+ },
+ }),
+ prisma.usersAndCollections.create({
+ data: {
+ userId: user2.id,
+ collectionId: user1Collections[1].id,
+ canCreate: true,
+ canUpdate: true,
+ canDelete: true,
+ },
+ }),
+ prisma.usersAndCollections.create({
+ data: {
+ userId: user3.id,
+ collectionId: user1Collections[1].id,
+ canCreate: true,
+ canUpdate: true,
+ canDelete: true,
+ },
+ }),
+ prisma.usersAndCollections.create({
+ data: {
+ userId: user4.id,
+ collectionId: user1Collections[1].id,
+ canCreate: true,
+ canUpdate: true,
+ canDelete: true,
+ },
+ }),
+ prisma.usersAndCollections.create({
+ data: {
+ userId: user5.id,
+ collectionId: user1Collections[1].id,
+ canCreate: true,
+ canUpdate: true,
+ canDelete: true,
+ },
+ }),
+ prisma.usersAndCollections.create({
+ data: {
+ userId: user2.id,
+ collectionId: user2Collections[0].id,
+ canCreate: true,
+ canUpdate: true,
+ canDelete: true,
+ },
+ }),
+ prisma.usersAndCollections.create({
+ data: {
+ userId: user3.id,
+ collectionId: user2Collections[0].id,
+ canCreate: true,
+ canUpdate: true,
+ canDelete: true,
+ },
+ }),
+ prisma.usersAndCollections.create({
+ data: {
+ userId: user2.id,
+ collectionId: user1Collections[0].id,
+ canCreate: true,
+ canUpdate: true,
+ canDelete: true,
+ },
+ }),
+ ]);
+
+ let projectAlphaCollection = await prisma.collection.findFirst({
+ where: {
+ name: "Project Alpha",
+ ownerId: user2.id,
+ },
+ });
+
+ const projectAlphaLinks = [
+ {
+ name: "More than 10,000 research papers were retracted in 2023 — a new record",
+ url: "https://www.nature.com/articles/d41586-023-03974-8",
+ },
+ {
+ name: "Advances in Liver Cancer Research",
+ url: "https://www.cancer.gov/types/liver/research",
+ },
+ {
+ name: "NEW RESEARCH REVEALS TOP AI TOOLS UTILIZED BY MUSIC PRODUCERS",
+ url: "https://edm.com/gear-tech/top-ai-tools-music-producers",
+ },
+ {
+ name: "New Google research: What we now know about 'decoding' consumer decision-making",
+ url: "https://www.thinkwithgoogle.com/intl/en-emea/consumer-insights/consumer-journey/the-consumer-decision-making-process/",
+ },
+ {
+ name: "Drug Overdose Death Rates",
+ url: "https://nida.nih.gov/research-topics/trends-statistics/overdose-death-rates",
+ },
+ {
+ name: "Explore the latest research making an impact in your field",
+ url: "https://biologue.plos.org/2023/10/25/latest-biological-science-research/",
+ },
+ ];
+
+ for (const link of projectAlphaLinks) {
+ await prisma.link.create({
+ data: {
+ name: link.name,
+ url: link.url,
+ collectionId: projectAlphaCollection.id,
+ },
+ });
+ }
+
+ for (const [collectionName, links] of Object.entries(linksAndCollections)) {
+ let collection = await prisma.collection.findFirst({
+ where: {
+ name: collectionName,
+ ownerId: user1.id,
+ },
+ });
+
+ if (!collection) {
+ collection = await prisma.collection.create({
+ data: {
+ name: collectionName,
+ ownerId: user1.id,
+ },
+ });
+ }
+
+ for (const link of links) {
+ await prisma.link.create({
+ data: {
+ name: link.name,
+ url: link.url,
+ collectionId: collection.id,
+ },
+ });
+ }
+ }
+
+ const tags = [
+ { name: "technology", ownerId: user1.id },
+ { name: "finance", ownerId: user1.id },
+ { name: "future", ownerId: user1.id },
+ { name: "health", ownerId: user1.id },
+ { name: "hacks", ownerId: user1.id },
+ { name: "lifestyle", ownerId: user1.id },
+ { name: "routine", ownerId: user1.id },
+ { name: "personal", ownerId: user1.id },
+ ];
+ });
+
+ return transaction;
+}
+
+main()
+ .catch((e) => {
+ console.error(e);
+ process.exit(1);
+ })
+ .finally(async () => {
+ await prisma.$disconnect();
+ });
+
+const linksAndCollections = {
+ "Health and Wellness": [
+ {
+ name: "50 Wellness Gifts for Anyone Who Could Use Some Self-Care",
+ url: "https://www.self.com/gallery/healthy-gift-ideas-for-wellness-gurus",
+ },
+ {
+ name: "Hearing aids slow cognitive decline in people at high risk",
+ url: "https://www.nih.gov/news-events/nih-research-matters/hearing-aids-slow-cognitive-decline-people-high-risk",
+ },
+ {
+ name: "Why Are Healthy Habits Important at Work and Home?",
+ url: "https://info.totalwellnesshealth.com/blog/why-are-healthy-habits-important",
+ },
+ {
+ name: "Wellness Travel BC explores shifting travel trends as health and wellness take center stage for Canadians",
+ url: "https://www.vancouverisawesome.com/sponsored/wellness-travel-bc-explores-shifting-travel-trends-as-health-and-wellness-take-center-stage-for-canadians-8004505",
+ },
+ {
+ name: "50 Wellness Gifts for Anyone Who Could Use Some Self-Care",
+ url: "https://www.self.com/gallery/healthy-gift-ideas-for-wellness-gurus",
+ },
+ {
+ name: "Example",
+ url: "https://example.com",
+ },
+ {
+ name: "Example",
+ url: "https://example.com",
+ },
+ {
+ name: "Example",
+ url: "https://example.com",
+ },
+ {
+ name: "Example",
+ url: "https://example.com",
+ },
+ ],
+ Research: [
+ {
+ name: "More than 10,000 research papers were retracted in 2023 — a new record",
+ url: "https://www.nature.com/articles/d41586-023-03974-8",
+ },
+ {
+ name: "Advances in Liver Cancer Research",
+ url: "https://www.cancer.gov/types/liver/research",
+ },
+ {
+ name: "NEW RESEARCH REVEALS TOP AI TOOLS UTILIZED BY MUSIC PRODUCERS",
+ url: "https://edm.com/gear-tech/top-ai-tools-music-producers",
+ },
+ {
+ name: "New Google research: What we now know about 'decoding' consumer decision-making",
+ url: "https://www.thinkwithgoogle.com/intl/en-emea/consumer-insights/consumer-journey/the-consumer-decision-making-process/",
+ },
+ {
+ name: "Drug Overdose Death Rates",
+ url: "https://nida.nih.gov/research-topics/trends-statistics/overdose-death-rates",
+ },
+ {
+ name: "Explore the latest research making an impact in your field",
+ url: "https://biologue.plos.org/2023/10/25/latest-biological-science-research/",
+ },
+ {
+ name: "Example",
+ url: "https://example.com",
+ },
+ ],
+ Technology: [
+ {
+ name: "These six questions will dictate the future of generative AI",
+ url: "https://www.technologyreview.com/2023/12/19/1084505/generative-ai-artificial-intelligence-bias-jobs-copyright-misinformation/",
+ },
+ {
+ name: "Q&A: People will only use technology they trust, Microsoft expert says",
+ url: "https://www.euronews.com/next/2023/12/21/qa-people-will-only-use-technology-they-trust-microsoft-expert-says",
+ },
+ {
+ name: "How technology and economics can help save endangered species",
+ url: "https://news.osu.edu/how-technology-and-economics-can-help-save-endangered-species/",
+ },
+ {
+ name: "How technology can help save Indigenous forests – and our planet",
+ url: "https://www.eco-business.com/opinion/how-technology-can-help-save-indigenous-forests-and-our-planet/",
+ },
+ {
+ name: "The most energy-efficient way to build homes",
+ url: "https://www.technologyreview.com/2023/12/22/1084532/passive-house-energy-efficient-harold-orr/",
+ },
+ {
+ name: "Using virtual reality to diagnose Alzheimer's disease",
+ url: "https://www.bbc.com/news/technology-67794645",
+ },
+ ],
+ "Personal Finance": [
+ {
+ name: "Turn your home’s empty bedroom into $875 in monthly rent",
+ url: "https://www.theglobeandmail.com/investing/personal-finance/household-finances/article-turn-your-homes-empty-bedroom-into-875-in-monthly-rent/",
+ },
+ {
+ name: "Don’t let financial constraints slow down your gift-giving",
+ url: "https://www.thespec.com/life/personal-finance/don-t-let-financial-constraints-slow-down-your-gift-giving/article_e3c99ac5-912c-59a9-a815-654befcd4c9c.html",
+ },
+ {
+ name: "The worst retirement planning mistakes you should avoid, according to an expert",
+ url: "https://www.ctvnews.ca/business/the-worst-retirement-planning-mistakes-you-should-avoid-according-to-an-expert-1.6694093",
+ },
+ {
+ name: "What to Do About That Credit-Card Debt",
+ url: "https://www.thecut.com/2023/12/what-to-do-about-that-credit-card-debt.html",
+ },
+ {
+ name: "How to become rich: Nine golden personal finance rules that may help you make money",
+ url: "https://www.livemint.com/money/personal-finance/how-to-become-rich-nine-golden-personal-finance-rules-that-may-help-you-make-money-11703059139843.html",
+ },
+ {
+ name: "Saving Money: Smart Strategies for Keeping Your Financial New Years’ Resolutions",
+ url: "https://www.tipranks.com/news/personal-finance/saving-money-smart-strategies-for-keeping-your-financial-new-years-resolutions",
+ },
+ {
+ name: "Example",
+ url: "https://example.com",
+ },
+ {
+ name: "Example",
+ url: "https://example.com",
+ },
+ ],
+ Productivity: [
+ {
+ name: "Efficiency Vs. Productivity At Work: How To Balance Both",
+ url: "https://www.forbes.com/sites/carolinecastrillon/2023/12/20/efficiency-vs-productivity-at-work-how-to-increase-both/?sh=4c7d486f1bee",
+ },
+ {
+ name: "Is it worth measuring software developer productivity? CIOs weigh in",
+ url: "https://www.cio.com/article/1255774/is-it-worth-measuring-software-developer-productivity-cios-weigh-in.html",
+ },
+ {
+ name: "Avoid These 10 Business Habits to Increase Workplace Productivity",
+ url: "https://www.entrepreneur.com/growing-a-business/10-bad-business-habits-that-destroy-productivity/466381",
+ },
+ {
+ name: "The value of productivity",
+ url: "https://www.tribuneindia.com/news/musings/the-value-of-productivity-573858",
+ },
+ {
+ name: "This new Canonical feature solves my biggest problem with online productivity apps",
+ url: "https://www.zdnet.com/article/canonical-will-soon-make-it-even-easier-to-work-with-google-workspace-and-office-365-online/",
+ },
+ {
+ name: "10 Practical Recommendations for Increasing Work Results and Value",
+ url: "https://www.inc.com/martin-zwilling/10-practical-recommendations-for-increasing-work-results-value.html",
+ },
+ {
+ name: "Example",
+ url: "https://example.com",
+ },
+ {
+ name: "Example",
+ url: "https://example.com",
+ },
+ {
+ name: "Example",
+ url: "https://example.com",
+ },
+ {
+ name: "Example",
+ url: "https://example.com",
+ },
+ {
+ name: "Example",
+ url: "https://example.com",
+ },
+ {
+ name: "Example",
+ url: "https://example.com",
+ },
+ ],
+ Recipes: [
+ {
+ name: "Joe Woodhouse’s vegetarian standouts for Christmas day – recipes",
+ url: "https://www.theguardian.com/food/2023/dec/22/joe-woodhouses-vegetarian-standouts-for-christmas-day-recipes",
+ },
+ {
+ name: "10 cookie recipes to bake for your holiday party",
+ url: "https://www.deseret.com/2023/12/21/24009656/best-holiday-cookie-recipes",
+ },
+ {
+ name: "The Best Potato Recipes for Holiday Season and Beyond, According to Eater Staff",
+ url: "https://www.eater.com/24003490/the-best-potato-recipes-for-holiday-season-and-beyond-according-to-eater-staff",
+ },
+ {
+ name: "The Most-Saved Recipes in the Epicurious App This Week",
+ url: "https://www.epicurious.com/recipes-menus/most-saved-recipes",
+ },
+ {
+ name: "11 Brand-New Recipes to Try This Month",
+ url: "https://www.tasteofhome.com/collection/new-recipes-to-try/",
+ },
+ {
+ name: "19 Baked Pasta Recipes for Golden, Gooey Comfort",
+ url: "https://www.bonappetit.com/gallery/baked-pasta-recipes",
+ },
+ {
+ name: "Example",
+ url: "https://example.com",
+ },
+ {
+ name: "Example",
+ url: "https://example.com",
+ },
+ {
+ name: "Example",
+ url: "https://example.com",
+ },
+ {
+ name: "Example",
+ url: "https://example.com",
+ },
+ {
+ name: "Example",
+ url: "https://example.com",
+ },
+ {
+ name: "Example",
+ url: "https://example.com",
+ },
+ {
+ name: "Example",
+ url: "https://example.com",
+ },
+ ],
+};
diff --git a/scripts/worker.ts b/scripts/worker.ts
index c5c3be81..7f60a49f 100644
--- a/scripts/worker.ts
+++ b/scripts/worker.ts
@@ -23,7 +23,7 @@ async function processBatch() {
archiveAsScreenshot: true,
},
},
- screenshotPath: null,
+ image: null,
},
{
collection: {
@@ -31,7 +31,7 @@ async function processBatch() {
archiveAsScreenshot: true,
},
},
- screenshotPath: "pending",
+ image: "pending",
},
///////////////////////
{
@@ -40,7 +40,7 @@ async function processBatch() {
archiveAsPDF: true,
},
},
- pdfPath: null,
+ pdf: null,
},
{
collection: {
@@ -48,14 +48,14 @@ async function processBatch() {
archiveAsPDF: true,
},
},
- pdfPath: "pending",
+ pdf: "pending",
},
///////////////////////
{
- readabilityPath: null,
+ readable: null,
},
{
- readabilityPath: "pending",
+ readable: "pending",
},
],
},
@@ -80,7 +80,7 @@ async function processBatch() {
archiveAsScreenshot: true,
},
},
- screenshotPath: null,
+ image: null,
},
{
collection: {
@@ -88,7 +88,7 @@ async function processBatch() {
archiveAsScreenshot: true,
},
},
- screenshotPath: "pending",
+ image: "pending",
},
///////////////////////
{
@@ -97,7 +97,7 @@ async function processBatch() {
archiveAsPDF: true,
},
},
- pdfPath: null,
+ pdf: null,
},
{
collection: {
@@ -105,14 +105,14 @@ async function processBatch() {
archiveAsPDF: true,
},
},
- pdfPath: "pending",
+ pdf: "pending",
},
///////////////////////
{
- readabilityPath: null,
+ readable: null,
},
{
- readabilityPath: "pending",
+ readable: "pending",
},
],
},