diff --git a/favicon.png b/favicon.png
new file mode 100644
index 000000000..add6436b0
Binary files /dev/null and b/favicon.png differ
diff --git a/index.js b/index.js
index 3aeea2e4a..56293d0ac 100644
--- a/index.js
+++ b/index.js
@@ -10,6 +10,7 @@ const memoryCache = require('./middleware/cache.js');
const redisCache = require('koa-redis-cache');
const filter = require('./middleware/filter.js');
const template = require('./middleware/template.js');
+const favicon = require('koa-favicon');
const router = require('./router');
@@ -21,6 +22,9 @@ logger.info('🍻 RSSHub start! Cheers!');
const app = new Koa();
+// favicon
+app.use(favicon(__dirname + '/favicon.png'));
+
// global error handing
app.use(onerror);
diff --git a/middleware/template.js b/middleware/template.js
index 7d4e11d97..8cb272739 100644
--- a/middleware/template.js
+++ b/middleware/template.js
@@ -4,9 +4,11 @@ const config = require('../config');
module.exports = async (ctx, next) => {
await next();
- ctx.body = art(path.resolve(__dirname, '../views/rss.art'), {
- lastBuildDate: new Date().toUTCString(),
- ttl: config.cacheExpire,
- ...ctx.state.data,
- });
+ if (!ctx.body) {
+ ctx.body = art(path.resolve(__dirname, '../views/rss.art'), {
+ lastBuildDate: new Date().toUTCString(),
+ ttl: config.cacheExpire,
+ ...ctx.state.data,
+ });
+ }
};
\ No newline at end of file
diff --git a/package.json b/package.json
index a50b0a347..2254a83cf 100644
--- a/package.json
+++ b/package.json
@@ -31,9 +31,11 @@
"crypto": "1.0.1",
"eslint": "4.19.1",
"form-data": "^2.3.2",
+ "git-rev-sync": "1.12.0",
"googleapis": "30.0.0",
"json-bigint": "0.2.3",
"koa": "2.5.0",
+ "koa-favicon": "2.0.1",
"koa-redis-cache": "3.0.0",
"koa-router": "7.4.0",
"lru-cache": "4.1.2",
diff --git a/router.js b/router.js
index 53d5b8476..10c6b1e05 100644
--- a/router.js
+++ b/router.js
@@ -4,12 +4,15 @@ const art = require('art-template');
const path = require('path');
const config = require('./config');
const logger = require('./utils/logger');
+const git = require('git-rev-sync');
router.get('/', async (ctx) => {
ctx.set({
'Content-Type': 'text/html; charset=UTF-8',
});
- ctx.body = art(path.resolve(__dirname, './views/welcome.art'), {});
+ ctx.body = art(path.resolve(__dirname, './views/welcome.art'), {
+ hash: git.short(),
+ });
});
// bilibili
diff --git a/views/welcome.art b/views/welcome.art
index 4b2ad1384..87f3e4650 100644
--- a/views/welcome.art
+++ b/views/welcome.art
@@ -6,17 +6,38 @@
body {
width: 35em;
margin: 0 auto;
- font-family: Tahoma, Verdana, Arial, sans-serif;
+ font-family: -apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen,Ubuntu,Cantarell,Fira Sans,Droid Sans,Helvetica Neue,sans-serif;
+ -webkit-font-smoothing: antialiased;
+ -moz-osx-font-smoothing: grayscale;
+ font-size: 16px;
+ color: #2c3e50;
+ }
+
+ .content {
+ position: absolute;
+ top: 40%;
+ left: 50%;
+ transform: translate(-50%, -50%);
+ min-width: 400px;
+ text-align: center;
}
-Welcome to RSSHub!
+
+

-
If you see this page, the RSSHub is successfully installed and working.
+
Welcome to RSSHub!
-
For online documentation and support please refer to rsshub.js.org.
+
If you see this page, the RSSHub{{ if hash }} ({{ hash }}){{ /if }} is successfully installed and working.
-
-- Made with ♥ by DIYgod
+
For online documentation and support please refer to
+ rsshub.js.org.
+
+
-- Made with
+ ♥ by
+ DIYgod
+
+