final touch
This commit is contained in:
parent
aee1828c15
commit
b6ad2b5900
|
@ -35,6 +35,15 @@ NEXT_PUBLIC_EMAIL_PROVIDER=
|
||||||
EMAIL_FROM=
|
EMAIL_FROM=
|
||||||
EMAIL_SERVER=
|
EMAIL_SERVER=
|
||||||
|
|
||||||
|
# Proxy settings
|
||||||
|
PROXY=
|
||||||
|
PROXY_USERNAME=
|
||||||
|
PROXY_PASSWORD=
|
||||||
|
PROXY_BYPASS=
|
||||||
|
|
||||||
|
# PDF archive settings
|
||||||
|
PDF_MARGIN_TOP=
|
||||||
|
PDF_MARGIN_BOTTOM=
|
||||||
|
|
||||||
#
|
#
|
||||||
# SSO Providers
|
# SSO Providers
|
||||||
|
|
|
@ -22,13 +22,13 @@ const BROWSER_TIMEOUT = Number(process.env.BROWSER_TIMEOUT) || 5;
|
||||||
export default async function archiveHandler(link: LinksAndCollectionAndOwner) {
|
export default async function archiveHandler(link: LinksAndCollectionAndOwner) {
|
||||||
// allow user to configure a proxy
|
// allow user to configure a proxy
|
||||||
let browserOptions: LaunchOptions = {};
|
let browserOptions: LaunchOptions = {};
|
||||||
if (process.env.ARCHIVER_PROXY) {
|
if (process.env.PROXY) {
|
||||||
browserOptions.proxy = {
|
browserOptions.proxy = {
|
||||||
server: process.env.ARCHIVER_PROXY,
|
server: process.env.PROXY,
|
||||||
bypass: process.env.ARCHIVER_PROXY_BYPASS,
|
bypass: process.env.PROXY_BYPASS,
|
||||||
username: process.env.ARCHIVER_PROXY_USERNAME,
|
username: process.env.PROXY_USERNAME,
|
||||||
password: process.env.ARCHIVER_PROXY_PASSWORD,
|
password: process.env.PROXY_PASSWORD,
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
const browser = await chromium.launch(browserOptions);
|
const browser = await chromium.launch(browserOptions);
|
||||||
|
@ -255,12 +255,10 @@ export default async function archiveHandler(link: LinksAndCollectionAndOwner) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// apply administrator's defined pdf margins or default to 15px
|
// apply administrator's defined pdf margins or default to 15px
|
||||||
const margins = { top: "15px", bottom: "15px" };
|
const margins = {
|
||||||
if (process.env.ARCHIVER_PDF_MARGIN_TOP) {
|
top: process.env.PDF_MARGIN_TOP || "15px",
|
||||||
margins.top = process.env.ARCHIVER_PDF_MARGIN_TOP;
|
bottom: process.env.PDF_MARGIN_BOTTOM || "15px",
|
||||||
} else if (process.env.ARCHIVER_PDF_MARGIN_BOTTOM) {
|
};
|
||||||
margins.bottom = process.env.ARCHIVER_PDF_MARGIN_BOTTOM;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (user.archiveAsPDF && !link.pdf?.startsWith("archive")) {
|
if (user.archiveAsPDF && !link.pdf?.startsWith("archive")) {
|
||||||
processingPromises.push(
|
processingPromises.push(
|
||||||
|
|
|
@ -14,13 +14,13 @@ export default async function getTitle(url: string) {
|
||||||
agent: httpsAgent,
|
agent: httpsAgent,
|
||||||
};
|
};
|
||||||
|
|
||||||
if (process.env.ARCHIVER_PROXY) {
|
if (process.env.PROXY) {
|
||||||
// parse proxy url
|
// parse proxy url
|
||||||
let proxy = new URL(process.env.ARCHIVER_PROXY)
|
let proxy = new URL(process.env.PROXY);
|
||||||
// if authentication set, apply to proxy URL
|
// if authentication set, apply to proxy URL
|
||||||
if (process.env.ARCHIVER_PROXY_USERNAME) {
|
if (process.env.PROXY_USERNAME) {
|
||||||
proxy.username = process.env.ARCHIVER_PROXY_USERNAME;
|
proxy.username = process.env.PROXY_USERNAME;
|
||||||
proxy.password = process.env.ARCHIVER_PROXY_PASSWORD || "";
|
proxy.password = process.env.PROXY_PASSWORD || "";
|
||||||
}
|
}
|
||||||
|
|
||||||
// add socks5 proxy to fetchOpts
|
// add socks5 proxy to fetchOpts
|
||||||
|
|
|
@ -51,7 +51,7 @@
|
||||||
"micro": "^10.0.1",
|
"micro": "^10.0.1",
|
||||||
"next": "13.4.12",
|
"next": "13.4.12",
|
||||||
"next-auth": "^4.22.1",
|
"next-auth": "^4.22.1",
|
||||||
"node-fetch": "^3.3.2",
|
"node-fetch": "^2.7.0",
|
||||||
"nodemailer": "^6.9.3",
|
"nodemailer": "^6.9.3",
|
||||||
"playwright": "^1.35.1",
|
"playwright": "^1.35.1",
|
||||||
"react": "18.2.0",
|
"react": "18.2.0",
|
||||||
|
|
|
@ -36,6 +36,16 @@ declare global {
|
||||||
NEXT_PUBLIC_TRIAL_PERIOD_DAYS?: string;
|
NEXT_PUBLIC_TRIAL_PERIOD_DAYS?: string;
|
||||||
BASE_URL?: string;
|
BASE_URL?: 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
|
// SSO Providers
|
||||||
//
|
//
|
||||||
|
@ -396,16 +406,6 @@ declare global {
|
||||||
ZOOM_CUSTOM_NAME?: string;
|
ZOOM_CUSTOM_NAME?: string;
|
||||||
ZOOM_CLIENT_ID?: string;
|
ZOOM_CLIENT_ID?: string;
|
||||||
ZOOM_CLIENT_SECRET?: string;
|
ZOOM_CLIENT_SECRET?: string;
|
||||||
|
|
||||||
// Proxy settings
|
|
||||||
ARCHIVER_PROXY?: string;
|
|
||||||
ARCHIVER_PROXY_USERNAME?: string;
|
|
||||||
ARCHIVER_PROXY_PASSWORD?: string;
|
|
||||||
ARCHIVER_PROXY_BYPASS?: string;
|
|
||||||
|
|
||||||
// PDF archive settings
|
|
||||||
ARCHIVER_PDF_MARGIN_TOP?: string;
|
|
||||||
ARCHIVER_PDF_MARGIN_BOTTOM?: string;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
41
yarn.lock
41
yarn.lock
|
@ -2712,11 +2712,6 @@ data-uri-to-buffer@0.0.3:
|
||||||
resolved "https://registry.yarnpkg.com/data-uri-to-buffer/-/data-uri-to-buffer-0.0.3.tgz#18ae979a6a0ca994b0625853916d2662bbae0b1a"
|
resolved "https://registry.yarnpkg.com/data-uri-to-buffer/-/data-uri-to-buffer-0.0.3.tgz#18ae979a6a0ca994b0625853916d2662bbae0b1a"
|
||||||
integrity sha512-Cp+jOa8QJef5nXS5hU7M1DWzXPEIoVR3kbV0dQuVGwROZg8bGf1DcCnkmajBTnvghTtSNMUdRrPjgaT6ZQucbw==
|
integrity sha512-Cp+jOa8QJef5nXS5hU7M1DWzXPEIoVR3kbV0dQuVGwROZg8bGf1DcCnkmajBTnvghTtSNMUdRrPjgaT6ZQucbw==
|
||||||
|
|
||||||
data-uri-to-buffer@^4.0.0:
|
|
||||||
version "4.0.1"
|
|
||||||
resolved "https://registry.yarnpkg.com/data-uri-to-buffer/-/data-uri-to-buffer-4.0.1.tgz#d8feb2b2881e6a4f58c2e08acfd0e2834e26222e"
|
|
||||||
integrity sha512-0R9ikRb668HB7QDxT1vkpuUBtqc53YyAwMwGeUFKRojY/NWKvdZ+9UYtRfGmhqNbRkTSVpMbmyhXipFFv2cb/A==
|
|
||||||
|
|
||||||
data-urls@^4.0.0:
|
data-urls@^4.0.0:
|
||||||
version "4.0.0"
|
version "4.0.0"
|
||||||
resolved "https://registry.yarnpkg.com/data-urls/-/data-urls-4.0.0.tgz#333a454eca6f9a5b7b0f1013ff89074c3f522dd4"
|
resolved "https://registry.yarnpkg.com/data-urls/-/data-urls-4.0.0.tgz#333a454eca6f9a5b7b0f1013ff89074c3f522dd4"
|
||||||
|
@ -3296,14 +3291,6 @@ fastq@^1.6.0:
|
||||||
dependencies:
|
dependencies:
|
||||||
reusify "^1.0.4"
|
reusify "^1.0.4"
|
||||||
|
|
||||||
fetch-blob@^3.1.2, fetch-blob@^3.1.4:
|
|
||||||
version "3.2.0"
|
|
||||||
resolved "https://registry.yarnpkg.com/fetch-blob/-/fetch-blob-3.2.0.tgz#f09b8d4bbd45adc6f0c20b7e787e793e309dcce9"
|
|
||||||
integrity sha512-7yAQpD2UMJzLi1Dqv7qFYnPbaPx7ZfFK6PiIxQ4PfkGPyNyl2Ugx+a/umUonmKqjhM4DnfbMvdX6otXq83soQQ==
|
|
||||||
dependencies:
|
|
||||||
node-domexception "^1.0.0"
|
|
||||||
web-streams-polyfill "^3.0.3"
|
|
||||||
|
|
||||||
file-entry-cache@^6.0.1:
|
file-entry-cache@^6.0.1:
|
||||||
version "6.0.1"
|
version "6.0.1"
|
||||||
resolved "https://registry.yarnpkg.com/file-entry-cache/-/file-entry-cache-6.0.1.tgz#211b2dd9659cb0394b073e7323ac3c933d522027"
|
resolved "https://registry.yarnpkg.com/file-entry-cache/-/file-entry-cache-6.0.1.tgz#211b2dd9659cb0394b073e7323ac3c933d522027"
|
||||||
|
@ -3388,13 +3375,6 @@ form-data@~2.3.2:
|
||||||
combined-stream "^1.0.6"
|
combined-stream "^1.0.6"
|
||||||
mime-types "^2.1.12"
|
mime-types "^2.1.12"
|
||||||
|
|
||||||
formdata-polyfill@^4.0.10:
|
|
||||||
version "4.0.10"
|
|
||||||
resolved "https://registry.yarnpkg.com/formdata-polyfill/-/formdata-polyfill-4.0.10.tgz#24807c31c9d402e002ab3d8c720144ceb8848423"
|
|
||||||
integrity sha512-buewHzMvYL29jdeQTVILecSaZKnt/RJWjoZCF5OW60Z67/GmSLBkOFM7qh1PI3zFNtJbaZL5eQu1vLfazOwj4g==
|
|
||||||
dependencies:
|
|
||||||
fetch-blob "^3.1.2"
|
|
||||||
|
|
||||||
formidable@^3.5.1:
|
formidable@^3.5.1:
|
||||||
version "3.5.1"
|
version "3.5.1"
|
||||||
resolved "https://registry.yarnpkg.com/formidable/-/formidable-3.5.1.tgz#9360a23a656f261207868b1484624c4c8d06ee1a"
|
resolved "https://registry.yarnpkg.com/formidable/-/formidable-3.5.1.tgz#9360a23a656f261207868b1484624c4c8d06ee1a"
|
||||||
|
@ -4514,12 +4494,7 @@ node-bitmap@0.0.1:
|
||||||
resolved "https://registry.yarnpkg.com/node-bitmap/-/node-bitmap-0.0.1.tgz#180eac7003e0c707618ef31368f62f84b2a69091"
|
resolved "https://registry.yarnpkg.com/node-bitmap/-/node-bitmap-0.0.1.tgz#180eac7003e0c707618ef31368f62f84b2a69091"
|
||||||
integrity sha512-Jx5lPaaLdIaOsj2mVLWMWulXF6GQVdyLvNSxmiYCvZ8Ma2hfKX0POoR2kgKOqz+oFsRreq0yYZjQ2wjE9VNzCA==
|
integrity sha512-Jx5lPaaLdIaOsj2mVLWMWulXF6GQVdyLvNSxmiYCvZ8Ma2hfKX0POoR2kgKOqz+oFsRreq0yYZjQ2wjE9VNzCA==
|
||||||
|
|
||||||
node-domexception@^1.0.0:
|
node-fetch@^2.6.1, node-fetch@^2.7.0:
|
||||||
version "1.0.0"
|
|
||||||
resolved "https://registry.yarnpkg.com/node-domexception/-/node-domexception-1.0.0.tgz#6888db46a1f71c0b76b3f7555016b63fe64766e5"
|
|
||||||
integrity sha512-/jKZoMpw0F8GRwl4/eLROPA3cfcXtLApP0QzLmUT/HuPCZWyB7IY9ZrMeKw2O/nFIqPQB3PVM9aYm0F312AXDQ==
|
|
||||||
|
|
||||||
node-fetch@^2.6.1:
|
|
||||||
version "2.7.0"
|
version "2.7.0"
|
||||||
resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.7.0.tgz#d0f0fa6e3e2dc1d27efcd8ad99d550bda94d187d"
|
resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.7.0.tgz#d0f0fa6e3e2dc1d27efcd8ad99d550bda94d187d"
|
||||||
integrity sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A==
|
integrity sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A==
|
||||||
|
@ -4533,15 +4508,6 @@ node-fetch@^2.6.7:
|
||||||
dependencies:
|
dependencies:
|
||||||
whatwg-url "^5.0.0"
|
whatwg-url "^5.0.0"
|
||||||
|
|
||||||
node-fetch@^3.3.2:
|
|
||||||
version "3.3.2"
|
|
||||||
resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-3.3.2.tgz#d1e889bacdf733b4ff3b2b243eb7a12866a0b78b"
|
|
||||||
integrity sha512-dRB78srN/l6gqWulah9SrxeYnxeddIG30+GOqK/9OlLVyLg3HPnr6SqOWTWOXKRwC2eGYCkZ59NNuSgvSrpgOA==
|
|
||||||
dependencies:
|
|
||||||
data-uri-to-buffer "^4.0.0"
|
|
||||||
fetch-blob "^3.1.4"
|
|
||||||
formdata-polyfill "^4.0.10"
|
|
||||||
|
|
||||||
node-releases@^2.0.12:
|
node-releases@^2.0.12:
|
||||||
version "2.0.12"
|
version "2.0.12"
|
||||||
resolved "https://registry.yarnpkg.com/node-releases/-/node-releases-2.0.12.tgz#35627cc224a23bfb06fb3380f2b3afaaa7eb1039"
|
resolved "https://registry.yarnpkg.com/node-releases/-/node-releases-2.0.12.tgz#35627cc224a23bfb06fb3380f2b3afaaa7eb1039"
|
||||||
|
@ -6029,11 +5995,6 @@ watchpack@2.4.0:
|
||||||
glob-to-regexp "^0.4.1"
|
glob-to-regexp "^0.4.1"
|
||||||
graceful-fs "^4.1.2"
|
graceful-fs "^4.1.2"
|
||||||
|
|
||||||
web-streams-polyfill@^3.0.3:
|
|
||||||
version "3.3.3"
|
|
||||||
resolved "https://registry.yarnpkg.com/web-streams-polyfill/-/web-streams-polyfill-3.3.3.tgz#2073b91a2fdb1fbfbd401e7de0ac9f8214cecb4b"
|
|
||||||
integrity sha512-d2JWLCivmZYTSIoge9MsgFCZrt571BikcWGYkjC1khllbTeDlGqZ2D8vD8E/lJa8WGWbb7Plm8/XJYV7IJHZZw==
|
|
||||||
|
|
||||||
webidl-conversions@^3.0.0:
|
webidl-conversions@^3.0.0:
|
||||||
version "3.0.1"
|
version "3.0.1"
|
||||||
resolved "https://registry.yarnpkg.com/webidl-conversions/-/webidl-conversions-3.0.1.tgz#24534275e2a7bc6be7bc86611cc16ae0a5654871"
|
resolved "https://registry.yarnpkg.com/webidl-conversions/-/webidl-conversions-3.0.1.tgz#24534275e2a7bc6be7bc86611cc16ae0a5654871"
|
||||||
|
|
Ŝarĝante…
Reference in New Issue