Skip to content

Commit

Permalink
Update api.js
Browse files Browse the repository at this point in the history
  • Loading branch information
inirey authored Jan 11, 2022
1 parent f2e0f13 commit 637edfb
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions routes/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -2965,6 +2965,22 @@ res.json(loghandler.invalidKey)
}
})

router.get('/random/yuli', async (req, res, next) => {
var Apikey = req.query.apikey

if(!Apikey) return res.json(loghandler.notparam)
if(listkey.includes(Apikey)){

const yuli = JSON.parse(fs.readFileSync(__path +'/data/yulibocil.json'));
const randyuli = yuli[Math.floor(Math.random() * yuli.length)];
data = await fetch(randyuli).then(v => v.buffer())
await fs.writeFileSync(__path +'/tmp/yuli.jpeg', data)
res.sendFile(__path +'/tmp/yuli.jpeg')
} else {
res.json(loghandler.invalidKey)
}
})

router.get('/wallpaper/pentol', async (req, res, next) => {
var Apikey = req.query.apikey

Expand Down

0 comments on commit 637edfb

Please sign in to comment.