Author SHA1 Message Date
Raymonzut 09ed207ab6 Merge branch 'beta' 2020-08-07 14:36:42 +02:00
f3f90df38e Bump fastify from 2.14.1 to 2.15.1 in /server (#11)
Bumps [fastify](https://github.com/fastify/fastify) from 2.14.1 to 2.15.1.
- [Release notes](https://github.com/fastify/fastify/releases)
- [Commits](https://github.com/fastify/fastify/compare/v2.14.1...v2.15.1)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: Raymonzut <40148684+Raymonzut@users.noreply.github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Raymon Zutekouw <me@raymon.dev>
2020-08-07 12:33:01 +02:00
Raymonzut dfe2436718 Add RSS feed link to posts page 2020-07-15 14:30:28 +02:00
Raymonzut 120d6b6941 Merge branch 'beta' into 'master' 2020-07-01 21:02:49 +02:00
Raymonzut b4440c8cc9 Swap /urls for /rss; complete RSS feed 2020-06-29 23:33:31 +02:00
Raymonzut da9024548d Change <loc> format from /posts/:id to /posts?post=:id 2020-06-29 19:16:31 +02:00
Raymonzut bb923a69e7 Create robots.txt 2020-06-29 17:59:41 +02:00
Raymonzut faaf082c8b Preload main page scripts 2020-06-21 14:42:50 +02:00
Raymonzut 79c9398981 Fix #10 2020-06-21 14:40:18 +02:00
Raymonzut bc785a0077 Add meta descriptions 2020-06-20 21:48:21 +02:00
Raymonzut 1a5bc59a99 Move async modules to the body 2020-06-20 21:34:34 +02:00
Raymonzut f4f9092fe8 Preload imported libs 2020-06-20 21:34:01 +02:00
Raymonzut 3e85246344 Async scripts instead of defer; defer is default for modules 2020-06-20 21:03:38 +02:00
Raymonzut 740c584378 Speed-up DNS time by prefetching it 2020-06-20 20:51:31 +02:00
Raymonzut 376f8099b9 Move themes.css into general.css as it is used on every page 2020-06-20 19:55:58 +02:00
Raymonzut c8789bc39e Fix #9 2020-06-20 16:57:00 +02:00
Raymonzut db3c56cfd8 Fix #8 2020-06-17 12:29:33 +02:00
10 changed files with 95 additions and 72 deletions
+25 -4
View File
@@ -1,15 +1,36 @@
:root {
--primary-color: #272736;
--text-color: #ffffeb;
/* Overriding DP DS */
--body-background: var(--primary-color);
--body-color: var(--text-color);
--nav-color: var(--primary-color);
--nav-background: var(--text-color);
--a-color: var(--text-color);
}
nav { nav {
border-bottom-left-radius: 5px; border-bottom-left-radius: 5px;
border-bottom-right-radius: 5px; border-bottom-right-radius: 5px;
} }
.question {
font-style: italic;
}
@media (prefers-color-scheme: light) {
:root {
--primary-color: #ffffeb;
--text-color: #272736;
}
}
@media (max-width: 420px) { @media (max-width: 420px) {
#app { #app {
margin-left: 0vw; margin-left: 0vw;
margin-right: 0vw; margin-right: 0vw;
} }
} }
.question {
font-style: italic;
}
-18
View File
@@ -1,18 +0,0 @@
:root {
--primary-color: #272736;
--text-color: #ffffeb;
/* Overriding DP DS */
--body-background: var(--primary-color);
--body-color: var(--text-color);
--nav-color: var(--primary-color);
--nav-background: var(--text-color);
}
@media (prefers-color-scheme: light) {
:root {
--primary-color: #ffffeb;
--text-color: #272736;
}
}
+8 -3
View File
@@ -2,19 +2,23 @@
<html lang="en"> <html lang="en">
<head> <head>
<meta charset="UTF-8"> <meta charset="UTF-8">
<meta
name="description"
content="Raymon's personal website about his life and projects with a blog.">
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Raymon Zutekouw</title> <title>Raymon Zutekouw</title>
<link rel="preload" href="./lib/me.mjs" as="script" crossorigin="anonymous" type="application/javascript">
<link rel="preload" href="index.mjs" as="script" crossorigin="anonymous" type="application/javascript">
<link rel="dns-prefetch" href="https://cdn.statically.io">
<link defer <link defer
rel="stylesheet" rel="stylesheet"
href="https://cdn.statically.io/gh/dragonprojects/dragondesign/master/main.min.css" href="https://cdn.statically.io/gh/dragonprojects/dragondesign/master/main.min.css"
media="all" media="all"
> >
<link defer rel="stylesheet" href="css/themes.css" media="all">
<link defer rel="stylesheet" href="css/general.css" media="all"> <link defer rel="stylesheet" href="css/general.css" media="all">
<script defer type="module" src="index.mjs"></script>
</head> </head>
<body> <body>
<div id="app"> <div id="app">
@@ -45,5 +49,6 @@
</p> </p>
</div> </div>
</div> </div>
<script async type="module" src="index.mjs"></script>
</body> </body>
</html> </html>
+8 -3
View File
@@ -2,19 +2,22 @@
<html lang="en"> <html lang="en">
<head> <head>
<meta charset="UTF-8"> <meta charset="UTF-8">
<meta
name="description"
content="Raymon typing nonsense on his blog">
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Raymon Zutekouw</title> <title>Raymon Zutekouw</title>
<link rel="preload" href="./lib/remote.mjs" as="script" crossorigin="anonymous" type="application/javascript">
<link rel="preload" href="posts.mjs" as="script" crossorigin="anonymous" type="application/javascript">
<link defer <link defer
rel="stylesheet" rel="stylesheet"
href="https://cdn.statically.io/gh/dragonprojects/dragondesign/master/main.min.css" href="https://cdn.statically.io/gh/dragonprojects/dragondesign/master/main.min.css"
media="all" media="all"
> >
<link defer rel="stylesheet" href="css/themes.css" media="all">
<link defer rel="stylesheet" href="css/general.css" media="all"> <link defer rel="stylesheet" href="css/general.css" media="all">
<script defer type="module" src="posts.mjs"></script>
</head> </head>
<body> <body>
<noscript> <noscript>
@@ -30,8 +33,10 @@
<a href="/qa">QA</a> <a href="/qa">QA</a>
</nav> </nav>
<h3>For those using a RSS reader, subscribe here: <a href="/api/posts/rss.xml">rss.xml</a></h3>
<!-- Placeholder for posts --> <!-- Placeholder for posts -->
<div id="posts"></div> <div id="posts"></div>
<script async type="module" src="posts.mjs"></script>
</div> </div>
</body> </body>
</html> </html>
+1 -1
View File
@@ -15,7 +15,7 @@ async function showPost(id) {
post.content.split('\n').forEach(paragraph => { post.content.split('\n').forEach(paragraph => {
const p = document.createElement("p") const p = document.createElement("p")
p.textContent = paragraph p.innerHTML = paragraph
postsDOM.appendChild(p) postsDOM.appendChild(p)
}); });
} }
+3 -1
View File
@@ -2,6 +2,9 @@
<html lang="en"> <html lang="en">
<head> <head>
<meta charset="UTF-8"> <meta charset="UTF-8">
<meta
name="description"
content="Raymon answering common questions">
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Raymon Zutekouw</title> <title>Raymon Zutekouw</title>
@@ -10,7 +13,6 @@
href="https://cdn.statically.io/gh/dragonprojects/dragondesign/master/main.min.css" href="https://cdn.statically.io/gh/dragonprojects/dragondesign/master/main.min.css"
media="all" media="all"
> >
<link defer rel="stylesheet" href="css/themes.css" media="all">
<link defer rel="stylesheet" href="css/general.css" media="all"> <link defer rel="stylesheet" href="css/general.css" media="all">
</head> </head>
+1
View File
@@ -0,0 +1 @@
User-agent: *
+28 -28
View File
@@ -37,9 +37,9 @@
"integrity": "sha512-/oA9z7JszpIioo6J6dB79LVUgJ3eD3cxkAmdCkvWWS+Y9tPtALs1rLqOekLUXUbYqM2fB9TTK0ibAyZJJOP/CA==" "integrity": "sha512-/oA9z7JszpIioo6J6dB79LVUgJ3eD3cxkAmdCkvWWS+Y9tPtALs1rLqOekLUXUbYqM2fB9TTK0ibAyZJJOP/CA=="
}, },
"ajv": { "ajv": {
"version": "6.12.2", "version": "6.12.3",
"resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.2.tgz", "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.3.tgz",
"integrity": "sha512-k+V+hzjm5q/Mr8ef/1Y9goCmlsK4I6Sm74teeyGvFk1XrOsbsKLjEdrvny42CZ+a8sXbk8KWpY/bDwS+FLL2UQ==", "integrity": "sha512-4K0cK3L1hsqk9xIb2z9vs/XU+PGJZ9PNpJRDS9YLzmNdX6jmVPfamLvTJr0aDAusnHyCHO6MjzlkAsgtqp9teA==",
"requires": { "requires": {
"fast-deep-equal": "^3.1.1", "fast-deep-equal": "^3.1.1",
"fast-json-stable-stringify": "^2.0.0", "fast-json-stable-stringify": "^2.0.0",
@@ -106,9 +106,9 @@
"integrity": "sha512-kNOjDqAh7px0XWNI+4QbzoiR/nTkHAWNud2uvnJquD1/x5a7EQZMJT0AczqK0Qn67oY/TTQ1LbUKajZpp3I9tQ==" "integrity": "sha512-kNOjDqAh7px0XWNI+4QbzoiR/nTkHAWNud2uvnJquD1/x5a7EQZMJT0AczqK0Qn67oY/TTQ1LbUKajZpp3I9tQ=="
}, },
"avvio": { "avvio": {
"version": "6.4.1", "version": "6.5.0",
"resolved": "https://registry.npmjs.org/avvio/-/avvio-6.4.1.tgz", "resolved": "https://registry.npmjs.org/avvio/-/avvio-6.5.0.tgz",
"integrity": "sha512-jeZaUK+F7MuWSNT3VHfltskPJZKqVeTWQqBA4SDaDoLaQ0lb5TOgLeQT1BEuhTIUNISCDCGY3zjYyVmQQ48gKA==", "integrity": "sha512-BmzcZ7gFpyFJsW8G+tfQw8vJNUboA9SDkkHLZ9RAALhvw/rplfWwni8Ee1rA11zj/J7/E5EvZmweusVvTHjWCA==",
"requires": { "requires": {
"archy": "^1.0.0", "archy": "^1.0.0",
"debug": "^4.0.0", "debug": "^4.0.0",
@@ -386,9 +386,9 @@
"integrity": "sha512-WKgKWg5eUxvRZGwW8FvfbaH7AXSh2cL+3j5fMGzUMCxWBJ3dV3a7Wz8y2f/uQ0e3B6WmodD3oS54jTQ9HVTIIg==" "integrity": "sha512-WKgKWg5eUxvRZGwW8FvfbaH7AXSh2cL+3j5fMGzUMCxWBJ3dV3a7Wz8y2f/uQ0e3B6WmodD3oS54jTQ9HVTIIg=="
}, },
"fast-deep-equal": { "fast-deep-equal": {
"version": "3.1.1", "version": "3.1.3",
"resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.1.tgz", "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz",
"integrity": "sha512-8UEa58QDLauDNfpbrX55Q9jrGHThw2ZMdOky5Gl1CDtVeJDPVrG4Jxx1N8jw2gkWaff5UUuX1KJd+9zGe2B+ZA==" "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q=="
}, },
"fast-json-stable-stringify": { "fast-json-stable-stringify": {
"version": "2.1.0", "version": "2.1.0",
@@ -396,9 +396,9 @@
"integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==" "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw=="
}, },
"fast-json-stringify": { "fast-json-stringify": {
"version": "1.20.1", "version": "1.21.0",
"resolved": "https://registry.npmjs.org/fast-json-stringify/-/fast-json-stringify-1.20.1.tgz", "resolved": "https://registry.npmjs.org/fast-json-stringify/-/fast-json-stringify-1.21.0.tgz",
"integrity": "sha512-PEPWrRZvKqI11fY2uDhLLuoapIda9wVQ2mzAj8rkBfVD7jWvOSIICL0Om1knoReIWKF5y/5bbR/GzcZANaaJfQ==", "integrity": "sha512-xY6gyjmHN3AK1Y15BCbMpeO9+dea5ePVsp3BouHCdukcx0hOHbXwFhRodhcI0NpZIgDChSeAKkHW9YjKvhwKBA==",
"requires": { "requires": {
"ajv": "^6.11.0", "ajv": "^6.11.0",
"deepmerge": "^4.2.2", "deepmerge": "^4.2.2",
@@ -416,13 +416,13 @@
"integrity": "sha512-Utm6CdzT+6xsDk2m8S6uL8VHxNwI6Jub+e9NYTcAms28T84pTa25GJQV9j0CY0N1rM8hK4x6grpF2BQf+2qwVA==" "integrity": "sha512-Utm6CdzT+6xsDk2m8S6uL8VHxNwI6Jub+e9NYTcAms28T84pTa25GJQV9j0CY0N1rM8hK4x6grpF2BQf+2qwVA=="
}, },
"fastify": { "fastify": {
"version": "2.14.1", "version": "2.15.1",
"resolved": "https://registry.npmjs.org/fastify/-/fastify-2.14.1.tgz", "resolved": "https://registry.npmjs.org/fastify/-/fastify-2.15.1.tgz",
"integrity": "sha512-nSL8AgIdFCpZmFwjqB5Zzv+3/1KpwwVtB/h88Q4Og8njYbkddKGpuQlQ2tHUULXPTJrLZ7wop6olzx6HEbHdpw==", "integrity": "sha512-pEE1pa5j/vtZeZTbPpFgsJgzLbThcYgiLDw2yZIG8qNZ5LkF1Ew2vbv9k3nTXNxGEPYFBbyNTCKRSj3JbX+FhA==",
"requires": { "requires": {
"abstract-logging": "^2.0.0", "abstract-logging": "^2.0.0",
"ajv": "^6.12.0", "ajv": "^6.12.0",
"avvio": "^6.3.1", "avvio": "^6.4.1",
"fast-json-stringify": "^1.18.0", "fast-json-stringify": "^1.18.0",
"find-my-way": "^2.2.2", "find-my-way": "^2.2.2",
"flatstr": "^1.0.12", "flatstr": "^1.0.12",
@@ -471,9 +471,9 @@
} }
}, },
"find-my-way": { "find-my-way": {
"version": "2.2.2", "version": "2.2.3",
"resolved": "https://registry.npmjs.org/find-my-way/-/find-my-way-2.2.2.tgz", "resolved": "https://registry.npmjs.org/find-my-way/-/find-my-way-2.2.3.tgz",
"integrity": "sha512-zk3eOsS1tABNQjII0vCbhkqgsX/COpRUxl0b5rlA41V2Ft7jWDr30LhYq4BZXLAlzw5yskg24XQG/U1wCT30vQ==", "integrity": "sha512-C7dxfbX8pV1maLd31ygkBEOaD51Ls4dROuHjeSQZf1FeQinUzq3UA/kSPecLSDy9iAQufd8w1zgp7j64kyLdhw==",
"requires": { "requires": {
"fast-decode-uri-component": "^1.0.0", "fast-decode-uri-component": "^1.0.0",
"safe-regex2": "^2.0.0", "safe-regex2": "^2.0.0",
@@ -1049,9 +1049,9 @@
"integrity": "sha512-TcZvGMMy9vodEFSse30lWinkj+JgOBvPn8wRItpQRSayhc+4ssDs335uklkfvQQJgL/WvmHLVj4Ycv2s7QCQMg==" "integrity": "sha512-TcZvGMMy9vodEFSse30lWinkj+JgOBvPn8wRItpQRSayhc+4ssDs335uklkfvQQJgL/WvmHLVj4Ycv2s7QCQMg=="
}, },
"set-cookie-parser": { "set-cookie-parser": {
"version": "2.4.5", "version": "2.4.6",
"resolved": "https://registry.npmjs.org/set-cookie-parser/-/set-cookie-parser-2.4.5.tgz", "resolved": "https://registry.npmjs.org/set-cookie-parser/-/set-cookie-parser-2.4.6.tgz",
"integrity": "sha512-LkSDwseogN5l6TerqGzFzL9mUDTxSq3hX2b5AaynjC1nSCNWiDypEgHatfc0v6KcnfgV3/6F6h4ABh6igjzlQQ==" "integrity": "sha512-mNCnTUF0OYPwYzSHbdRdCfNNHqrne+HS5tS5xNb6yJbdP9wInV0q5xPLE0EyfV/Q3tImo3y/OXpD8Jn0Jtnjrg=="
}, },
"signal-exit": { "signal-exit": {
"version": "3.0.3", "version": "3.0.3",
@@ -1069,9 +1069,9 @@
} }
}, },
"string-similarity": { "string-similarity": {
"version": "4.0.1", "version": "4.0.2",
"resolved": "https://registry.npmjs.org/string-similarity/-/string-similarity-4.0.1.tgz", "resolved": "https://registry.npmjs.org/string-similarity/-/string-similarity-4.0.2.tgz",
"integrity": "sha512-v36MJzloekKVvKAsYi6O/qpn2mIuvwEFIT9Gx3yg4spkNjXYsk7yxc37g4ZTyMVIBvt/9PZGxnqEtme8XHK+Mw==" "integrity": "sha512-eCsPPyoQBgY4TMpVD6DVfO7pLrimUONriaO4Xjp3WPUW0YnNLqdHgRj23xotLlqrL90eJhBeq3zdAJf2mQgfBQ=="
}, },
"string-width": { "string-width": {
"version": "4.2.0", "version": "4.2.0",
@@ -1152,9 +1152,9 @@
"dev": true "dev": true
}, },
"tiny-lru": { "tiny-lru": {
"version": "7.0.2", "version": "7.0.6",
"resolved": "https://registry.npmjs.org/tiny-lru/-/tiny-lru-7.0.2.tgz", "resolved": "https://registry.npmjs.org/tiny-lru/-/tiny-lru-7.0.6.tgz",
"integrity": "sha512-cmc9OOwmnAJtyFBYaznKR3abypEhWecarFrvS5db6qwSgoaDUWV0JX+mdh6B9wN60Wux3+gE1vjzxkoqxFBjqw==" "integrity": "sha512-zNYO0Kvgn5rXzWpL0y3RS09sMK67eGaQj9805jlK9G6pSadfriTczzLHFXa/xcW4mIRfmlB9HyQ/+SgL0V1uow=="
}, },
"to-readable-stream": { "to-readable-stream": {
"version": "1.0.0", "version": "1.0.0",
+1 -1
View File
@@ -11,7 +11,7 @@
"author": "Raymonzut", "author": "Raymonzut",
"license": "ISC", "license": "ISC",
"dependencies": { "dependencies": {
"fastify": "^2.14.1", "fastify": "^2.15.1",
"fastify-cors": "^3.0.3" "fastify-cors": "^3.0.3"
}, },
"devDependencies": { "devDependencies": {
+19 -12
View File
@@ -56,9 +56,9 @@ routes.set('/:id', async (req, res) => {
else res.send(results[0]) else res.send(results[0])
}) })
// For the sitemap.xml, will be listed in the XML Sitemap Index // Dynamic RSS feed
routes.set('/urls', async (req, res) => { routes.set('/rss.xml', async (req, res) => {
const re = /(\/api\/)?(.*)\/urls/g const re = /(\/api\/)?(.*)\/rss/g
const result = [...req.raw.originalUrl.matchAll(re)] const result = [...req.raw.originalUrl.matchAll(re)]
if (!result) { if (!result) {
notFoundResponse(res) notFoundResponse(res)
@@ -68,16 +68,23 @@ routes.set('/urls', async (req, res) => {
const endpoint = result [1] ? result[1][2] : result[0][2] const endpoint = result [1] ? result[1][2] : result[0][2]
// Assumes https // Assumes https
const BASE_URL = 'https://' + req.raw.hostname + endpoint const BASE_URL = 'https://' + req.raw.hostname + endpoint
const urls = posts.map(post => const ITEMS = posts.map(post =>
`\n <url> `\r\n <item>
<loc>${BASE_URL}/${post._id}</loc> <title>${post.title}</title>
<lastmod>${post.date}</lastmod> <link>https://${req.raw.hostname}/posts?post=${post._id}</link>
<changefreq>never</changefreq> <guid>https://${req.raw.hostname}/posts?post=${post._id}</guid>
<priority>0.9</priority> <description>${post.content}</description>
</url>` </item>`
).join("\n") ).join("\n")
const xml = `<?xml version="1.0" encoding="UTF-8"?>\r<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"> const xml = `<?xml version="1.0" encoding="UTF-8" ?>\n<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
${urls}\n\r</urlset>` <channel>
<atom:link href="https://${req.raw.hostname}/api/posts/rss.xml" rel="self" type="application/rss+xml" />
<title>Posts</title>
<link>https://${req.raw.hostname}</link>
<description>Personal blog</description>
<language>en-us</language>
${ITEMS}
</channel>\n</rss>`
res.header('Content-Type', 'application/xml') res.header('Content-Type', 'application/xml')
res.status(200).send(xml) res.status(200).send(xml)