Skip to content

Commit

Permalink
fix bug
Browse files Browse the repository at this point in the history
  • Loading branch information
reruin committed Dec 16, 2019
1 parent 752455f commit cab791f
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions app/controllers/sharelist.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,12 @@ const output = async (ctx , data)=>{
module.exports = {
async index(ctx){
let downloadLinkAge = config.getConfig('max_age_download')
let cursign = md5(config.getConfig('max_age_download_sign') + Math.floor(Date.now() / downloadLinkAge))

if( downloadLinkAge > 0 && ctx.query.t){
if( ctx.query.t != md5(config.getConfig('max_age_download_sign') + Math.floor(Date.now() / downloadLinkAge)) ) {
ctx.status = 403
return
}
//exclude folder
if( downloadLinkAge > 0 && ctx.query.t && ctx.query.t != cursign ) {
ctx.status = 403
return
}

const data = await service.path(ctx.runtime)
Expand Down Expand Up @@ -144,6 +144,12 @@ module.exports = {
ctx.body = result
}
else{

if( downloadLinkAge > 0 && ctx.query.t != cursign ) {
ctx.status = 403
return
}

if( ignoreexts.includes(data.ext) || ignorefiles.includes(data.name) ){
ctx.status = 404
}else{
Expand Down

0 comments on commit cab791f

Please sign in to comment.