Trying something smoother for delivery

pull/1/head
Matteo Cargnelutti 2022-11-18 16:29:04 -05:00
rodzic 6aba090b7d
commit 75f70bbe40
3 zmienionych plików z 4 dodań i 36 usunięć

Wyświetl plik

@ -40,9 +40,9 @@ export const STATIC_PATH = `${process.env.PWD}/app/static/`;
/**
* Maximum capture processes that can be run in parallel.
*/
export const MAX_PARALLEL_CAPTURES_TOTAL = 100;
export const MAX_PARALLEL_CAPTURES_TOTAL = 200;
/**
* Maximum capture processes that can be run in parallel for a given key.
*/
export const MAX_PARALLEL_CAPTURES_PER_ACCESS_KEY = 2;
export const MAX_PARALLEL_CAPTURES_PER_ACCESS_KEY = 20;

Wyświetl plik

@ -167,15 +167,10 @@ export default async function (fastify, opts) {
SuccessLog.add(accessKey, pdf);
const html = nunjucks.render(`${TEMPLATES_PATH}success.njk`, {
pdfBase64: pdf.toString('base64'),
url: tweets.url
});
return reply
.code(200)
.header('Content-Type', 'text/html; charset=utf-8')
.send(html);
.header('Content-Type', 'application/pdf')
.send(pdf);
}
catch(err) {
request.log.error(`Capture failed. ${err}`);

Wyświetl plik

@ -1,27 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>archive.social | High-fidelity capture of Twitter threads as sealed PDFs.</title>
<meta name="description" content="archive.social is an experiment of the Harvard Library Innovation Lab.">
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<style>
* {
padding: 0px;
margin: 0px;
}
iframe {
display: block;
width: 100%;
height: 100vh;
border: 0px;
}
</style>
</head>
<body>
<iframe src="data:application/pdf;base64,{{ pdfBase64 }}"></iframe>
</body>
</html>