Compare commits
69 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 15a0084fb7 | |||
| cd82083e09 | |||
| c0abf2f411 | |||
| 061e22d225 | |||
| a886437589 | |||
| 8e6f88d29f | |||
| a82c4ef85f | |||
| 6983e41576 | |||
| 7e96ba63df | |||
| 7036b46084 | |||
| af7f0fb47c | |||
| 2bba8198b8 | |||
| 9d8ae6970c | |||
| 96a70a9689 | |||
| 6cae2fb634 | |||
| 288fd9df87 | |||
| 5e6d46b6b9 | |||
| a76e996fc1 | |||
| 2264abd384 | |||
| 6544e3ecbb | |||
| a8ffbc87d1 | |||
| 92c7f40956 | |||
| 6c29d905d9 | |||
| 9b85a2b1bb | |||
| cebe746ca7 | |||
| 5b0297bfe0 | |||
| 9c5226ee51 | |||
| 6d30912812 | |||
| 78111f010b | |||
| a2637d4526 | |||
| 479995366a | |||
| 7edd7f893b | |||
| 0185ec57c7 | |||
| 7c95761990 | |||
| c67526e54c | |||
| 8db5307747 | |||
| 54beb50576 | |||
| 9ab01da369 | |||
| 78c80a5fea | |||
| 644b827669 | |||
| d66c784d3f | |||
| 1e2ed6c293 | |||
| 576d50f467 | |||
| 06234e42df | |||
| 8a901ba0e9 | |||
| 39422e54df | |||
| a71f42af6e | |||
| 5b8e1d53cc | |||
| 52f7cbb10b | |||
| 22b2734494 | |||
| 9fa9fe5db0 | |||
| 6003c6c449 | |||
| afd5e5f036 | |||
| 8082efdc67 | |||
| 3618ba907d | |||
| c68f9d68ad | |||
| 359d22e61b | |||
| 7e98de6122 | |||
| 5f34f03355 | |||
| 4344183564 | |||
| bc3ec3cc54 | |||
| fc97735703 | |||
| 8f38c82ed7 | |||
| 74030b26c5 | |||
| 2b8f7d4be2 | |||
| 797ddc4b73 | |||
| 237d301f88 | |||
| 6d7d364853 | |||
| 5fe6a5b19a |
+31
-9
@@ -15,14 +15,24 @@ NEXT_PUBLIC_DISABLE_REGISTRATION=
|
||||
NEXT_PUBLIC_CREDENTIALS_ENABLED=
|
||||
DISABLE_NEW_SSO_USERS=
|
||||
RE_ARCHIVE_LIMIT=
|
||||
NEXT_PUBLIC_MAX_FILE_SIZE=
|
||||
MAX_LINKS_PER_USER=
|
||||
ARCHIVE_TAKE_COUNT=
|
||||
BROWSER_TIMEOUT=
|
||||
IGNORE_UNAUTHORIZED_CA=
|
||||
IGNORE_HTTPS_ERRORS=
|
||||
IGNORE_URL_SIZE_LIMIT=
|
||||
ADMINISTRATOR=
|
||||
NEXT_PUBLIC_DEMO=
|
||||
NEXT_PUBLIC_DEMO_USERNAME=
|
||||
NEXT_PUBLIC_DEMO_PASSWORD=
|
||||
NEXT_PUBLIC_ADMIN=
|
||||
NEXT_PUBLIC_MAX_FILE_BUFFER=
|
||||
MONOLITH_MAX_BUFFER=
|
||||
MONOLITH_CUSTOM_OPTIONS=
|
||||
PDF_MAX_BUFFER=
|
||||
SCREENSHOT_MAX_BUFFER=
|
||||
READABILITY_MAX_BUFFER=
|
||||
PREVIEW_MAX_BUFFER=
|
||||
IMPORT_LIMIT=
|
||||
|
||||
# AWS S3 Settings
|
||||
SPACES_KEY=
|
||||
@@ -48,9 +58,9 @@ PROXY_BYPASS=
|
||||
PDF_MARGIN_TOP=
|
||||
PDF_MARGIN_BOTTOM=
|
||||
|
||||
#
|
||||
# SSO Providers
|
||||
#
|
||||
#################
|
||||
# SSO Providers #
|
||||
#################
|
||||
|
||||
# 42 School
|
||||
NEXT_PUBLIC_FORTYTWO_ENABLED=
|
||||
@@ -84,7 +94,6 @@ AUTHELIA_CLIENT_ID=""
|
||||
AUTHELIA_CLIENT_SECRET=""
|
||||
AUTHELIA_WELLKNOWN_URL=""
|
||||
|
||||
|
||||
# Authentik
|
||||
NEXT_PUBLIC_AUTHENTIK_ENABLED=
|
||||
AUTHENTIK_CUSTOM_NAME=
|
||||
@@ -92,12 +101,25 @@ AUTHENTIK_ISSUER=
|
||||
AUTHENTIK_CLIENT_ID=
|
||||
AUTHENTIK_CLIENT_SECRET=
|
||||
|
||||
# Azure AD B2C
|
||||
NEXT_PUBLIC_AZURE_AD_B2C_ENABLED=
|
||||
AZURE_AD_B2C_TENANT_NAME=
|
||||
AZURE_AD_B2C_CLIENT_ID=
|
||||
AZURE_AD_B2C_CLIENT_SECRET=
|
||||
AZURE_AD_B2C_PRIMARY_USER_FLOW=
|
||||
|
||||
# Azure AD
|
||||
NEXT_PUBLIC_AZURE_AD_ENABLED=
|
||||
AZURE_AD_CLIENT_ID=
|
||||
AZURE_AD_CLIENT_SECRET=
|
||||
AZURE_AD_TENANT_ID=
|
||||
|
||||
# Battle.net
|
||||
NEXT_PUBLIC_BATTLENET_ENABLED=
|
||||
BATTLENET_CUSTOM_NAME=
|
||||
BATTLENET_CLIENT_ID=
|
||||
BATTLENET_CLIENT_SECRET=
|
||||
BATLLENET_ISSUER=
|
||||
BATTLENET_ISSUER=
|
||||
|
||||
# Box
|
||||
NEXT_PUBLIC_BOX_ENABLED=
|
||||
@@ -186,8 +208,8 @@ FUSIONAUTH_TENANT_ID=
|
||||
# GitHub
|
||||
NEXT_PUBLIC_GITHUB_ENABLED=
|
||||
GITHUB_CUSTOM_NAME=
|
||||
GITHUB_CLIENT_ID=
|
||||
GITHUB_CLIENT_SECRET=
|
||||
GITHUB_ID=
|
||||
GITHUB_SECRET=
|
||||
|
||||
# GitLab
|
||||
NEXT_PUBLIC_GITLAB_ENABLED=
|
||||
|
||||
+18
-1
@@ -8,13 +8,30 @@ WORKDIR /data
|
||||
|
||||
COPY ./package.json ./yarn.lock ./playwright.config.ts ./
|
||||
|
||||
# Increase timeout to pass github actions arm64 build
|
||||
RUN --mount=type=cache,sharing=locked,target=/usr/local/share/.cache/yarn yarn install --network-timeout 10000000
|
||||
|
||||
RUN apt-get update
|
||||
|
||||
RUN apt-get install -y \
|
||||
build-essential \
|
||||
curl \
|
||||
libssl-dev \
|
||||
pkg-config
|
||||
|
||||
RUN apt-get update
|
||||
|
||||
RUN curl https://sh.rustup.rs -sSf | bash -s -- -y
|
||||
|
||||
ENV PATH="/root/.cargo/bin:${PATH}"
|
||||
|
||||
RUN cargo install monolith
|
||||
|
||||
RUN npx playwright install-deps && \
|
||||
apt-get clean && \
|
||||
yarn cache clean
|
||||
|
||||
RUN yarn playwright install
|
||||
|
||||
COPY . .
|
||||
|
||||
RUN yarn prisma generate && \
|
||||
|
||||
@@ -57,7 +57,7 @@ We've forked the old version from the current repository into [this repo](https:
|
||||
|
||||
## Features
|
||||
|
||||
- 📸 Auto capture a screenshot, PDF, and readable view of each webpage.
|
||||
- 📸 Auto capture a screenshot, PDF, single html file, and readable view of each webpage.
|
||||
- 🏛️ Send your webpage to Wayback Machine ([archive.org](https://archive.org)) for a snapshot. (Optional)
|
||||
- 📂 Organize links by collection, sub-collection, name, description and multiple tags.
|
||||
- 👥 Collaborate on gathering links in a collection.
|
||||
|
||||
@@ -10,8 +10,8 @@ export default function Announcement({ toggleAnnouncementBar }: Props) {
|
||||
const announcementId = localStorage.getItem("announcementId");
|
||||
|
||||
return (
|
||||
<div className="fixed left-0 right-0 bottom-20 sm:bottom-10 w-full p-5 z-30">
|
||||
<div className="mx-auto w-full p-2 flex justify-between gap-2 items-center border border-primary shadow-xl rounded-xl bg-base-300 backdrop-blur-sm bg-opacity-80 max-w-md">
|
||||
<div className="fixed mx-auto bottom-20 sm:bottom-10 w-full pointer-events-none p-5 z-30">
|
||||
<div className="mx-auto pointer-events-auto p-2 flex justify-between gap-2 items-center border border-primary shadow-xl rounded-xl bg-base-300 backdrop-blur-sm bg-opacity-80 max-w-md">
|
||||
<i className="bi-stars text-2xl text-yellow-600 dark:text-yellow-500"></i>
|
||||
<p className="w-4/5 text-center text-sm sm:text-base">
|
||||
<Trans
|
||||
|
||||
@@ -39,6 +39,7 @@ export default function CollectionCard({ collection, className }: Props) {
|
||||
username: "",
|
||||
image: "",
|
||||
archiveAsScreenshot: undefined as unknown as boolean,
|
||||
archiveAsMonolith: undefined as unknown as boolean,
|
||||
archiveAsPDF: undefined as unknown as boolean,
|
||||
});
|
||||
|
||||
@@ -54,6 +55,7 @@ export default function CollectionCard({ collection, className }: Props) {
|
||||
username: account.username as string,
|
||||
image: account.image as string,
|
||||
archiveAsScreenshot: account.archiveAsScreenshot as boolean,
|
||||
archiveAsMonolith: account.archiveAsMonolith as boolean,
|
||||
archiveAsPDF: account.archiveAsPDF as boolean,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -81,12 +81,15 @@ const LinkListOptions = ({
|
||||
|
||||
toast.dismiss(load);
|
||||
|
||||
response.ok &&
|
||||
if (response.ok) {
|
||||
toast.success(
|
||||
selectedLinks.length === 1
|
||||
? t("link_deleted")
|
||||
: t("links_deleted", { count: selectedLinks.length })
|
||||
);
|
||||
} else {
|
||||
toast.error(response.data as string);
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
|
||||
@@ -55,8 +55,11 @@ export default function LinkActions({
|
||||
|
||||
toast.dismiss(load);
|
||||
|
||||
response.ok &&
|
||||
if (response.ok) {
|
||||
toast.success(isAlreadyPinned ? t("link_unpinned") : t("link_unpinned"));
|
||||
} else {
|
||||
toast.error(response.data as string);
|
||||
}
|
||||
};
|
||||
|
||||
const deleteLink = async () => {
|
||||
@@ -66,7 +69,11 @@ export default function LinkActions({
|
||||
|
||||
toast.dismiss(load);
|
||||
|
||||
response.ok && toast.success(t("deleted"));
|
||||
if (response.ok) {
|
||||
toast.success(t("deleted"));
|
||||
} else {
|
||||
toast.error(response.data as string);
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
|
||||
@@ -70,7 +70,14 @@ export default function LinkIcon({
|
||||
size={size}
|
||||
icon="bi-file-earmark-image"
|
||||
/>
|
||||
) : undefined}
|
||||
) : // : link.type === "monolith" ? (
|
||||
// <LinkPlaceholderIcon
|
||||
// iconClasses={iconClasses + dimension}
|
||||
// size={size}
|
||||
// icon="bi-filetype-html"
|
||||
// />
|
||||
// )
|
||||
undefined}
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -157,7 +157,12 @@ export default function LinkCardCompact({
|
||||
// linkInfo={showInfo}
|
||||
/>
|
||||
</div>
|
||||
<div className="divider my-0 last:hidden h-[1px]"></div>
|
||||
<div
|
||||
className="last:hidden rounded-none"
|
||||
style={{
|
||||
borderTop: "1px solid var(--fallback-bc,oklch(var(--bc)/0.1))",
|
||||
}}
|
||||
></div>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -177,7 +177,7 @@ export default function LinkMasonry({ link, flipDropdown, editMode }: Props) {
|
||||
</p>
|
||||
)}
|
||||
|
||||
{link.tags[0] && (
|
||||
{link.tags && link.tags[0] && (
|
||||
<div className="flex gap-1 items-center flex-wrap">
|
||||
{link.tags.map((e, i) => (
|
||||
<Link
|
||||
@@ -225,7 +225,7 @@ export default function LinkMasonry({ link, flipDropdown, editMode }: Props) {
|
||||
</span>
|
||||
)}
|
||||
</p>
|
||||
{link.tags[0] && (
|
||||
{link.tags && link.tags[0] && (
|
||||
<>
|
||||
<p className="text-neutral text-lg mt-3 font-semibold">
|
||||
{t("tags")}
|
||||
|
||||
@@ -30,7 +30,11 @@ export default function DeleteLinkModal({ onClose, activeLink }: Props) {
|
||||
|
||||
toast.dismiss(load);
|
||||
|
||||
response.ok && toast.success(t("deleted"));
|
||||
if (response.ok) {
|
||||
toast.success(t("deleted"));
|
||||
} else {
|
||||
toast.error(response.data as string);
|
||||
}
|
||||
|
||||
if (router.pathname.startsWith("/links/[id]")) {
|
||||
router.push("/dashboard");
|
||||
|
||||
@@ -20,7 +20,11 @@ export default function DeleteUserModal({ onClose, userId }: Props) {
|
||||
|
||||
toast.dismiss(load);
|
||||
|
||||
response.ok && toast.success(t("user_deleted"));
|
||||
if (response.ok) {
|
||||
toast.success(t("user_deleted"));
|
||||
} else {
|
||||
toast.error(response.data as string);
|
||||
}
|
||||
|
||||
onClose();
|
||||
};
|
||||
|
||||
@@ -68,6 +68,7 @@ export default function EditCollectionSharingModal({
|
||||
username: "",
|
||||
image: "",
|
||||
archiveAsScreenshot: undefined as unknown as boolean,
|
||||
archiveAsMonolith: undefined as unknown as boolean,
|
||||
archiveAsPDF: undefined as unknown as boolean,
|
||||
});
|
||||
|
||||
|
||||
@@ -30,6 +30,7 @@ export default function NewLinkModal({ onClose }: Props) {
|
||||
image: "",
|
||||
pdf: "",
|
||||
readable: "",
|
||||
monolith: "",
|
||||
textContent: "",
|
||||
collection: {
|
||||
name: "",
|
||||
|
||||
@@ -12,12 +12,14 @@ import { useSession } from "next-auth/react";
|
||||
import {
|
||||
pdfAvailable,
|
||||
readabilityAvailable,
|
||||
monolithAvailable,
|
||||
screenshotAvailable,
|
||||
} from "@/lib/shared/getArchiveValidity";
|
||||
import PreservedFormatRow from "@/components/PreserverdFormatRow";
|
||||
import useAccountStore from "@/store/account";
|
||||
import getPublicUserData from "@/lib/client/getPublicUserData";
|
||||
import { useTranslation } from "next-i18next";
|
||||
import { BeatLoader } from "react-spinners";
|
||||
|
||||
type Props = {
|
||||
onClose: Function;
|
||||
@@ -41,6 +43,7 @@ export default function PreservedFormatsModal({ onClose, activeLink }: Props) {
|
||||
username: "",
|
||||
image: "",
|
||||
archiveAsScreenshot: undefined as unknown as boolean,
|
||||
archiveAsMonolith: undefined as unknown as boolean,
|
||||
archiveAsPDF: undefined as unknown as boolean,
|
||||
});
|
||||
|
||||
@@ -58,6 +61,7 @@ export default function PreservedFormatsModal({ onClose, activeLink }: Props) {
|
||||
username: account.username as string,
|
||||
image: account.image as string,
|
||||
archiveAsScreenshot: account.archiveAsScreenshot as boolean,
|
||||
archiveAsMonolith: account.archiveAsScreenshot as boolean,
|
||||
archiveAsPDF: account.archiveAsPDF as boolean,
|
||||
});
|
||||
}
|
||||
@@ -72,6 +76,9 @@ export default function PreservedFormatsModal({ onClose, activeLink }: Props) {
|
||||
(collectionOwner.archiveAsScreenshot === true
|
||||
? link.pdf && link.pdf !== "pending"
|
||||
: true) &&
|
||||
(collectionOwner.archiveAsMonolith === true
|
||||
? link.monolith && link.monolith !== "pending"
|
||||
: true) &&
|
||||
(collectionOwner.archiveAsPDF === true
|
||||
? link.pdf && link.pdf !== "pending"
|
||||
: true) &&
|
||||
@@ -80,6 +87,15 @@ export default function PreservedFormatsModal({ onClose, activeLink }: Props) {
|
||||
);
|
||||
};
|
||||
|
||||
const atLeastOneFormatAvailable = () => {
|
||||
return (
|
||||
screenshotAvailable(link) ||
|
||||
pdfAvailable(link) ||
|
||||
readabilityAvailable(link) ||
|
||||
monolithAvailable(link)
|
||||
);
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
(async () => {
|
||||
const data = await getLink(link.id as number, isPublic);
|
||||
@@ -108,7 +124,7 @@ export default function PreservedFormatsModal({ onClose, activeLink }: Props) {
|
||||
clearInterval(interval);
|
||||
}
|
||||
};
|
||||
}, [link, getLink]);
|
||||
}, [link?.monolith]);
|
||||
|
||||
const updateArchive = async () => {
|
||||
const load = toast.loading(t("sending_request"));
|
||||
@@ -133,56 +149,81 @@ export default function PreservedFormatsModal({ onClose, activeLink }: Props) {
|
||||
<Modal toggleModal={onClose}>
|
||||
<p className="text-xl font-thin">{t("preserved_formats")}</p>
|
||||
<div className="divider mb-2 mt-1"></div>
|
||||
{isReady() &&
|
||||
(screenshotAvailable(link) ||
|
||||
pdfAvailable(link) ||
|
||||
readabilityAvailable(link)) ? (
|
||||
{screenshotAvailable(link) ||
|
||||
pdfAvailable(link) ||
|
||||
readabilityAvailable(link) ||
|
||||
monolithAvailable(link) ? (
|
||||
<p className="mb-3">{t("available_formats")}</p>
|
||||
) : (
|
||||
""
|
||||
)}
|
||||
|
||||
<div className="flex flex-col gap-3">
|
||||
{isReady() ? (
|
||||
<>
|
||||
{screenshotAvailable(link) ? (
|
||||
<PreservedFormatRow
|
||||
name={t("screenshot")}
|
||||
icon={"bi-file-earmark-image"}
|
||||
format={
|
||||
link?.image?.endsWith("png")
|
||||
? ArchivedFormat.png
|
||||
: ArchivedFormat.jpeg
|
||||
}
|
||||
activeLink={link}
|
||||
downloadable={true}
|
||||
/>
|
||||
) : undefined}
|
||||
{pdfAvailable(link) ? (
|
||||
<PreservedFormatRow
|
||||
name={t("pdf")}
|
||||
icon="bi-file-earmark-pdf"
|
||||
format={ArchivedFormat.pdf}
|
||||
activeLink={link}
|
||||
downloadable={true}
|
||||
/>
|
||||
) : undefined}
|
||||
{readabilityAvailable(link) ? (
|
||||
<PreservedFormatRow
|
||||
name={t("readable")}
|
||||
icon="bi-file-earmark-text"
|
||||
format={ArchivedFormat.readability}
|
||||
activeLink={link}
|
||||
/>
|
||||
) : undefined}
|
||||
</>
|
||||
) : (
|
||||
<div className="w-full h-full flex flex-col justify-center p-10 skeleton bg-base-200">
|
||||
<i className="bi-stack drop-shadow text-primary text-8xl mx-auto mb-5"></i>
|
||||
<div className={`flex flex-col gap-3`}>
|
||||
{monolithAvailable(link) ? (
|
||||
<PreservedFormatRow
|
||||
name={t("webpage")}
|
||||
icon={"bi-filetype-html"}
|
||||
format={ArchivedFormat.monolith}
|
||||
activeLink={link}
|
||||
downloadable={true}
|
||||
/>
|
||||
) : undefined}
|
||||
|
||||
{screenshotAvailable(link) ? (
|
||||
<PreservedFormatRow
|
||||
name={t("screenshot")}
|
||||
icon={"bi-file-earmark-image"}
|
||||
format={
|
||||
link?.image?.endsWith("png")
|
||||
? ArchivedFormat.png
|
||||
: ArchivedFormat.jpeg
|
||||
}
|
||||
activeLink={link}
|
||||
downloadable={true}
|
||||
/>
|
||||
) : undefined}
|
||||
|
||||
{pdfAvailable(link) ? (
|
||||
<PreservedFormatRow
|
||||
name={t("pdf")}
|
||||
icon={"bi-file-earmark-pdf"}
|
||||
format={ArchivedFormat.pdf}
|
||||
activeLink={link}
|
||||
downloadable={true}
|
||||
/>
|
||||
) : undefined}
|
||||
|
||||
{readabilityAvailable(link) ? (
|
||||
<PreservedFormatRow
|
||||
name={t("readable")}
|
||||
icon={"bi-file-earmark-text"}
|
||||
format={ArchivedFormat.readability}
|
||||
activeLink={link}
|
||||
/>
|
||||
) : undefined}
|
||||
|
||||
{!isReady() && !atLeastOneFormatAvailable() ? (
|
||||
<div className={`w-full h-full flex flex-col justify-center p-10`}>
|
||||
<BeatLoader
|
||||
color="oklch(var(--p))"
|
||||
className="mx-auto mb-3"
|
||||
size={30}
|
||||
/>
|
||||
|
||||
<p className="text-center text-2xl">{t("preservation_in_queue")}</p>
|
||||
<p className="text-center text-lg">{t("check_back_later")}</p>
|
||||
</div>
|
||||
)}
|
||||
) : !isReady() && atLeastOneFormatAvailable() ? (
|
||||
<div className={`w-full h-full flex flex-col justify-center p-5`}>
|
||||
<BeatLoader
|
||||
color="oklch(var(--p))"
|
||||
className="mx-auto mb-3"
|
||||
size={20}
|
||||
/>
|
||||
<p className="text-center">{t("there_are_more_formats")}</p>
|
||||
<p className="text-center text-sm">{t("check_back_later")}</p>
|
||||
</div>
|
||||
) : undefined}
|
||||
|
||||
<div
|
||||
className={`flex flex-col sm:flex-row gap-3 items-center justify-center ${
|
||||
|
||||
@@ -30,6 +30,8 @@ export default function DeleteTokenModal({ onClose, activeToken }: Props) {
|
||||
|
||||
if (response.ok) {
|
||||
toast.success(t("token_revoked"));
|
||||
} else {
|
||||
toast.error(response.data as string);
|
||||
}
|
||||
|
||||
onClose();
|
||||
|
||||
@@ -5,7 +5,10 @@ import TextInput from "@/components/TextInput";
|
||||
import unescapeString from "@/lib/client/unescapeString";
|
||||
import useCollectionStore from "@/store/collections";
|
||||
import useLinkStore from "@/store/links";
|
||||
import { LinkIncludingShortenedCollectionAndTags } from "@/types/global";
|
||||
import {
|
||||
LinkIncludingShortenedCollectionAndTags,
|
||||
ArchivedFormat,
|
||||
} from "@/types/global";
|
||||
import { useSession } from "next-auth/react";
|
||||
import { useRouter } from "next/router";
|
||||
import toast from "react-hot-toast";
|
||||
@@ -30,6 +33,7 @@ export default function UploadFileModal({ onClose }: Props) {
|
||||
image: "",
|
||||
pdf: "",
|
||||
readable: "",
|
||||
monolith: "",
|
||||
textContent: "",
|
||||
collection: {
|
||||
name: "",
|
||||
@@ -92,6 +96,24 @@ export default function UploadFileModal({ onClose }: Props) {
|
||||
|
||||
const submit = async () => {
|
||||
if (!submitLoader && file) {
|
||||
let fileType: ArchivedFormat | null = null;
|
||||
let linkType: "url" | "image" | "monolith" | "pdf" | null = null;
|
||||
|
||||
if (file?.type === "image/jpg" || file.type === "image/jpeg") {
|
||||
fileType = ArchivedFormat.jpeg;
|
||||
linkType = "image";
|
||||
} else if (file.type === "image/png") {
|
||||
fileType = ArchivedFormat.png;
|
||||
linkType = "image";
|
||||
} else if (file.type === "application/pdf") {
|
||||
fileType = ArchivedFormat.pdf;
|
||||
linkType = "pdf";
|
||||
}
|
||||
// else if (file.type === "text/html") {
|
||||
// fileType = ArchivedFormat.monolith;
|
||||
// linkType = "monolith";
|
||||
// }
|
||||
|
||||
setSubmitLoader(true);
|
||||
const load = toast.loading(t("creating"));
|
||||
|
||||
@@ -122,14 +144,14 @@ export default function UploadFileModal({ onClose }: Props) {
|
||||
<label className="btn h-10 btn-sm w-full border border-neutral-content hover:border-neutral-content flex justify-between">
|
||||
<input
|
||||
type="file"
|
||||
accept=".pdf,.png,.jpg,.jpeg"
|
||||
accept=".pdf,.png,.jpg,.jpeg,.html"
|
||||
className="cursor-pointer custom-file-input"
|
||||
onChange={(e) => e.target.files && setFile(e.target.files[0])}
|
||||
/>
|
||||
</label>
|
||||
<p className="text-xs font-semibold mt-2">
|
||||
{t("file_types", {
|
||||
size: process.env.NEXT_PUBLIC_MAX_FILE_SIZE || 30,
|
||||
size: process.env.NEXT_PUBLIC_MAX_FILE_BUFFER || 10,
|
||||
})}
|
||||
</p>
|
||||
</div>
|
||||
|
||||
@@ -12,7 +12,7 @@ export default function PageHeader({
|
||||
return (
|
||||
<div className="flex items-center gap-3">
|
||||
<i
|
||||
className={`${icon} text-primary text-3xl sm:text-4xl drop-shadow`}
|
||||
className={`${icon} text-primary sm:text-3xl text-2xl drop-shadow`}
|
||||
></i>
|
||||
<div>
|
||||
<p className="text-3xl capitalize font-thin">{title}</p>
|
||||
|
||||
@@ -4,6 +4,7 @@ import {
|
||||
ArchivedFormat,
|
||||
LinkIncludingShortenedCollectionAndTags,
|
||||
} from "@/types/global";
|
||||
import toast from "react-hot-toast";
|
||||
import Link from "next/link";
|
||||
import { useRouter } from "next/router";
|
||||
import { useSession } from "next-auth/react";
|
||||
@@ -60,7 +61,7 @@ export default function PreservedFormatRow({
|
||||
clearInterval(interval);
|
||||
}
|
||||
};
|
||||
}, [link?.image, link?.pdf, link?.readable]);
|
||||
}, [link?.image, link?.pdf, link?.readable, link?.monolith]);
|
||||
|
||||
const handleDownload = () => {
|
||||
const path = `/api/v1/archives/${link?.id}?format=${format}`;
|
||||
@@ -68,10 +69,15 @@ export default function PreservedFormatRow({
|
||||
.then((response) => {
|
||||
if (response.ok) {
|
||||
// Create a temporary link and click it to trigger the download
|
||||
const link = document.createElement("a");
|
||||
link.href = path;
|
||||
link.download = format === ArchivedFormat.pdf ? "PDF" : "Screenshot";
|
||||
link.click();
|
||||
const anchorElement = document.createElement("a");
|
||||
anchorElement.href = path;
|
||||
anchorElement.download =
|
||||
format === ArchivedFormat.monolith
|
||||
? "Webpage"
|
||||
: format === ArchivedFormat.pdf
|
||||
? "PDF"
|
||||
: "Screenshot";
|
||||
anchorElement.click();
|
||||
} else {
|
||||
console.error("Failed to download file");
|
||||
}
|
||||
|
||||
@@ -11,6 +11,8 @@ export default function ProfileDropdown() {
|
||||
const { settings, updateSettings } = useLocalSettingsStore();
|
||||
const { account } = useAccountStore();
|
||||
|
||||
const isAdmin = account.id === Number(process.env.NEXT_PUBLIC_ADMIN || 1);
|
||||
|
||||
const handleToggle = () => {
|
||||
const newTheme = settings.theme === "dark" ? "light" : "dark";
|
||||
updateSettings({ theme: newTheme });
|
||||
@@ -29,7 +31,11 @@ export default function ProfileDropdown() {
|
||||
priority={true}
|
||||
/>
|
||||
</div>
|
||||
<ul className="dropdown-content z-[1] menu shadow bg-base-200 border border-neutral-content rounded-box w-40 mt-1">
|
||||
<ul
|
||||
className={`dropdown-content z-[1] menu shadow bg-base-200 border border-neutral-content rounded-box ${
|
||||
isAdmin ? "w-48" : "w-40"
|
||||
} mt-1`}
|
||||
>
|
||||
<li>
|
||||
<Link
|
||||
href="/settings/account"
|
||||
@@ -54,6 +60,18 @@ export default function ProfileDropdown() {
|
||||
})}
|
||||
</div>
|
||||
</li>
|
||||
{isAdmin ? (
|
||||
<li>
|
||||
<Link
|
||||
href="/admin"
|
||||
onClick={() => (document?.activeElement as HTMLElement)?.blur()}
|
||||
tabIndex={0}
|
||||
role="button"
|
||||
>
|
||||
{t("server_administration")}
|
||||
</Link>
|
||||
</li>
|
||||
) : null}
|
||||
<li>
|
||||
<div
|
||||
onClick={() => {
|
||||
|
||||
@@ -81,9 +81,11 @@ export default function ReadableView({ link }: Props) {
|
||||
(link?.image === "pending" ||
|
||||
link?.pdf === "pending" ||
|
||||
link?.readable === "pending" ||
|
||||
link?.monolith === "pending" ||
|
||||
!link?.image ||
|
||||
!link?.pdf ||
|
||||
!link?.readable)
|
||||
!link?.readable ||
|
||||
!link?.monolith)
|
||||
) {
|
||||
interval = setInterval(() => getLink(link.id as number), 5000);
|
||||
} else {
|
||||
@@ -97,7 +99,7 @@ export default function ReadableView({ link }: Props) {
|
||||
clearInterval(interval);
|
||||
}
|
||||
};
|
||||
}, [link?.image, link?.pdf, link?.readable]);
|
||||
}, [link?.image, link?.pdf, link?.readable, link?.monolith]);
|
||||
|
||||
const rgbToHex = (r: number, g: number, b: number): string =>
|
||||
"#" +
|
||||
|
||||
@@ -52,25 +52,25 @@ export default function Sidebar({ className }: { className?: string }) {
|
||||
>
|
||||
<div className="grid grid-cols-2 gap-2">
|
||||
<SidebarHighlightLink
|
||||
title={"Dashboard"}
|
||||
title={t("dashboard")}
|
||||
href={`/dashboard`}
|
||||
icon={"bi-house"}
|
||||
active={active === `/dashboard`}
|
||||
/>
|
||||
<SidebarHighlightLink
|
||||
title={"Pinned"}
|
||||
title={t("pinned")}
|
||||
href={`/links/pinned`}
|
||||
icon={"bi-pin-angle"}
|
||||
active={active === `/links/pinned`}
|
||||
/>
|
||||
<SidebarHighlightLink
|
||||
title={"All Links"}
|
||||
title={t("all_links")}
|
||||
href={`/links`}
|
||||
icon={"bi-link-45deg"}
|
||||
active={active === `/links`}
|
||||
/>
|
||||
<SidebarHighlightLink
|
||||
title={"All Collections"}
|
||||
title={t("all_collections")}
|
||||
href={`/collections`}
|
||||
icon={"bi-folder"}
|
||||
active={active === `/collections`}
|
||||
|
||||
+61
-248
@@ -1,15 +1,16 @@
|
||||
import { LaunchOptions, chromium, devices } from "playwright";
|
||||
import { prisma } from "./db";
|
||||
import createFile from "./storage/createFile";
|
||||
import sendToWayback from "./sendToWayback";
|
||||
import { Readability } from "@mozilla/readability";
|
||||
import { JSDOM } from "jsdom";
|
||||
import DOMPurify from "dompurify";
|
||||
import sendToWayback from "./preservationScheme/sendToWayback";
|
||||
import { Collection, Link, User } from "@prisma/client";
|
||||
import validateUrlSize from "./validateUrlSize";
|
||||
import fetchHeaders from "./fetchHeaders";
|
||||
import createFolder from "./storage/createFolder";
|
||||
import generatePreview from "./generatePreview";
|
||||
import { removeFiles } from "./manageLinkFiles";
|
||||
import handleMonolith from "./preservationScheme/handleMonolith";
|
||||
import handleReadablility from "./preservationScheme/handleReadablility";
|
||||
import handleArchivePreview from "./preservationScheme/handleArchivePreview";
|
||||
import handleScreenshotAndPdf from "./preservationScheme/handleScreenshotAndPdf";
|
||||
import imageHandler from "./preservationScheme/imageHandler";
|
||||
import pdfHandler from "./preservationScheme/pdfHandler";
|
||||
|
||||
type LinksAndCollectionAndOwner = Link & {
|
||||
collection: Collection & {
|
||||
@@ -20,6 +21,18 @@ type LinksAndCollectionAndOwner = Link & {
|
||||
const BROWSER_TIMEOUT = Number(process.env.BROWSER_TIMEOUT) || 5;
|
||||
|
||||
export default async function archiveHandler(link: LinksAndCollectionAndOwner) {
|
||||
const timeoutPromise = new Promise((_, reject) => {
|
||||
setTimeout(
|
||||
() =>
|
||||
reject(
|
||||
new Error(
|
||||
`Browser has been open for more than ${BROWSER_TIMEOUT} minutes.`
|
||||
)
|
||||
),
|
||||
BROWSER_TIMEOUT * 60000
|
||||
);
|
||||
});
|
||||
|
||||
// allow user to configure a proxy
|
||||
let browserOptions: LaunchOptions = {};
|
||||
if (process.env.PROXY) {
|
||||
@@ -39,18 +52,6 @@ export default async function archiveHandler(link: LinksAndCollectionAndOwner) {
|
||||
|
||||
const page = await context.newPage();
|
||||
|
||||
const timeoutPromise = new Promise((_, reject) => {
|
||||
setTimeout(
|
||||
() =>
|
||||
reject(
|
||||
new Error(
|
||||
`Browser has been open for more than ${BROWSER_TIMEOUT} minutes.`
|
||||
)
|
||||
),
|
||||
BROWSER_TIMEOUT * 60000
|
||||
);
|
||||
});
|
||||
|
||||
createFolder({
|
||||
filePath: `archives/preview/${link.collectionId}`,
|
||||
});
|
||||
@@ -62,17 +63,11 @@ export default async function archiveHandler(link: LinksAndCollectionAndOwner) {
|
||||
try {
|
||||
await Promise.race([
|
||||
(async () => {
|
||||
const validatedUrl = link.url
|
||||
? await validateUrlSize(link.url)
|
||||
: undefined;
|
||||
const user = link.collection?.owner;
|
||||
|
||||
if (
|
||||
validatedUrl === null &&
|
||||
process.env.IGNORE_URL_SIZE_LIMIT !== "true"
|
||||
)
|
||||
throw "Something went wrong while retrieving the file size.";
|
||||
const header = link.url ? await fetchHeaders(link.url) : undefined;
|
||||
|
||||
const contentType = validatedUrl?.get("content-type");
|
||||
const contentType = header?.get("content-type");
|
||||
let linkType = "url";
|
||||
let imageExtension = "png";
|
||||
|
||||
@@ -84,23 +79,22 @@ export default async function archiveHandler(link: LinksAndCollectionAndOwner) {
|
||||
else if (contentType.includes("image/png")) imageExtension = "png";
|
||||
}
|
||||
|
||||
const user = link.collection?.owner;
|
||||
|
||||
// send to archive.org
|
||||
if (user.archiveAsWaybackMachine && link.url) sendToWayback(link.url);
|
||||
|
||||
const targetLink = await prisma.link.update({
|
||||
await prisma.link.update({
|
||||
where: { id: link.id },
|
||||
data: {
|
||||
type: linkType,
|
||||
image:
|
||||
user.archiveAsScreenshot && !link.image?.startsWith("archive")
|
||||
? "pending"
|
||||
: "unavailable",
|
||||
: undefined,
|
||||
pdf:
|
||||
user.archiveAsPDF && !link.pdf?.startsWith("archive")
|
||||
? "pending"
|
||||
: "unavailable",
|
||||
: undefined,
|
||||
monolith:
|
||||
user.archiveAsMonolith && !link.monolith?.startsWith("archive")
|
||||
? "pending"
|
||||
: undefined,
|
||||
readable: !link.readable?.startsWith("archive")
|
||||
? "pending"
|
||||
: undefined,
|
||||
@@ -111,6 +105,9 @@ export default async function archiveHandler(link: LinksAndCollectionAndOwner) {
|
||||
},
|
||||
});
|
||||
|
||||
// send to archive.org
|
||||
if (user.archiveAsWaybackMachine && link.url) sendToWayback(link.url);
|
||||
|
||||
if (linkType === "image" && !link.image?.startsWith("archive")) {
|
||||
await imageHandler(link, imageExtension); // archive image (jpeg/png)
|
||||
return;
|
||||
@@ -124,151 +121,37 @@ export default async function archiveHandler(link: LinksAndCollectionAndOwner) {
|
||||
|
||||
const content = await page.content();
|
||||
|
||||
// TODO single file
|
||||
// const session = await page.context().newCDPSession(page);
|
||||
// const doc = await session.send("Page.captureSnapshot", {
|
||||
// format: "mhtml",
|
||||
// });
|
||||
// const saveDocLocally = (doc: any) => {
|
||||
// console.log(doc);
|
||||
// return createFile({
|
||||
// data: doc,
|
||||
// filePath: `archives/${targetLink.collectionId}/${link.id}.mhtml`,
|
||||
// });
|
||||
// };
|
||||
// saveDocLocally(doc.data);
|
||||
// Preview
|
||||
if (
|
||||
!link.preview?.startsWith("archives") &&
|
||||
!link.preview?.startsWith("unavailable")
|
||||
)
|
||||
await handleArchivePreview(link, page);
|
||||
|
||||
// Readability
|
||||
const window = new JSDOM("").window;
|
||||
const purify = DOMPurify(window);
|
||||
const cleanedUpContent = purify.sanitize(content);
|
||||
const dom = new JSDOM(cleanedUpContent, { url: link.url || "" });
|
||||
const article = new Readability(dom.window.document).parse();
|
||||
const articleText = article?.textContent
|
||||
.replace(/ +(?= )/g, "") // strip out multiple spaces
|
||||
.replace(/(\r\n|\n|\r)/gm, " "); // strip out line breaks
|
||||
if (
|
||||
articleText &&
|
||||
articleText !== "" &&
|
||||
!link.readable?.startsWith("archive")
|
||||
) {
|
||||
await createFile({
|
||||
data: JSON.stringify(article),
|
||||
filePath: `archives/${targetLink.collectionId}/${link.id}_readability.json`,
|
||||
});
|
||||
|
||||
await prisma.link.update({
|
||||
where: { id: link.id },
|
||||
data: {
|
||||
readable: `archives/${targetLink.collectionId}/${link.id}_readability.json`,
|
||||
textContent: articleText,
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
// Preview
|
||||
|
||||
const ogImageUrl = await page.evaluate(() => {
|
||||
const metaTag = document.querySelector('meta[property="og:image"]');
|
||||
return metaTag ? (metaTag as any).content : null;
|
||||
});
|
||||
|
||||
if (ogImageUrl) {
|
||||
console.log("Found og:image URL:", ogImageUrl);
|
||||
|
||||
// Download the image
|
||||
const imageResponse = await page.goto(ogImageUrl);
|
||||
|
||||
// Check if imageResponse is not null
|
||||
if (imageResponse && !link.preview?.startsWith("archive")) {
|
||||
const buffer = await imageResponse.body();
|
||||
await generatePreview(buffer, link.collectionId, link.id);
|
||||
}
|
||||
|
||||
await page.goBack();
|
||||
} else if (!link.preview?.startsWith("archive")) {
|
||||
console.log("No og:image found");
|
||||
await page
|
||||
.screenshot({ type: "jpeg", quality: 20 })
|
||||
.then((screenshot) => {
|
||||
return createFile({
|
||||
data: screenshot,
|
||||
filePath: `archives/preview/${link.collectionId}/${link.id}.jpeg`,
|
||||
});
|
||||
})
|
||||
.then(() => {
|
||||
return prisma.link.update({
|
||||
where: { id: link.id },
|
||||
data: {
|
||||
preview: `archives/preview/${link.collectionId}/${link.id}.jpeg`,
|
||||
},
|
||||
});
|
||||
});
|
||||
}
|
||||
!link.readable?.startsWith("archives") &&
|
||||
!link.readable?.startsWith("unavailable")
|
||||
)
|
||||
await handleReadablility(content, link);
|
||||
|
||||
// Screenshot/PDF
|
||||
await page.evaluate(
|
||||
autoScroll,
|
||||
Number(process.env.AUTOSCROLL_TIMEOUT) || 30
|
||||
);
|
||||
if (
|
||||
(!link.image?.startsWith("archives") &&
|
||||
!link.image?.startsWith("unavailable")) ||
|
||||
(!link.pdf?.startsWith("archives") &&
|
||||
!link.pdf?.startsWith("unavailable"))
|
||||
)
|
||||
await handleScreenshotAndPdf(link, page, user);
|
||||
|
||||
// Check if the user hasn't deleted the link by the time we're done scrolling
|
||||
const linkExists = await prisma.link.findUnique({
|
||||
where: { id: link.id },
|
||||
});
|
||||
if (linkExists) {
|
||||
const processingPromises = [];
|
||||
|
||||
if (
|
||||
user.archiveAsScreenshot &&
|
||||
!link.image?.startsWith("archive")
|
||||
) {
|
||||
processingPromises.push(
|
||||
page.screenshot({ fullPage: true }).then((screenshot) => {
|
||||
return createFile({
|
||||
data: screenshot,
|
||||
filePath: `archives/${linkExists.collectionId}/${link.id}.png`,
|
||||
});
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
// apply administrator's defined pdf margins or default to 15px
|
||||
const margins = {
|
||||
top: process.env.PDF_MARGIN_TOP || "15px",
|
||||
bottom: process.env.PDF_MARGIN_BOTTOM || "15px",
|
||||
};
|
||||
|
||||
if (user.archiveAsPDF && !link.pdf?.startsWith("archive")) {
|
||||
processingPromises.push(
|
||||
page
|
||||
.pdf({
|
||||
width: "1366px",
|
||||
height: "1931px",
|
||||
printBackground: true,
|
||||
margin: margins,
|
||||
})
|
||||
.then((pdf) => {
|
||||
return createFile({
|
||||
data: pdf,
|
||||
filePath: `archives/${linkExists.collectionId}/${link.id}.pdf`,
|
||||
});
|
||||
})
|
||||
);
|
||||
}
|
||||
await Promise.allSettled(processingPromises);
|
||||
await prisma.link.update({
|
||||
where: { id: link.id },
|
||||
data: {
|
||||
image: user.archiveAsScreenshot
|
||||
? `archives/${linkExists.collectionId}/${link.id}.png`
|
||||
: undefined,
|
||||
pdf: user.archiveAsPDF
|
||||
? `archives/${linkExists.collectionId}/${link.id}.pdf`
|
||||
: undefined,
|
||||
},
|
||||
});
|
||||
}
|
||||
// Monolith
|
||||
if (
|
||||
!link.monolith?.startsWith("archive") &&
|
||||
!link.monolith?.startsWith("unavailable") &&
|
||||
user.archiveAsMonolith &&
|
||||
link.url
|
||||
)
|
||||
await handleMonolith(link, content);
|
||||
}
|
||||
})(),
|
||||
timeoutPromise,
|
||||
@@ -293,6 +176,9 @@ export default async function archiveHandler(link: LinksAndCollectionAndOwner) {
|
||||
image: !finalLink.image?.startsWith("archives")
|
||||
? "unavailable"
|
||||
: undefined,
|
||||
monolith: !finalLink.monolith?.startsWith("archives")
|
||||
? "unavailable"
|
||||
: undefined,
|
||||
pdf: !finalLink.pdf?.startsWith("archives")
|
||||
? "unavailable"
|
||||
: undefined,
|
||||
@@ -308,76 +194,3 @@ export default async function archiveHandler(link: LinksAndCollectionAndOwner) {
|
||||
await browser.close();
|
||||
}
|
||||
}
|
||||
|
||||
const autoScroll = async (AUTOSCROLL_TIMEOUT: number) => {
|
||||
const timeoutPromise = new Promise<void>((_, reject) => {
|
||||
setTimeout(() => {
|
||||
reject(new Error(`Webpage was too long to be archived.`));
|
||||
}, AUTOSCROLL_TIMEOUT * 1000);
|
||||
});
|
||||
|
||||
const scrollingPromise = new Promise<void>((resolve) => {
|
||||
let totalHeight = 0;
|
||||
let distance = 100;
|
||||
let scrollDown = setInterval(() => {
|
||||
let scrollHeight = document.body.scrollHeight;
|
||||
window.scrollBy(0, distance);
|
||||
totalHeight += distance;
|
||||
if (totalHeight >= scrollHeight) {
|
||||
clearInterval(scrollDown);
|
||||
window.scroll(0, 0);
|
||||
resolve();
|
||||
}
|
||||
}, 100);
|
||||
});
|
||||
|
||||
await Promise.race([scrollingPromise, timeoutPromise]);
|
||||
};
|
||||
|
||||
const imageHandler = async ({ url, id }: Link, extension: string) => {
|
||||
const image = await fetch(url as string).then((res) => res.blob());
|
||||
|
||||
const buffer = Buffer.from(await image.arrayBuffer());
|
||||
|
||||
const linkExists = await prisma.link.findUnique({
|
||||
where: { id },
|
||||
});
|
||||
|
||||
if (linkExists) {
|
||||
await createFile({
|
||||
data: buffer,
|
||||
filePath: `archives/${linkExists.collectionId}/${id}.${extension}`,
|
||||
});
|
||||
|
||||
await prisma.link.update({
|
||||
where: { id },
|
||||
data: {
|
||||
image: `archives/${linkExists.collectionId}/${id}.${extension}`,
|
||||
},
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
const pdfHandler = async ({ url, id }: Link) => {
|
||||
const pdf = await fetch(url as string).then((res) => res.blob());
|
||||
|
||||
const buffer = Buffer.from(await pdf.arrayBuffer());
|
||||
|
||||
const linkExists = await prisma.link.findUnique({
|
||||
where: { id },
|
||||
});
|
||||
|
||||
if (linkExists) {
|
||||
await createFile({
|
||||
data: buffer,
|
||||
filePath: `archives/${linkExists.collectionId}/${id}.pdf`,
|
||||
});
|
||||
|
||||
await prisma.link.update({
|
||||
where: { id },
|
||||
data: {
|
||||
pdf: `archives/${linkExists.collectionId}/${id}.pdf`,
|
||||
},
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { prisma } from "@/lib/api/db";
|
||||
import getPermission from "@/lib/api/getPermission";
|
||||
import { Collection, UsersAndCollections } from "@prisma/client";
|
||||
import { UsersAndCollections } from "@prisma/client";
|
||||
import removeFolder from "@/lib/api/storage/removeFolder";
|
||||
|
||||
export default async function deleteCollection(
|
||||
@@ -58,6 +58,7 @@ export default async function deleteCollection(
|
||||
});
|
||||
|
||||
await removeFolder({ filePath: `archives/${collectionId}` });
|
||||
await removeFolder({ filePath: `archives/preview/${collectionId}` });
|
||||
|
||||
await removeFromOrders(userId, collectionId);
|
||||
|
||||
@@ -100,6 +101,7 @@ async function deleteSubCollections(collectionId: number) {
|
||||
});
|
||||
|
||||
await removeFolder({ filePath: `archives/${subCollection.id}` });
|
||||
await removeFolder({ filePath: `archives/preview/${subCollection.id}` });
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -2,7 +2,8 @@ import { prisma } from "@/lib/api/db";
|
||||
import { LinkRequestQuery, Sort } from "@/types/global";
|
||||
|
||||
export default async function getLink(userId: number, query: LinkRequestQuery) {
|
||||
const POSTGRES_IS_ENABLED = process.env.DATABASE_URL.startsWith("postgresql");
|
||||
const POSTGRES_IS_ENABLED =
|
||||
process.env.DATABASE_URL?.startsWith("postgresql");
|
||||
|
||||
let order: any;
|
||||
if (query.sort === Sort.DateNewestFirst) order = { id: "desc" };
|
||||
@@ -102,7 +103,7 @@ export default async function getLink(userId: number, query: LinkRequestQuery) {
|
||||
}
|
||||
|
||||
const links = await prisma.link.findMany({
|
||||
take: Number(process.env.PAGINATION_TAKE_COUNT) || 20,
|
||||
take: Number(process.env.PAGINATION_TAKE_COUNT) || 50,
|
||||
skip: query.cursor ? 1 : undefined,
|
||||
cursor: query.cursor ? { id: query.cursor } : undefined,
|
||||
where: {
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import { prisma } from "@/lib/api/db";
|
||||
import { Link, UsersAndCollections } from "@prisma/client";
|
||||
import getPermission from "@/lib/api/getPermission";
|
||||
import removeFile from "@/lib/api/storage/removeFile";
|
||||
import { removeFiles } from "@/lib/api/manageLinkFiles";
|
||||
|
||||
export default async function deleteLink(userId: number, linkId: number) {
|
||||
|
||||
@@ -48,7 +48,7 @@ export default async function updateLinkById(
|
||||
},
|
||||
});
|
||||
|
||||
return { response: updatedLink, status: 200 };
|
||||
// return { response: updatedLink, status: 200 };
|
||||
}
|
||||
|
||||
const targetCollectionIsAccessible = await getPermission({
|
||||
@@ -60,9 +60,6 @@ export default async function updateLinkById(
|
||||
(e: UsersAndCollections) => e.userId === userId && e.canUpdate
|
||||
);
|
||||
|
||||
const targetCollectionsAccessible =
|
||||
targetCollectionIsAccessible?.ownerId === userId;
|
||||
|
||||
const targetCollectionMatchesData = data.collection.id
|
||||
? data.collection.id === targetCollectionIsAccessible?.id
|
||||
: true && data.collection.name
|
||||
@@ -71,12 +68,7 @@ export default async function updateLinkById(
|
||||
? data.collection.ownerId === targetCollectionIsAccessible?.ownerId
|
||||
: true;
|
||||
|
||||
if (!targetCollectionsAccessible)
|
||||
return {
|
||||
response: "Target collection is not accessible.",
|
||||
status: 401,
|
||||
};
|
||||
else if (!targetCollectionMatchesData)
|
||||
if (!targetCollectionMatchesData)
|
||||
return {
|
||||
response: "Target collection does not match the data.",
|
||||
status: 401,
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
import { prisma } from "@/lib/api/db";
|
||||
import { LinkIncludingShortenedCollectionAndTags } from "@/types/global";
|
||||
import getTitle from "@/lib/shared/getTitle";
|
||||
import { UsersAndCollections } from "@prisma/client";
|
||||
import getPermission from "@/lib/api/getPermission";
|
||||
import fetchTitleAndHeaders from "@/lib/shared/fetchTitleAndHeaders";
|
||||
import createFolder from "@/lib/api/storage/createFolder";
|
||||
import validateUrlSize from "../../validateUrlSize";
|
||||
import setLinkCollection from "../../setLinkCollection";
|
||||
|
||||
const MAX_LINKS_PER_USER = Number(process.env.MAX_LINKS_PER_USER) || 30000;
|
||||
|
||||
@@ -24,93 +22,10 @@ export default async function postLink(
|
||||
}
|
||||
}
|
||||
|
||||
if (!link.collection.id && link.collection.name) {
|
||||
link.collection.name = link.collection.name.trim();
|
||||
const linkCollection = await setLinkCollection(link, userId);
|
||||
|
||||
// find the collection with the name and the user's id
|
||||
const findCollection = await prisma.collection.findFirst({
|
||||
where: {
|
||||
name: link.collection.name,
|
||||
ownerId: userId,
|
||||
parentId: link.collection.parentId,
|
||||
},
|
||||
});
|
||||
|
||||
if (findCollection) {
|
||||
const collectionIsAccessible = await getPermission({
|
||||
userId,
|
||||
collectionId: findCollection.id,
|
||||
});
|
||||
|
||||
const memberHasAccess = collectionIsAccessible?.members.some(
|
||||
(e: UsersAndCollections) => e.userId === userId && e.canCreate
|
||||
);
|
||||
|
||||
if (!(collectionIsAccessible?.ownerId === userId || memberHasAccess))
|
||||
return { response: "Collection is not accessible.", status: 401 };
|
||||
|
||||
link.collection.id = findCollection.id;
|
||||
link.collection.ownerId = findCollection.ownerId;
|
||||
} else {
|
||||
const collection = await prisma.collection.create({
|
||||
data: {
|
||||
name: link.collection.name,
|
||||
ownerId: userId,
|
||||
},
|
||||
});
|
||||
|
||||
link.collection.id = collection.id;
|
||||
|
||||
await prisma.user.update({
|
||||
where: {
|
||||
id: userId,
|
||||
},
|
||||
data: {
|
||||
collectionOrder: {
|
||||
push: link.collection.id,
|
||||
},
|
||||
},
|
||||
});
|
||||
}
|
||||
} else if (link.collection.id) {
|
||||
const collectionIsAccessible = await getPermission({
|
||||
userId,
|
||||
collectionId: link.collection.id,
|
||||
});
|
||||
|
||||
const memberHasAccess = collectionIsAccessible?.members.some(
|
||||
(e: UsersAndCollections) => e.userId === userId && e.canCreate
|
||||
);
|
||||
|
||||
if (!(collectionIsAccessible?.ownerId === userId || memberHasAccess))
|
||||
return { response: "Collection is not accessible.", status: 401 };
|
||||
} else if (!link.collection.id) {
|
||||
link.collection.name = "Unorganized";
|
||||
link.collection.parentId = null;
|
||||
|
||||
// find the collection with the name "Unorganized" and the user's id
|
||||
const unorganizedCollection = await prisma.collection.findFirst({
|
||||
where: {
|
||||
name: "Unorganized",
|
||||
ownerId: userId,
|
||||
},
|
||||
});
|
||||
|
||||
link.collection.id = unorganizedCollection?.id;
|
||||
|
||||
await prisma.user.update({
|
||||
where: {
|
||||
id: userId,
|
||||
},
|
||||
data: {
|
||||
collectionOrder: {
|
||||
push: link.collection.id,
|
||||
},
|
||||
},
|
||||
});
|
||||
} else {
|
||||
return { response: "Uncaught error.", status: 500 };
|
||||
}
|
||||
if (!linkCollection)
|
||||
return { response: "Collection is not accessible.", status: 400 };
|
||||
|
||||
const user = await prisma.user.findUnique({
|
||||
where: {
|
||||
@@ -124,8 +39,6 @@ export default async function postLink(
|
||||
const urlWithoutWww = hasWwwPrefix ? url?.replace(`://www.`, "://") : url;
|
||||
const urlWithWww = hasWwwPrefix ? url : url?.replace("://", `://www.`);
|
||||
|
||||
console.log(url, urlWithoutWww, urlWithWww);
|
||||
|
||||
const existingLink = await prisma.link.findFirst({
|
||||
where: {
|
||||
OR: [{ url: urlWithWww }, { url: urlWithoutWww }],
|
||||
@@ -135,8 +48,6 @@ export default async function postLink(
|
||||
},
|
||||
});
|
||||
|
||||
console.log(url, urlWithoutWww, urlWithWww, "DONE!");
|
||||
|
||||
if (existingLink)
|
||||
return {
|
||||
response: "Link already exists",
|
||||
@@ -147,30 +58,23 @@ export default async function postLink(
|
||||
const numberOfLinksTheUserHas = await prisma.link.count({
|
||||
where: {
|
||||
collection: {
|
||||
ownerId: userId,
|
||||
ownerId: linkCollection.ownerId,
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
if (numberOfLinksTheUserHas + 1 > MAX_LINKS_PER_USER)
|
||||
if (numberOfLinksTheUserHas > MAX_LINKS_PER_USER)
|
||||
return {
|
||||
response: `Error: Each user can only have a maximum of ${MAX_LINKS_PER_USER} Links.`,
|
||||
response: `Each collection owner can only have a maximum of ${MAX_LINKS_PER_USER} Links.`,
|
||||
status: 400,
|
||||
};
|
||||
|
||||
link.collection.name = link.collection.name.trim();
|
||||
|
||||
const title =
|
||||
!(link.name && link.name !== "") && link.url
|
||||
? await getTitle(link.url)
|
||||
: "";
|
||||
const { title, headers } = await fetchTitleAndHeaders(link.url || "");
|
||||
|
||||
const name =
|
||||
link.name && link.name !== "" ? link.name : link.url ? title : "";
|
||||
|
||||
const validatedUrl = link.url ? await validateUrlSize(link.url) : undefined;
|
||||
|
||||
const contentType = validatedUrl?.get("content-type");
|
||||
const contentType = headers?.get("content-type");
|
||||
let linkType = "url";
|
||||
let imageExtension = "png";
|
||||
|
||||
@@ -190,7 +94,7 @@ export default async function postLink(
|
||||
type: linkType,
|
||||
collection: {
|
||||
connect: {
|
||||
id: link.collection.id,
|
||||
id: linkCollection.id,
|
||||
},
|
||||
},
|
||||
tags: {
|
||||
@@ -198,14 +102,14 @@ export default async function postLink(
|
||||
where: {
|
||||
name_ownerId: {
|
||||
name: tag.name.trim(),
|
||||
ownerId: link.collection.ownerId,
|
||||
ownerId: linkCollection.ownerId,
|
||||
},
|
||||
},
|
||||
create: {
|
||||
name: tag.name.trim(),
|
||||
owner: {
|
||||
connect: {
|
||||
id: link.collection.ownerId,
|
||||
id: linkCollection.ownerId,
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
@@ -31,7 +31,7 @@ export default async function importFromHTMLFile(
|
||||
|
||||
if (totalImports + numberOfLinksTheUserHas > MAX_LINKS_PER_USER)
|
||||
return {
|
||||
response: `Error: Each user can only have a maximum of ${MAX_LINKS_PER_USER} Links.`,
|
||||
response: `Each collection owner can only have a maximum of ${MAX_LINKS_PER_USER} Links.`,
|
||||
status: 400,
|
||||
};
|
||||
|
||||
@@ -63,11 +63,21 @@ async function processBookmarks(
|
||||
) as Element;
|
||||
|
||||
if (collectionName) {
|
||||
collectionId = await createCollection(
|
||||
userId,
|
||||
(collectionName.children[0] as TextNode).content,
|
||||
parentCollectionId
|
||||
);
|
||||
const collectionNameContent = (collectionName.children[0] as TextNode)?.content;
|
||||
if (collectionNameContent) {
|
||||
collectionId = await createCollection(
|
||||
userId,
|
||||
collectionNameContent,
|
||||
parentCollectionId
|
||||
);
|
||||
} else {
|
||||
// Handle the case when the collection name is empty
|
||||
collectionId = await createCollection(
|
||||
userId,
|
||||
"Untitled Collection",
|
||||
parentCollectionId
|
||||
);
|
||||
}
|
||||
}
|
||||
await processBookmarks(
|
||||
userId,
|
||||
@@ -264,3 +274,4 @@ function processNodes(nodes: Node[]) {
|
||||
nodes.forEach(findAndProcessDL);
|
||||
return nodes;
|
||||
}
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ export default async function importFromLinkwarden(
|
||||
|
||||
if (totalImports + numberOfLinksTheUserHas > MAX_LINKS_PER_USER)
|
||||
return {
|
||||
response: `Error: Each user can only have a maximum of ${MAX_LINKS_PER_USER} Links.`,
|
||||
response: `Each collection owner can only have a maximum of ${MAX_LINKS_PER_USER} Links.`,
|
||||
status: 400,
|
||||
};
|
||||
|
||||
|
||||
@@ -47,7 +47,7 @@ export default async function importFromWallabag(
|
||||
|
||||
if (totalImports + numberOfLinksTheUserHas > MAX_LINKS_PER_USER)
|
||||
return {
|
||||
response: `Error: Each user can only have a maximum of ${MAX_LINKS_PER_USER} Links.`,
|
||||
response: `Each collection owner can only have a maximum of ${MAX_LINKS_PER_USER} Links.`,
|
||||
status: 400,
|
||||
};
|
||||
|
||||
|
||||
@@ -4,7 +4,8 @@ import { LinkRequestQuery, Sort } from "@/types/global";
|
||||
export default async function getLink(
|
||||
query: Omit<LinkRequestQuery, "tagId" | "pinnedOnly">
|
||||
) {
|
||||
const POSTGRES_IS_ENABLED = process.env.DATABASE_URL.startsWith("postgresql");
|
||||
const POSTGRES_IS_ENABLED =
|
||||
process.env.DATABASE_URL?.startsWith("postgresql");
|
||||
|
||||
let order: any;
|
||||
if (query.sort === Sort.DateNewestFirst) order = { id: "desc" };
|
||||
@@ -68,7 +69,7 @@ export default async function getLink(
|
||||
}
|
||||
|
||||
const links = await prisma.link.findMany({
|
||||
take: Number(process.env.PAGINATION_TAKE_COUNT) || 20,
|
||||
take: Number(process.env.PAGINATION_TAKE_COUNT) || 50,
|
||||
skip: query.cursor ? 1 : undefined,
|
||||
cursor: query.cursor ? { id: query.cursor } : undefined,
|
||||
where: {
|
||||
|
||||
@@ -75,6 +75,7 @@ export default async function getPublicUser(
|
||||
username: lessSensitiveInfo.username,
|
||||
image: lessSensitiveInfo.image,
|
||||
archiveAsScreenshot: lessSensitiveInfo.archiveAsScreenshot,
|
||||
archiveAsMonolith: lessSensitiveInfo.archiveAsMonolith,
|
||||
archiveAsPDF: lessSensitiveInfo.archiveAsPDF,
|
||||
};
|
||||
|
||||
|
||||
@@ -21,12 +21,12 @@ export default async function createSession(
|
||||
jti: crypto.randomUUID(),
|
||||
},
|
||||
maxAge: expiryDateSecond || 604800,
|
||||
secret: process.env.NEXTAUTH_SECRET,
|
||||
secret: process.env.NEXTAUTH_SECRET as string,
|
||||
});
|
||||
|
||||
const tokenBody = await decode({
|
||||
token,
|
||||
secret: process.env.NEXTAUTH_SECRET,
|
||||
secret: process.env.NEXTAUTH_SECRET as string,
|
||||
});
|
||||
|
||||
const createToken = await prisma.accessToken.create({
|
||||
|
||||
@@ -65,12 +65,12 @@ export default async function postToken(
|
||||
jti: crypto.randomUUID(),
|
||||
},
|
||||
maxAge: expiryDateSecond || 604800,
|
||||
secret: process.env.NEXTAUTH_SECRET,
|
||||
secret: process.env.NEXTAUTH_SECRET as string,
|
||||
});
|
||||
|
||||
const tokenBody = await decode({
|
||||
token,
|
||||
secret: process.env.NEXTAUTH_SECRET,
|
||||
secret: process.env.NEXTAUTH_SECRET as string,
|
||||
});
|
||||
|
||||
const createToken = await prisma.accessToken.create({
|
||||
|
||||
@@ -80,7 +80,7 @@ export default async function deleteUserById(
|
||||
});
|
||||
|
||||
// Delete archive folders
|
||||
removeFolder({ filePath: `archives/${collection.id}` });
|
||||
await removeFolder({ filePath: `archives/${collection.id}` });
|
||||
|
||||
await removeFolder({
|
||||
filePath: `archives/preview/${collection.id}`,
|
||||
|
||||
@@ -207,6 +207,7 @@ export default async function updateUserById(
|
||||
),
|
||||
locale: i18n.locales.includes(data.locale) ? data.locale : "en",
|
||||
archiveAsScreenshot: data.archiveAsScreenshot,
|
||||
archiveAsMonolith: data.archiveAsMonolith,
|
||||
archiveAsPDF: data.archiveAsPDF,
|
||||
archiveAsWaybackMachine: data.archiveAsWaybackMachine,
|
||||
linksRouteTo: data.linksRouteTo,
|
||||
|
||||
@@ -2,7 +2,7 @@ import fetch from "node-fetch";
|
||||
import https from "https";
|
||||
import { SocksProxyAgent } from "socks-proxy-agent";
|
||||
|
||||
export default async function validateUrlSize(url: string) {
|
||||
export default async function fetchHeaders(url: string) {
|
||||
if (process.env.IGNORE_URL_SIZE_LIMIT === "true") return null;
|
||||
|
||||
try {
|
||||
@@ -29,13 +29,17 @@ export default async function validateUrlSize(url: string) {
|
||||
};
|
||||
}
|
||||
|
||||
const response = await fetch(url, fetchOpts);
|
||||
const responsePromise = fetch(url, fetchOpts);
|
||||
|
||||
const totalSizeMB =
|
||||
Number(response.headers.get("content-length")) / Math.pow(1024, 2);
|
||||
if (totalSizeMB > (Number(process.env.NEXT_PUBLIC_MAX_FILE_SIZE) || 30))
|
||||
return null;
|
||||
else return response.headers;
|
||||
const timeoutPromise = new Promise((_, reject) => {
|
||||
setTimeout(() => {
|
||||
reject(new Error("Fetch header timeout"));
|
||||
}, 10 * 1000); // Stop after 10 seconds
|
||||
});
|
||||
|
||||
const response = await Promise.race([responsePromise, timeoutPromise]);
|
||||
|
||||
return (response as Response)?.headers || null;
|
||||
} catch (err) {
|
||||
console.log(err);
|
||||
return null;
|
||||
+30
-19
@@ -1,7 +1,6 @@
|
||||
import Jimp from "jimp";
|
||||
import { prisma } from "./db";
|
||||
import createFile from "./storage/createFile";
|
||||
import createFolder from "./storage/createFolder";
|
||||
|
||||
const generatePreview = async (
|
||||
buffer: Buffer,
|
||||
@@ -9,27 +8,39 @@ const generatePreview = async (
|
||||
linkId: number
|
||||
) => {
|
||||
if (buffer && collectionId && linkId) {
|
||||
// Load the image using Jimp
|
||||
await Jimp.read(buffer, async (err, image) => {
|
||||
if (image && !err) {
|
||||
image?.resize(1280, Jimp.AUTO).quality(20);
|
||||
const processedBuffer = await image?.getBufferAsync(Jimp.MIME_JPEG);
|
||||
try {
|
||||
const image = await Jimp.read(buffer);
|
||||
|
||||
createFile({
|
||||
data: processedBuffer,
|
||||
filePath: `archives/preview/${collectionId}/${linkId}.jpeg`,
|
||||
}).then(() => {
|
||||
return prisma.link.update({
|
||||
where: { id: linkId },
|
||||
data: {
|
||||
preview: `archives/preview/${collectionId}/${linkId}.jpeg`,
|
||||
},
|
||||
});
|
||||
});
|
||||
if (!image) {
|
||||
console.log("Error generating preview: Image not found");
|
||||
return;
|
||||
}
|
||||
}).catch((err) => {
|
||||
|
||||
image.resize(1280, Jimp.AUTO).quality(20);
|
||||
const processedBuffer = await image.getBufferAsync(Jimp.MIME_JPEG);
|
||||
|
||||
if (
|
||||
Buffer.byteLength(processedBuffer) >
|
||||
1024 * 1024 * Number(process.env.PREVIEW_MAX_BUFFER || 0.1)
|
||||
) {
|
||||
console.log("Error generating preview: Buffer size exceeded");
|
||||
return;
|
||||
}
|
||||
|
||||
await createFile({
|
||||
data: processedBuffer,
|
||||
filePath: `archives/preview/${collectionId}/${linkId}.jpeg`,
|
||||
});
|
||||
|
||||
await prisma.link.update({
|
||||
where: { id: linkId },
|
||||
data: {
|
||||
preview: `archives/preview/${collectionId}/${linkId}.jpeg`,
|
||||
},
|
||||
});
|
||||
} catch (err) {
|
||||
console.error("Error processing the image:", err);
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -3,14 +3,12 @@ import { prisma } from "@/lib/api/db";
|
||||
type Props = {
|
||||
userId: number;
|
||||
collectionId?: number;
|
||||
collectionName?: string;
|
||||
linkId?: number;
|
||||
};
|
||||
|
||||
export default async function getPermission({
|
||||
userId,
|
||||
collectionId,
|
||||
collectionName,
|
||||
linkId,
|
||||
}: Props) {
|
||||
if (linkId) {
|
||||
@@ -26,11 +24,10 @@ export default async function getPermission({
|
||||
});
|
||||
|
||||
return check;
|
||||
} else if (collectionId || collectionName) {
|
||||
} else if (collectionId) {
|
||||
const check = await prisma.collection.findFirst({
|
||||
where: {
|
||||
id: collectionId || undefined,
|
||||
name: collectionName || undefined,
|
||||
id: collectionId,
|
||||
OR: [{ ownerId: userId }, { members: { some: { userId } } }],
|
||||
},
|
||||
include: { members: true },
|
||||
|
||||
@@ -36,7 +36,7 @@ export default async function isServerAdmin({ req }: Props): Promise<boolean> {
|
||||
},
|
||||
});
|
||||
|
||||
if (findUser?.username === process.env.ADMINISTRATOR) {
|
||||
if (findUser?.id === Number(process.env.NEXT_PUBLIC_ADMIN || 1)) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
|
||||
@@ -16,6 +16,10 @@ const removeFiles = async (linkId: number, collectionId: number) => {
|
||||
await removeFile({
|
||||
filePath: `archives/${collectionId}/${linkId}.jpg`,
|
||||
});
|
||||
// HTML
|
||||
await removeFile({
|
||||
filePath: `archives/${collectionId}/${linkId}.html`,
|
||||
});
|
||||
// Preview
|
||||
await removeFile({
|
||||
filePath: `archives/preview/${collectionId}/${linkId}.jpeg`,
|
||||
@@ -47,6 +51,11 @@ const moveFiles = async (linkId: number, from: number, to: number) => {
|
||||
`archives/${to}/${linkId}.jpg`
|
||||
);
|
||||
|
||||
await moveFile(
|
||||
`archives/${from}/${linkId}.html`,
|
||||
`archives/${to}/${linkId}.html`
|
||||
);
|
||||
|
||||
await moveFile(
|
||||
`archives/preview/${from}/${linkId}.jpeg`,
|
||||
`archives/preview/${to}/${linkId}.jpeg`
|
||||
|
||||
@@ -0,0 +1,61 @@
|
||||
import { Collection, Link, User } from "@prisma/client";
|
||||
import { Page } from "playwright";
|
||||
import generatePreview from "../generatePreview";
|
||||
import createFile from "../storage/createFile";
|
||||
import { prisma } from "../db";
|
||||
|
||||
type LinksAndCollectionAndOwner = Link & {
|
||||
collection: Collection & {
|
||||
owner: User;
|
||||
};
|
||||
};
|
||||
|
||||
const handleArchivePreview = async (
|
||||
link: LinksAndCollectionAndOwner,
|
||||
page: Page
|
||||
) => {
|
||||
const ogImageUrl = await page.evaluate(() => {
|
||||
const metaTag = document.querySelector('meta[property="og:image"]');
|
||||
return metaTag ? (metaTag as any).content : null;
|
||||
});
|
||||
|
||||
if (ogImageUrl) {
|
||||
console.log("Found og:image URL:", ogImageUrl);
|
||||
|
||||
// Download the image
|
||||
const imageResponse = await page.goto(ogImageUrl);
|
||||
|
||||
// Check if imageResponse is not null
|
||||
if (imageResponse && !link.preview?.startsWith("archive")) {
|
||||
const buffer = await imageResponse.body();
|
||||
generatePreview(buffer, link.collectionId, link.id);
|
||||
}
|
||||
|
||||
await page.goBack();
|
||||
} else if (!link.preview?.startsWith("archive")) {
|
||||
console.log("No og:image found");
|
||||
await page
|
||||
.screenshot({ type: "jpeg", quality: 20 })
|
||||
.then(async (screenshot) => {
|
||||
if (
|
||||
Buffer.byteLength(screenshot) >
|
||||
1024 * 1024 * Number(process.env.PREVIEW_MAX_BUFFER || 0.1)
|
||||
)
|
||||
return console.log("Error generating preview: Buffer size exceeded");
|
||||
|
||||
await createFile({
|
||||
data: screenshot,
|
||||
filePath: `archives/preview/${link.collectionId}/${link.id}.jpeg`,
|
||||
});
|
||||
|
||||
await prisma.link.update({
|
||||
where: { id: link.id },
|
||||
data: {
|
||||
preview: `archives/preview/${link.collectionId}/${link.id}.jpeg`,
|
||||
},
|
||||
});
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
export default handleArchivePreview;
|
||||
@@ -0,0 +1,46 @@
|
||||
import { execSync } from "child_process";
|
||||
import createFile from "../storage/createFile";
|
||||
import { prisma } from "../db";
|
||||
import { Link } from "@prisma/client";
|
||||
|
||||
const handleMonolith = async (link: Link, content: string) => {
|
||||
if (!link.url) return;
|
||||
|
||||
try {
|
||||
let html = execSync(
|
||||
`monolith - -I -b ${link.url} ${
|
||||
process.env.MONOLITH_CUSTOM_OPTIONS || "-j -F -s"
|
||||
} -o -`,
|
||||
{
|
||||
timeout: 120000,
|
||||
maxBuffer: 1024 * 1024 * Number(process.env.MONOLITH_MAX_BUFFER || 5),
|
||||
input: content,
|
||||
}
|
||||
);
|
||||
|
||||
if (!html?.length)
|
||||
return console.error("Error archiving as Monolith: Empty buffer");
|
||||
|
||||
if (
|
||||
Buffer.byteLength(html) >
|
||||
1024 * 1024 * Number(process.env.MONOLITH_MAX_BUFFER || 6)
|
||||
)
|
||||
return console.error("Error archiving as Monolith: Buffer size exceeded");
|
||||
|
||||
await createFile({
|
||||
data: html,
|
||||
filePath: `archives/${link.collectionId}/${link.id}.html`,
|
||||
}).then(async () => {
|
||||
await prisma.link.update({
|
||||
where: { id: link.id },
|
||||
data: {
|
||||
monolith: `archives/${link.collectionId}/${link.id}.html`,
|
||||
},
|
||||
});
|
||||
});
|
||||
} catch (err) {
|
||||
console.log("Error running MONOLITH:", err);
|
||||
}
|
||||
};
|
||||
|
||||
export default handleMonolith;
|
||||
@@ -0,0 +1,51 @@
|
||||
import { Readability } from "@mozilla/readability";
|
||||
import { JSDOM } from "jsdom";
|
||||
import DOMPurify from "dompurify";
|
||||
import { prisma } from "../db";
|
||||
import createFile from "../storage/createFile";
|
||||
import { Link } from "@prisma/client";
|
||||
|
||||
const handleReadablility = async (content: string, link: Link) => {
|
||||
const window = new JSDOM("").window;
|
||||
const purify = DOMPurify(window);
|
||||
const cleanedUpContent = purify.sanitize(content);
|
||||
const dom = new JSDOM(cleanedUpContent, { url: link.url || "" });
|
||||
const article = new Readability(dom.window.document).parse();
|
||||
const articleText = article?.textContent
|
||||
.replace(/ +(?= )/g, "") // strip out multiple spaces
|
||||
.replace(/(\r\n|\n|\r)/gm, " "); // strip out line breaks
|
||||
|
||||
if (articleText && articleText !== "") {
|
||||
const collectionId = (
|
||||
await prisma.link.findUnique({
|
||||
where: { id: link.id },
|
||||
select: { collectionId: true },
|
||||
})
|
||||
)?.collectionId;
|
||||
|
||||
const data = JSON.stringify(article);
|
||||
|
||||
if (
|
||||
Buffer.byteLength(data, "utf8") >
|
||||
1024 * 1024 * Number(process.env.READABILITY_MAX_BUFFER || 1)
|
||||
)
|
||||
return console.error(
|
||||
"Error archiving as Readability: Buffer size exceeded"
|
||||
);
|
||||
|
||||
await createFile({
|
||||
data,
|
||||
filePath: `archives/${collectionId}/${link.id}_readability.json`,
|
||||
});
|
||||
|
||||
await prisma.link.update({
|
||||
where: { id: link.id },
|
||||
data: {
|
||||
readable: `archives/${collectionId}/${link.id}_readability.json`,
|
||||
textContent: articleText,
|
||||
},
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
export default handleReadablility;
|
||||
@@ -0,0 +1,122 @@
|
||||
import { Collection, Link, User } from "@prisma/client";
|
||||
import { Page } from "playwright";
|
||||
import createFile from "../storage/createFile";
|
||||
import { prisma } from "../db";
|
||||
|
||||
type LinksAndCollectionAndOwner = Link & {
|
||||
collection: Collection & {
|
||||
owner: User;
|
||||
};
|
||||
};
|
||||
const handleScreenshotAndPdf = async (
|
||||
link: LinksAndCollectionAndOwner,
|
||||
page: Page,
|
||||
user: User
|
||||
) => {
|
||||
await page.evaluate(autoScroll, Number(process.env.AUTOSCROLL_TIMEOUT) || 30);
|
||||
|
||||
// Check if the user hasn't deleted the link by the time we're done scrolling
|
||||
const linkExists = await prisma.link.findUnique({
|
||||
where: { id: link.id },
|
||||
});
|
||||
if (linkExists) {
|
||||
const processingPromises = [];
|
||||
|
||||
if (user.archiveAsScreenshot && !link.image?.startsWith("archive")) {
|
||||
processingPromises.push(
|
||||
page
|
||||
.screenshot({ fullPage: true, type: "jpeg" })
|
||||
.then(async (screenshot) => {
|
||||
if (
|
||||
Buffer.byteLength(screenshot) >
|
||||
1024 * 1024 * Number(process.env.SCREENSHOT_MAX_BUFFER || 2)
|
||||
)
|
||||
return console.log(
|
||||
"Error archiving as Screenshot: Buffer size exceeded"
|
||||
);
|
||||
|
||||
await createFile({
|
||||
data: screenshot,
|
||||
filePath: `archives/${linkExists.collectionId}/${link.id}.jpeg`,
|
||||
});
|
||||
await prisma.link.update({
|
||||
where: { id: link.id },
|
||||
data: {
|
||||
image: user.archiveAsScreenshot
|
||||
? `archives/${linkExists.collectionId}/${link.id}.jpeg`
|
||||
: undefined,
|
||||
},
|
||||
});
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
const margins = {
|
||||
top: process.env.PDF_MARGIN_TOP || "15px",
|
||||
bottom: process.env.PDF_MARGIN_BOTTOM || "15px",
|
||||
};
|
||||
|
||||
if (user.archiveAsPDF && !link.pdf?.startsWith("archive")) {
|
||||
processingPromises.push(
|
||||
page
|
||||
.pdf({
|
||||
width: "1366px",
|
||||
height: "1931px",
|
||||
printBackground: true,
|
||||
margin: margins,
|
||||
})
|
||||
.then(async (pdf) => {
|
||||
if (
|
||||
Buffer.byteLength(pdf) >
|
||||
1024 * 1024 * Number(process.env.PDF_MAX_BUFFER || 2)
|
||||
)
|
||||
return console.log(
|
||||
"Error archiving as PDF: Buffer size exceeded"
|
||||
);
|
||||
|
||||
await createFile({
|
||||
data: pdf,
|
||||
filePath: `archives/${linkExists.collectionId}/${link.id}.pdf`,
|
||||
});
|
||||
|
||||
await prisma.link.update({
|
||||
where: { id: link.id },
|
||||
data: {
|
||||
pdf: user.archiveAsPDF
|
||||
? `archives/${linkExists.collectionId}/${link.id}.pdf`
|
||||
: undefined,
|
||||
},
|
||||
});
|
||||
})
|
||||
);
|
||||
}
|
||||
await Promise.allSettled(processingPromises);
|
||||
}
|
||||
};
|
||||
|
||||
const autoScroll = async (AUTOSCROLL_TIMEOUT: number) => {
|
||||
const timeoutPromise = new Promise<void>((resolve) => {
|
||||
setTimeout(() => {
|
||||
resolve();
|
||||
}, AUTOSCROLL_TIMEOUT * 1000);
|
||||
});
|
||||
|
||||
const scrollingPromise = new Promise<void>((resolve) => {
|
||||
let totalHeight = 0;
|
||||
let distance = 100;
|
||||
let scrollDown = setInterval(() => {
|
||||
let scrollHeight = document.body.scrollHeight;
|
||||
window.scrollBy(0, distance);
|
||||
totalHeight += distance;
|
||||
if (totalHeight >= scrollHeight) {
|
||||
clearInterval(scrollDown);
|
||||
window.scroll(0, 0);
|
||||
resolve();
|
||||
}
|
||||
}, 100);
|
||||
});
|
||||
|
||||
await Promise.race([scrollingPromise, timeoutPromise]);
|
||||
};
|
||||
|
||||
export default handleScreenshotAndPdf;
|
||||
@@ -0,0 +1,38 @@
|
||||
import { Link } from "@prisma/client";
|
||||
import { prisma } from "../db";
|
||||
import createFile from "../storage/createFile";
|
||||
import generatePreview from "../generatePreview";
|
||||
|
||||
const imageHandler = async ({ url, id }: Link, extension: string) => {
|
||||
const image = await fetch(url as string).then((res) => res.blob());
|
||||
|
||||
const buffer = Buffer.from(await image.arrayBuffer());
|
||||
|
||||
if (
|
||||
Buffer.byteLength(buffer) >
|
||||
1024 * 1024 * Number(process.env.SCREENSHOT_MAX_BUFFER || 2)
|
||||
)
|
||||
return console.log("Error archiving as Screenshot: Buffer size exceeded");
|
||||
|
||||
const linkExists = await prisma.link.findUnique({
|
||||
where: { id },
|
||||
});
|
||||
|
||||
if (linkExists) {
|
||||
await generatePreview(buffer, linkExists.collectionId, id);
|
||||
|
||||
await createFile({
|
||||
data: buffer,
|
||||
filePath: `archives/${linkExists.collectionId}/${id}.${extension}`,
|
||||
});
|
||||
|
||||
await prisma.link.update({
|
||||
where: { id },
|
||||
data: {
|
||||
image: `archives/${linkExists.collectionId}/${id}.${extension}`,
|
||||
},
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
export default imageHandler;
|
||||
@@ -0,0 +1,35 @@
|
||||
import { Link } from "@prisma/client";
|
||||
import { prisma } from "../db";
|
||||
import createFile from "../storage/createFile";
|
||||
|
||||
const pdfHandler = async ({ url, id }: Link) => {
|
||||
const pdf = await fetch(url as string).then((res) => res.blob());
|
||||
|
||||
const buffer = Buffer.from(await pdf.arrayBuffer());
|
||||
|
||||
if (
|
||||
Buffer.byteLength(buffer) >
|
||||
1024 * 1024 * Number(process.env.PDF_MAX_BUFFER || 2)
|
||||
)
|
||||
return console.log("Error archiving as PDF: Buffer size exceeded");
|
||||
|
||||
const linkExists = await prisma.link.findUnique({
|
||||
where: { id },
|
||||
});
|
||||
|
||||
if (linkExists) {
|
||||
await createFile({
|
||||
data: buffer,
|
||||
filePath: `archives/${linkExists.collectionId}/${id}.pdf`,
|
||||
});
|
||||
|
||||
await prisma.link.update({
|
||||
where: { id },
|
||||
data: {
|
||||
pdf: `archives/${linkExists.collectionId}/${id}.pdf`,
|
||||
},
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
export default pdfHandler;
|
||||
@@ -0,0 +1,89 @@
|
||||
import { LinkIncludingShortenedCollectionAndTags } from "@/types/global";
|
||||
import { prisma } from "./db";
|
||||
import getPermission from "./getPermission";
|
||||
import { UsersAndCollections } from "@prisma/client";
|
||||
|
||||
const setLinkCollection = async (
|
||||
link: LinkIncludingShortenedCollectionAndTags,
|
||||
userId: number
|
||||
) => {
|
||||
if (link?.collection?.id && typeof link?.collection?.id === "number") {
|
||||
const existingCollection = await prisma.collection.findUnique({
|
||||
where: {
|
||||
id: link.collection.id,
|
||||
},
|
||||
});
|
||||
|
||||
if (!existingCollection) return null;
|
||||
|
||||
const collectionIsAccessible = await getPermission({
|
||||
userId,
|
||||
collectionId: existingCollection.id,
|
||||
});
|
||||
|
||||
const memberHasAccess = collectionIsAccessible?.members.some(
|
||||
(e: UsersAndCollections) => e.userId === userId && e.canCreate
|
||||
);
|
||||
|
||||
if (!(collectionIsAccessible?.ownerId === userId || memberHasAccess))
|
||||
return null;
|
||||
|
||||
return existingCollection;
|
||||
} else if (link?.collection?.name) {
|
||||
if (link.collection.name === "Unorganized") {
|
||||
const firstTopLevelUnorganizedCollection =
|
||||
await prisma.collection.findFirst({
|
||||
where: {
|
||||
name: "Unorganized",
|
||||
ownerId: userId,
|
||||
parentId: null,
|
||||
},
|
||||
});
|
||||
|
||||
if (firstTopLevelUnorganizedCollection)
|
||||
return firstTopLevelUnorganizedCollection;
|
||||
}
|
||||
|
||||
const newCollection = await prisma.collection.create({
|
||||
data: {
|
||||
name: link.collection.name.trim(),
|
||||
ownerId: userId,
|
||||
},
|
||||
});
|
||||
|
||||
await prisma.user.update({
|
||||
where: {
|
||||
id: userId,
|
||||
},
|
||||
data: {
|
||||
collectionOrder: {
|
||||
push: newCollection.id,
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
return newCollection;
|
||||
} else {
|
||||
const firstTopLevelUnorganizedCollection =
|
||||
await prisma.collection.findFirst({
|
||||
where: {
|
||||
name: "Unorganized",
|
||||
ownerId: userId,
|
||||
parentId: null,
|
||||
},
|
||||
});
|
||||
|
||||
if (firstTopLevelUnorganizedCollection)
|
||||
return firstTopLevelUnorganizedCollection;
|
||||
else
|
||||
return await prisma.collection.create({
|
||||
data: {
|
||||
name: "Unorganized",
|
||||
ownerId: userId,
|
||||
parentId: null,
|
||||
},
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
export default setLinkCollection;
|
||||
@@ -10,6 +10,7 @@ import util from "util";
|
||||
|
||||
type ReturnContentTypes =
|
||||
| "text/plain"
|
||||
| "text/html"
|
||||
| "image/jpeg"
|
||||
| "image/png"
|
||||
| "application/pdf"
|
||||
@@ -61,6 +62,8 @@ export default async function readFile(filePath: string) {
|
||||
contentType = "image/png";
|
||||
} else if (filePath.endsWith("_readability.json")) {
|
||||
contentType = "application/json";
|
||||
} else if (filePath.endsWith(".html")) {
|
||||
contentType = "text/html";
|
||||
} else {
|
||||
// if (filePath.endsWith(".jpg"))
|
||||
contentType = "image/jpeg";
|
||||
@@ -88,6 +91,8 @@ export default async function readFile(filePath: string) {
|
||||
contentType = "image/png";
|
||||
} else if (filePath.endsWith("_readability.json")) {
|
||||
contentType = "application/json";
|
||||
} else if (filePath.endsWith(".html")) {
|
||||
contentType = "text/html";
|
||||
} else {
|
||||
// if (filePath.endsWith(".jpg"))
|
||||
contentType = "image/jpeg";
|
||||
|
||||
@@ -8,6 +8,7 @@ import {
|
||||
pdfAvailable,
|
||||
readabilityAvailable,
|
||||
screenshotAvailable,
|
||||
monolithAvailable,
|
||||
} from "../shared/getArchiveValidity";
|
||||
|
||||
export const generateLinkHref = (
|
||||
@@ -33,12 +34,15 @@ export const generateLinkHref = (
|
||||
account.linksRouteTo === LinksRouteTo.SCREENSHOT ||
|
||||
link.type === "image"
|
||||
) {
|
||||
console.log(link);
|
||||
if (!screenshotAvailable(link)) return link.url || "";
|
||||
|
||||
return `/preserved/${link?.id}?format=${
|
||||
link?.image?.endsWith("png") ? ArchivedFormat.png : ArchivedFormat.jpeg
|
||||
}`;
|
||||
} else if (account.linksRouteTo === LinksRouteTo.MONOLITH) {
|
||||
if (!monolithAvailable(link)) return link.url || "";
|
||||
|
||||
return `/preserved/${link?.id}?format=${ArchivedFormat.monolith}`;
|
||||
} else {
|
||||
return link.url || "";
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@ import fetch from "node-fetch";
|
||||
import https from "https";
|
||||
import { SocksProxyAgent } from "socks-proxy-agent";
|
||||
|
||||
export default async function getTitle(url: string) {
|
||||
export default async function fetchTitleAndHeaders(url: string) {
|
||||
try {
|
||||
const httpsAgent = new https.Agent({
|
||||
rejectUnauthorized:
|
||||
@@ -41,12 +41,16 @@ export default async function getTitle(url: string) {
|
||||
|
||||
// regular expression to find the <title> tag
|
||||
let match = text.match(/<title.*>([^<]*)<\/title>/);
|
||||
if (match) return match[1];
|
||||
else return "";
|
||||
|
||||
const title = match[1] || "";
|
||||
const headers = (response as Response)?.headers || null;
|
||||
|
||||
return { title, headers };
|
||||
} else {
|
||||
return "";
|
||||
return { title: "", headers: null };
|
||||
}
|
||||
} catch (err) {
|
||||
console.log(err);
|
||||
return { title: "", headers: null };
|
||||
}
|
||||
}
|
||||
@@ -28,6 +28,17 @@ export function readabilityAvailable(
|
||||
);
|
||||
}
|
||||
|
||||
export function monolithAvailable(
|
||||
link: LinkIncludingShortenedCollectionAndTags
|
||||
) {
|
||||
return (
|
||||
link &&
|
||||
link.monolith &&
|
||||
link.monolith !== "pending" &&
|
||||
link.monolith !== "unavailable"
|
||||
);
|
||||
}
|
||||
|
||||
export function previewAvailable(link: any) {
|
||||
return (
|
||||
link &&
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
module.exports = {
|
||||
i18n: {
|
||||
defaultLocale: "en",
|
||||
locales: ["en"],
|
||||
locales: ["en","it"],
|
||||
},
|
||||
reloadOnPrerender: process.env.NODE_ENV === "development",
|
||||
};
|
||||
|
||||
+3
-3
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "linkwarden",
|
||||
"version": "v2.6.0",
|
||||
"version": "v2.6.2",
|
||||
"main": "index.js",
|
||||
"repository": "https://github.com/linkwarden/linkwarden.git",
|
||||
"author": "Daniel31X13 <daniel31x13@gmail.com>",
|
||||
@@ -60,7 +60,7 @@
|
||||
"next-i18next": "^15.3.0",
|
||||
"node-fetch": "^2.7.0",
|
||||
"nodemailer": "^6.9.3",
|
||||
"playwright": "^1.43.1",
|
||||
"playwright": "^1.45.0",
|
||||
"react": "18.2.0",
|
||||
"react-colorful": "^5.6.1",
|
||||
"react-dom": "18.2.0",
|
||||
@@ -77,7 +77,7 @@
|
||||
"zustand": "^4.3.8"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@playwright/test": "^1.43.1",
|
||||
"@playwright/test": "^1.45.0",
|
||||
"@types/bcrypt": "^5.0.0",
|
||||
"@types/dompurify": "^3.0.4",
|
||||
"@types/jsdom": "^21.1.3",
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import DeleteUserModal from "@/components/ModalContent/DeleteUserModal";
|
||||
import NewUserModal from "@/components/ModalContent/NewUserModal";
|
||||
import useUserStore from "@/store/admin/users";
|
||||
import { User as U } from "@prisma/client";
|
||||
|
||||
@@ -29,6 +29,7 @@ export default async function Index(req: NextApiRequest, res: NextApiResponse) {
|
||||
else if (format === ArchivedFormat.jpeg) suffix = ".jpeg";
|
||||
else if (format === ArchivedFormat.pdf) suffix = ".pdf";
|
||||
else if (format === ArchivedFormat.readability) suffix = "_readability.json";
|
||||
else if (format === ArchivedFormat.monolith) suffix = ".html";
|
||||
|
||||
//@ts-ignore
|
||||
if (!linkId || !suffix)
|
||||
@@ -76,6 +77,12 @@ export default async function Index(req: NextApiRequest, res: NextApiResponse) {
|
||||
return res.send(file);
|
||||
}
|
||||
} else if (req.method === "POST") {
|
||||
if (process.env.NEXT_PUBLIC_DEMO === "true")
|
||||
return res.status(400).json({
|
||||
response:
|
||||
"This action is disabled because this is a read-only demo of Linkwarden.",
|
||||
});
|
||||
|
||||
const user = await verifyUser({ req, res });
|
||||
if (!user) return;
|
||||
|
||||
@@ -84,21 +91,46 @@ export default async function Index(req: NextApiRequest, res: NextApiResponse) {
|
||||
linkId,
|
||||
});
|
||||
|
||||
const memberHasAccess = collectionPermissions?.members.some(
|
||||
if (!collectionPermissions)
|
||||
return res.status(400).json({
|
||||
response: "Collection is not accessible.",
|
||||
});
|
||||
|
||||
const memberHasAccess = collectionPermissions.members.some(
|
||||
(e: UsersAndCollections) => e.userId === user.id && e.canCreate
|
||||
);
|
||||
|
||||
if (!(collectionPermissions?.ownerId === user.id || memberHasAccess))
|
||||
return { response: "Collection is not accessible.", status: 401 };
|
||||
if (!(collectionPermissions.ownerId === user.id || memberHasAccess))
|
||||
return res.status(400).json({
|
||||
response: "Collection is not accessible.",
|
||||
});
|
||||
|
||||
// await uploadHandler(linkId, )
|
||||
|
||||
const MAX_UPLOAD_SIZE = Number(process.env.NEXT_PUBLIC_MAX_FILE_SIZE);
|
||||
const MAX_LINKS_PER_USER = Number(process.env.MAX_LINKS_PER_USER || 30000);
|
||||
|
||||
const numberOfLinksTheUserHas = await prisma.link.count({
|
||||
where: {
|
||||
collection: {
|
||||
ownerId: user.id,
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
if (numberOfLinksTheUserHas > MAX_LINKS_PER_USER)
|
||||
return res.status(400).json({
|
||||
response:
|
||||
"Each collection owner can only have a maximum of ${MAX_LINKS_PER_USER} Links.",
|
||||
});
|
||||
|
||||
const NEXT_PUBLIC_MAX_FILE_BUFFER = Number(
|
||||
process.env.NEXT_PUBLIC_MAX_FILE_BUFFER || 10
|
||||
);
|
||||
|
||||
const form = formidable({
|
||||
maxFields: 1,
|
||||
maxFiles: 1,
|
||||
maxFileSize: MAX_UPLOAD_SIZE || 30 * 1048576,
|
||||
maxFileSize: NEXT_PUBLIC_MAX_FILE_BUFFER * 1024 * 1024,
|
||||
});
|
||||
|
||||
form.parse(req, async (err, fields, files) => {
|
||||
@@ -116,18 +148,26 @@ export default async function Index(req: NextApiRequest, res: NextApiResponse) {
|
||||
!allowedMIMETypes.includes(files.file[0].mimetype || "")
|
||||
) {
|
||||
// Handle parsing error
|
||||
return res.status(500).json({
|
||||
response: `Sorry, we couldn't process your file. Please ensure it's a PDF, PNG, or JPG format and doesn't exceed ${MAX_UPLOAD_SIZE}MB.`,
|
||||
return res.status(400).json({
|
||||
response: `Sorry, we couldn't process your file. Please ensure it's a PDF, PNG, or JPG format and doesn't exceed ${NEXT_PUBLIC_MAX_FILE_BUFFER}MB.`,
|
||||
});
|
||||
} else {
|
||||
const fileBuffer = fs.readFileSync(files.file[0].filepath);
|
||||
|
||||
if (
|
||||
Buffer.byteLength(fileBuffer) >
|
||||
1024 * 1024 * Number(NEXT_PUBLIC_MAX_FILE_BUFFER)
|
||||
)
|
||||
return res.status(400).json({
|
||||
response: `Sorry, we couldn't process your file. Please ensure it's a PDF, PNG, or JPG format and doesn't exceed ${NEXT_PUBLIC_MAX_FILE_BUFFER}MB.`,
|
||||
});
|
||||
|
||||
const linkStillExists = await prisma.link.findUnique({
|
||||
where: { id: linkId },
|
||||
});
|
||||
|
||||
if (linkStillExists && files.file[0].mimetype?.includes("image")) {
|
||||
const collectionId = collectionPermissions?.id as number;
|
||||
const collectionId = collectionPermissions.id as number;
|
||||
createFolder({
|
||||
filePath: `archives/preview/${collectionId}`,
|
||||
});
|
||||
@@ -137,9 +177,7 @@ export default async function Index(req: NextApiRequest, res: NextApiResponse) {
|
||||
|
||||
if (linkStillExists) {
|
||||
await createFile({
|
||||
filePath: `archives/${collectionPermissions?.id}/${
|
||||
linkId + suffix
|
||||
}`,
|
||||
filePath: `archives/${collectionPermissions.id}/${linkId + suffix}`,
|
||||
data: fileBuffer,
|
||||
});
|
||||
|
||||
@@ -150,10 +188,10 @@ export default async function Index(req: NextApiRequest, res: NextApiResponse) {
|
||||
? "unavailable"
|
||||
: undefined,
|
||||
image: files.file[0].mimetype?.includes("image")
|
||||
? `archives/${collectionPermissions?.id}/${linkId + suffix}`
|
||||
? `archives/${collectionPermissions.id}/${linkId + suffix}`
|
||||
: null,
|
||||
pdf: files.file[0].mimetype?.includes("pdf")
|
||||
? `archives/${collectionPermissions?.id}/${linkId + suffix}`
|
||||
? `archives/${collectionPermissions.id}/${linkId + suffix}`
|
||||
: null,
|
||||
lastPreserved: new Date().toISOString(),
|
||||
},
|
||||
|
||||
@@ -1,27 +1,31 @@
|
||||
import { prisma } from "@/lib/api/db";
|
||||
import NextAuth from "next-auth/next";
|
||||
import CredentialsProvider from "next-auth/providers/credentials";
|
||||
import bcrypt from "bcrypt";
|
||||
import EmailProvider from "next-auth/providers/email";
|
||||
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 verifySubscription from "@/lib/api/verifySubscription";
|
||||
import { PrismaAdapter } from "@auth/prisma-adapter";
|
||||
import bcrypt from "bcrypt";
|
||||
import { randomBytes } from "crypto";
|
||||
import type { NextApiRequest, NextApiResponse } from "next";
|
||||
import { Adapter } from "next-auth/adapters";
|
||||
import NextAuth from "next-auth/next";
|
||||
import { Provider } from "next-auth/providers";
|
||||
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 AzureAdProvider from "next-auth/providers/azure-ad";
|
||||
import AzureAdB2CProvider from "next-auth/providers/azure-ad-b2c";
|
||||
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";
|
||||
import CredentialsProvider from "next-auth/providers/credentials";
|
||||
import DiscordProvider from "next-auth/providers/discord";
|
||||
import DropboxProvider from "next-auth/providers/dropbox";
|
||||
import DuendeIDS6Provider from "next-auth/providers/duende-identity-server6";
|
||||
import EmailProvider from "next-auth/providers/email";
|
||||
import EVEOnlineProvider from "next-auth/providers/eveonline";
|
||||
import FacebookProvider from "next-auth/providers/facebook";
|
||||
import FaceItProvider from "next-auth/providers/faceit";
|
||||
@@ -64,8 +68,6 @@ import ZitadelProvider from "next-auth/providers/zitadel";
|
||||
import ZohoProvider from "next-auth/providers/zoho";
|
||||
import ZoomProvider from "next-auth/providers/zoom";
|
||||
import * as process from "process";
|
||||
import type { NextApiRequest, NextApiResponse } from "next";
|
||||
import { randomBytes } from "crypto";
|
||||
|
||||
const emailEnabled =
|
||||
process.env.EMAIL_FROM && process.env.EMAIL_SERVER ? true : false;
|
||||
@@ -77,10 +79,7 @@ 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
|
||||
) {
|
||||
if (process.env.NEXT_PUBLIC_CREDENTIALS_ENABLED !== "false") {
|
||||
// undefined is for backwards compatibility
|
||||
providers.push(
|
||||
CredentialsProvider({
|
||||
@@ -317,13 +316,65 @@ if (process.env.NEXT_PUBLIC_AUTHENTIK_ENABLED === "true") {
|
||||
};
|
||||
}
|
||||
|
||||
// Azure AD B2C
|
||||
if (process.env.NEXT_PUBLIC_AZURE_AD_ENABLED === "true") {
|
||||
providers.push(
|
||||
AzureAdB2CProvider({
|
||||
tenantId: process.env.AZURE_AD_B2C_TENANT_NAME,
|
||||
clientId: process.env.AZURE_AD_B2C_CLIENT_ID!,
|
||||
clientSecret: process.env.AZURE_AD_B2C_CLIENT_SECRET!,
|
||||
primaryUserFlow: process.env.AZURE_AD_B2C_PRIMARY_USER_FLOW,
|
||||
authorization: { params: { scope: "offline_access openid" } },
|
||||
})
|
||||
);
|
||||
|
||||
const _linkAccount = adapter.linkAccount;
|
||||
adapter.linkAccount = (account) => {
|
||||
const {
|
||||
"not-before-policy": _,
|
||||
refresh_expires_in,
|
||||
refresh_token_expires_in,
|
||||
not_before,
|
||||
id_token_expires_in,
|
||||
profile_info,
|
||||
...data
|
||||
} = account;
|
||||
return _linkAccount ? _linkAccount(data) : undefined;
|
||||
};
|
||||
}
|
||||
|
||||
// Azure AD
|
||||
if (process.env.NEXT_PUBLIC_AZURE_AD_ENABLED === "true") {
|
||||
providers.push(
|
||||
AzureAdProvider({
|
||||
clientId: process.env.AZURE_AD_CLIENT_ID!,
|
||||
clientSecret: process.env.AZURE_AD_CLIENT_SECRET!,
|
||||
tenantId: process.env.AZURE_AD_TENANT_ID,
|
||||
})
|
||||
);
|
||||
|
||||
const _linkAccount = adapter.linkAccount;
|
||||
adapter.linkAccount = (account) => {
|
||||
const {
|
||||
"not-before-policy": _,
|
||||
refresh_expires_in,
|
||||
token_type,
|
||||
expires_in,
|
||||
ext_expires_in,
|
||||
access_token,
|
||||
...data
|
||||
} = account;
|
||||
return _linkAccount ? _linkAccount(data) : undefined;
|
||||
};
|
||||
}
|
||||
|
||||
// Battle.net
|
||||
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.BATTLENET_ISSUER as BattleNetIssuer,
|
||||
})
|
||||
);
|
||||
|
||||
@@ -1146,6 +1197,28 @@ export default async function auth(req: NextApiRequest, res: NextApiResponse) {
|
||||
if (trigger === "signIn" || trigger === "signUp")
|
||||
token.id = user?.id as number;
|
||||
|
||||
if (trigger === "signUp") {
|
||||
const checkIfUserExists = await prisma.user.findUnique({
|
||||
where: {
|
||||
id: token.id,
|
||||
},
|
||||
});
|
||||
|
||||
if (checkIfUserExists && !checkIfUserExists.username) {
|
||||
const autoGeneratedUsername =
|
||||
"user" + Math.round(Math.random() * 1000000000);
|
||||
|
||||
await prisma.user.update({
|
||||
where: {
|
||||
id: token.id,
|
||||
},
|
||||
data: {
|
||||
username: autoGeneratedUsername,
|
||||
},
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
return token;
|
||||
},
|
||||
async session({ session, token }) {
|
||||
|
||||
@@ -7,6 +7,12 @@ export default async function forgotPassword(
|
||||
res: NextApiResponse
|
||||
) {
|
||||
if (req.method === "POST") {
|
||||
if (process.env.NEXT_PUBLIC_DEMO === "true")
|
||||
return res.status(400).json({
|
||||
response:
|
||||
"This action is disabled because this is a read-only demo of Linkwarden.",
|
||||
});
|
||||
|
||||
const email = req.body.email;
|
||||
|
||||
if (!email) {
|
||||
|
||||
@@ -7,6 +7,12 @@ export default async function resetPassword(
|
||||
res: NextApiResponse
|
||||
) {
|
||||
if (req.method === "POST") {
|
||||
if (process.env.NEXT_PUBLIC_DEMO === "true")
|
||||
return res.status(400).json({
|
||||
response:
|
||||
"This action is disabled because this is a read-only demo of Linkwarden.",
|
||||
});
|
||||
|
||||
const token = req.body.token;
|
||||
const password = req.body.password;
|
||||
|
||||
|
||||
@@ -7,6 +7,12 @@ export default async function verifyEmail(
|
||||
res: NextApiResponse
|
||||
) {
|
||||
if (req.method === "POST") {
|
||||
if (process.env.NEXT_PUBLIC_DEMO === "true")
|
||||
return res.status(400).json({
|
||||
response:
|
||||
"This action is disabled because this is a read-only demo of Linkwarden.",
|
||||
});
|
||||
|
||||
const token = req.query.token;
|
||||
|
||||
if (!token || typeof token !== "string") {
|
||||
|
||||
@@ -19,9 +19,21 @@ export default async function collections(
|
||||
.status(collections.status)
|
||||
.json({ response: collections.response });
|
||||
} else if (req.method === "PUT") {
|
||||
if (process.env.NEXT_PUBLIC_DEMO === "true")
|
||||
return res.status(400).json({
|
||||
response:
|
||||
"This action is disabled because this is a read-only demo of Linkwarden.",
|
||||
});
|
||||
|
||||
const updated = await updateCollectionById(user.id, collectionId, req.body);
|
||||
return res.status(updated.status).json({ response: updated.response });
|
||||
} else if (req.method === "DELETE") {
|
||||
if (process.env.NEXT_PUBLIC_DEMO === "true")
|
||||
return res.status(400).json({
|
||||
response:
|
||||
"This action is disabled because this is a read-only demo of Linkwarden.",
|
||||
});
|
||||
|
||||
const deleted = await deleteCollectionById(user.id, collectionId);
|
||||
return res.status(deleted.status).json({ response: deleted.response });
|
||||
}
|
||||
|
||||
@@ -16,6 +16,12 @@ export default async function collections(
|
||||
.status(collections.status)
|
||||
.json({ response: collections.response });
|
||||
} else if (req.method === "POST") {
|
||||
if (process.env.NEXT_PUBLIC_DEMO === "true")
|
||||
return res.status(400).json({
|
||||
response:
|
||||
"This action is disabled because this is a read-only demo of Linkwarden.",
|
||||
});
|
||||
|
||||
const newCollection = await postCollection(req.body, user.id);
|
||||
return res
|
||||
.status(newCollection.status)
|
||||
|
||||
@@ -29,6 +29,12 @@ export default async function links(req: NextApiRequest, res: NextApiResponse) {
|
||||
});
|
||||
|
||||
if (req.method === "PUT") {
|
||||
if (process.env.NEXT_PUBLIC_DEMO === "true")
|
||||
return res.status(400).json({
|
||||
response:
|
||||
"This action is disabled because this is a read-only demo of Linkwarden.",
|
||||
});
|
||||
|
||||
if (
|
||||
link?.lastPreserved &&
|
||||
getTimezoneDifferenceInMinutes(new Date(), link?.lastPreserved) <
|
||||
@@ -76,6 +82,7 @@ const deleteArchivedFiles = async (link: Link & { collection: Collection }) => {
|
||||
image: null,
|
||||
pdf: null,
|
||||
readable: null,
|
||||
monolith: null,
|
||||
preview: null,
|
||||
},
|
||||
});
|
||||
|
||||
@@ -14,6 +14,12 @@ export default async function links(req: NextApiRequest, res: NextApiResponse) {
|
||||
response: updated.response,
|
||||
});
|
||||
} else if (req.method === "PUT") {
|
||||
if (process.env.NEXT_PUBLIC_DEMO === "true")
|
||||
return res.status(400).json({
|
||||
response:
|
||||
"This action is disabled because this is a read-only demo of Linkwarden.",
|
||||
});
|
||||
|
||||
const updated = await updateLinkById(
|
||||
user.id,
|
||||
Number(req.query.id),
|
||||
@@ -23,6 +29,12 @@ export default async function links(req: NextApiRequest, res: NextApiResponse) {
|
||||
response: updated.response,
|
||||
});
|
||||
} else if (req.method === "DELETE") {
|
||||
if (process.env.NEXT_PUBLIC_DEMO === "true")
|
||||
return res.status(400).json({
|
||||
response:
|
||||
"This action is disabled because this is a read-only demo of Linkwarden.",
|
||||
});
|
||||
|
||||
const deleted = await deleteLinkById(user.id, Number(req.query.id));
|
||||
return res.status(deleted.status).json({
|
||||
response: deleted.response,
|
||||
|
||||
@@ -37,11 +37,23 @@ export default async function links(req: NextApiRequest, res: NextApiResponse) {
|
||||
const links = await getLinks(user.id, convertedData);
|
||||
return res.status(links.status).json({ response: links.response });
|
||||
} else if (req.method === "POST") {
|
||||
if (process.env.NEXT_PUBLIC_DEMO === "true")
|
||||
return res.status(400).json({
|
||||
response:
|
||||
"This action is disabled because this is a read-only demo of Linkwarden.",
|
||||
});
|
||||
|
||||
const newlink = await postLink(req.body, user.id);
|
||||
return res.status(newlink.status).json({
|
||||
response: newlink.response,
|
||||
});
|
||||
} else if (req.method === "PUT") {
|
||||
if (process.env.NEXT_PUBLIC_DEMO === "true")
|
||||
return res.status(400).json({
|
||||
response:
|
||||
"This action is disabled because this is a read-only demo of Linkwarden.",
|
||||
});
|
||||
|
||||
const updated = await updateLinks(
|
||||
user.id,
|
||||
req.body.links,
|
||||
@@ -52,6 +64,12 @@ export default async function links(req: NextApiRequest, res: NextApiResponse) {
|
||||
response: updated.response,
|
||||
});
|
||||
} else if (req.method === "DELETE") {
|
||||
if (process.env.NEXT_PUBLIC_DEMO === "true")
|
||||
return res.status(400).json({
|
||||
response:
|
||||
"This action is disabled because this is a read-only demo of Linkwarden.",
|
||||
});
|
||||
|
||||
const deleted = await deleteLinksById(user.id, req.body.linkIds);
|
||||
return res.status(deleted.status).json({
|
||||
response: deleted.response,
|
||||
|
||||
@@ -55,6 +55,20 @@ export function getLogins() {
|
||||
name: process.env.AUTHENTIK_CUSTOM_NAME ?? "Authentik",
|
||||
});
|
||||
}
|
||||
// Azure AD B2C
|
||||
if (process.env.NEXT_PUBLIC_AZURE_AD_B2C_ENABLED === "true") {
|
||||
buttonAuths.push({
|
||||
method: "azure-ad-b2c",
|
||||
name: process.env.AZURE_AD_B2C_CUSTOM_NAME ?? "Azure AD B2C",
|
||||
});
|
||||
}
|
||||
// Azure AD
|
||||
if (process.env.NEXT_PUBLIC_AZURE_AD_ENABLED === "true") {
|
||||
buttonAuths.push({
|
||||
method: "azure-ad",
|
||||
name: process.env.AZURE_AD_CUSTOM_NAME ?? "Azure AD",
|
||||
});
|
||||
}
|
||||
// Battle.net
|
||||
if (process.env.NEXT_PUBLIC_BATTLENET_ENABLED === "true") {
|
||||
buttonAuths.push({
|
||||
@@ -400,8 +414,7 @@ export function getLogins() {
|
||||
}
|
||||
return {
|
||||
credentialsEnabled:
|
||||
process.env.NEXT_PUBLIC_CREDENTIALS_ENABLED === "true" ||
|
||||
process.env.NEXT_PUBLIC_CREDENTIALS_ENABLED === undefined
|
||||
process.env.NEXT_PUBLIC_CREDENTIALS_ENABLED !== "false"
|
||||
? "true"
|
||||
: "false",
|
||||
emailEnabled:
|
||||
|
||||
@@ -9,7 +9,9 @@ import importFromWallabag from "@/lib/api/controllers/migration/importFromWallab
|
||||
export const config = {
|
||||
api: {
|
||||
bodyParser: {
|
||||
sizeLimit: "10mb",
|
||||
sizeLimit: process.env.IMPORT_LIMIT
|
||||
? process.env.IMPORT_LIMIT + "mb"
|
||||
: "10mb",
|
||||
},
|
||||
},
|
||||
};
|
||||
@@ -28,6 +30,12 @@ export default async function users(req: NextApiRequest, res: NextApiResponse) {
|
||||
.status(data.status)
|
||||
.json(data.response);
|
||||
} else if (req.method === "POST") {
|
||||
if (process.env.NEXT_PUBLIC_DEMO === "true")
|
||||
return res.status(400).json({
|
||||
response:
|
||||
"This action is disabled because this is a read-only demo of Linkwarden.",
|
||||
});
|
||||
|
||||
const request: MigrationRequest = JSON.parse(req.body);
|
||||
|
||||
let data;
|
||||
|
||||
@@ -10,9 +10,21 @@ export default async function tags(req: NextApiRequest, res: NextApiResponse) {
|
||||
const tagId = Number(req.query.id);
|
||||
|
||||
if (req.method === "PUT") {
|
||||
if (process.env.NEXT_PUBLIC_DEMO === "true")
|
||||
return res.status(400).json({
|
||||
response:
|
||||
"This action is disabled because this is a read-only demo of Linkwarden.",
|
||||
});
|
||||
|
||||
const tags = await updeteTagById(user.id, tagId, req.body);
|
||||
return res.status(tags.status).json({ response: tags.response });
|
||||
} else if (req.method === "DELETE") {
|
||||
if (process.env.NEXT_PUBLIC_DEMO === "true")
|
||||
return res.status(400).json({
|
||||
response:
|
||||
"This action is disabled because this is a read-only demo of Linkwarden.",
|
||||
});
|
||||
|
||||
const tags = await deleteTagById(user.id, tagId);
|
||||
return res.status(tags.status).json({ response: tags.response });
|
||||
}
|
||||
|
||||
@@ -7,6 +7,12 @@ export default async function token(req: NextApiRequest, res: NextApiResponse) {
|
||||
if (!user) return;
|
||||
|
||||
if (req.method === "DELETE") {
|
||||
if (process.env.NEXT_PUBLIC_DEMO === "true")
|
||||
return res.status(400).json({
|
||||
response:
|
||||
"This action is disabled because this is a read-only demo of Linkwarden.",
|
||||
});
|
||||
|
||||
const deleted = await deleteToken(user.id, Number(req.query.id) as number);
|
||||
return res.status(deleted.status).json({ response: deleted.response });
|
||||
}
|
||||
|
||||
@@ -11,6 +11,12 @@ export default async function tokens(
|
||||
if (!user) return;
|
||||
|
||||
if (req.method === "POST") {
|
||||
if (process.env.NEXT_PUBLIC_DEMO === "true")
|
||||
return res.status(400).json({
|
||||
response:
|
||||
"This action is disabled because this is a read-only demo of Linkwarden.",
|
||||
});
|
||||
|
||||
const token = await postToken(JSON.parse(req.body), user.id);
|
||||
return res.status(token.status).json({ response: token.response });
|
||||
} else if (req.method === "GET") {
|
||||
|
||||
@@ -22,7 +22,7 @@ export default async function users(req: NextApiRequest, res: NextApiResponse) {
|
||||
},
|
||||
});
|
||||
|
||||
const isServerAdmin = process.env.ADMINISTRATOR === user?.username;
|
||||
const isServerAdmin = user?.id === Number(process.env.NEXT_PUBLIC_ADMIN || 1);
|
||||
|
||||
const userId = isServerAdmin ? Number(req.query.id) : token.id;
|
||||
|
||||
@@ -58,9 +58,21 @@ export default async function users(req: NextApiRequest, res: NextApiResponse) {
|
||||
}
|
||||
|
||||
if (req.method === "PUT") {
|
||||
if (process.env.NEXT_PUBLIC_DEMO === "true")
|
||||
return res.status(400).json({
|
||||
response:
|
||||
"This action is disabled because this is a read-only demo of Linkwarden.",
|
||||
});
|
||||
|
||||
const updated = await updateUserById(userId, req.body);
|
||||
return res.status(updated.status).json({ response: updated.response });
|
||||
} else if (req.method === "DELETE") {
|
||||
if (process.env.NEXT_PUBLIC_DEMO === "true")
|
||||
return res.status(400).json({
|
||||
response:
|
||||
"This action is disabled because this is a read-only demo of Linkwarden.",
|
||||
});
|
||||
|
||||
const updated = await deleteUserById(userId, req.body, isServerAdmin);
|
||||
return res.status(updated.status).json({ response: updated.response });
|
||||
}
|
||||
|
||||
@@ -5,11 +5,18 @@ import verifyUser from "@/lib/api/verifyUser";
|
||||
|
||||
export default async function users(req: NextApiRequest, res: NextApiResponse) {
|
||||
if (req.method === "POST") {
|
||||
if (process.env.NEXT_PUBLIC_DEMO === "true")
|
||||
return res.status(400).json({
|
||||
response:
|
||||
"This action is disabled because this is a read-only demo of Linkwarden.",
|
||||
});
|
||||
|
||||
const response = await postUser(req, res);
|
||||
return res.status(response.status).json({ response: response.response });
|
||||
} else if (req.method === "GET") {
|
||||
const user = await verifyUser({ req, res });
|
||||
if (!user || process.env.ADMINISTRATOR !== user.username)
|
||||
|
||||
if (!user || user.id !== Number(process.env.NEXT_PUBLIC_ADMIN || 1))
|
||||
return res.status(401).json({ response: "Unauthorized..." });
|
||||
|
||||
const response = await getUsers();
|
||||
|
||||
@@ -59,6 +59,7 @@ export default function Index() {
|
||||
username: "",
|
||||
image: "",
|
||||
archiveAsScreenshot: undefined as unknown as boolean,
|
||||
archiveAsMonolith: undefined as unknown as boolean,
|
||||
archiveAsPDF: undefined as unknown as boolean,
|
||||
});
|
||||
|
||||
@@ -76,6 +77,7 @@ export default function Index() {
|
||||
username: account.username as string,
|
||||
image: account.image as string,
|
||||
archiveAsScreenshot: account.archiveAsScreenshot as boolean,
|
||||
archiveAsMonolith: account.archiveAsScreenshot as boolean,
|
||||
archiveAsPDF: account.archiveAsPDF as boolean,
|
||||
});
|
||||
}
|
||||
@@ -126,7 +128,7 @@ export default function Index() {
|
||||
style={{ color: activeCollection?.color }}
|
||||
></i>
|
||||
|
||||
<p className="sm:text-4xl text-3xl capitalize w-full py-1 break-words hyphens-auto font-thin">
|
||||
<p className="sm:text-3xl text-2xl capitalize w-full py-1 break-words hyphens-auto font-thin">
|
||||
{activeCollection?.name}
|
||||
</p>
|
||||
</div>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import CenteredForm from "@/layouts/CenteredForm";
|
||||
import { signIn } from "next-auth/react";
|
||||
import { useRouter } from "next/router";
|
||||
import React, { useState } from "react";
|
||||
import { useState } from "react";
|
||||
import toast from "react-hot-toast";
|
||||
import { useTranslation } from "next-i18next";
|
||||
import getServerSideProps from "@/lib/client/getServerSideProps";
|
||||
|
||||
@@ -92,6 +92,66 @@ export default function Login({
|
||||
{t("enter_credentials")}
|
||||
</p>
|
||||
<hr className="border-1 border-sky-100 dark:border-neutral-700" />
|
||||
|
||||
{process.env.NEXT_PUBLIC_DEMO === "true" &&
|
||||
process.env.NEXT_PUBLIC_DEMO_USERNAME &&
|
||||
process.env.NEXT_PUBLIC_DEMO_PASSWORD && (
|
||||
<div className="p-3 shadow-lg border border-primary rounded-xl">
|
||||
<div className="flex flex-col gap-2 items-center text-center w-full">
|
||||
<div className="flex items-center gap-2">
|
||||
<svg
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
fill="none"
|
||||
viewBox="0 0 24 24"
|
||||
className="stroke-info h-6 w-6 shrink-0"
|
||||
>
|
||||
<path
|
||||
strokeLinecap="round"
|
||||
strokeLinejoin="round"
|
||||
strokeWidth="2"
|
||||
d="M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"
|
||||
></path>
|
||||
</svg>
|
||||
<p className="font-bold">{t("demo_title")}</p>
|
||||
</div>
|
||||
<div className="text-xs">{t("demo_desc")}</div>
|
||||
|
||||
<div className="text-xs">
|
||||
{t("demo_desc_2")}{" "}
|
||||
<a
|
||||
href="https://cloud.linkwarden.app"
|
||||
target="_blank"
|
||||
className="font-bold"
|
||||
>
|
||||
cloud.linkwarden.app
|
||||
</a>
|
||||
</div>
|
||||
<div
|
||||
className="btn btn-sm btn-primary w-full"
|
||||
onClick={async () => {
|
||||
const load = toast.loading(t("authenticating"));
|
||||
|
||||
setForm({
|
||||
username: process.env
|
||||
.NEXT_PUBLIC_DEMO_USERNAME as string,
|
||||
password: process.env
|
||||
.NEXT_PUBLIC_DEMO_PASSWORD as string,
|
||||
});
|
||||
await signIn("credentials", {
|
||||
username: process.env.NEXT_PUBLIC_DEMO_USERNAME,
|
||||
password: process.env.NEXT_PUBLIC_DEMO_PASSWORD,
|
||||
redirect: false,
|
||||
});
|
||||
|
||||
toast.dismiss(load);
|
||||
}}
|
||||
>
|
||||
{t("demo_button")}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
|
||||
<div>
|
||||
<p className="text-sm text-black dark:text-white w-fit font-semibold mb-1">
|
||||
{availableLogins.emailEnabled === "true"
|
||||
|
||||
@@ -6,6 +6,7 @@ import {
|
||||
LinkIncludingShortenedCollectionAndTags,
|
||||
} from "@/types/global";
|
||||
import ReadableView from "@/components/ReadableView";
|
||||
import getServerSideProps from "@/lib/client/getServerSideProps";
|
||||
|
||||
export default function Index() {
|
||||
const { links, getLink } = useLinkStore();
|
||||
@@ -36,6 +37,12 @@ export default function Index() {
|
||||
{link && Number(router.query.format) === ArchivedFormat.readability && (
|
||||
<ReadableView link={link} />
|
||||
)}
|
||||
{link && Number(router.query.format) === ArchivedFormat.monolith && (
|
||||
<iframe
|
||||
src={`/api/v1/archives/${link.id}?format=${ArchivedFormat.monolith}`}
|
||||
className="w-full h-screen border-none"
|
||||
></iframe>
|
||||
)}
|
||||
{link && Number(router.query.format) === ArchivedFormat.pdf && (
|
||||
<iframe
|
||||
src={`/api/v1/archives/${link.id}?format=${ArchivedFormat.pdf}`}
|
||||
@@ -59,3 +66,5 @@ export default function Index() {
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export { getServerSideProps };
|
||||
|
||||
@@ -42,6 +42,7 @@ export default function PublicCollections() {
|
||||
username: "",
|
||||
image: "",
|
||||
archiveAsScreenshot: undefined as unknown as boolean,
|
||||
archiveAsMonolith: undefined as unknown as boolean,
|
||||
archiveAsPDF: undefined as unknown as boolean,
|
||||
});
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@ import {
|
||||
LinkIncludingShortenedCollectionAndTags,
|
||||
} from "@/types/global";
|
||||
import ReadableView from "@/components/ReadableView";
|
||||
import getServerSideProps from "@/lib/client/getServerSideProps";
|
||||
|
||||
export default function Index() {
|
||||
const { links, getLink } = useLinkStore();
|
||||
@@ -61,3 +62,5 @@ export default function Index() {
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export { getServerSideProps };
|
||||
|
||||
@@ -25,14 +25,21 @@ export default function Appearance() {
|
||||
const [archiveAsPDF, setArchiveAsPDF] = useState<boolean>(
|
||||
account.archiveAsPDF
|
||||
);
|
||||
|
||||
const [archiveAsMonolith, setArchiveAsMonolith] = useState<boolean>(
|
||||
account.archiveAsMonolith
|
||||
);
|
||||
|
||||
const [archiveAsWaybackMachine, setArchiveAsWaybackMachine] =
|
||||
useState<boolean>(account.archiveAsWaybackMachine);
|
||||
|
||||
const [linksRouteTo, setLinksRouteTo] = useState(account.linksRouteTo);
|
||||
|
||||
useEffect(() => {
|
||||
setUser({
|
||||
...account,
|
||||
archiveAsScreenshot,
|
||||
archiveAsMonolith,
|
||||
archiveAsPDF,
|
||||
archiveAsWaybackMachine,
|
||||
linksRouteTo,
|
||||
@@ -41,6 +48,7 @@ export default function Appearance() {
|
||||
}, [
|
||||
account,
|
||||
archiveAsScreenshot,
|
||||
archiveAsMonolith,
|
||||
archiveAsPDF,
|
||||
archiveAsWaybackMachine,
|
||||
linksRouteTo,
|
||||
@@ -54,6 +62,7 @@ export default function Appearance() {
|
||||
useEffect(() => {
|
||||
if (!objectIsEmpty(account)) {
|
||||
setArchiveAsScreenshot(account.archiveAsScreenshot);
|
||||
setArchiveAsMonolith(account.archiveAsMonolith);
|
||||
setArchiveAsPDF(account.archiveAsPDF);
|
||||
setArchiveAsWaybackMachine(account.archiveAsWaybackMachine);
|
||||
setLinksRouteTo(account.linksRouteTo);
|
||||
@@ -125,6 +134,13 @@ export default function Appearance() {
|
||||
state={archiveAsScreenshot}
|
||||
onClick={() => setArchiveAsScreenshot(!archiveAsScreenshot)}
|
||||
/>
|
||||
|
||||
<Checkbox
|
||||
label={t("webpage")}
|
||||
state={archiveAsMonolith}
|
||||
onClick={() => setArchiveAsMonolith(!archiveAsMonolith)}
|
||||
/>
|
||||
|
||||
<Checkbox
|
||||
label={t("pdf")}
|
||||
state={archiveAsPDF}
|
||||
@@ -204,6 +220,24 @@ export default function Appearance() {
|
||||
</span>
|
||||
</label>
|
||||
|
||||
<label
|
||||
className="label cursor-pointer flex gap-2 justify-start w-fit"
|
||||
tabIndex={0}
|
||||
role="button"
|
||||
>
|
||||
<input
|
||||
type="radio"
|
||||
name="link-preference-radio"
|
||||
className="radio checked:bg-primary"
|
||||
value="Monolith"
|
||||
checked={linksRouteTo === LinksRouteTo.MONOLITH}
|
||||
onChange={() => setLinksRouteTo(LinksRouteTo.MONOLITH)}
|
||||
/>
|
||||
<span className="label-text">
|
||||
{t("open_webpage_if_available")}
|
||||
</span>
|
||||
</label>
|
||||
|
||||
<label
|
||||
className="label cursor-pointer flex gap-2 justify-start w-fit"
|
||||
tabIndex={0}
|
||||
|
||||
+2
-2
@@ -145,7 +145,7 @@ export default function Index() {
|
||||
<input
|
||||
type="text"
|
||||
autoFocus
|
||||
className="sm:text-4xl text-3xl capitalize bg-transparent h-10 w-3/4 outline-none border-b border-b-neutral-content"
|
||||
className="sm:text-3xl text-2xl bg-transparent h-10 w-3/4 outline-none border-b border-b-neutral-content"
|
||||
value={newTagName}
|
||||
onChange={(e) => setNewTagName(e.target.value)}
|
||||
/>
|
||||
@@ -167,7 +167,7 @@ export default function Index() {
|
||||
</>
|
||||
) : (
|
||||
<>
|
||||
<p className="sm:text-4xl text-3xl capitalize">
|
||||
<p className="sm:text-3xl text-2xl capitalize">
|
||||
{activeTag?.name}
|
||||
</p>
|
||||
<div className="relative">
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
-- AlterEnum
|
||||
ALTER TYPE "LinksRouteTo" ADD VALUE 'SINGLEFILE';
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE "User" ADD COLUMN "archiveAsSinglefile" BOOLEAN NOT NULL DEFAULT false;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE "Link" ADD COLUMN "singlefile" text;
|
||||
@@ -0,0 +1,21 @@
|
||||
/*
|
||||
Warnings:
|
||||
|
||||
- The values [SINGLEFILE] on the enum `LinksRouteTo` will be removed. If these variants are still used in the database, this will fail.
|
||||
- You are about to drop the column `archiveAsSinglefile` on the `User` table. All the data in the column will be lost.
|
||||
|
||||
*/
|
||||
-- AlterEnum
|
||||
BEGIN;
|
||||
CREATE TYPE "LinksRouteTo_new" AS ENUM ('ORIGINAL', 'PDF', 'READABLE', 'MONOLITH', 'SCREENSHOT');
|
||||
ALTER TABLE "User" ALTER COLUMN "linksRouteTo" DROP DEFAULT;
|
||||
ALTER TABLE "User" ALTER COLUMN "linksRouteTo" TYPE "LinksRouteTo_new" USING ("linksRouteTo"::text::"LinksRouteTo_new");
|
||||
ALTER TYPE "LinksRouteTo" RENAME TO "LinksRouteTo_old";
|
||||
ALTER TYPE "LinksRouteTo_new" RENAME TO "LinksRouteTo";
|
||||
DROP TYPE "LinksRouteTo_old";
|
||||
ALTER TABLE "User" ALTER COLUMN "linksRouteTo" SET DEFAULT 'ORIGINAL';
|
||||
COMMIT;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE "User" DROP COLUMN "archiveAsSinglefile",
|
||||
ADD COLUMN "archiveAsMonolith" BOOLEAN NOT NULL DEFAULT true;
|
||||
@@ -0,0 +1,9 @@
|
||||
/*
|
||||
Warnings:
|
||||
|
||||
- You are about to drop the column `singlefile` on the `Link` table. All the data in the column will be lost.
|
||||
|
||||
*/
|
||||
-- AlterTable
|
||||
ALTER TABLE "Link" DROP COLUMN "singlefile",
|
||||
ADD COLUMN "monolith" TEXT;
|
||||
@@ -47,6 +47,7 @@ model User {
|
||||
linksRouteTo LinksRouteTo @default(ORIGINAL)
|
||||
preventDuplicateLinks Boolean @default(false)
|
||||
archiveAsScreenshot Boolean @default(true)
|
||||
archiveAsMonolith Boolean @default(true)
|
||||
archiveAsPDF Boolean @default(true)
|
||||
archiveAsWaybackMachine Boolean @default(false)
|
||||
isPrivate Boolean @default(false)
|
||||
@@ -58,6 +59,7 @@ enum LinksRouteTo {
|
||||
ORIGINAL
|
||||
PDF
|
||||
READABLE
|
||||
MONOLITH
|
||||
SCREENSHOT
|
||||
}
|
||||
|
||||
@@ -137,6 +139,7 @@ model Link {
|
||||
image String?
|
||||
pdf String?
|
||||
readable String?
|
||||
monolith String?
|
||||
lastPreserved DateTime?
|
||||
importDate DateTime?
|
||||
createdAt DateTime @default(now())
|
||||
|
||||
@@ -166,6 +166,7 @@
|
||||
"open_pdf_if_available": "Open PDF, if available",
|
||||
"open_readable_if_available": "Open Readable, if available",
|
||||
"open_screenshot_if_available": "Open Screenshot, if available",
|
||||
"open_webpage_if_available": "Open Webpage copy, if available",
|
||||
"tag_renamed": "Tag renamed!",
|
||||
"tag_deleted": "Tag deleted!",
|
||||
"rename_tag": "Rename Tag",
|
||||
@@ -221,8 +222,9 @@
|
||||
"github": "GitHub",
|
||||
"twitter": "Twitter",
|
||||
"mastodon": "Mastodon",
|
||||
"link_preservation_in_queue": "LThe Link preservation is currently in the queue",
|
||||
"link_preservation_in_queue": "The Link preservation is currently in the queue",
|
||||
"check_back_later": "Please check back later to see the result",
|
||||
"there_are_more_formats": "There are more preserved formats in the queue",
|
||||
"settings": "Settings",
|
||||
"switch_to": "Switch to {{theme}}",
|
||||
"logout": "Logout",
|
||||
@@ -360,5 +362,13 @@
|
||||
"show_link_details": "Show Link Details",
|
||||
"hide_link_details": "Hide Link Details",
|
||||
"link_pinned": "Link Pinned!",
|
||||
"link_unpinned": "Link Unpinned!"
|
||||
"link_unpinned": "Link Unpinned!",
|
||||
"webpage": "Webpage",
|
||||
"server_administration": "Server Administration",
|
||||
"all_collections": "All Collections",
|
||||
"dashboard": "Dashboard",
|
||||
"demo_title": "Demo Only",
|
||||
"demo_desc": "This is only a demo instance of Linkwarden and uploads are disabled.",
|
||||
"demo_desc_2": "If you want to try out the full version, you can sign up for a free trial at:",
|
||||
"demo_button": "Login as demo user"
|
||||
}
|
||||
@@ -0,0 +1,370 @@
|
||||
{
|
||||
"user_administration": "Amministrazione Utenti",
|
||||
"search_users": "Cerca Utenti",
|
||||
"no_users_found": "Nessun utente trovato.",
|
||||
"no_user_found_in_search": "Nessun utente trovato con la query di ricerca specificata.",
|
||||
"username": "Nome utente",
|
||||
"email": "Email",
|
||||
"subscribed": "Iscritto",
|
||||
"created_at": "Creato il",
|
||||
"not_available": "N/D",
|
||||
"check_your_email": "Per favore controlla la tua email",
|
||||
"authenticating": "Autenticazione in corso...",
|
||||
"verification_email_sent": "Email di verifica inviata.",
|
||||
"verification_email_sent_desc": "Un link di accesso è stato inviato al tuo indirizzo email. Se non vedi l'email, controlla la cartella dello spam.",
|
||||
"resend_email": "Reinvia Email",
|
||||
"invalid_credentials": "Credenziali non valide.",
|
||||
"fill_all_fields": "Per favore compila tutti i campi.",
|
||||
"enter_credentials": "Inserisci le tue credenziali",
|
||||
"username_or_email": "Nome utente o Email",
|
||||
"password": "Password",
|
||||
"confirm_password": "Conferma Password",
|
||||
"forgot_password": "Password dimenticata?",
|
||||
"login": "Accedi",
|
||||
"or_continue_with": "O continua con",
|
||||
"new_here": "Nuovo qui?",
|
||||
"sign_up": "Registrati",
|
||||
"sign_in_to_your_account": "Accedi al tuo account",
|
||||
"dashboard_desc": "Una breve panoramica dei tuoi dati",
|
||||
"link": "Link",
|
||||
"links": "Links",
|
||||
"collection": "Collezione",
|
||||
"collections": "Collezioni",
|
||||
"tag": "Tag",
|
||||
"tags": "Tags",
|
||||
"recent": "Recenti",
|
||||
"recent_links_desc": "Link aggiunti di recente",
|
||||
"view_all": "Vedi tutti",
|
||||
"view_added_links_here": "Visualizza i tuoi Link aggiunti di recente qui!",
|
||||
"view_added_links_here_desc": "Questa sezione mostrerà i tuoi ultimi Link aggiunti in tutte le Collezioni a cui hai accesso.",
|
||||
"add_link": "Aggiungi Nuovo Link",
|
||||
"import_links": "Importa Links",
|
||||
"from_linkwarden": "Da Linkwarden",
|
||||
"from_html": "Da file HTML dei segnalibri",
|
||||
"from_wallabag": "Da Wallabag (file JSON)",
|
||||
"pinned": "Fissati",
|
||||
"pinned_links_desc": "I tuoi Link fissati",
|
||||
"pin_favorite_links_here": "Fissa i tuoi Link preferiti qui!",
|
||||
"pin_favorite_links_here_desc": "Puoi fissare i tuoi Link preferiti cliccando sui tre puntini su ogni Link e selezionando Fissa alla Dashboard.",
|
||||
"sending_password_link": "Invio del link per il recupero della password...",
|
||||
"password_email_prompt": "Inserisci la tua email per inviarti un link per creare una nuova password.",
|
||||
"send_reset_link": "Invia Link di Reset",
|
||||
"reset_email_sent_desc": "Controlla la tua email per un link per reimpostare la password. Se non appare entro pochi minuti, controlla la cartella dello spam.",
|
||||
"back_to_login": "Torna al Login",
|
||||
"email_sent": "Email Inviata!",
|
||||
"passwords_mismatch": "Le password non corrispondono.",
|
||||
"password_too_short": "Le password devono essere di almeno 8 caratteri.",
|
||||
"creating_account": "Creazione dell'Account in corso...",
|
||||
"account_created": "Account Creato!",
|
||||
"trial_offer_desc": "Sblocca {{count}} giorni di Servizio Premium gratuitamente!",
|
||||
"register_desc": "Crea un nuovo account",
|
||||
"registration_disabled_desc": "La registrazione è disabilitata per questa istanza, contatta l'amministratore in caso di problemi.",
|
||||
"enter_details": "Inserisci i tuoi dettagli",
|
||||
"display_name": "Nome visualizzato",
|
||||
"sign_up_agreement": "Registrandoti, accetti i nostri <0>Termini di Servizio</0> e la <1>Privacy Policy</1>.",
|
||||
"need_help": "Hai bisogno di aiuto?",
|
||||
"get_in_touch": "Contattaci",
|
||||
"already_registered": "Hai già un account?",
|
||||
"deleting_selections": "Eliminazione delle selezioni in corso...",
|
||||
"links_deleted": "{{count}} Link eliminati.",
|
||||
"link_deleted": "1 Link eliminato.",
|
||||
"links_selected": "{{count}} Link selezionati",
|
||||
"link_selected": "1 Link selezionato",
|
||||
"nothing_selected": "Nessuna selezione",
|
||||
"edit": "Modifica",
|
||||
"delete": "Elimina",
|
||||
"nothing_found": "Nessun risultato trovato.",
|
||||
"redirecting_to_stripe": "Reindirizzamento a Stripe...",
|
||||
"subscribe_title": "Abbonati a Linkwarden!",
|
||||
"subscribe_desc": "Sarai reindirizzato a Stripe, non esitare a contattarci a <0>support@linkwarden.app</0> in caso di problemi.",
|
||||
"monthly": "Mensile",
|
||||
"yearly": "Annuale",
|
||||
"discount_percent": "{{percent}}% di sconto",
|
||||
"billed_monthly": "Fatturato mensilmente",
|
||||
"billed_yearly": "Fatturato annualmente",
|
||||
"total": "Totale",
|
||||
"total_annual_desc": "Prova gratuita di {{count}} giorni, poi ${{annualPrice}} all'anno",
|
||||
"total_monthly_desc": "Prova gratuita di {{count}} giorni, poi ${{monthlyPrice}} al mese",
|
||||
"plus_tax": "+ IVA se applicabile",
|
||||
"complete_subscription": "Completa Abbonamento",
|
||||
"sign_out": "Esci",
|
||||
"access_tokens": "Token di Accesso",
|
||||
"access_tokens_description": "I Token di Accesso possono essere utilizzati per accedere a Linkwarden da altre app e servizi senza dover fornire il tuo Nome utente e Password.",
|
||||
"new_token": "Nuovo Token di Accesso",
|
||||
"name": "Nome",
|
||||
"created_success": "Creato con successo!",
|
||||
"created": "Creato",
|
||||
"expires": "Scade",
|
||||
"accountSettings": "Impostazioni Account",
|
||||
"language": "Lingua",
|
||||
"profile_photo": "Foto Profilo",
|
||||
"upload_new_photo": "Carica una nuova foto...",
|
||||
"remove_photo": "Rimuovi Foto",
|
||||
"make_profile_private": "Rendi il profilo privato",
|
||||
"profile_privacy_info": "Questo limiterà chi può trovarti e aggiungerti a nuove Collezioni.",
|
||||
"whitelisted_users": "Utenti nella lista bianca",
|
||||
"whitelisted_users_info": "Per favore fornisci il Nome utente degli utenti a cui desideri concedere la visibilità del tuo profilo. Separati da virgola.",
|
||||
"whitelisted_users_placeholder": "Il tuo profilo è nascosto a tutti in questo momento...",
|
||||
"save_changes": "Salva Modifiche",
|
||||
"import_export": "Importa & Esporta",
|
||||
"import_data": "Importa i tuoi dati da altre piattaforme.",
|
||||
"download_data": "Scarica i tuoi dati istantaneamente.",
|
||||
"export_data": "Esporta Dati",
|
||||
"delete_account": "Elimina Account",
|
||||
"delete_account_warning": "Questo eliminerà permanentemente TUTTI i Link, le Collezioni, i Tag e i dati archiviati di tua proprietà.",
|
||||
"cancel_subscription_notice": "Cancellerà anche il tuo abbonamento.",
|
||||
"account_deletion_page": "Pagina di eliminazione dell'account",
|
||||
"applying_settings": "Applicazione delle impostazioni in corso...",
|
||||
"settings_applied": "Impostazioni Applicate!",
|
||||
"email_change_request": "Richiesta di cambio email inviata. Per favore verifica il nuovo indirizzo email.",
|
||||
"image_upload_size_error": "Per favore seleziona un file PNG o JPEG di dimensioni inferiori a 1MB.",
|
||||
"image_upload_format_error": "Formato file non valido.",
|
||||
"importing_bookmarks": "Importazione dei segnalibri in corso...",
|
||||
"import_success": "Segnalibri importati! Ricaricamento della pagina...",
|
||||
"more_coming_soon": "Altro in arrivo presto!",
|
||||
"billing_settings": "Impostazioni di Fatturazione",
|
||||
"manage_subscription_intro": "Per gestire/cancellare il tuo abbonamento, visita il",
|
||||
"billing_portal": "Portale di Fatturazione",
|
||||
"help_contact_intro": "Se hai ancora bisogno di aiuto o hai riscontrato problemi, non esitare a contattarci a:",
|
||||
"fill_required_fields": "Per favore compila i campi obbligatori.",
|
||||
"deleting_message": "Eliminazione di tutto in corso, attendere prego...",
|
||||
"delete_warning": "Questo eliminerà permanentemente tutti i Link, le Collezioni, i Tag e i dati archiviati di tua proprietà. Ti disconnetterà anche. Questa azione è irreversibile!",
|
||||
"optional": "Opzionale",
|
||||
"feedback_help": "(ma ci aiuta davvero a migliorare!)",
|
||||
"reason_for_cancellation": "Motivo della cancellazione",
|
||||
"please_specify": "Per favore specifica",
|
||||
"customer_service": "Servizio Clienti",
|
||||
"low_quality": "Bassa Qualità",
|
||||
"missing_features": "Funzionalità Mancanti",
|
||||
"switched_service": "Cambiato Servizio",
|
||||
"too_complex": "Troppo Complesso",
|
||||
"too_expensive": "Troppo Costoso",
|
||||
"unused": "Non Utilizzato",
|
||||
"other": "Altro",
|
||||
"more_information": "Ulteriori informazioni (più dettagli fornisci, più utile sarà)",
|
||||
"feedback_placeholder": "es. Avevo bisogno di una funzionalità che...",
|
||||
"delete_your_account": "Elimina il Tuo Account",
|
||||
"change_password": "Cambia Password",
|
||||
"password_length_error": "Le password devono essere di almeno 8 caratteri.",
|
||||
"applying_changes": "Applicazione in corso...",
|
||||
"password_change_instructions": "Per cambiare la tua password, compila quanto segue. La tua password dovrebbe essere di almeno 8 caratteri.",
|
||||
"old_password": "Vecchia Password",
|
||||
"new_password": "Nuova Password",
|
||||
"preference": "Preferenza",
|
||||
"select_theme": "Seleziona Tema",
|
||||
"dark": "Scuro",
|
||||
"light": "Chiaro",
|
||||
"archive_settings": "Impostazioni di Archiviazione",
|
||||
"formats_to_archive": "Formati per archiviare/preservare le pagine web:",
|
||||
"screenshot": "Screenshot",
|
||||
"pdf": "PDF",
|
||||
"archive_org_snapshot": "Snapshot di Archive.org",
|
||||
"link_settings": "Impostazioni Link",
|
||||
"prevent_duplicate_links": "Previeni link duplicati",
|
||||
"clicking_on_links_should": "Cliccando sui Link si dovrebbe:",
|
||||
"open_original_content": "Aprire il contenuto originale",
|
||||
"open_pdf_if_available": "Aprire PDF, se disponibile",
|
||||
"open_readable_if_available": "Aprire versione leggibile, se disponibile",
|
||||
"open_screenshot_if_available": "Aprire Screenshot, se disponibile",
|
||||
"open_webpage_if_available": "Aprire copia della pagina web, se disponibile",
|
||||
"tag_renamed": "Tag rinominato!",
|
||||
"tag_deleted": "Tag eliminato!",
|
||||
"rename_tag": "Rinomina Tag",
|
||||
"delete_tag": "Elimina Tag",
|
||||
"list_created_with_linkwarden": "Lista creata con Linkwarden",
|
||||
"by_author": "Di {{author}}.",
|
||||
"by_author_and_other": "Di {{author}} e {{count}} altro.",
|
||||
"by_author_and_others": "Di {{author}} e {{count}} altri.",
|
||||
"search_count_link": "Cerca {{count}} Link",
|
||||
"search_count_links": "Cerca {{count}} Links",
|
||||
"collection_is_empty": "Questa Collezione è vuota...",
|
||||
"all_links": "Tutti i Link",
|
||||
"all_links_desc": "Link da ogni Collezione",
|
||||
"you_have_not_added_any_links": "Non hai ancora creato alcun Link",
|
||||
"collections_you_own": "Collezioni di tua proprietà",
|
||||
"new_collection": "Nuova Collezione",
|
||||
"other_collections": "Altre Collezioni",
|
||||
"other_collections_desc": "Collezioni condivise di cui sei membro",
|
||||
"showing_count_results": "Mostrati {{count}} risultati",
|
||||
"showing_count_result": "Mostrato {{count}} risultato",
|
||||
"edit_collection_info": "Modifica Info Collezione",
|
||||
"share_and_collaborate": "Condividi e Collabora",
|
||||
"view_team": "Visualizza Team",
|
||||
"team": "Team",
|
||||
"create_subcollection": "Crea Sotto-Collezione",
|
||||
"delete_collection": "Elimina Collezione",
|
||||
"leave_collection": "Lascia Collezione",
|
||||
"email_verified_signing_out": "Email verificata. Disconnessione in corso...",
|
||||
"invalid_token": "Token non valido.",
|
||||
"sending_password_recovery_link": "Invio del link per il recupero della password in corso...",
|
||||
"please_fill_all_fields": "Per favore compila tutti i campi.",
|
||||
"password_updated": "Password Aggiornata!",
|
||||
"reset_password": "Reimposta Password",
|
||||
"enter_email_for_new_password": "Inserisci la tua email per inviarti un link per creare una nuova password.",
|
||||
"update_password": "Aggiorna Password",
|
||||
"password_successfully_updated": "La tua password è stata aggiornata con successo.",
|
||||
"user_already_member": "L'utente esiste già.",
|
||||
"you_are_already_collection_owner": "Sei già il proprietario della collezione.",
|
||||
"date_newest_first": "Data (Più recente prima)",
|
||||
"date_oldest_first": "Data (Più vecchio prima)",
|
||||
"name_az": "Nome (A-Z)",
|
||||
"name_za": "Nome (Z-A)",
|
||||
"description_az": "Descrizione (A-Z)",
|
||||
"description_za": "Descrizione (Z-A)",
|
||||
"all_rights_reserved": "© {{date}} <0>Linkwarden</0>. Tutti i diritti riservati.",
|
||||
"you_have_no_collections": "Non hai Collezioni...",
|
||||
"you_have_no_tags": "Non hai Tag...",
|
||||
"cant_change_collection_you_dont_own": "Non puoi apportare modifiche a una collezione di cui non sei proprietario.",
|
||||
"account": "Account",
|
||||
"billing": "Fatturazione",
|
||||
"linkwarden_version": "Linkwarden {{version}}",
|
||||
"help": "Aiuto",
|
||||
"github": "GitHub",
|
||||
"twitter": "Twitter",
|
||||
"mastodon": "Mastodon",
|
||||
"link_preservation_in_queue": "La preservazione del Link è attualmente in coda",
|
||||
"check_back_later": "Per favore controlla più tardi per vedere il risultato",
|
||||
"there_are_more_formats": "Ci sono altri formati preservati in coda",
|
||||
"settings": "Impostazioni",
|
||||
"switch_to": "Passa a {{theme}}",
|
||||
"logout": "Esci",
|
||||
"start_journey": "Inizia il tuo viaggio creando un nuovo Link!",
|
||||
"create_new_link": "Crea Nuovo Link",
|
||||
"new_link": "Nuovo Link",
|
||||
"create_new": "Crea Nuovo...",
|
||||
"pwa_install_prompt": "Installa Linkwarden sulla tua schermata iniziale per un accesso più rapido e un'esperienza migliore. <0>Scopri di più</0>",
|
||||
"full_content": "Contenuto Completo",
|
||||
"slower": "Più lento",
|
||||
"new_version_announcement": "Scopri le novità in <0>Linkwarden {{version}}!</0>",
|
||||
"creating": "Creazione in corso...",
|
||||
"upload_file": "Carica File",
|
||||
"file": "File",
|
||||
"file_types": "PDF, PNG, JPG (Fino a {{size}} MB)",
|
||||
"description": "Descrizione",
|
||||
"auto_generated": "Sarà generato automaticamente se non viene fornito nulla.",
|
||||
"example_link": "es. Link di Esempio",
|
||||
"hide": "Nascondi",
|
||||
"more": "Altro",
|
||||
"options": "Opzioni",
|
||||
"description_placeholder": "Note, pensieri, ecc.",
|
||||
"deleting": "Eliminazione in corso...",
|
||||
"token_revoked": "Token Revocato.",
|
||||
"revoke_token": "Revoca Token",
|
||||
"revoke_confirmation": "Sei sicuro di voler revocare questo Token di Accesso? Qualsiasi app o servizio che utilizza questo token non sarà più in grado di accedere a Linkwarden utilizzandolo.",
|
||||
"revoke": "Revoca",
|
||||
"sending_request": "Invio richiesta...",
|
||||
"link_being_archived": "Il Link è in fase di archiviazione...",
|
||||
"preserved_formats": "Formati Preservati",
|
||||
"available_formats": "I seguenti formati sono disponibili per questo link:",
|
||||
"readable": "Leggibile",
|
||||
"preservation_in_queue": "La preservazione del Link è in coda",
|
||||
"view_latest_snapshot": "Visualizza l'ultimo snapshot su archive.org",
|
||||
"refresh_preserved_formats": "Aggiorna Formati Preservati",
|
||||
"this_deletes_current_preservations": "Questo elimina le preservazioni attuali",
|
||||
"create_new_user": "Crea Nuovo Utente",
|
||||
"placeholder_johnny": "Johnny",
|
||||
"placeholder_email": "johnny@esempio.com",
|
||||
"placeholder_john": "john",
|
||||
"user_created": "Utente Creato!",
|
||||
"fill_all_fields_error": "Per favore compila tutti i campi.",
|
||||
"password_change_note": "<0>Nota:</0> Assicurati di informare l'utente che deve cambiare la propria password.",
|
||||
"create_user": "Crea Utente",
|
||||
"creating_token": "Creazione Token in corso...",
|
||||
"token_created": "Token Creato!",
|
||||
"access_token_created": "Token di Accesso Creato",
|
||||
"token_creation_notice": "Il tuo nuovo token è stato creato. Per favore copialo e conservalo in un luogo sicuro. Non sarai in grado di vederlo di nuovo.",
|
||||
"copied_to_clipboard": "Copiato negli appunti!",
|
||||
"copy_to_clipboard": "Copia negli Appunti",
|
||||
"create_access_token": "Crea un Token di Accesso",
|
||||
"expires_in": "Scade tra",
|
||||
"token_name_placeholder": "es. Per la scorciatoia iOS",
|
||||
"create_token": "Crea Token di Accesso",
|
||||
"7_days": "7 Giorni",
|
||||
"30_days": "30 Giorni",
|
||||
"60_days": "60 Giorni",
|
||||
"90_days": "90 Giorni",
|
||||
"no_expiration": "Nessuna Scadenza",
|
||||
"creating_link": "Creazione link in corso...",
|
||||
"link_created": "Link creato!",
|
||||
"link_name_placeholder": "Sarà generato automaticamente se lasciato vuoto.",
|
||||
"link_url_placeholder": "es. http://esempio.com/",
|
||||
"link_description_placeholder": "Note, pensieri, ecc.",
|
||||
"more_options": "Più Opzioni",
|
||||
"hide_options": "Nascondi Opzioni",
|
||||
"create_link": "Crea Link",
|
||||
"new_sub_collection": "Nuova Sotto-Collezione",
|
||||
"for_collection": "Per {{name}}",
|
||||
"create_new_collection": "Crea una Nuova Collezione",
|
||||
"color": "Colore",
|
||||
"reset": "Ripristina",
|
||||
"collection_name_placeholder": "es. Collezione di Esempio",
|
||||
"collection_description_placeholder": "Lo scopo di questa Collezione...",
|
||||
"create_collection_button": "Crea Collezione",
|
||||
"password_change_warning": "Per favore conferma la tua password prima di cambiare il tuo indirizzo email.",
|
||||
"stripe_update_note": "L'aggiornamento di questo campo cambierà anche la tua email di fatturazione su Stripe.",
|
||||
"sso_will_be_removed_warning": "Se cambi il tuo indirizzo email, tutte le connessioni SSO {{service}} esistenti verranno rimosse.",
|
||||
"old_email": "Vecchia Email",
|
||||
"new_email": "Nuova Email",
|
||||
"confirm": "Conferma",
|
||||
"edit_link": "Modifica Link",
|
||||
"updating": "Aggiornamento in corso...",
|
||||
"updated": "Aggiornato!",
|
||||
"placeholder_example_link": "es. Link di Esempio",
|
||||
"make_collection_public": "Rendi la Collezione Pubblica",
|
||||
"make_collection_public_checkbox": "Rendi questa una collezione pubblica",
|
||||
"make_collection_public_desc": "Questo permetterà a chiunque di visualizzare questa collezione e i suoi utenti.",
|
||||
"sharable_link_guide": "Link Condivisibile (Clicca per copiare)",
|
||||
"copied": "Copiato!",
|
||||
"members": "Membri",
|
||||
"members_username_placeholder": "Nome utente (senza '@')",
|
||||
"owner": "Proprietario",
|
||||
"admin": "Amministratore",
|
||||
"contributor": "Collaboratore",
|
||||
"viewer": "Visualizzatore",
|
||||
"viewer_desc": "Accesso in sola lettura",
|
||||
"contributor_desc": "Può visualizzare e creare Link",
|
||||
"admin_desc": "Accesso completo a tutti i Link",
|
||||
"remove_member": "Rimuovi Membro",
|
||||
"placeholder_example_collection": "es. Collezione di Esempio",
|
||||
"placeholder_collection_purpose": "Lo scopo di questa Collezione...",
|
||||
"deleting_user": "Eliminazione in corso...",
|
||||
"user_deleted": "Utente Eliminato.",
|
||||
"delete_user": "Elimina Utente",
|
||||
"confirm_user_deletion": "Sei sicuro di voler rimuovere questo utente?",
|
||||
"irreversible_action_warning": "Questa azione è irreversibile!",
|
||||
"delete_confirmation": "Elimina, so cosa sto facendo",
|
||||
"delete_link": "Elimina Link",
|
||||
"deleted": "Eliminato.",
|
||||
"link_deletion_confirmation_message": "Sei sicuro di voler eliminare questo Link?",
|
||||
"warning": "Attenzione",
|
||||
"irreversible_warning": "Questa azione è irreversibile!",
|
||||
"shift_key_tip": "Tieni premuto il tasto Shift mentre clicchi su 'Elimina' per evitare questa conferma in futuro.",
|
||||
"deleting_collection": "Eliminazione in corso...",
|
||||
"collection_deleted": "Collezione Eliminata.",
|
||||
"confirm_deletion_prompt": "Per confermare, digita \"{{name}}\" nella casella sottostante:",
|
||||
"type_name_placeholder": "Digita \"{{name}}\" Qui.",
|
||||
"deletion_warning": "L'eliminazione di questa collezione cancellerà permanentemente tutti i suoi contenuti e diventerà inaccessibile a tutti, inclusi i membri con accesso precedente.",
|
||||
"leave_prompt": "Clicca il pulsante sottostante per lasciare la collezione corrente.",
|
||||
"leave": "Lascia",
|
||||
"edit_links": "Modifica {{count}} Link",
|
||||
"move_to_collection": "Sposta nella Collezione",
|
||||
"add_tags": "Aggiungi Tag",
|
||||
"remove_previous_tags": "Rimuovi tag precedenti",
|
||||
"delete_links": "Elimina {{count}} Link",
|
||||
"links_deletion_confirmation_message": "Sei sicuro di voler eliminare {{count}} Link? ",
|
||||
"warning_irreversible": "Attenzione: Questa azione è irreversibile!",
|
||||
"shift_key_instruction": "Tieni premuto il tasto 'Shift' mentre clicchi su 'Elimina' per evitare questa conferma in futuro.",
|
||||
"link_selection_error": "Non hai il permesso di modificare o eliminare questo elemento.",
|
||||
"no_description": "Nessuna descrizione fornita.",
|
||||
"applying": "Applicazione in corso...",
|
||||
"unpin": "Rimuovi fissaggio",
|
||||
"pin_to_dashboard": "Fissa alla Dashboard",
|
||||
"show_link_details": "Mostra Dettagli Link",
|
||||
"hide_link_details": "Nascondi Dettagli Link",
|
||||
"link_pinned": "Link Fissato!",
|
||||
"link_unpinned": "Fissaggio Link Rimosso!",
|
||||
"webpage": "Pagina web",
|
||||
"server_administration": "Amministrazione Server",
|
||||
"all_collections": "Tutte le Collezioni",
|
||||
"dashboard": "Dashboard"
|
||||
}
|
||||
@@ -1,70 +0,0 @@
|
||||
// [Optional, but recommended]
|
||||
|
||||
// We decided that the "name" field should be the auto-generated field instead of the "description" field, so we need to
|
||||
// move the data from the "description" field to the "name" field for links that have an empty name.
|
||||
|
||||
// This script is meant to be run only once.
|
||||
|
||||
// Run the script with `node scripts/migration/descriptionToName.js`
|
||||
|
||||
const { PrismaClient } = require("@prisma/client");
|
||||
|
||||
const prisma = new PrismaClient();
|
||||
|
||||
async function main() {
|
||||
console.log("Starting...");
|
||||
|
||||
const count = await prisma.link.count({
|
||||
where: {
|
||||
name: "",
|
||||
description: {
|
||||
not: "",
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
console.log(
|
||||
`Applying the changes to ${count} ${
|
||||
count == 1 ? "link" : "links"
|
||||
} in 10 seconds...`
|
||||
);
|
||||
|
||||
await new Promise((resolve) => setTimeout(resolve, 10000));
|
||||
|
||||
console.log("Applying the changes...");
|
||||
|
||||
const links = await prisma.link.findMany({
|
||||
where: {
|
||||
name: "",
|
||||
description: {
|
||||
not: "",
|
||||
},
|
||||
},
|
||||
select: {
|
||||
id: true,
|
||||
description: true,
|
||||
},
|
||||
});
|
||||
|
||||
for (const link of links) {
|
||||
await prisma.link.update({
|
||||
where: {
|
||||
id: link.id,
|
||||
},
|
||||
data: {
|
||||
name: link.description,
|
||||
description: "",
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
console.log("Done!");
|
||||
}
|
||||
|
||||
main()
|
||||
.catch((e) => {
|
||||
throw e;
|
||||
})
|
||||
.finally(async () => {
|
||||
await prisma.$disconnect();
|
||||
});
|
||||
@@ -0,0 +1,169 @@
|
||||
// Run the script with `node scripts/migration/v2.6.1/index.js`
|
||||
// Docker users can run the script with `docker exec -it CONTAINER_ID /bin/bash -c 'node scripts/migration/v2.6.1/index.js'`
|
||||
|
||||
// There are two parts to this script:
|
||||
|
||||
// Firstly we decided that the "name" field should be the auto-generated field instead of the "description" field, so we need to
|
||||
// move the data from the "description" field to the "name" field for links that have an empty name.
|
||||
|
||||
// Secondly it looks for every link and checks if the pdf/screenshot exist in the filesystem.
|
||||
// If they do, it updates the link with the path in the db.
|
||||
// If they don't, it passes.
|
||||
|
||||
const { S3 } = require("@aws-sdk/client-s3");
|
||||
const { PrismaClient } = require("@prisma/client");
|
||||
const { existsSync } = require("fs");
|
||||
const util = require("util");
|
||||
|
||||
const prisma = new PrismaClient();
|
||||
|
||||
const STORAGE_FOLDER = process.env.STORAGE_FOLDER || "data";
|
||||
|
||||
const s3Client =
|
||||
process.env.SPACES_ENDPOINT &&
|
||||
process.env.SPACES_REGION &&
|
||||
process.env.SPACES_KEY &&
|
||||
process.env.SPACES_SECRET
|
||||
? new S3({
|
||||
forcePathStyle: false,
|
||||
endpoint: process.env.SPACES_ENDPOINT,
|
||||
region: process.env.SPACES_REGION,
|
||||
credentials: {
|
||||
accessKeyId: process.env.SPACES_KEY,
|
||||
secretAccessKey: process.env.SPACES_SECRET,
|
||||
},
|
||||
})
|
||||
: undefined;
|
||||
|
||||
async function checkFileExistence(path) {
|
||||
if (s3Client) {
|
||||
// One millisecond delay to avoid rate limiting
|
||||
await new Promise((resolve) => setTimeout(resolve, 1));
|
||||
|
||||
const bucketParams = {
|
||||
Bucket: process.env.SPACES_BUCKET_NAME,
|
||||
Key: path,
|
||||
};
|
||||
|
||||
try {
|
||||
const headObjectAsync = util.promisify(
|
||||
s3Client.headObject.bind(s3Client)
|
||||
);
|
||||
|
||||
try {
|
||||
await headObjectAsync(bucketParams);
|
||||
return true;
|
||||
} catch (err) {
|
||||
return false;
|
||||
}
|
||||
} catch (err) {
|
||||
console.log("Error:", err);
|
||||
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
try {
|
||||
if (existsSync(STORAGE_FOLDER + "/" + path)) {
|
||||
return true;
|
||||
} else return false;
|
||||
} catch (err) {
|
||||
console.log(err);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
async function main() {
|
||||
console.log("Starting... Please do not interrupt the process.");
|
||||
|
||||
const linksWithoutName = await prisma.link.findMany({
|
||||
where: {
|
||||
name: "",
|
||||
description: {
|
||||
not: "",
|
||||
},
|
||||
},
|
||||
select: {
|
||||
id: true,
|
||||
description: true,
|
||||
},
|
||||
});
|
||||
|
||||
for (const link of linksWithoutName) {
|
||||
await prisma.link.update({
|
||||
where: {
|
||||
id: link.id,
|
||||
},
|
||||
data: {
|
||||
name: link.description,
|
||||
description: "",
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
const links = await prisma.link.findMany({
|
||||
select: {
|
||||
id: true,
|
||||
collectionId: true,
|
||||
image: true,
|
||||
pdf: true,
|
||||
readable: true,
|
||||
monolith: true,
|
||||
},
|
||||
orderBy: { id: "asc" },
|
||||
});
|
||||
|
||||
// PDFs
|
||||
for (let link of links) {
|
||||
const path = `archives/${link.collectionId}/${link.id}.pdf`;
|
||||
|
||||
const res = await checkFileExistence(path);
|
||||
|
||||
if (res) {
|
||||
await prisma.link.update({
|
||||
where: { id: link.id },
|
||||
data: { pdf: path },
|
||||
});
|
||||
}
|
||||
|
||||
console.log("Indexing the PDF for link:", link.id);
|
||||
}
|
||||
|
||||
// Screenshots (PNGs)
|
||||
for (let link of links) {
|
||||
const path = `archives/${link.collectionId}/${link.id}.png`;
|
||||
|
||||
const res = await checkFileExistence(path);
|
||||
|
||||
if (res) {
|
||||
await prisma.link.update({
|
||||
where: { id: link.id },
|
||||
data: { image: path },
|
||||
});
|
||||
}
|
||||
|
||||
console.log("Indexing the PNG for link:", link.id);
|
||||
}
|
||||
|
||||
// Screenshots (JPEGs)
|
||||
for (let link of links) {
|
||||
const path = `archives/${link.collectionId}/${link.id}.jpeg`;
|
||||
|
||||
const res = await checkFileExistence(path);
|
||||
|
||||
if (res) {
|
||||
await prisma.link.update({
|
||||
where: { id: link.id },
|
||||
data: { image: path },
|
||||
});
|
||||
}
|
||||
|
||||
console.log("Indexing the JPEG for link:", link.id);
|
||||
}
|
||||
|
||||
await prisma.$disconnect();
|
||||
}
|
||||
|
||||
main().catch((e) => {
|
||||
console.error(e);
|
||||
process.exit(1);
|
||||
});
|
||||
@@ -38,6 +38,13 @@ async function processBatch() {
|
||||
{
|
||||
readable: "pending",
|
||||
},
|
||||
///////////////////////
|
||||
{
|
||||
monolith: null,
|
||||
},
|
||||
{
|
||||
monolith: "pending",
|
||||
},
|
||||
],
|
||||
},
|
||||
take: archiveTakeCount,
|
||||
@@ -75,6 +82,13 @@ async function processBatch() {
|
||||
{
|
||||
readable: "pending",
|
||||
},
|
||||
///////////////////////
|
||||
{
|
||||
monolith: null,
|
||||
},
|
||||
{
|
||||
monolith: "pending",
|
||||
},
|
||||
],
|
||||
},
|
||||
take: archiveTakeCount,
|
||||
|
||||
Vendored
-423
@@ -1,423 +0,0 @@
|
||||
declare global {
|
||||
namespace NodeJS {
|
||||
interface ProcessEnv {
|
||||
NEXTAUTH_SECRET: string;
|
||||
DATABASE_URL: string;
|
||||
NEXTAUTH_URL: string;
|
||||
NEXT_PUBLIC_DISABLE_REGISTRATION?: string;
|
||||
PAGINATION_TAKE_COUNT?: string;
|
||||
STORAGE_FOLDER?: string;
|
||||
AUTOSCROLL_TIMEOUT?: string;
|
||||
RE_ARCHIVE_LIMIT?: string;
|
||||
NEXT_PUBLIC_MAX_FILE_SIZE?: string;
|
||||
MAX_LINKS_PER_USER?: string;
|
||||
ARCHIVE_TAKE_COUNT?: string;
|
||||
IGNORE_UNAUTHORIZED_CA?: string;
|
||||
IGNORE_URL_SIZE_LIMIT?: string;
|
||||
ADMINISTRATOR?: string;
|
||||
|
||||
SPACES_KEY?: string;
|
||||
SPACES_SECRET?: string;
|
||||
SPACES_ENDPOINT?: string;
|
||||
SPACES_BUCKET_NAME?: string;
|
||||
SPACES_REGION?: string;
|
||||
SPACES_FORCE_PATH_STYLE?: string;
|
||||
|
||||
NEXT_PUBLIC_CREDENTIALS_ENABLED?: string;
|
||||
DISABLE_NEW_SSO_USERS?: string;
|
||||
|
||||
NEXT_PUBLIC_EMAIL_PROVIDER?: string;
|
||||
EMAIL_FROM?: string;
|
||||
EMAIL_SERVER?: string;
|
||||
|
||||
BASE_URL?: string; // Used for email and stripe
|
||||
|
||||
NEXT_PUBLIC_STRIPE?: string;
|
||||
STRIPE_SECRET_KEY?: string;
|
||||
MONTHLY_PRICE_ID?: string;
|
||||
YEARLY_PRICE_ID?: string;
|
||||
NEXT_PUBLIC_STRIPE_BILLING_PORTAL_URL?: string;
|
||||
NEXT_PUBLIC_TRIAL_PERIOD_DAYS?: string;
|
||||
|
||||
// Proxy settings
|
||||
PROXY?: string;
|
||||
PROXY_USERNAME?: string;
|
||||
PROXY_PASSWORD?: string;
|
||||
PROXY_BYPASS?: string;
|
||||
|
||||
// PDF archive settings
|
||||
PDF_MARGIN_TOP?: string;
|
||||
PDF_MARGIN_BOTTOM?: string;
|
||||
|
||||
//
|
||||
// SSO Providers
|
||||
//
|
||||
|
||||
// 42 School
|
||||
NEXT_PUBLIC_FORTYTWO_ENABLED?: string;
|
||||
FORTYTWO_CUSTOM_NAME?: string;
|
||||
FORTYTWO_CLIENT_ID?: string;
|
||||
FORTYTWO_CLIENT_SECRET?: string;
|
||||
|
||||
// Apple
|
||||
NEXT_PUBLIC_APPLE_ENABLED?: string;
|
||||
APPLE_CUSTOM_NAME?: string;
|
||||
APPLE_ID?: string;
|
||||
APPLE_SECRET?: string;
|
||||
|
||||
// Atlassian
|
||||
NEXT_PUBLIC_ATLASSIAN_ENABLED?: string;
|
||||
ATLASSIAN_CUSTOM_NAME?: string;
|
||||
ATLASSIAN_CLIENT_ID?: string;
|
||||
ATLASSIAN_CLIENT_SECRET?: string;
|
||||
ATLASSIAN_SCOPE?: string;
|
||||
|
||||
// Auth0
|
||||
NEXT_PUBLIC_AUTH0_ENABLED?: string;
|
||||
AUTH0_CUSTOM_NAME?: string;
|
||||
AUTH0_ISSUER?: string;
|
||||
AUTH0_CLIENT_SECRET?: string;
|
||||
AUTH0_CLIENT_ID?: string;
|
||||
|
||||
// Authelia
|
||||
NEXT_PUBLIC_AUTHELIA_ENABLED?: string;
|
||||
AUTHELIA_CUSTOM_NAME?: string;
|
||||
AUTHELIA_CLIENT_ID?: string;
|
||||
AUTHELIA_CLIENT_SECRET?: string;
|
||||
AUTHELIA_WELLKNOWN_URL?: string;
|
||||
|
||||
// Authentik
|
||||
NEXT_PUBLIC_AUTHENTIK_ENABLED?: string;
|
||||
AUTHENTIK_CUSTOM_NAME?: string;
|
||||
AUTHENTIK_ISSUER?: string;
|
||||
AUTHENTIK_CLIENT_ID?: string;
|
||||
AUTHENTIK_CLIENT_SECRET?: string;
|
||||
|
||||
// TODO: Azure AD B2C
|
||||
// TODO: Azure AD
|
||||
|
||||
// Battle.net
|
||||
NEXT_PUBLIC_BATTLENET_ENABLED?: string;
|
||||
BATTLENET_CUSTOM_NAME?: string;
|
||||
BATTLENET_CLIENT_ID?: string;
|
||||
BATTLENET_CLIENT_SECRET?: string;
|
||||
BATLLENET_ISSUER?: string;
|
||||
|
||||
// Box
|
||||
NEXT_PUBLIC_BOX_ENABLED?: string;
|
||||
BOX_CUSTOM_NAME?: string;
|
||||
BOX_CLIENT_ID?: string;
|
||||
BOX_CLIENT_SECRET?: string;
|
||||
|
||||
// TODO: BoxyHQ SAML
|
||||
|
||||
// Bungie
|
||||
NEXT_PUBLIC_BUNGIE_ENABLED?: string;
|
||||
BUNGIE_CUSTOM_NAME?: string;
|
||||
BUNGIE_CLIENT_ID?: string;
|
||||
BUNGIE_CLIENT_SECRET?: string;
|
||||
BUNGIE_API_KEY?: string;
|
||||
|
||||
// Cognito
|
||||
NEXT_PUBLIC_COGNITO_ENABLED?: string;
|
||||
COGNITO_CUSTOM_NAME?: string;
|
||||
COGNITO_CLIENT_ID?: string;
|
||||
COGNITO_CLIENT_SECRET?: string;
|
||||
COGNITO_ISSUER?: string;
|
||||
|
||||
// Coinbase
|
||||
NEXT_PUBLIC_COINBASE_ENABLED?: string;
|
||||
COINBASE_CUSTOM_NAME?: string;
|
||||
COINBASE_CLIENT_ID?: string;
|
||||
COINBASE_CLIENT_SECRET?: string;
|
||||
|
||||
// Discord
|
||||
NEXT_PUBLIC_DISCORD_ENABLED?: string;
|
||||
DISCORD_CUSTOM_NAME?: string;
|
||||
DISCORD_CLIENT_ID?: string;
|
||||
DISCORD_CLIENT_SECRET?: string;
|
||||
|
||||
// Dropbox
|
||||
NEXT_PUBLIC_DROPBOX_ENABLED?: string;
|
||||
DROPBOX_CUSTOM_NAME?: string;
|
||||
DROPBOX_CLIENT_ID?: string;
|
||||
DROPBOX_CLIENT_SECRET?: string;
|
||||
|
||||
// DuendeIndentityServer6
|
||||
NEXT_PUBLIC_DUENDE_IDS6_ENABLED?: string;
|
||||
DUENDE_IDS6_CUSTOM_NAME?: string;
|
||||
DUENDE_IDS6_CLIENT_ID?: string;
|
||||
DUENDE_IDS6_CLIENT_SECRET?: string;
|
||||
DUENDE_IDS6_ISSUER?: string;
|
||||
|
||||
// EVE Online
|
||||
NEXT_PUBLIC_EVEONLINE_ENABLED?: string;
|
||||
EVEONLINE_CUSTOM_NAME?: string;
|
||||
EVEONLINE_CLIENT_ID?: string;
|
||||
EVEONLINE_CLIENT_SECRET?: string;
|
||||
|
||||
// Facebook
|
||||
NEXT_PUBLIC_FACEBOOK_ENABLED?: string;
|
||||
FACEBOOK_CUSTOM_NAME?: string;
|
||||
FACEBOOK_CLIENT_ID?: string;
|
||||
FACEBOOK_CLIENT_SECRET?: string;
|
||||
|
||||
// FACEIT
|
||||
NEXT_PUBLIC_FACEIT_ENABLED?: string;
|
||||
FACEIT_CUSTOM_NAME?: string;
|
||||
FACEIT_CLIENT_ID?: string;
|
||||
FACEIT_CLIENT_SECRET?: string;
|
||||
|
||||
// Foursquare
|
||||
NEXT_PUBLIC_FOURSQUARE_ENABLED?: string;
|
||||
FOURSQUARE_CUSTOM_NAME?: string;
|
||||
FOURSQUARE_CLIENT_ID?: string;
|
||||
FOURSQUARE_CLIENT_SECRET?: string;
|
||||
FOURSQUARE_APIVERSION?: string;
|
||||
|
||||
// Freshbooks
|
||||
NEXT_PUBLIC_FRESHBOOKS_ENABLED?: string;
|
||||
FRESHBOOKS_CUSTOM_NAME?: string;
|
||||
FRESHBOOKS_CLIENT_ID?: string;
|
||||
FRESHBOOKS_CLIENT_SECRET?: string;
|
||||
|
||||
// FusionAuth
|
||||
NEXT_PUBLIC_FUSIONAUTH_ENABLED?: string;
|
||||
FUSIONAUTH_CUSTOM_NAME?: string;
|
||||
FUSIONAUTH_CLIENT_ID?: string;
|
||||
FUSIONAUTH_CLIENT_SECRET?: string;
|
||||
FUSIONAUTH_ISSUER?: string;
|
||||
FUSIONAUTH_TENANT_ID?: string;
|
||||
|
||||
// GitHub
|
||||
NEXT_PUBLIC_GITHUB_ENABLED?: string;
|
||||
GITHUB_CUSTOM_NAME?: string;
|
||||
GITHUB_CLIENT_ID?: string;
|
||||
GITHUB_CLIENT_SECRET?: string;
|
||||
|
||||
// GitLab
|
||||
NEXT_PUBLIC_GITLAB_ENABLED?: string;
|
||||
GITLAB_CUSTOM_NAME?: string;
|
||||
GITLAB_CLIENT_ID?: string;
|
||||
GITLAB_CLIENT_SECRET?: string;
|
||||
|
||||
// Google
|
||||
NEXT_PUBLIC_GOOGLE_ENABLED?: string;
|
||||
GOOGLE_CUSTOM_NAME?: string;
|
||||
GOOGLE_CLIENT_ID?: string;
|
||||
GOOGLE_CLIENT_SECRET?: string;
|
||||
|
||||
// HubSpot
|
||||
NEXT_PUBLIC_HUBSPOT_ENABLED?: string;
|
||||
HUBSPOT_CUSTOM_NAME?: string;
|
||||
HUBSPOT_CLIENT_ID?: string;
|
||||
HUBSPOT_CLIENT_SECRET?: string;
|
||||
|
||||
// IdentityServer4
|
||||
NEXT_PUBLIC_IDS4_ENABLED?: string;
|
||||
IDS4_CUSTOM_NAME?: string;
|
||||
IDS4_CLIENT_ID?: string;
|
||||
IDS4_CLIENT_SECRET?: string;
|
||||
IDS4_ISSUER?: string;
|
||||
|
||||
// TODO: Instagram (Doesn't return email)
|
||||
|
||||
// Kakao
|
||||
NEXT_PUBLIC_KAKAO_ENABLED?: string;
|
||||
KAKAO_CUSTOM_NAME?: string;
|
||||
KAKAO_CLIENT_ID?: string;
|
||||
KAKAO_CLIENT_SECRET?: string;
|
||||
|
||||
// Keycloak
|
||||
NEXT_PUBLIC_KEYCLOAK_ENABLED?: string;
|
||||
KEYCLOAK_CUSTOM_NAME?: string;
|
||||
KEYCLOAK_ISSUER?: string;
|
||||
KEYCLOAK_CLIENT_ID?: string;
|
||||
KEYCLOAK_CLIENT_SECRET?: string;
|
||||
|
||||
// LINE
|
||||
NEXT_PUBLIC_LINE_ENABLED?: string;
|
||||
LINE_CUSTOM_NAME?: string;
|
||||
LINE_CLIENT_ID?: string;
|
||||
LINE_CLIENT_SECRET?: string;
|
||||
|
||||
// LinkedIn
|
||||
NEXT_PUBLIC_LINKEDIN_ENABLED?: string;
|
||||
LINKEDIN_CUSTOM_NAME?: string;
|
||||
LINKEDIN_CLIENT_ID?: string;
|
||||
LINKEDIN_CLIENT_SECRET?: string;
|
||||
|
||||
// Mailchimp
|
||||
NEXT_PUBLIC_MAILCHIMP_ENABLED?: string;
|
||||
MAILCHIMP_CUSTOM_NAME?: string;
|
||||
MAILCHIMP_CLIENT_ID?: string;
|
||||
MAILCHIMP_CLIENT_SECRET?: string;
|
||||
|
||||
// Mail.ru
|
||||
NEXT_PUBLIC_MAILRU_ENABLED?: string;
|
||||
MAILRU_CUSTOM_NAME?: string;
|
||||
MAILRU_CLIENT_ID?: string;
|
||||
MAILRU_CLIENT_SECRET?: string;
|
||||
|
||||
// TODO: Medium (Doesn't return email)
|
||||
|
||||
// Naver
|
||||
NEXT_PUBLIC_NAVER_ENABLED?: string;
|
||||
NAVER_CUSTOM_NAME?: string;
|
||||
NAVER_CLIENT_ID?: string;
|
||||
NAVER_CLIENT_SECRET?: string;
|
||||
|
||||
// Netlify
|
||||
NEXT_PUBLIC_NETLIFY_ENABLED?: string;
|
||||
NETLIFY_CUSTOM_NAME?: string;
|
||||
NETLIFY_CLIENT_ID?: string;
|
||||
NETLIFY_CLIENT_SECRET?: string;
|
||||
|
||||
// Okta
|
||||
NEXT_PUBLIC_OKTA_ENABLED?: string;
|
||||
OKTA_CUSTOM_NAME?: string;
|
||||
OKTA_CLIENT_ID?: string;
|
||||
OKTA_CLIENT_SECRET?: string;
|
||||
OKTA_ISSUER?: string;
|
||||
|
||||
// OneLogin
|
||||
NEXT_PUBLIC_ONELOGIN_ENABLED?: string;
|
||||
ONELOGIN_CUSTOM_NAME?: string;
|
||||
ONELOGIN_CLIENT_ID?: string;
|
||||
ONELOGIN_CLIENT_SECRET?: string;
|
||||
ONELOGIN_ISSUER?: string;
|
||||
|
||||
// Osso
|
||||
NEXT_PUBLIC_OSSO_ENABLED?: string;
|
||||
OSSO_CUSTOM_NAME?: string;
|
||||
OSSO_CLIENT_ID?: string;
|
||||
OSSO_CLIENT_SECRET?: string;
|
||||
OSSO_ISSUER?: string;
|
||||
|
||||
// osu!
|
||||
NEXT_PUBLIC_OSU_ENABLED?: string;
|
||||
OSU_CUSTOM_NAME?: string;
|
||||
OSU_CLIENT_ID?: string;
|
||||
OSU_CLIENT_SECRET?: string;
|
||||
|
||||
// Patreon
|
||||
NEXT_PUBLIC_PATREON_ENABLED?: string;
|
||||
PATREON_CUSTOM_NAME?: string;
|
||||
PATREON_CLIENT_ID?: string;
|
||||
PATREON_CLIENT_SECRET?: string;
|
||||
|
||||
// Pinterest
|
||||
NEXT_PUBLIC_PINTEREST_ENABLED?: string;
|
||||
PINTEREST_CUSTOM_NAME?: string;
|
||||
PINTEREST_CLIENT_ID?: string;
|
||||
PINTEREST_CLIENT_SECRET?: string;
|
||||
|
||||
// Pipedrive
|
||||
NEXT_PUBLIC_PIPEDRIVE_ENABLED?: string;
|
||||
PIPEDRIVE_CUSTOM_NAME?: string;
|
||||
PIPEDRIVE_CLIENT_ID?: string;
|
||||
PIPEDRIVE_CLIENT_SECRET?: string;
|
||||
|
||||
// Reddit
|
||||
// TODO (1h tokens)
|
||||
NEXT_PUBLIC_REDDIT_ENABLED?: string;
|
||||
REDDIT_CUSTOM_NAME?: string;
|
||||
REDDIT_CLIENT_ID?: string;
|
||||
REDDIT_CLIENT_SECRET?: string;
|
||||
|
||||
// Salesforce
|
||||
NEXT_PUBLIC_SALESFORCE_ENABLED?: string;
|
||||
SALESFORCE_CUSTOM_NAME?: string;
|
||||
SALESFORCE_CLIENT_ID?: string;
|
||||
SALESFORCE_CLIENT_SECRET?: string;
|
||||
|
||||
// Slack
|
||||
NEXT_PUBLIC_SLACK_ENABLED?: string;
|
||||
SLACK_CUSTOM_NAME?: string;
|
||||
SLACK_CLIENT_ID?: string;
|
||||
SLACK_CLIENT_SECRET?: string;
|
||||
|
||||
// Spotify
|
||||
NEXT_PUBLIC_SPOTIFY_ENABLED?: string;
|
||||
SPOTIFY_CUSTOM_NAME?: string;
|
||||
SPOTIFY_CLIENT_ID?: string;
|
||||
SPOTIFY_CLIENT_SECRET?: string;
|
||||
|
||||
// Strava
|
||||
NEXT_PUBLIC_STRAVA_ENABLED?: string;
|
||||
STRAVA_CUSTOM_NAME?: string;
|
||||
STRAVA_CLIENT_ID?: string;
|
||||
STRAVA_CLIENT_SECRET?: string;
|
||||
|
||||
// Todoist
|
||||
NEXT_PUBLIC_TODOIST_ENABLED?: string;
|
||||
TODOIST_CUSTOM_NAME?: string;
|
||||
TODOIST_CLIENT_ID?: string;
|
||||
TODOIST_CLIENT_SECRET?: string;
|
||||
|
||||
// TODO: Trakt (Doesn't return email)
|
||||
|
||||
// Twitch
|
||||
NEXT_PUBLIC_TWITCH_ENABLED?: string;
|
||||
TWITCH_CUSTOM_NAME?: string;
|
||||
TWITCH_CLIENT_ID?: string;
|
||||
TWITCH_CLIENT_SECRET?: string;
|
||||
|
||||
// TODO: Twitter (OAuth 1.0)
|
||||
|
||||
// United Effects
|
||||
NEXT_PUBLIC_UNITED_EFFECTS_ENABLED?: string;
|
||||
UNITED_EFFECTS_CUSTOM_NAME?: string;
|
||||
UNITED_EFFECTS_CLIENT_ID?: string;
|
||||
UNITED_EFFECTS_CLIENT_SECRET?: string;
|
||||
UNITED_EFFECTS_ISSUER?: string;
|
||||
|
||||
// VK
|
||||
NEXT_PUBLIC_VK_ENABLED?: string;
|
||||
VK_CUSTOM_NAME?: string;
|
||||
VK_CLIENT_ID?: string;
|
||||
VK_CLIENT_SECRET?: string;
|
||||
|
||||
// Wikimedia
|
||||
NEXT_PUBLIC_WIKIMEDIA_ENABLED?: string;
|
||||
WIKIMEDIA_CUSTOM_NAME?: string;
|
||||
WIKIMEDIA_CLIENT_ID?: string;
|
||||
WIKIMEDIA_CLIENT_SECRET?: string;
|
||||
|
||||
// Wordpress.com
|
||||
NEXT_PUBLIC_WORDPRESS_ENABLED?: string;
|
||||
WORDPRESS_CUSTOM_NAME?: string;
|
||||
WORDPRESS_CLIENT_ID?: string;
|
||||
WORDPRESS_CLIENT_SECRET?: string;
|
||||
|
||||
// TODO: WorkOS (Custom flow)
|
||||
|
||||
// Yandex
|
||||
NEXT_PUBLIC_YANDEX_ENABLED?: string;
|
||||
YANDEX_CUSTOM_NAME?: string;
|
||||
YANDEX_CLIENT_ID?: string;
|
||||
YANDEX_CLIENT_SECRET?: string;
|
||||
|
||||
// Zitadel
|
||||
NEXT_PUBLIC_ZITADEL_ENABLED?: string;
|
||||
ZITADEL_CUSTOM_NAME?: string;
|
||||
ZITADEL_CLIENT_ID?: string;
|
||||
ZITADEL_CLIENT_SECRET?: string;
|
||||
ZITADEL_ISSUER?: string;
|
||||
|
||||
// Zoho
|
||||
NEXT_PUBLIC_ZOHO_ENABLED?: string;
|
||||
ZOHO_CUSTOM_NAME?: string;
|
||||
ZOHO_CLIENT_ID?: string;
|
||||
ZOHO_CLIENT_SECRET?: string;
|
||||
|
||||
// Zoom
|
||||
NEXT_PUBLIC_ZOOM_ENABLED?: string;
|
||||
ZOOM_CUSTOM_NAME?: string;
|
||||
ZOOM_CLIENT_ID?: string;
|
||||
ZOOM_CLIENT_SECRET?: string;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export {};
|
||||
@@ -137,12 +137,14 @@ export enum ArchivedFormat {
|
||||
jpeg,
|
||||
pdf,
|
||||
readability,
|
||||
monolith,
|
||||
}
|
||||
|
||||
export enum LinkType {
|
||||
url,
|
||||
pdf,
|
||||
image,
|
||||
monolith,
|
||||
}
|
||||
|
||||
export enum TokenExpiry {
|
||||
|
||||
@@ -1293,12 +1293,12 @@
|
||||
tiny-glob "^0.2.9"
|
||||
tslib "^2.4.0"
|
||||
|
||||
"@playwright/test@^1.43.1":
|
||||
version "1.43.1"
|
||||
resolved "https://registry.yarnpkg.com/@playwright/test/-/test-1.43.1.tgz#16728a59eb8ce0f60472f98d8886d6cab0fa3e42"
|
||||
integrity sha512-HgtQzFgNEEo4TE22K/X7sYTYNqEMMTZmFS8kTq6m8hXj+m1D8TgwgIbumHddJa9h4yl4GkKb8/bgAl2+g7eDgA==
|
||||
"@playwright/test@^1.45.0":
|
||||
version "1.45.0"
|
||||
resolved "https://registry.yarnpkg.com/@playwright/test/-/test-1.45.0.tgz#790a66165a46466c0d7099dd260881802f5aba7e"
|
||||
integrity sha512-TVYsfMlGAaxeUllNkywbwek67Ncf8FRGn8ZlRdO291OL3NjG9oMbfVhyP82HQF0CZLMrYsvesqoUekxdWuF9Qw==
|
||||
dependencies:
|
||||
playwright "1.43.1"
|
||||
playwright "1.45.0"
|
||||
|
||||
"@prisma/client@^4.16.2":
|
||||
version "4.16.2"
|
||||
@@ -5005,17 +5005,17 @@ pixelmatch@^4.0.2:
|
||||
dependencies:
|
||||
pngjs "^3.0.0"
|
||||
|
||||
playwright-core@1.43.1:
|
||||
version "1.43.1"
|
||||
resolved "https://registry.yarnpkg.com/playwright-core/-/playwright-core-1.43.1.tgz#0eafef9994c69c02a1a3825a4343e56c99c03b02"
|
||||
integrity sha512-EI36Mto2Vrx6VF7rm708qSnesVQKbxEWvPrfA1IPY6HgczBplDx7ENtx+K2n4kJ41sLLkuGfmb0ZLSSXlDhqPg==
|
||||
playwright-core@1.45.0:
|
||||
version "1.45.0"
|
||||
resolved "https://registry.yarnpkg.com/playwright-core/-/playwright-core-1.45.0.tgz#5741a670b7c9060ce06852c0051d84736fb94edc"
|
||||
integrity sha512-lZmHlFQ0VYSpAs43dRq1/nJ9G/6SiTI7VPqidld9TDefL9tX87bTKExWZZUF5PeRyqtXqd8fQi2qmfIedkwsNQ==
|
||||
|
||||
playwright@1.43.1, playwright@^1.43.1:
|
||||
version "1.43.1"
|
||||
resolved "https://registry.yarnpkg.com/playwright/-/playwright-1.43.1.tgz#8ad08984ac66c9ef3d0db035be54dd7ec9f1c7d9"
|
||||
integrity sha512-V7SoH0ai2kNt1Md9E3Gwas5B9m8KR2GVvwZnAI6Pg0m3sh7UvgiYhRrhsziCmqMJNouPckiOhk8T+9bSAK0VIA==
|
||||
playwright@1.45.0, playwright@^1.45.0:
|
||||
version "1.45.0"
|
||||
resolved "https://registry.yarnpkg.com/playwright/-/playwright-1.45.0.tgz#400c709c64438690f13705cb9c88ef93089c5c27"
|
||||
integrity sha512-4z3ac3plDfYzGB6r0Q3LF8POPR20Z8D0aXcxbJvmfMgSSq1hkcgvFRXJk9rUq5H/MJ0Ktal869hhOdI/zUTeLA==
|
||||
dependencies:
|
||||
playwright-core "1.43.1"
|
||||
playwright-core "1.45.0"
|
||||
optionalDependencies:
|
||||
fsevents "2.3.2"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user