mirror of
https://github.com/tdurieux/anonymous_github.git
synced 2026-07-07 22:28:01 +02:00
fix: fix cache duration
This commit is contained in:
+1
-1
@@ -34,7 +34,7 @@ router.get(
|
|||||||
anonymizedPath.substring(anonymizedPath.lastIndexOf("/") + 1)
|
anonymizedPath.substring(anonymizedPath.lastIndexOf("/") + 1)
|
||||||
);
|
);
|
||||||
// cache the file for 5min
|
// cache the file for 5min
|
||||||
res.header('Cache-Control', 'max-age=250000');
|
res.header('Cache-Control', 'max-age=300');
|
||||||
await f.send(res);
|
await f.send(res);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
return handleError(error, res);
|
return handleError(error, res);
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ router.get(
|
|||||||
res.attachment(`${repo.repoId}.zip`);
|
res.attachment(`${repo.repoId}.zip`);
|
||||||
|
|
||||||
// cache the file for 6 hours
|
// cache the file for 6 hours
|
||||||
res.header("Cache-Control", "max-age=21600000");
|
res.header("Cache-Control", "max-age=21600");
|
||||||
await pipeline(repo.zip(), res);
|
await pipeline(repo.zip(), res);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
handleError(error, res);
|
handleError(error, res);
|
||||||
@@ -49,7 +49,7 @@ router.get(
|
|||||||
if (!repo) return;
|
if (!repo) return;
|
||||||
try {
|
try {
|
||||||
// ache the file for 6 hours
|
// ache the file for 6 hours
|
||||||
res.header("Cache-Control", "max-age=21600000");
|
res.header("Cache-Control", "no-cache");
|
||||||
|
|
||||||
res.json(await repo.anonymizedFiles({ includeSha: false }));
|
res.json(await repo.anonymizedFiles({ includeSha: false }));
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
|||||||
+1
-1
@@ -93,7 +93,7 @@ export default async function start() {
|
|||||||
express.static(path.join(__dirname, "..", "public"), {
|
express.static(path.join(__dirname, "..", "public"), {
|
||||||
etag: true,
|
etag: true,
|
||||||
lastModified: true,
|
lastModified: true,
|
||||||
maxAge: 3600000, // 1h
|
maxAge: 3600, // 1h
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user