mirror of
https://github.com/BobbyWibowo/lolisafe.git
synced 2024-12-14 16:36:21 +00:00
Updates
Restored CDN warning to album pages. Turns out adding Page Rule to /api/album/zip/* with Cache Level set to Cache Everything and Origin Cache Control set to On will work just fine. The version string is still necessary to ensure that clients are downloading the very latest version of the archive though. Also last time I was using zipGeneratedAt timestamp, which was dumb, this time it is using editedAt timestamp, which was my original plan but kinda forgotten.
This commit is contained in:
parent
00123b95d2
commit
e01b007ea1
@ -193,7 +193,7 @@ albumsController.get = async (req, res, next) => {
|
||||
albumsController.generateZip = async (req, res, next) => {
|
||||
const download = (filePath, fileName) => {
|
||||
const headers = { 'Access-Control-Allow-Origin': '*' }
|
||||
// Album page will append zipGeneratedAt timestamp to the download link by default
|
||||
// Album page will append editedAt timestamp to the download link by default
|
||||
if (parseInt(req.query.v) > 0) {
|
||||
// Cache-Control header is useful when using CDN (max-age: 30 days)
|
||||
headers['Cache-Control'] = 'public, max-age=2592000, must-revalidate, proxy-revalidate, immutable, stale-while-revalidate=86400, stale-if-error=604800'
|
||||
|
@ -62,7 +62,7 @@ routes.get('/a/:identifier', async (req, res, next) => {
|
||||
files,
|
||||
identifier,
|
||||
enableDownload: Boolean(config.uploads.generateZips),
|
||||
zipGeneratedAt: album.zipGeneratedAt,
|
||||
editedAt: album.editedAt,
|
||||
url: `${homeDomain}/a/${album.identifier}`
|
||||
})
|
||||
})
|
||||
|
@ -44,12 +44,11 @@
|
||||
{% if enableDownload -%}
|
||||
<div class="level-right">
|
||||
<p class="level-item">
|
||||
<a class="button is-primary is-outlined" title="Download album" href="../api/album/zip/{{ identifier }}?v={{ zipGeneratedAt }}">Download Album</a>
|
||||
<a class="button is-primary is-outlined" title="Download album" href="../api/album/zip/{{ identifier }}?v={{ editedAt }}">Download Album</a>
|
||||
</p>
|
||||
</div>
|
||||
{%- endif %}
|
||||
</nav>
|
||||
{#
|
||||
{% if enableDownload -%}
|
||||
<article class="message">
|
||||
<div class="message-body">
|
||||
@ -57,7 +56,6 @@
|
||||
</div>
|
||||
</article>
|
||||
{%- endif %}
|
||||
#}
|
||||
<hr>
|
||||
{% if files.length -%}
|
||||
<div id="table" class="columns is-multiline is-mobile is-centered has-text-centered">
|
||||
|
Loading…
Reference in New Issue
Block a user