added seed script + renamed table fields + added field
This commit is contained in:
parent
385bdc2343
commit
98106b9f25
|
@ -25,9 +25,10 @@ export default function NewLinkModal({ onClose }: Props) {
|
|||
description: "",
|
||||
type: "url",
|
||||
tags: [],
|
||||
screenshotPath: "",
|
||||
pdfPath: "",
|
||||
readabilityPath: "",
|
||||
preview: "",
|
||||
image: "",
|
||||
pdf: "",
|
||||
readable: "",
|
||||
textContent: "",
|
||||
collection: {
|
||||
name: "",
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
|
@ -27,9 +27,10 @@ export default function UploadFileModal({ onClose }: Props) {
|
|||
description: "",
|
||||
type: "url",
|
||||
tags: [],
|
||||
screenshotPath: "",
|
||||
pdfPath: "",
|
||||
readabilityPath: "",
|
||||
preview: "",
|
||||
image: "",
|
||||
pdf: "",
|
||||
readable: "",
|
||||
textContent: "",
|
||||
collection: {
|
||||
name: "",
|
||||
|
|
|
@ -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}`;
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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")
|
||||
? "pending"
|
||||
: undefined,
|
||||
readabilityPath: !link.readabilityPath?.startsWith("archive")
|
||||
pdf:
|
||||
user.archiveAsPDF && !link.pdf?.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`,
|
||||
},
|
||||
});
|
||||
}
|
||||
|
|
|
@ -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"
|
||||
);
|
||||
}
|
||||
|
|
|
@ -6,6 +6,9 @@
|
|||
"author": "Daniel31X13 <daniel31x13@gmail.com>",
|
||||
"license": "AGPL-3.0",
|
||||
"private": true,
|
||||
"prisma": {
|
||||
"seed": "node ./prisma/seed.js"
|
||||
},
|
||||
"scripts": {
|
||||
"dev": "next dev",
|
||||
"worker": "ts-node --skip-project scripts/worker.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(),
|
||||
|
|
|
@ -14,7 +14,9 @@ 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",
|
||||
|
@ -119,7 +123,7 @@ if (process.env.NEXT_PUBLIC_CREDENTIALS_ENABLED === 'true' || process.env.NEXT_P
|
|||
} 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,7 +154,7 @@ if (process.env.NEXT_PUBLIC_FORTYTWO_ENABLED === 'true') {
|
|||
email: profile.email,
|
||||
image: profile.image_url,
|
||||
username: profile.id.toString(),
|
||||
}
|
||||
};
|
||||
},
|
||||
})
|
||||
);
|
||||
|
@ -159,11 +163,11 @@ if (process.env.NEXT_PUBLIC_FORTYTWO_ENABLED === 'true') {
|
|||
adapter.linkAccount = (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,9 +179,8 @@ if (process.env.NEXT_PUBLIC_APPLE_ENABLED === 'true') {
|
|||
email: profile.email,
|
||||
image: null,
|
||||
username: profile.sub,
|
||||
}
|
||||
};
|
||||
},
|
||||
|
||||
})
|
||||
);
|
||||
|
||||
|
@ -185,19 +188,20 @@ if (process.env.NEXT_PUBLIC_APPLE_ENABLED === 'true') {
|
|||
adapter.linkAccount = (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,7 +210,7 @@ if (process.env.NEXT_PUBLIC_ATLASSIAN_ENABLED === 'true') {
|
|||
email: profile.email,
|
||||
image: profile.picture,
|
||||
username: profile.account_id,
|
||||
}
|
||||
};
|
||||
},
|
||||
})
|
||||
);
|
||||
|
@ -215,16 +219,16 @@ if (process.env.NEXT_PUBLIC_ATLASSIAN_ENABLED === 'true') {
|
|||
adapter.linkAccount = (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,
|
||||
})
|
||||
);
|
||||
|
||||
|
@ -232,11 +236,11 @@ if(process.env.NEXT_PUBLIC_AUTH0_ENABLED === 'true') {
|
|||
adapter.linkAccount = (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!,
|
||||
|
@ -257,16 +261,16 @@ if (process.env.NEXT_PUBLIC_AUTHENTIK_ENABLED === 'true') {
|
|||
adapter.linkAccount = (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,
|
||||
})
|
||||
);
|
||||
|
||||
|
@ -274,15 +278,15 @@ if(process.env.NEXT_PUBLIC_BATTLENET_ENABLED === 'true') {
|
|||
adapter.linkAccount = (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,
|
||||
})
|
||||
);
|
||||
|
||||
|
@ -290,11 +294,11 @@ if(process.env.NEXT_PUBLIC_BOX_ENABLED === 'true') {
|
|||
adapter.linkAccount = (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!,
|
||||
|
@ -307,15 +311,15 @@ if(process.env.NEXT_PUBLIC_COGNITO_ENABLED === 'true') {
|
|||
adapter.linkAccount = (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,
|
||||
})
|
||||
);
|
||||
|
||||
|
@ -323,15 +327,15 @@ if(process.env.NEXT_PUBLIC_COINBASE_ENABLED === 'true') {
|
|||
adapter.linkAccount = (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!,
|
||||
})
|
||||
);
|
||||
|
||||
|
@ -339,15 +343,15 @@ if(process.env.NEXT_PUBLIC_DISCORD_ENABLED === 'true') {
|
|||
adapter.linkAccount = (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,
|
||||
})
|
||||
);
|
||||
|
||||
|
@ -355,11 +359,11 @@ if(process.env.NEXT_PUBLIC_DROPBOX_ENABLED === 'true') {
|
|||
adapter.linkAccount = (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!,
|
||||
|
@ -372,15 +376,15 @@ if(process.env.NEXT_PUBLIC_DUENDE_IDS6_ENABLED === 'true') {
|
|||
adapter.linkAccount = (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!,
|
||||
})
|
||||
);
|
||||
|
||||
|
@ -388,15 +392,15 @@ if(process.env.NEXT_PUBLIC_EVEONLINE_ENABLED === 'true') {
|
|||
adapter.linkAccount = (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!,
|
||||
})
|
||||
);
|
||||
|
||||
|
@ -404,15 +408,15 @@ if(process.env.NEXT_PUBLIC_FACEBOOK_ENABLED === 'true') {
|
|||
adapter.linkAccount = (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,
|
||||
})
|
||||
);
|
||||
|
||||
|
@ -420,16 +424,16 @@ if(process.env.NEXT_PUBLIC_FACEIT_ENABLED === 'true') {
|
|||
adapter.linkAccount = (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,
|
||||
})
|
||||
);
|
||||
|
||||
|
@ -437,11 +441,11 @@ if(process.env.NEXT_PUBLIC_FOURSQUARE_ENABLED === 'true') {
|
|||
adapter.linkAccount = (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,
|
||||
|
@ -453,11 +457,11 @@ if(process.env.NEXT_PUBLIC_FRESHBOOKS_ENABLED === 'true') {
|
|||
adapter.linkAccount = (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",
|
||||
|
@ -465,23 +469,23 @@ if(process.env.NEXT_PUBLIC_FUSIONAUTH_ENABLED === 'true') {
|
|||
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;
|
||||
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!,
|
||||
})
|
||||
);
|
||||
|
||||
|
@ -489,15 +493,15 @@ if(process.env.NEXT_PUBLIC_GITHUB_ENABLED === 'true') {
|
|||
adapter.linkAccount = (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!,
|
||||
})
|
||||
);
|
||||
|
||||
|
@ -505,15 +509,15 @@ if(process.env.NEXT_PUBLIC_GITLAB_ENABLED === 'true') {
|
|||
adapter.linkAccount = (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!,
|
||||
})
|
||||
);
|
||||
|
||||
|
@ -521,15 +525,15 @@ if(process.env.NEXT_PUBLIC_GOOGLE_ENABLED === 'true') {
|
|||
adapter.linkAccount = (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!,
|
||||
})
|
||||
);
|
||||
|
||||
|
@ -537,18 +541,18 @@ if(process.env.NEXT_PUBLIC_HUBSPOT_ENABLED === 'true') {
|
|||
adapter.linkAccount = (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,
|
||||
clientId: process.env.IdentityServer4_CLIENT_ID,
|
||||
clientSecret: process.env.IdentityServer4_CLIENT_SECRET
|
||||
clientSecret: process.env.IdentityServer4_CLIENT_SECRET,
|
||||
})
|
||||
);
|
||||
|
||||
|
@ -556,15 +560,15 @@ if(process.env.NEXT_PUBLIC_IDS4_ENABLED === 'true') {
|
|||
adapter.linkAccount = (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!,
|
||||
})
|
||||
);
|
||||
|
||||
|
@ -572,11 +576,11 @@ if(process.env.NEXT_PUBLIC_KAKAO_ENABLED === 'true') {
|
|||
adapter.linkAccount = (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!,
|
||||
|
@ -600,11 +604,11 @@ if (process.env.NEXT_PUBLIC_KEYCLOAK_ENABLED === 'true') {
|
|||
}
|
||||
|
||||
// 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!,
|
||||
})
|
||||
);
|
||||
|
||||
|
@ -612,15 +616,15 @@ if(process.env.NEXT_PUBLIC_LINE_ENABLED === 'true') {
|
|||
adapter.linkAccount = (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!,
|
||||
})
|
||||
);
|
||||
|
||||
|
@ -628,15 +632,15 @@ if(process.env.NEXT_PUBLIC_LINKEDIN_ENABLED === 'true') {
|
|||
adapter.linkAccount = (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,
|
||||
})
|
||||
);
|
||||
|
||||
|
@ -644,15 +648,15 @@ if(process.env.NEXT_PUBLIC_MAILCHIMP_ENABLED === 'true') {
|
|||
adapter.linkAccount = (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,
|
||||
})
|
||||
);
|
||||
|
||||
|
@ -660,15 +664,15 @@ if(process.env.NEXT_PUBLIC_MAILRU_ENABLED === 'true') {
|
|||
adapter.linkAccount = (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!,
|
||||
})
|
||||
);
|
||||
|
||||
|
@ -676,15 +680,15 @@ if(process.env.NEXT_PUBLIC_NAVER_ENABLED === 'true') {
|
|||
adapter.linkAccount = (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,
|
||||
})
|
||||
);
|
||||
|
||||
|
@ -692,16 +696,16 @@ if(process.env.NEXT_PUBLIC_NETLIFY_ENABLED === 'true') {
|
|||
adapter.linkAccount = (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,
|
||||
})
|
||||
);
|
||||
|
||||
|
@ -709,16 +713,16 @@ if(process.env.NEXT_PUBLIC_OKTA_ENABLED === 'true') {
|
|||
adapter.linkAccount = (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,
|
||||
})
|
||||
);
|
||||
|
||||
|
@ -726,16 +730,16 @@ if(process.env.NEXT_PUBLIC_ONELOGIN_ENABLED === 'true') {
|
|||
adapter.linkAccount = (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,
|
||||
})
|
||||
);
|
||||
|
||||
|
@ -743,15 +747,15 @@ if(process.env.NEXT_PUBLIC_OSSO_ENABLED === 'true') {
|
|||
adapter.linkAccount = (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!,
|
||||
})
|
||||
);
|
||||
|
||||
|
@ -759,11 +763,11 @@ if(process.env.NEXT_PUBLIC_OSU_ENABLED === 'true') {
|
|||
adapter.linkAccount = (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!,
|
||||
|
@ -775,15 +779,15 @@ if(process.env.NEXT_PUBLIC_PATREON_ENABLED === 'true') {
|
|||
adapter.linkAccount = (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!,
|
||||
})
|
||||
);
|
||||
|
||||
|
@ -791,11 +795,11 @@ if(process.env.NEXT_PUBLIC_PINTEREST_ENABLED === 'true') {
|
|||
adapter.linkAccount = (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!,
|
||||
|
@ -807,15 +811,15 @@ if(process.env.NEXT_PUBLIC_PIPEDRIVE_ENABLED === 'true') {
|
|||
adapter.linkAccount = (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,
|
||||
})
|
||||
);
|
||||
|
||||
|
@ -823,11 +827,11 @@ if(process.env.NEXT_PUBLIC_REDDIT_ENABLED === 'true') {
|
|||
adapter.linkAccount = (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!,
|
||||
|
@ -839,15 +843,15 @@ if(process.env.NEXT_PUBLIC_SALESFORCE_ENABLED === 'true') {
|
|||
adapter.linkAccount = (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!,
|
||||
})
|
||||
);
|
||||
|
||||
|
@ -855,15 +859,15 @@ if(process.env.NEXT_PUBLIC_SLACK_ENABLED === 'true') {
|
|||
adapter.linkAccount = (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!,
|
||||
})
|
||||
);
|
||||
|
||||
|
@ -871,11 +875,11 @@ if(process.env.NEXT_PUBLIC_SPOTIFY_ENABLED === 'true') {
|
|||
adapter.linkAccount = (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!,
|
||||
|
@ -887,15 +891,15 @@ if(process.env.NEXT_PUBLIC_STRAVA_ENABLED === 'true') {
|
|||
adapter.linkAccount = (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!,
|
||||
})
|
||||
);
|
||||
|
||||
|
@ -903,15 +907,15 @@ if(process.env.NEXT_PUBLIC_TODOIST_ENABLED === 'true') {
|
|||
adapter.linkAccount = (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!,
|
||||
})
|
||||
);
|
||||
|
||||
|
@ -919,16 +923,16 @@ if(process.env.NEXT_PUBLIC_TWITCH_ENABLED === 'true') {
|
|||
adapter.linkAccount = (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!,
|
||||
})
|
||||
);
|
||||
|
||||
|
@ -936,15 +940,15 @@ if(process.env.NEXT_PUBLIC_UNITED_EFFECTS_ENABLED === 'true') {
|
|||
adapter.linkAccount = (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!,
|
||||
})
|
||||
);
|
||||
|
||||
|
@ -952,15 +956,15 @@ if(process.env.NEXT_PUBLIC_VK_ENABLED === 'true') {
|
|||
adapter.linkAccount = (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!,
|
||||
})
|
||||
);
|
||||
|
||||
|
@ -968,15 +972,15 @@ if(process.env.NEXT_PUBLIC_WIKIMEDIA_ENABLED === 'true') {
|
|||
adapter.linkAccount = (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,
|
||||
})
|
||||
);
|
||||
|
||||
|
@ -984,15 +988,15 @@ if(process.env.NEXT_PUBLIC_WORDPRESS_ENABLED === 'true') {
|
|||
adapter.linkAccount = (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!,
|
||||
})
|
||||
);
|
||||
|
||||
|
@ -1000,11 +1004,11 @@ if(process.env.NEXT_PUBLIC_YANDEX_ENABLED === 'true') {
|
|||
adapter.linkAccount = (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,
|
||||
|
@ -1017,15 +1021,15 @@ if(process.env.NEXT_PUBLIC_ZITADEL_ENABLED === 'true') {
|
|||
adapter.linkAccount = (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,
|
||||
})
|
||||
);
|
||||
|
||||
|
@ -1033,15 +1037,15 @@ if(process.env.NEXT_PUBLIC_ZOHO_ENABLED === 'true') {
|
|||
adapter.linkAccount = (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!,
|
||||
})
|
||||
);
|
||||
|
||||
|
@ -1049,7 +1053,7 @@ if(process.env.NEXT_PUBLIC_ZOOM_ENABLED_ENABLED === 'true') {
|
|||
adapter.linkAccount = (account) => {
|
||||
const { "not-before-policy": _, refresh_expires_in, ...data } = account;
|
||||
return _linkAccount ? _linkAccount(data) : undefined;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
export const authOptions: AuthOptions = {
|
||||
|
@ -1065,7 +1069,8 @@ export const authOptions: AuthOptions = {
|
|||
},
|
||||
callbacks: {
|
||||
async signIn({ user, account, profile, email, credentials }) {
|
||||
if (account?.provider !== "credentials") { // registration via SSO can be separately disabled
|
||||
if (account?.provider !== "credentials") {
|
||||
// registration via SSO can be separately disabled
|
||||
const existingUser = await prisma.account.findFirst({
|
||||
where: {
|
||||
providerAccountId: account?.providerAccountId,
|
||||
|
|
|
@ -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,
|
||||
},
|
||||
});
|
||||
|
||||
|
|
|
@ -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;
|
|
@ -46,7 +46,7 @@ model User {
|
|||
archiveAsWaybackMachine Boolean @default(false)
|
||||
isPrivate Boolean @default(false)
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt @default(now())
|
||||
updatedAt DateTime @default(now()) @updatedAt
|
||||
}
|
||||
|
||||
model WhitelistedUser {
|
||||
|
@ -55,7 +55,7 @@ model WhitelistedUser {
|
|||
User User? @relation(fields: [userId], references: [id])
|
||||
userId Int?
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt @default(now())
|
||||
updatedAt DateTime @default(now()) @updatedAt
|
||||
}
|
||||
|
||||
model VerificationToken {
|
||||
|
@ -63,7 +63,7 @@ model VerificationToken {
|
|||
token String @unique
|
||||
expires DateTime
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt @default(now())
|
||||
updatedAt DateTime @default(now()) @updatedAt
|
||||
|
||||
@@unique([identifier, token])
|
||||
}
|
||||
|
@ -79,7 +79,7 @@ model Collection {
|
|||
members UsersAndCollections[]
|
||||
links Link[]
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt @default(now())
|
||||
updatedAt DateTime @default(now()) @updatedAt
|
||||
|
||||
@@unique([name, ownerId])
|
||||
}
|
||||
|
@ -93,7 +93,7 @@ model UsersAndCollections {
|
|||
canUpdate Boolean
|
||||
canDelete Boolean
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt @default(now())
|
||||
updatedAt DateTime @default(now()) @updatedAt
|
||||
|
||||
@@id([userId, collectionId])
|
||||
}
|
||||
|
@ -109,12 +109,13 @@ model Link {
|
|||
tags Tag[]
|
||||
url String?
|
||||
textContent String?
|
||||
screenshotPath String?
|
||||
pdfPath String?
|
||||
readabilityPath String?
|
||||
preview String?
|
||||
image String?
|
||||
pdf String?
|
||||
readable String?
|
||||
lastPreserved DateTime?
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt @default(now())
|
||||
updatedAt DateTime @default(now()) @updatedAt
|
||||
}
|
||||
|
||||
model Tag {
|
||||
|
@ -124,7 +125,7 @@ model Tag {
|
|||
owner User @relation(fields: [ownerId], references: [id])
|
||||
ownerId Int
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt @default(now())
|
||||
updatedAt DateTime @default(now()) @updatedAt
|
||||
|
||||
@@unique([name, ownerId])
|
||||
}
|
||||
|
@ -138,7 +139,7 @@ model Subscription {
|
|||
user User @relation(fields: [userId], references: [id])
|
||||
userId Int @unique
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt @default(now())
|
||||
updatedAt DateTime @default(now()) @updatedAt
|
||||
}
|
||||
|
||||
model ApiKey {
|
||||
|
@ -150,7 +151,7 @@ model ApiKey {
|
|||
expires DateTime
|
||||
lastUsedAt DateTime?
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt @default(now())
|
||||
updatedAt DateTime @default(now()) @updatedAt
|
||||
|
||||
@@unique([token, userId])
|
||||
}
|
||||
|
|
|
@ -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: "user1@example.com",
|
||||
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: "user2@example.com",
|
||||
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: "user3@example.com",
|
||||
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: "user4@example.com",
|
||||
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: "user5@example.com",
|
||||
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",
|
||||
},
|
||||
],
|
||||
};
|
|
@ -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",
|
||||
},
|
||||
],
|
||||
},
|
||||
|
|
Ŝarĝante…
Reference in New Issue