diff --git a/index.js b/index.js
index e1ce207..8621d10 100644
--- a/index.js
+++ b/index.js
@@ -166,6 +166,7 @@ router.post('/generate', async ctx => {
ctx.body = key
})
+/*
router.get('/download/:key', async ctx => {
const key = ctx.cookies.get('key')
if (!key) {
@@ -182,13 +183,15 @@ router.get('/download/:key', async ctx => {
ctx.redirect('/' + encodeURIComponent(info.file.name));
})
+*/
async function downloadFile (ctx, next) {
- const key = ctx.cookies.get('key')
+ const key = ctx.query.key
if (!key) {
await next()
return
}
+
const filename = decodeURIComponent(ctx.params.filename)
const info = ctx.keys.get(key)
@@ -544,7 +547,7 @@ router.get('/status/:key', async ctx => {
return
}
expireKey(key)
- ctx.cookies.set('key', key, {overwrite: true, httpOnly: false, sameSite: 'strict', maxAge: expireDelay * 1000})
+ // ctx.cookies.set('key', key, {overwrite: true, httpOnly: false, sameSite: 'strict', maxAge: expireDelay * 1000})
ctx.body = {
alive: info.alive,
file: info.file ? {
diff --git a/static/download.html b/static/download.html
index 0278643..2e97717 100644
--- a/static/download.html
+++ b/static/download.html
@@ -39,6 +39,7 @@
Visit this on other devices to send ebooks to this ereader:
https://send.djazz.se
Created by djazz. Source code on Github
+ Last updated: 2024-10-20
@@ -81,7 +82,7 @@ function pollFile () {
if (data.file) {
downloads.style.display = 'block'
downloadlink.textContent = data.file.name
- downloadlink.href = '/' + encodeURIComponent(data.file.name)
+ downloadlink.href = '/' + encodeURIComponent(data.file.name) + "?key=" + key
} else {
downloads.style.display = 'none'
}
diff --git a/static/upload.html b/static/upload.html
index 07f5f5d..e3852c5 100644
--- a/static/upload.html
+++ b/static/upload.html
@@ -33,7 +33,8 @@