Skip to content

Commit

Permalink
add feature
Browse files Browse the repository at this point in the history
  • Loading branch information
pp committed Dec 9, 2022
1 parent cce7c80 commit fd1833f
Show file tree
Hide file tree
Showing 5 changed files with 1,926 additions and 5 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
node_modules
static/node_modules
static/dist
218 changes: 218 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 6 additions & 2 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ router.post(
metadata:{
size:img[i].size,
name:url,
type:img[i].type,
date:new Date().getTime()
}
})
Expand All @@ -119,6 +120,8 @@ 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);
res.type=metadata.type
res.body=body

})
Expand All @@ -132,8 +135,9 @@ router.post(
</svg>`;
});

router.get('/query/:pass',async ({req,res})=>{
if (req.params.pass===pass) {
router.get('/query',async ({req,res})=>{
const paramas=req.url.searchParams
if (paramas.get('pass')==pass) {
const key=await LINK.list()
res.body=key
}
Expand Down
Loading

0 comments on commit fd1833f

Please sign in to comment.