From 4973489dd18fb8cf7ec4320242a73734b5af4eb0 Mon Sep 17 00:00:00 2001 From: sahrohit Date: Tue, 14 Jun 2022 10:36:26 +0545 Subject: [PATCH 1/2] Added Path for getting Custom Numbers --- index.js | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/index.js b/index.js index 88e6828..cb44e5b 100644 --- a/index.js +++ b/index.js @@ -57,6 +57,28 @@ app.get('/record/@:name', async (req, res) => { res.json(data) }) +app.get('/number/@:num', async (req, res) => { + const { num } = req.params + console.log(num) + const { theme = 'moebooru' } = req.query + + let length = PLACES + // This helps with GitHub's image cache + res.set({ + 'content-type': 'image/svg+xml', + 'cache-control': 'max-age=0, no-cache, no-store, must-revalidate', + }) + length = 10 + + // Send the generated SVG as the result + const renderSvg = themify.getCountImage({ + count: parseInt(num), + theme, + length, + }) + res.send(renderSvg) +}) + app.get('/heart-beat', (req, res) => { res.set({ 'cache-control': 'max-age=0, no-cache, no-store, must-revalidate' From a8667d16b41b0c23de5ecf4fbc8c3be489de895f Mon Sep 17 00:00:00 2001 From: sahrohit Date: Tue, 14 Jun 2022 11:11:23 +0545 Subject: [PATCH 2/2] Updated Docs for New Path Number --- views/index.pug | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/views/index.pug b/views/index.pug index fa2dadf..0bc84ea 100644 --- a/views/index.pug +++ b/views/index.pug @@ -27,12 +27,18 @@ html h5 SVG address code https://count.getloli.com/get/@:name + code https://count.getloli.com/number/@:num + h5 Img tag code <img src="https://count.getloli.com/get/@:name" alt=":name" /> + code <img src="https://count.getloli.com/number/@:num" alt=":name" /> + h5 Markdown code ![:name](https://count.getloli.com/get/@:name) + code ![:name](https://count.getloli.com/number/@:num) + h3 eg: Moe Count!