dont use cookies
This commit is contained in:
7
index.js
7
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 ? {
|
||||
|
||||
@@ -39,6 +39,7 @@
|
||||
Visit this on other devices to send ebooks to this ereader:<br/><a id="siteurl">https://send.djazz.se</a><br/>
|
||||
<br/>
|
||||
Created by djazz. Source code on <a href="https://github.com/daniel-j/send2ereader" target="_blank">Github</a><br/>
|
||||
Last updated: 2024-10-20<br/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -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'
|
||||
}
|
||||
|
||||
@@ -33,7 +33,8 @@
|
||||
<hr/>
|
||||
<div class="center">
|
||||
Created by djazz. Powered by <a href="https://koajs.com/" target="_blank">Koa</a>, <a href="https://pgaskin.net/kepubify/" target="_blank">Kepubify</a>, <a href="https://www.amazon.com/gp/feature.html?ie=UTF8&docId=1000765211" target="_blank">KindleGen</a> and <a href="https://github.com/abarker/pdfCropMargins" target="_blank">pdfCropMargins</a><br/>
|
||||
Source code on <a href="https://github.com/daniel-j/send2ereader" target="_blank">Github</a> - <a id="siteurl">https://send.djazz.se</span>
|
||||
Source code on <a href="https://github.com/daniel-j/send2ereader" target="_blank">Github</a> - <a id="siteurl">https://send.djazz.se</a><br/>
|
||||
Last updated: 2024-10-20
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user