Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
pp committed Feb 5, 2023
1 parent 82b1a82 commit d6795a5
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,11 +86,16 @@ router.post(
//获取图片
router.get('/api/img/:p', async ({req,res})=>{
let body=await LINK.get(req.params.p,{cacheTtl:864000,type:"stream"})
const { metadata } = await LINK.getWithMetadata(req.params.p);
let {metadata:{type,date,size}}=await LINK.getWithMetadata(req.params.p,{ type: "text" });
if (req.headers.has('If-None-Match')) {
return res.status=304

}
res.headers=header
res.type=metadata.type
res.headers.set('Cache-Control','public, max-age=864000')
res.type=type
res.etag=size
res.body=body

})

//简易登陆验证
Expand Down

0 comments on commit d6795a5

Please sign in to comment.