Add emoji support. but hide it for now

Not sure if it's really needed, and emoji looks not that cool in
11px size 🤔 just leave it here hidden for now.

Preview at /emoji/unicorns/💩🤱🦄/DDD
pull/15/head
Amio 2018-07-20 17:43:07 +08:00
rodzic 2f7c3cd004
commit ec67a10403
7 zmienionych plików z 35 dodań i 18 usunięć

Wyświetl plik

@ -1,6 +1,6 @@
const badgen = require('badgen')
function serveBadge (req, res, params) {
module.exports = function serveBadge (req, res, params) {
params.style = req.headers.host === 'flat.badgen.net' ? 'flat' : undefined
res.writeHead(200, {
@ -9,13 +9,3 @@ function serveBadge (req, res, params) {
})
res.end(badgen(params))
}
function serveListBadge (req, res, params) {
const { subject, status, color } = params
serveBadge(req, res, { subject, status: status.replace(/,/g, ' | '), color })
}
module.exports = {
serveBadge,
serveListBadge
}

Wyświetl plik

@ -0,0 +1,6 @@
const serveBadge = require('./serve-badge.js')
module.exports = function serveListBadge (req, res, params) {
const { subject, status, color } = params
serveBadge(req, res, { subject, status, color, emoji: true })
}

Wyświetl plik

@ -1,4 +1,4 @@
const { serveBadge } = require('./serve-badge.js')
const serveBadge = require('./serve-badge.js')
module.exports = (req, res) => {
serveBadge(req, res, {

Wyświetl plik

@ -0,0 +1,9 @@
const serveBadge = require('./serve-badge.js')
module.exports = function serveListBadge (req, res, params) {
serveBadge(req, res, {
subject: params.subject,
status: params.status.replace(/,/g, ' | '),
color: params.color
})
}

14
package-lock.json wygenerowano
Wyświetl plik

@ -147,9 +147,12 @@
}
},
"badgen": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/badgen/-/badgen-2.0.0.tgz",
"integrity": "sha512-G2D8AmoT21bdodAqaVDQriC0hO25BRMVpNYSnt40Lj0DDVP2OK1zheH8Vf8IpMnNbK5mZkstjX6LGbFcEkKu+w=="
"version": "2.1.1",
"resolved": "https://registry.npmjs.org/badgen/-/badgen-2.1.1.tgz",
"integrity": "sha512-FngwSM/Akm4ycTcgMAAA6Ma6tIdPFjwvgHuQ0vCi3FQdOML6DFkpBfUcCA4FxdXiTGexOu9N4ncYnK2c9nMOig==",
"requires": {
"unicode-astral-regex": "^1.0.1"
}
},
"balanced-match": {
"version": "1.0.0",
@ -1827,6 +1830,11 @@
"integrity": "sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c=",
"dev": true
},
"unicode-astral-regex": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/unicode-astral-regex/-/unicode-astral-regex-1.0.1.tgz",
"integrity": "sha512-UP6cmDeiWi8bMDmkyXLRsDuVPTvPjh8Wsz+pHu1VkGgTBl4pUceYAdHXY0cdc6Q3+Z2q7QMzi/0E7L/S/yOvFw=="
},
"uniq": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/uniq/-/uniq-1.0.1.tgz",

Wyświetl plik

@ -12,7 +12,7 @@
},
"dependencies": {
"axios": "^0.18.0",
"badgen": "^2.0.0",
"badgen": "^2.1.1",
"chrome-webstore": "^1.0.0",
"find-my-way": "^1.15.1",
"lru-cache": "^4.1.3",
@ -24,5 +24,5 @@
},
"eslintConfig": {
"extends": "standard"
}
}
}

Wyświetl plik

@ -4,7 +4,9 @@ const setupLiveBadge = require('./libs/setup-live-badge.js')
const serveFavicon = require('./libs/serve-favicon.js')
const serveIndex = require('./libs/serve-index.js')
const serve404 = require('./libs/serve-404.js')
const { serveBadge, serveListBadge } = require('./libs/serve-badge.js')
const serveBadge = require('./libs/serve-badge.js')
const serveListBadge = require('./libs/serve-list-badge.js')
const serveEmojiBadge = require('./libs/serve-emoji-badge.js')
const router = fmw({ defaultRoute: serve404 })
@ -15,6 +17,8 @@ router.get('/badge/:subject/:status', serveBadge)
router.get('/badge/:subject/:status/:color', serveBadge)
router.get('/list/:subject/:status', serveListBadge)
router.get('/list/:subject/:status/:color', serveListBadge)
router.get('/emoji/:subject/:status', serveEmojiBadge)
router.get('/emoji/:subject/:status/:color', serveEmojiBadge)
setupLiveBadge(router)