feat: Get url from req for index page #50

Merged
HChenZi merged 2 commits from feat-homePageUrl into master 2023-04-04 07:03:09 +00:00
2 changed files with 16 additions and 15 deletions
Showing only changes of commit 5d5045de54 - Show all commits

View File

@ -17,7 +17,8 @@ app.use(compression())
app.set('view engine', 'pug') app.set('view engine', 'pug')
app.get('/', (req, res) => { app.get('/', (req, res) => {
res.render('index') const url = req.protocol+'://'+req.get('host')
res.render('index', { url })
}); });
// get the image // get the image

View File

@ -25,16 +25,16 @@ html
h3 How to use: h3 How to use:
h5 SVG address h5 SVG address
code https://count.getloli.com/get/@:name code #{url}/get/@:name
h5 Img tag h5 Img tag
code <img src="https://count.getloli.com/get/@:name" alt=":name" /> code <img src="#{url}/get/@:name" alt=":name" />
h5 Markdown h5 Markdown
code ![:name](https://count.getloli.com/get/@:name) code ![:name](#{url}/get/@:name)
h3 eg: h3 eg:
<img src="https://count.getloli.com/get/@index" alt="Moe Count!" /> <img src="#{url}/get/@index" alt="Moe Count!" />
i Data can access by anyone, please i Data can access by anyone, please
| <span style="color: #ff4500;"> DO NOT</span> | <span style="color: #ff4500;"> DO NOT</span>
@ -43,19 +43,19 @@ html
details details
summary(style='display: inline-block;', onclick='_evt_push("click", "normal", "more_theme")') summary(style='display: inline-block;', onclick='_evt_push("click", "normal", "more_theme")')
h3(style='display: inline-block; cursor: pointer;') More theme h3(style='display: inline-block; cursor: pointer;') More theme
p(style='margin: 0;') Just use the query parameters <code>theme</code>, like this: <code>https://count.getloli.com/get/@:name?theme=moebooru</code> p(style='margin: 0;') Just use the query parameters <code>theme</code>, like this: <code>#{url}/get/@:name?theme=moebooru</code>
h5 asoul h5 asoul
img(src='https://count.getloli.com/get/@demo?theme=asoul', alt='A-SOUL') img(src='#{url}/get/@demo?theme=asoul', alt='A-SOUL')
h5 moebooru h5 moebooru
img(src='https://count.getloli.com/get/@demo?theme=moebooru', alt='Moebooru') img(src='#{url}/get/@demo?theme=moebooru', alt='Moebooru')
h5 moebooru-h h5 moebooru-h
img(src='https://count.getloli.com/get/@demo?theme=moebooru-h', alt='Moebooru-Hentai') img(src='#{url}/get/@demo?theme=moebooru-h', alt='Moebooru-Hentai')
h5 rule34 h5 rule34
img(src='https://count.getloli.com/get/@demo?theme=rule34', alt='Rule34') img(src='#{url}/get/@demo?theme=rule34', alt='Rule34')
h5 gelbooru h5 gelbooru
img(src='https://count.getloli.com/get/@demo?theme=gelbooru', alt='Gelbooru') img(src='#{url}/get/@demo?theme=gelbooru', alt='Gelbooru')
h5 gelbooru-h h5 gelbooru-h
img(src='https://count.getloli.com/get/@demo?theme=gelbooru-h', alt='Gelbooru-Hentai') img(src='#{url}/get/@demo?theme=gelbooru-h', alt='Gelbooru-Hentai')
h3 Credits h3 Credits
ul ul
@ -76,7 +76,7 @@ html
h3 Tool h3 Tool
.tool .tool
code https://count.getloli.com/get/@ code #{url}/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;') 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= 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;') 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;')
@ -103,7 +103,7 @@ html
return return
} }
img.src = 'https://count.getloli.com/get/@' + text + '?theme=' + theme img.src = '#{url}/get/@' + text + '?theme=' + theme
}) })
iframe(src="https://chat.getloli.com/room/@Moe-counter?title=%E8%90%8C%E8%90%8C%E8%AE%A1%E6%95%B0%E5%99%A8%E7%9A%84%E7%95%99%E8%A8%80%E6%9D%BF", scrolling="no", frameborder="0", height="70%", width="26%", style="position: fixed;top: 2%;right: 5%;") iframe(src="https://chat.getloli.com/room/@Moe-counter?title=%E8%90%8C%E8%90%8C%E8%AE%A1%E6%95%B0%E5%99%A8%E7%9A%84%E7%95%99%E8%A8%80%E6%9D%BF", scrolling="no", frameborder="0", height="70%", width="26%", style="position: fixed;top: 2%;right: 5%;")