diff --git a/assets/theme/konachan/0.gif b/assets/theme/konachan/0.gif
new file mode 100644
index 0000000..385282d
Binary files /dev/null and b/assets/theme/konachan/0.gif differ
diff --git a/assets/theme/konachan/1.gif b/assets/theme/konachan/1.gif
new file mode 100644
index 0000000..183fabe
Binary files /dev/null and b/assets/theme/konachan/1.gif differ
diff --git a/assets/theme/konachan/2.gif b/assets/theme/konachan/2.gif
new file mode 100644
index 0000000..53459fb
Binary files /dev/null and b/assets/theme/konachan/2.gif differ
diff --git a/assets/theme/konachan/3.gif b/assets/theme/konachan/3.gif
new file mode 100644
index 0000000..ea0398f
Binary files /dev/null and b/assets/theme/konachan/3.gif differ
diff --git a/assets/theme/konachan/4.gif b/assets/theme/konachan/4.gif
new file mode 100644
index 0000000..fa0db17
Binary files /dev/null and b/assets/theme/konachan/4.gif differ
diff --git a/assets/theme/konachan/5.gif b/assets/theme/konachan/5.gif
new file mode 100644
index 0000000..348f202
Binary files /dev/null and b/assets/theme/konachan/5.gif differ
diff --git a/assets/theme/konachan/6.gif b/assets/theme/konachan/6.gif
new file mode 100644
index 0000000..a84ab8c
Binary files /dev/null and b/assets/theme/konachan/6.gif differ
diff --git a/assets/theme/konachan/7.gif b/assets/theme/konachan/7.gif
new file mode 100644
index 0000000..784e7d0
Binary files /dev/null and b/assets/theme/konachan/7.gif differ
diff --git a/assets/theme/konachan/8.gif b/assets/theme/konachan/8.gif
new file mode 100644
index 0000000..ffc3b4a
Binary files /dev/null and b/assets/theme/konachan/8.gif differ
diff --git a/assets/theme/konachan/9.gif b/assets/theme/konachan/9.gif
new file mode 100644
index 0000000..4b866c5
Binary files /dev/null and b/assets/theme/konachan/9.gif differ
diff --git a/assets/theme/rule34/0.gif b/assets/theme/rule34/0.gif
new file mode 100644
index 0000000..3512b00
Binary files /dev/null and b/assets/theme/rule34/0.gif differ
diff --git a/assets/theme/rule34/1.gif b/assets/theme/rule34/1.gif
new file mode 100644
index 0000000..b292edd
Binary files /dev/null and b/assets/theme/rule34/1.gif differ
diff --git a/assets/theme/rule34/2.gif b/assets/theme/rule34/2.gif
new file mode 100644
index 0000000..6d3a68a
Binary files /dev/null and b/assets/theme/rule34/2.gif differ
diff --git a/assets/theme/rule34/3.gif b/assets/theme/rule34/3.gif
new file mode 100644
index 0000000..1b91cb3
Binary files /dev/null and b/assets/theme/rule34/3.gif differ
diff --git a/assets/theme/rule34/4.gif b/assets/theme/rule34/4.gif
new file mode 100644
index 0000000..7dec2c2
Binary files /dev/null and b/assets/theme/rule34/4.gif differ
diff --git a/assets/theme/rule34/5.gif b/assets/theme/rule34/5.gif
new file mode 100644
index 0000000..e89449d
Binary files /dev/null and b/assets/theme/rule34/5.gif differ
diff --git a/assets/theme/rule34/6.gif b/assets/theme/rule34/6.gif
new file mode 100644
index 0000000..3869b82
Binary files /dev/null and b/assets/theme/rule34/6.gif differ
diff --git a/assets/theme/rule34/7.gif b/assets/theme/rule34/7.gif
new file mode 100644
index 0000000..5b29513
Binary files /dev/null and b/assets/theme/rule34/7.gif differ
diff --git a/assets/theme/rule34/8.gif b/assets/theme/rule34/8.gif
new file mode 100644
index 0000000..e75867a
Binary files /dev/null and b/assets/theme/rule34/8.gif differ
diff --git a/assets/theme/rule34/9.gif b/assets/theme/rule34/9.gif
new file mode 100644
index 0000000..1c59260
Binary files /dev/null and b/assets/theme/rule34/9.gif differ
diff --git a/count.db b/count.db
index 2e355cb..4eb4184 100644
Binary files a/count.db and b/count.db differ
diff --git a/index.js b/index.js
index ee6d2d1..c46d9fd 100644
--- a/index.js
+++ b/index.js
@@ -4,19 +4,18 @@ const fs = require('fs')
const express = require('express')
const compression = require('compression')
-const db = require('./db')
-
-const numList = require('./num-list')
+const db = require('./utils/db')
+const themify = require('./utils/themify')
const PLACES = 7
-function getCountImage(count) {
+function getCountImage({ count, theme='konachan', PLACES=PLACES }) {
// This is not the greatest way for generating an SVG but it'll do for now
const countArray = count.toString().padStart(PLACES, '0').split('')
const parts = countArray.reduce((acc, next, index) => `
${acc}
-
+
`, '')
return `
@@ -42,13 +41,8 @@ app.get('/', (req, res) => {
// get the image
app.get('/get/@:name', async (req, res) => {
const name = req.params.name
-
- if (!name) return
-
- const counter = await db.getNum(name)
- const num = counter.num + 1
-
- db.setNum(counter.name, num)
+ const theme = req.query.theme || 'konachan'
+ let length = PLACES, num = 0
// This helps with GitHub's image cache
res.set({
@@ -56,9 +50,20 @@ app.get('/get/@:name', async (req, res) => {
'cache-control': 'max-age=0, no-cache, no-store, must-revalidate'
})
+ if (name === 'demo') {
+ num = '0123456789'
+ length = 10
+
+ } else {
+ const counter = await db.getNum(name)
+ num = counter.num + 1
+
+ db.setNum(counter.name, num)
+ console.log(counter, `theme: ${theme}`)
+ }
+
// Send the generated SVG as the result
- res.send(getCountImage(num))
- console.log(counter)
+ res.send(getCountImage({ count: num, theme, PLACES: length }))
})
app.get('/heart-beat', (req, res) => {
diff --git a/num-list.js b/num-list.js
deleted file mode 100644
index f24a0db..0000000
--- a/num-list.js
+++ /dev/null
@@ -1,12 +0,0 @@
-module.exports = {
- 0: 'R0lGODlhLQBkALMAACocJKGkunN8ntXa6BE1dwxKpTdvw0mq6v7j0vDWzOGFgLZtauGjov7+/gAAAP///yH5BAEAAA8ALAAAAAAtAGQAAAT/8MlJq7046827p04ohl8pjU2qCoJoco7aFEZtF2zrvmCcFgWZDJgTBBy8RygVmAmfs+IRWfI1mtAsC8BKUWFWrEwsXm27DZLGen2W340iV6D6Wthx4RseP6PTF3h5KgFvCzKHfX50V3ZKAUU5hUyJlIQLTXIAm5wAjiKRk1cKY5UBC6SanZ4ZIYVGTacMY6SUqTmramsOsKOztpcKkLibuh0OkwIKv1eowcNbrCa8mUDWBagB1wWbZ44eDgCZDOTl5udzXN/H4nGrCfDwq+ktL7xcDQAD1gPx8PtABtBbt+HelgYEEjZAwJAhQoUD7QkQN7HWwoYNVSiIOG1iLAYK/0JibBhyGccqHpvFG8kw3oKT4EIYaTSiZk1cxo6lmFkmi5mJgKrsjOXziRGgBDE4MLCsTc+iR0M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EyW/VsW0t3bNG4g4AoZftVwYJMAAwExhvQzI+0VttJzGTAwAADhDk4kHiv3+IAORFAbjGZgJsBIAGAPKCZQGRWmWENOKCTAOvSpldMPuAKAWuLrHGCPp3F9anVOkPmpn2A9xmQBE79bH2gAWvHsVNMDpl8ucTmP5Nvlo78enbXziVCN05husXG4rFb3M2duvjrzt07Lo6ic+v32N2Dp2/Cgc7n1jn33f9oBDRAXlQIjCaga7a11thtAxzoAGwghbSgRRhGeMKE98F3G4YYkvdDgxiSONqA0ZlVT4PUGUBiPTDGeNoPMDYYnIutxagjYTTGaGNjmhnAQEEF6QgAEOQ4oJSONpLW2F586diAgZJBmUCM2D1ngJVsxTgllazQhaWAt9GVAAMwfgkmHHQpACNprJUJVlv1qLlmFmsVWc9wt0HZVmN23nlGWAwI9lFzgaoJaKIaKUlkoV+Cd4UDDUDKKCttpcUApXZOmqiaP8CRaVqcTmlEp0B8amA8SmpKKqip3rbqD6o6gU2rrpY6K6WynlpgoLZmMeqmsNL6k1GnDsBoqGe4WqjCrqcWSylowAYbkJG6mjoppY5VW5YPMe5WrafJ/frlD99GVWFI4qp6bqogUftuug7o1667u7KUIKz0dnjvp9Hqa+6q/WZoGr6+iueiuej64p/B2e6a6pQYksawteX5ezCqVOAE4mvzCuJfh45F/Cl66dEWcgX+6UcAAiYn2tiDcRplalQBoVgyvl/mFGfN52YhGoZHxpzozxAGfYaRERodqM/PAaDszWcMAOMpQWxrhY5NI3lGLTDP+JuGSTJLAhYYRAAAOw=='
-}
\ No newline at end of file
diff --git a/package.json b/package.json
index 37c005c..576ca91 100644
--- a/package.json
+++ b/package.json
@@ -13,6 +13,7 @@
"dependencies": {
"compression": "^1.7.4",
"express": "^4.17.1",
+ "mime-types": "^2.1.27",
"pug": "^3.0.0",
"sqlite3": "^5.0.0"
}
diff --git a/db.js b/utils/db.js
similarity index 91%
rename from db.js
rename to utils/db.js
index 6e3f3b6..0912101 100644
--- a/db.js
+++ b/utils/db.js
@@ -1,6 +1,9 @@
+'use strict'
+
+const path = require('path')
const sqlite3 = require('sqlite3')
-const db = new sqlite3.Database('count.db')
+const db = new sqlite3.Database(path.resolve(__dirname, '../count.db'))
db.run(`CREATE TABLE IF NOT EXISTS tb_count (
id INTEGER PRIMARY KEY AUTOINCREMENT
diff --git a/utils/themify.js b/utils/themify.js
new file mode 100644
index 0000000..c440cd8
--- /dev/null
+++ b/utils/themify.js
@@ -0,0 +1,34 @@
+'use strict'
+
+const fs = require('fs')
+const path = require('path')
+const mimeType = require('mime-types')
+
+const themePath = path.resolve(__dirname, '../assets/theme')
+
+const themeList = {}
+
+fs.readdirSync(themePath).forEach(theme => {
+ if(!(theme in themeList)) themeList[theme] = {}
+ const imgList = fs.readdirSync(path.resolve(themePath, theme))
+ imgList.forEach(img => {
+ const name = path.parse(img).name
+ themeList[theme][name] = convertToDatauri(path.resolve(themePath, theme, img))
+ })
+})
+
+function convertToDatauri(path){
+ const mime = mimeType.lookup(path)
+ const base64 = fs.readFileSync(path).toString('base64')
+
+ return `data:${mime};base64,${base64}`
+}
+
+function wrap(num, theme='konachan'){
+ if(!(theme in themeList)) theme = 'konachan'
+ return themeList[theme][num]
+}
+
+module.exports = {
+ wrap
+}
\ No newline at end of file
diff --git a/views/index.pug b/views/index.pug
index c3a6718..e6c62cf 100644
--- a/views/index.pug
+++ b/views/index.pug
@@ -24,6 +24,15 @@ html
| DO NOT
| enter personal information
+ details
+ summary(style='display: inline-block;')
+ h3(style='display: inline-block; cursor: pointer;') More theme
+ p(style='margin: 0;') Just use the query parameters theme
, like this: https://count.getloli.com/get/@:name?theme=konachan
+ h5 konachan
+ img(src='https://count.getloli.com/get/@demo?theme=konachan', alt='Konachan')
+ h5 rule34
+ img(src='https://count.getloli.com/get/@demo?theme=rule34', alt='Rule34')
+
h3 Credits
ul
li
@@ -31,6 +40,9 @@ html
li
a(href='javascript:alert("!!! NSFW LINK !!!\\nPlease enter the url manually")') konachan.com
| NSFW
+ li
+ a(href='javascript:alert("!!! NSFW LINK !!!\\nPlease enter the url manually")') rule34.xxx
+ | NSFW
li
a(href='https://icons8.com/icons/set/star', target='_blank', rel='nofollow') Icons8
@@ -38,6 +50,10 @@ html
.tool
code https://count.getloli.com/get/@
input#name(type='text', placeholder=':name', style='display: inline-block; width: 80px; height: 1.4em; line-height: 1.4em; margin: 0 4px; vertical-align: middle;')
+ code ?theme=
+ select#theme(style='display: inline-block; height: 1.6em; line-height: 1.6em; font-size: 14px; margin: 0 4px; padding: 0 4px; vertical-align: middle;')
+ option(value='konachan') konachan
+ option(value='rule34') rule34
button#get(style='margin: 10px 0') Get
img#result(style='display: block; width: 315px; height: 100px')
@@ -46,14 +62,16 @@ html
img = document.getElementById('result')
btn.addEventListener('click', function() {
- var name = document.getElementById('name')
+ var name = document.getElementById('name'),
+ themeEl = document.getElementById('theme')
var text = name.value ? name.value.trim() : ''
+ var theme = themeEl.value || 'konachan'
if(!text) {
alert('Please input counter name.')
return
}
- img.src = 'https://count.getloli.com/get/@' + text
+ img.src = 'https://count.getloli.com/get/@' + text + '?theme=' + theme
})
p.copy