-
Notifications
You must be signed in to change notification settings - Fork 1
/
home.js
49 lines (39 loc) · 1.87 KB
/
home.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
const fs = require('fs')
const path = require('path')
const { serveMarked } = require('serve-marked')
const icons = require('./icons.js')
const serveHome = serveMarked(
fs.readFileSync(path.join(__dirname, 'README.md'), 'utf8'),
{
title: 'Colored Octicon SVGs',
beforeHeadEnd: `
<meta name="viewport" content="width=device-width">
<meta name="description" content="Simple website for getting colored Octicons SVGs from GitHub.">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="Colored Octicon SVGs">
<meta name="twitter:description" content="Simple website for getting colored Octicons SVGs from GitHub.">
<meta name="og:site_name" content="Colored Octicon SVGs">
<meta name="og:title" content="Colored Octicon SVGs">
<meta name="og:description" content="Simple website for getting colored Octicons SVGs from GitHub.">
<meta name="og:url" content="https://octicons-col.vercel.app/">
<link href="https://www.andre601.ch/assets/img/favicons/apple-touch-icon.png" rel="apple-touch-icon" sizes="180x180">
<link href="https://www.andre601.ch/assets/img/favicons/favicon-32x32.png" rel="icon" type="image/png" sizes="32x32">
<link href="https://www.andre601.ch/assets/img/favicons/favicon-16x16.png" rel="icon" type="image/png" sizes="16x16">
<link href="https://www.andre601.ch/assets/site.webmanifest" rel="manifest">
<link href="/styles" rel="stylesheet">
`,
beforeBodyEnd: `
<div id="icons" class="markdown-body">
<h2>Icons</h2><div>${genIconsHtml()}</div>
</div>
`
}
)
module.exports = function (req, res) {
serveHome(req, res)
}
function genIconsHtml () {
return Object.keys(icons).map(k => {
return `<a href="/${k}/000" target="_blank"><img src="/${k}/e4e8ec" alt="${k}" />${k}</a>`
}).join('')
}