diff --git a/.gitignore b/.gitignore
index 9295227..32b7f43 100644
--- a/.gitignore
+++ b/.gitignore
@@ -3,6 +3,7 @@
/config.json
/config.example.json
/data
+/data/*
/test_data
/access.log
/error.log
diff --git a/package.json b/package.json
index 8e65711..b4cf32e 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "gitblog.md",
- "version": "1.1.5",
+ "version": "1.2.0",
"description": "A static blog using Markdown pulled from your git repository.",
"main": "src/server.js",
"dependencies": {
diff --git a/sample_data/home/error.ejs b/sample_data/home/error.ejs
index c6c5597..2fdfeea 100644
--- a/sample_data/home/error.ejs
+++ b/sample_data/home/error.ejs
@@ -3,17 +3,7 @@
<%= info.title %> - Error <%= error %>
-
-
- <%- `` %>
- <%- `` %>
- <%- `` %>
- <%- `` %>
- <%- `` %>
-
-
-
-
+ <%- include('head'); %>
diff --git a/sample_data/home/footer.ejs b/sample_data/home/footer.ejs
index 1008e4e..4695f3c 100644
--- a/sample_data/home/footer.ejs
+++ b/sample_data/home/footer.ejs
@@ -1,6 +1,6 @@
\ No newline at end of file
+
diff --git a/sample_data/home/head.ejs b/sample_data/home/head.ejs
new file mode 100644
index 0000000..0829bed
--- /dev/null
+++ b/sample_data/home/head.ejs
@@ -0,0 +1,25 @@
+
+<% if(locals.article){ %>
+ <%- `` %>
+ <%- `` %>
+ <%- `` %>
+ <%- `` %>
+ <%- `` %>
+ <% if (article.thumbnail) { %>
+ <%- `` %>
+ <%- `` %>
+ <% } %>
+
+<% } else { %>
+ <%- `` %>
+ <%- `` %>
+ <%- `` %>
+ <%- `` %>
+ <%- `` %>
+<% } %>
+
+
+
+
+
+
\ No newline at end of file
diff --git a/sample_data/home/index.ejs b/sample_data/home/index.ejs
index e91b227..7f975b6 100644
--- a/sample_data/home/index.ejs
+++ b/sample_data/home/index.ejs
@@ -3,17 +3,7 @@
<%= info.title %> - Home
-
-
- <%- `` %>
- <%- `` %>
- <%- `` %>
- <%- `` %>
- <%- `` %>
-
-
-
-
+ <%- include('head'); %>
diff --git a/sample_data/home/style.css b/sample_data/home/style.css
index fb4ca4e..e0b0dcc 100644
--- a/sample_data/home/style.css
+++ b/sample_data/home/style.css
@@ -8,7 +8,7 @@ body, html {
}
body {
- font: 14px/1.45 -apple-system, BlinkMacSystemFont, Segoe UI, sans-serif;
+ font: 15px sans-serif;
color: #111;
-webkit-text-size-adjust: none;
background-color: #F5F5F5;
@@ -16,8 +16,8 @@ body {
}
main {
- max-width: 75ch;
- padding: 2ch;
+ max-width: 42rem;
+ padding: 2rem;
margin: auto;
background-color: #F0F0F0;
min-height: 100vh;
@@ -58,7 +58,7 @@ blockquote {
border-left: 0.5em solid #ccc;
padding-left: 1em;
margin: 0.25em 0;
- color: #333;
+ color: #555;
}
blockquote > p {
@@ -108,7 +108,7 @@ main.article div.header a.link-home {
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-bottom: 0.25em;
font-size: 2em;
@@ -123,11 +123,19 @@ main.article div.header span.time, div.article span.time {
}
div.article {
- margin-left: 1em;
+ margin: 0 1em 1em 1em;
}
div.article h3 {
font-size: 1.3em;
+ margin:0;
+}
+
+div.article img{
+ max-width: 100%;
+ height: auto;
+ margin-right:1em;
+ margin-top:0.25em;
}
#text {
@@ -142,4 +150,4 @@ div.article h3 {
#text img {
max-width: 100%;
height: auto;
-}
\ No newline at end of file
+}
diff --git a/sample_data/home/template.ejs b/sample_data/home/template.ejs
index 5855270..6e54334 100644
--- a/sample_data/home/template.ejs
+++ b/sample_data/home/template.ejs
@@ -3,22 +3,7 @@
<%= info.title %> - <%= article.title %>
-
-
- <%- `` %>
- <%- `` %>
- <%- `` %>
- <%- `` %>
- <%- `` %>
- <% if (article.thumbnail) { %>
- <%- `` %>
- <%- `` %>
- <% } %>
-
-
-
-
-
+ <%- include('head'); %>
@@ -33,4 +18,4 @@
<%- include('footer'); %>
-
\ No newline at end of file
+
diff --git a/src/app.js b/src/app.js
index e0bb3cb..b47aa2b 100644
--- a/src/app.js
+++ b/src/app.js
@@ -160,7 +160,7 @@ module.exports = (config) => {
});
lastRSS = feed.xml();
}
- res.type('rss').send(lastRSS);
+ res.type(req.headers['user-agent'].match(/Mozilla/) ? 'text/xml' : 'rss').send(lastRSS);
} else {
showError(req.path, 404, res);
}
diff --git a/src/config.default.json b/src/config.default.json
index 687ef07..c13b358 100644
--- a/src/config.default.json
+++ b/src/config.default.json
@@ -37,7 +37,7 @@
"endpoint": "/webhook",
"secret": "",
"signature_header": "",
- "pull_command": "git pull"
+ "pull_command": "git pull origin master"
},
"showdown": {
"parseImgDimensions": true,
@@ -54,4 +54,4 @@
"plantuml": {
"output_format": "svg"
}
-}
\ No newline at end of file
+}
diff --git a/test/app.test.js b/test/app.test.js
index 9db6f98..1f3e453 100644
--- a/test/app.test.js
+++ b/test/app.test.js
@@ -175,11 +175,19 @@ describe('Test RSS feed', () => {
test('200 empty rss', (done) => {
request(app).get('/rsstest').then((response) => {
expect(response.statusCode).toBe(200);
+ expect(response.type).toBe('application/rss+xml');
expect(response.text.length).toBeGreaterThan(0);
expect(response.text.split('- ').length).toBe(1);
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) => {
request(app).get('/rsstest').then(() => {
request(app).get('/rsstest').then((response) => {