Compare commits
16 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| ea95a285c9 | |||
| 0fde428806 | |||
| 8fc7ff1ca7 | |||
| ae4e2eb8d5 | |||
| 528e4be1fe | |||
| bd42883330 | |||
| b6ac0a73b4 | |||
| aebc3da5bc | |||
| 7a4a4f9006 | |||
| 1341aa5a56 | |||
| 5e05f250f4 | |||
| 6cf7be3afb | |||
| 6aceacad18 | |||
| a3a23be1c2 | |||
| e8e8024021 | |||
| 1806d60ca7 |
@@ -3,6 +3,7 @@
|
|||||||
/config.json
|
/config.json
|
||||||
/config.example.json
|
/config.example.json
|
||||||
/data
|
/data
|
||||||
|
/data/*
|
||||||
/test_data
|
/test_data
|
||||||
/access.log
|
/access.log
|
||||||
/error.log
|
/error.log
|
||||||
|
|||||||
@@ -132,7 +132,10 @@ You need to [create a new repository](https://github.com/new) on your favorite G
|
|||||||
```bash
|
```bash
|
||||||
#gitblog.md/
|
#gitblog.md/
|
||||||
cd data
|
cd data
|
||||||
|
git init
|
||||||
git remote add origin <url_of_your_repo.git>
|
git remote add origin <url_of_your_repo.git>
|
||||||
|
git add .
|
||||||
|
git commit -m "initial commit"
|
||||||
git push -u origin master
|
git push -u origin master
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -157,7 +160,7 @@ Here are the steps for Github, if you use another platform adapt it your way (he
|
|||||||
```json
|
```json
|
||||||
"webhook": {
|
"webhook": {
|
||||||
"endpoint": "/webhook",
|
"endpoint": "/webhook",
|
||||||
"secret": "sha1=<value>",
|
"secret": "<value>",
|
||||||
"signature_header": "X-Hub-Signature"
|
"signature_header": "X-Hub-Signature"
|
||||||
},
|
},
|
||||||
```
|
```
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "gitblog.md",
|
"name": "gitblog.md",
|
||||||
"version": "1.1.4",
|
"version": "1.2.0",
|
||||||
"description": "A static blog using Markdown pulled from your git repository.",
|
"description": "A static blog using Markdown pulled from your git repository.",
|
||||||
"main": "src/server.js",
|
"main": "src/server.js",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
|||||||
@@ -3,17 +3,7 @@
|
|||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<title><%= info.title %> - Error <%= error %></title>
|
<title><%= info.title %> - Error <%= error %></title>
|
||||||
|
<%- include('head'); %>
|
||||||
<meta name="twitter:card" content="summary_large_image">
|
|
||||||
<%= `<meta property="og:title" content="${info.title} - Home">` %>
|
|
||||||
<%= `<meta property="twitter:title" content="${info.title} - Home">` %>
|
|
||||||
<%= `<meta property="og:description" content="${info.description}">` %>
|
|
||||||
<%= `<meta property="twitter:description" content="${info.description}">` %>
|
|
||||||
<%= `<meta property="org:url" content="${info.host}/">` %>
|
|
||||||
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, shrink-to-fit=no">
|
|
||||||
|
|
||||||
<link rel="stylesheet" type="text/css" href="/style.css">
|
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<main>
|
<main>
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<hr>
|
<hr>
|
||||||
<footer>
|
<footer>
|
||||||
<small><a href="/rss">RSS feed</a> - @<%= new Date().getFullYear() %> - Made with <a
|
<small><a href="/rss">RSS feed</a> - <%= new Date().getFullYear() %> - Made with <a
|
||||||
href="https://github.com/klemek/gitblog.md">GitBlog.md</a> (v<%= info.version %>)
|
href="https://github.com/klemek/gitblog.md">GitBlog.md</a> (v<%= info.version %>)
|
||||||
</small>
|
</small>
|
||||||
</footer>
|
</footer>
|
||||||
|
|||||||
@@ -0,0 +1,25 @@
|
|||||||
|
<meta name="twitter:card" content="summary_large_image">
|
||||||
|
<% if(locals.article){ %>
|
||||||
|
<%- `<meta property="og:title" content="${info.title} - ${article.title}">` %>
|
||||||
|
<%- `<meta property="twitter:title" content="${info.title} - ${article.title}">` %>
|
||||||
|
<%- `<meta property="og:description" content="${info.description}">` %>
|
||||||
|
<%- `<meta property="twitter:description" content="${info.description}">` %>
|
||||||
|
<%- `<meta property="org:url" content="${info.host + article.url}">` %>
|
||||||
|
<% if (article.thumbnail) { %>
|
||||||
|
<%- `<meta property="og:image" content="${info.host}/${article.thumbnail}">` %>
|
||||||
|
<%- `<meta property="twitter:image" content="${info.host}/${article.thumbnail}">` %>
|
||||||
|
<% } %>
|
||||||
|
<link rel="stylesheet" type="text/css" href="/prism.css">
|
||||||
|
<% } else { %>
|
||||||
|
<%- `<meta property="og:title" content="${info.title} - Home">` %>
|
||||||
|
<%- `<meta property="twitter:title" content="${info.title} - Home">` %>
|
||||||
|
<%- `<meta property="og:description" content="${info.description}">` %>
|
||||||
|
<%- `<meta property="twitter:description" content="${info.description}">` %>
|
||||||
|
<%- `<meta property="org:url" content="${info.host}/">` %>
|
||||||
|
<% } %>
|
||||||
|
|
||||||
|
<link rel="alternate" type="application/rss+xml" title="RSS feed" href="/rss"/>
|
||||||
|
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0, shrink-to-fit=no">
|
||||||
|
|
||||||
|
<link rel="stylesheet" type="text/css" href="/style.css">
|
||||||
@@ -3,17 +3,7 @@
|
|||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<title><%= info.title %> - Home</title>
|
<title><%= info.title %> - Home</title>
|
||||||
|
<%- include('head'); %>
|
||||||
<meta name="twitter:card" content="summary_large_image">
|
|
||||||
<%= `<meta property="og:title" content="${info.title} - Home">` %>
|
|
||||||
<%= `<meta property="twitter:title" content="${info.title} - Home">` %>
|
|
||||||
<%= `<meta property="og:description" content="${info.description}">` %>
|
|
||||||
<%= `<meta property="twitter:description" content="${info.description}">` %>
|
|
||||||
<%= `<meta property="org:url" content="${info.host}/">` %>
|
|
||||||
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, shrink-to-fit=no">
|
|
||||||
|
|
||||||
<link rel="stylesheet" type="text/css" href="style.css">
|
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<main>
|
<main>
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ body, html {
|
|||||||
}
|
}
|
||||||
|
|
||||||
body {
|
body {
|
||||||
font: 14px/1.45 -apple-system, BlinkMacSystemFont, Segoe UI, sans-serif;
|
font: 15px sans-serif;
|
||||||
color: #111;
|
color: #111;
|
||||||
-webkit-text-size-adjust: none;
|
-webkit-text-size-adjust: none;
|
||||||
background-color: #F5F5F5;
|
background-color: #F5F5F5;
|
||||||
@@ -16,8 +16,8 @@ body {
|
|||||||
}
|
}
|
||||||
|
|
||||||
main {
|
main {
|
||||||
max-width: 75ch;
|
max-width: 42rem;
|
||||||
padding: 2ch;
|
padding: 2rem;
|
||||||
margin: auto;
|
margin: auto;
|
||||||
background-color: #F0F0F0;
|
background-color: #F0F0F0;
|
||||||
min-height: 100vh;
|
min-height: 100vh;
|
||||||
@@ -58,7 +58,7 @@ blockquote {
|
|||||||
border-left: 0.5em solid #ccc;
|
border-left: 0.5em solid #ccc;
|
||||||
padding-left: 1em;
|
padding-left: 1em;
|
||||||
margin: 0.25em 0;
|
margin: 0.25em 0;
|
||||||
color: #333;
|
color: #555;
|
||||||
}
|
}
|
||||||
|
|
||||||
blockquote > p {
|
blockquote > p {
|
||||||
@@ -108,7 +108,7 @@ main.article div.header a.link-home {
|
|||||||
line-height: 2.4;
|
line-height: 2.4;
|
||||||
}
|
}
|
||||||
|
|
||||||
main.article div.header h1, main.article div.header h2, div.article h3 {
|
main.article div.header h1, main.article div.header h2 {
|
||||||
margin-top: 0.85em;
|
margin-top: 0.85em;
|
||||||
margin-bottom: 0.25em;
|
margin-bottom: 0.25em;
|
||||||
font-size: 2em;
|
font-size: 2em;
|
||||||
@@ -123,11 +123,19 @@ main.article div.header span.time, div.article span.time {
|
|||||||
}
|
}
|
||||||
|
|
||||||
div.article {
|
div.article {
|
||||||
margin-left: 1em;
|
margin: 0 1em 1em 1em;
|
||||||
}
|
}
|
||||||
|
|
||||||
div.article h3 {
|
div.article h3 {
|
||||||
font-size: 1.3em;
|
font-size: 1.3em;
|
||||||
|
margin:0;
|
||||||
|
}
|
||||||
|
|
||||||
|
div.article img{
|
||||||
|
max-width: 100%;
|
||||||
|
height: auto;
|
||||||
|
margin-right:1em;
|
||||||
|
margin-top:0.25em;
|
||||||
}
|
}
|
||||||
|
|
||||||
#text {
|
#text {
|
||||||
@@ -142,4 +150,4 @@ div.article h3 {
|
|||||||
#text img {
|
#text img {
|
||||||
max-width: 100%;
|
max-width: 100%;
|
||||||
height: auto;
|
height: auto;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,22 +3,7 @@
|
|||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<title><%= info.title %> - <%= article.title %></title>
|
<title><%= info.title %> - <%= article.title %></title>
|
||||||
|
<%- include('head'); %>
|
||||||
<meta name="twitter:card" content="summary_large_image">
|
|
||||||
<%= `<meta property="og:title" content="${info.title} - ${article.title}">` %>
|
|
||||||
<%= `<meta property="twitter:title" content="${info.title} - ${article.title}">` %>
|
|
||||||
<%= `<meta property="og:description" content="${info.description}">` %>
|
|
||||||
<%= `<meta property="twitter:description" content="${info.description}">` %>
|
|
||||||
<%= `<meta property="org:url" content="${info.host + article.url}">` %>
|
|
||||||
<% if (article.thumbnail) { %>
|
|
||||||
<%= `<meta property="org:image" content="${info.host + article.thumbnail}">` %>
|
|
||||||
<%= `<meta property="twitter:image" content="${info.host + article.thumbnail}">` %>
|
|
||||||
<% } %>
|
|
||||||
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, shrink-to-fit=no">
|
|
||||||
|
|
||||||
<link rel="stylesheet" type="text/css" href="/prism.css">
|
|
||||||
<link rel="stylesheet" type="text/css" href="/style.css">
|
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<main class="article">
|
<main class="article">
|
||||||
@@ -33,4 +18,4 @@
|
|||||||
<%- include('footer'); %>
|
<%- include('footer'); %>
|
||||||
</main>
|
</main>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
+1
-1
@@ -160,7 +160,7 @@ module.exports = (config) => {
|
|||||||
});
|
});
|
||||||
lastRSS = feed.xml();
|
lastRSS = feed.xml();
|
||||||
}
|
}
|
||||||
res.type('rss').send(lastRSS);
|
res.type(req.headers['user-agent'].match(/Mozilla/) ? 'text/xml' : 'rss').send(lastRSS);
|
||||||
} else {
|
} else {
|
||||||
showError(req.path, 404, res);
|
showError(req.path, 404, res);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -37,7 +37,7 @@
|
|||||||
"endpoint": "/webhook",
|
"endpoint": "/webhook",
|
||||||
"secret": "",
|
"secret": "",
|
||||||
"signature_header": "",
|
"signature_header": "",
|
||||||
"pull_command": "git pull"
|
"pull_command": "git pull origin master"
|
||||||
},
|
},
|
||||||
"showdown": {
|
"showdown": {
|
||||||
"parseImgDimensions": true,
|
"parseImgDimensions": true,
|
||||||
@@ -54,4 +54,4 @@
|
|||||||
"plantuml": {
|
"plantuml": {
|
||||||
"output_format": "svg"
|
"output_format": "svg"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -175,11 +175,19 @@ describe('Test RSS feed', () => {
|
|||||||
test('200 empty rss', (done) => {
|
test('200 empty rss', (done) => {
|
||||||
request(app).get('/rsstest').then((response) => {
|
request(app).get('/rsstest').then((response) => {
|
||||||
expect(response.statusCode).toBe(200);
|
expect(response.statusCode).toBe(200);
|
||||||
|
expect(response.type).toBe('application/rss+xml');
|
||||||
expect(response.text.length).toBeGreaterThan(0);
|
expect(response.text.length).toBeGreaterThan(0);
|
||||||
expect(response.text.split('<item>').length).toBe(1);
|
expect(response.text.split('<item>').length).toBe(1);
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
test('200 Mozilla fix', (done) => {
|
||||||
|
request(app).get('/rsstest').set('user-agent', 'Mozilla Firefox 64.0').then((response) => {
|
||||||
|
expect(response.statusCode).toBe(200);
|
||||||
|
expect(response.type).toBe('text/xml');
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
});
|
||||||
test('200 rss cache', (done) => {
|
test('200 rss cache', (done) => {
|
||||||
request(app).get('/rsstest').then(() => {
|
request(app).get('/rsstest').then(() => {
|
||||||
request(app).get('/rsstest').then((response) => {
|
request(app).get('/rsstest').then((response) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user