quickfix for cached html
This commit is contained in:
17
index.js
17
index.js
@@ -164,6 +164,23 @@ router.post('/generate', async ctx => {
|
|||||||
ctx.body = key
|
ctx.body = key
|
||||||
})
|
})
|
||||||
|
|
||||||
|
router.get('/download/:key', async ctx => {
|
||||||
|
const key = ctx.cookies.get('key')
|
||||||
|
if (!key) {
|
||||||
|
await next()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
const info = ctx.keys.get(key)
|
||||||
|
|
||||||
|
if (!info || !info.file) {
|
||||||
|
await next()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
ctx.redirect('/' + encodeURIComponent(info.file.name));
|
||||||
|
})
|
||||||
|
|
||||||
async function downloadFile (ctx, next) {
|
async function downloadFile (ctx, next) {
|
||||||
const key = ctx.cookies.get('key')
|
const key = ctx.cookies.get('key')
|
||||||
if (!key) {
|
if (!key) {
|
||||||
|
|||||||
@@ -78,9 +78,6 @@ function pollFile () {
|
|||||||
downloads.style.display = 'none'
|
downloads.style.display = 'none'
|
||||||
}
|
}
|
||||||
var urls = data.urls && data.urls.length > 0 ? data.urls : null
|
var urls = data.urls && data.urls.length > 0 ? data.urls : null
|
||||||
if (data.file || urls) {
|
|
||||||
} else {
|
|
||||||
}
|
|
||||||
if (data.file) {
|
if (data.file) {
|
||||||
downloads.style.display = 'block'
|
downloads.style.display = 'block'
|
||||||
downloadlink.textContent = data.file.name
|
downloadlink.textContent = data.file.name
|
||||||
|
|||||||
Reference in New Issue
Block a user