Merge branch 'beta' into 'master'

master c1.1.0-s1.2.0
Raymonzut 4 years ago
commit 1a76d0d426
No known key found for this signature in database
GPG Key ID: 1E9BCC39EDD1DD53
  1. 3
      .gitattributes
  2. 2
      client/package-lock.json
  3. 2
      client/package.json
  4. 8
      client/public/index.html
  5. 77
      client/src/App.vue
  6. 6
      client/src/components/AboutMe.vue
  7. 2
      server/package-lock.json
  8. 2
      server/package.json
  9. 28
      server/routes/api/posts.js

3
.gitattributes vendored

@ -0,0 +1,3 @@
* text=auto
eol=lf

@ -1,6 +1,6 @@
{ {
"name": "personal-website", "name": "personal-website",
"version": "1.0.0", "version": "1.1.0",
"lockfileVersion": 1, "lockfileVersion": 1,
"requires": true, "requires": true,
"dependencies": { "dependencies": {

@ -1,6 +1,6 @@
{ {
"name": "personal-website", "name": "personal-website",
"version": "1.0.0", "version": "1.1.0",
"private": true, "private": true,
"description": "A nice introduction to my chaos", "description": "A nice introduction to my chaos",
"main": "src/main.js", "main": "src/main.js",

@ -6,6 +6,14 @@
<meta http-equiv="X-UA-Compatible" content="IE-edge"> <meta http-equiv="X-UA-Compatible" content="IE-edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Personal Website</title> <title>Personal Website</title>
<style>
body, html {
padding: 0;
margin: 0;
width: 100%;
}
</style>
</head> </head>
<body> <body>

@ -1,28 +1,87 @@
<template> <template>
<div id="app"> <div id="app" :class="theme">
<div id="nav"> <div id="nav">
<router-link to="/">Home</router-link> | <router-link to="/">Home</router-link> |
<router-link to="/posts">Posts</router-link> | <router-link to="/posts">Posts</router-link> |
<router-link to="/qa">QA</router-link> <router-link to="/qa">QA</router-link>
</div>
<router-view />
</div> </div>
<div>
<button id="toggleThemeButton" @click="toggleTheme">{{ themeToggleVerb }} my eyes</button>
</div>
<router-view />
</div>
</template> </template>
<script> <script>
export default { export default {
name: 'App', name: 'App',
data() {
return {
theme: 'dark'
}
},
computed: {
themeToggleVerb: function() {
return this.theme === 'light' ? "Save" : "Hurt"
}
},
methods: {
toggleTheme() {
const themes = ['light', 'dark']
this.theme = themes[(themes.indexOf(this.theme) + 1) % themes.length]
}
},
} }
</script> </script>
<style> <style>
.light {
--primary-color: #ffffeb;
--text-color: #272736;
}
.dark {
--primary-color: #272736;
--text-color: #ffffeb;
}
.dark a {
color: #7e7e8f;
}
body {
background-color: var(--primary-color);
}
#app { #app {
font-family: Avenir, Helvetica, Arial, sans-serif; font-family: Avenir, Helvetica, Arial, sans-serif;
-webkit-font-smoothing: antialiased; -webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale; -moz-osx-font-smoothing: grayscale;
text-align: center; text-align: center;
color: #2c3e50; color: var(--text-color);
margin-top: 60px; padding-top: 60px;
background-color: var(--primary-color);
min-height: 100vh;
}
#toggleThemeButton {
background: var(--primary-color);
border: 0px;
color: var(--text-color);
margin: 0 auto;
margin-right: 0px;
} }
@media (min-width:420px) {
#toggleThemeButton {
float:right;
margin-right: 10px;
}
}
</style> </style>

@ -4,9 +4,15 @@
<p> <p>
Hi there, good to see you on my website. Hi there, good to see you on my website.
My name is Raymon Zutekouw({{ age }}). My name is Raymon Zutekouw({{ age }}).
</p>
<p>
Building software and exploring the wide variety of tools (or making them) is my passion. Building software and exploring the wide variety of tools (or making them) is my passion.
To see it in action, checkout the stuff I make on To see it in action, checkout the stuff I make on
<a href='https://github.com/Raymonzut'>GitHub</a>. <a href='https://github.com/Raymonzut'>GitHub</a>.
</p>
<p>
The projects that may be useful to others are open source; for inspiring others and improving each others work. The projects that may be useful to others are open source; for inspiring others and improving each others work.
That is why I am a huge fan of That is why I am a huge fan of
<a href='https://www.gnu.org/philosophy/free-sw.en.html'>free software</a>. <a href='https://www.gnu.org/philosophy/free-sw.en.html'>free software</a>.

@ -1,6 +1,6 @@
{ {
"name": "server", "name": "server",
"version": "1.1.0", "version": "1.2.0",
"lockfileVersion": 1, "lockfileVersion": 1,
"requires": true, "requires": true,
"dependencies": { "dependencies": {

@ -1,6 +1,6 @@
{ {
"name": "server", "name": "server",
"version": "1.1.0", "version": "1.2.0",
"description": "The API for the website", "description": "The API for the website",
"main": "index.js", "main": "index.js",
"scripts": { "scripts": {

@ -37,7 +37,10 @@ routes.set('', async (req, res) => {
if (req.query.sort === '1') res.send(posts_sorted) if (req.query.sort === '1') res.send(posts_sorted)
else res.send(posts_sorted.reverse()) else res.send(posts_sorted.reverse())
return
} }
// Default response when there are no interesting queries
res.send(posts)
}) })
routes.set('/:id', async (req, res) => { routes.set('/:id', async (req, res) => {
@ -53,4 +56,29 @@ 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
routes.set('/urls', async (req, res) => {
const re = /(\/api\/)?(.*)\/urls/g
const result = [...req.raw.originalUrl.matchAll(re)]
if (!result) {
notFoundResponse(res)
return
}
const endpoint = result [1] ? result[1][2] : result[0][2]
// Assumes https
const BASE_URL = 'https://' + req.raw.hostname + endpoint
const urls = posts.map(post =>
`\n <url>
<loc>${BASE_URL}/${post._id}</loc>
<lastmod>${post.date}</lastmod>
<changefreq>never</changefreq>
<priority>0.9</priority>
</url>`
).join("\n")
const xml = `<?xml version="1.0" encoding="UTF-8"?>\r<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
${urls}\n\r</urlset>`
res.send(xml)
})
module.exports = routes module.exports = routes

Loading…
Cancel
Save