app: welcome page

This commit is contained in:
DIYgod
2018-05-15 01:55:19 +08:00
parent b33edd5283
commit 36ad5f2415
7 changed files with 80 additions and 16 deletions
BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

+4
View File
@@ -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);
+7 -5
View File
@@ -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,
});
}
};
+2
View File
@@ -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",
+4 -1
View File
@@ -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
+26 -5
View File
@@ -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;
}
</style>
</head>
<body>
<h1>Welcome to <span style="color: #F5712C;">RSSHub</span>!</h1>
<div class="content">
<p><img src="https://i.imgur.com/NZpRScX.png" alt="RSSHub" width="100"></p>
<p>If you see this page, the RSSHub is successfully installed and working.</p>
<h1>Welcome to <span style="color: #F5712C;">RSSHub</span>!</h1>
<p>For online documentation and support please refer to <a href="https://rsshub.js.org" target="_blank">rsshub.js.org</a>.</p>
<p>If you see this page, the RSSHub{{ if hash }} ({{ hash }}){{ /if }} is successfully installed and working.</p>
<p>-- Made with <i style="color:#d43f57">♥</i> by <a href="https://diygod.me" target="_blank">DIYgod</a></p>
<p>For online documentation and support please refer to
<a href="https://rsshub.js.org" target="_blank">rsshub.js.org</a>.</p>
<p>-- Made with
<i style="color:#d43f57">♥</i> by
<a href="https://diygod.me" target="_blank">DIYgod</a>
</p>
</div>
</body>
</html>
+37 -5
View File
@@ -1652,7 +1652,7 @@ escape-html@^1.0.3, escape-html@~1.0.1:
version "1.0.3"
resolved "http://registry.npm.taobao.org/escape-html/download/escape-html-1.0.3.tgz#0258eae4d3d0c0974de1c169188ef0051d1d1988"
escape-string-regexp@^1.0.2, escape-string-regexp@^1.0.5:
escape-string-regexp@1.0.5, escape-string-regexp@^1.0.2, escape-string-regexp@^1.0.5:
version "1.0.5"
resolved "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4"
@@ -2078,6 +2078,14 @@ getpass@^0.1.1:
dependencies:
assert-plus "^1.0.0"
git-rev-sync@1.12.0:
version "1.12.0"
resolved "https://registry.npmjs.org/git-rev-sync/-/git-rev-sync-1.12.0.tgz#4468406c7e6c3ba4cf4587999e1adb28d9d1af55"
dependencies:
escape-string-regexp "1.0.5"
graceful-fs "4.1.11"
shelljs "0.7.7"
glob-parent@^3.1.0:
version "3.1.0"
resolved "https://registry.npmjs.org/glob-parent/-/glob-parent-3.1.0.tgz#9e6af6299d8d3bd2bd40430832bd113df906c5ae"
@@ -2100,7 +2108,7 @@ glob@7.0.x:
once "^1.3.0"
path-is-absolute "^1.0.0"
glob@^7.0.3, glob@^7.0.5, glob@^7.1.2:
glob@^7.0.0, glob@^7.0.3, glob@^7.0.5, glob@^7.1.2:
version "7.1.2"
resolved "https://registry.npmjs.org/glob/-/glob-7.1.2.tgz#c19c9df9a028702d678612384a6552404c636d15"
dependencies:
@@ -2213,7 +2221,7 @@ got@^6.7.1:
unzip-response "^2.0.1"
url-parse-lax "^1.0.0"
graceful-fs@^4.1.11, graceful-fs@^4.1.2, graceful-fs@^4.1.6:
graceful-fs@4.1.11, graceful-fs@^4.1.11, graceful-fs@^4.1.2, graceful-fs@^4.1.6:
version "4.1.11"
resolved "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.1.11.tgz#0e8bdfe4d1ddb8854d64e04ea7c00e2a026e5658"
@@ -2543,6 +2551,10 @@ inquirer@^3.0.6:
strip-ansi "^4.0.0"
through "^2.3.6"
interpret@^1.0.0:
version "1.1.0"
resolved "https://registry.npmjs.org/interpret/-/interpret-1.1.0.tgz#7ed1b1410c6a0e0f78cf95d3b8440c63f78b8614"
is-absolute-url@^2.0.0:
version "2.1.0"
resolved "https://registry.npmjs.org/is-absolute-url/-/is-absolute-url-2.1.0.tgz#50530dfb84fcc9aa7dbe7852e83a37b93b9f2aa6"
@@ -2963,6 +2975,12 @@ koa-convert@^1.2.0:
co "^4.6.0"
koa-compose "^3.0.0"
koa-favicon@2.0.1:
version "2.0.1"
resolved "https://registry.npmjs.org/koa-favicon/-/koa-favicon-2.0.1.tgz#cfae363e5fd00bd5dd67c1150fbef31e0b5d6f4d"
dependencies:
mz "^2.7.0"
koa-is-json@^1.0.0:
version "1.0.0"
resolved "https://registry.npmjs.org/koa-is-json/-/koa-is-json-1.0.0.tgz#273c07edcdcb8df6a2c1ab7d59ee76491451ec14"
@@ -3528,7 +3546,7 @@ mute-stream@0.0.7:
version "0.0.7"
resolved "https://registry.npmjs.org/mute-stream/-/mute-stream-0.0.7.tgz#3075ce93bc21b8fab43e1bc4da7e8115ed1e7bab"
mz@^2.6.0:
mz@^2.6.0, mz@^2.7.0:
version "2.7.0"
resolved "https://registry.npmjs.org/mz/-/mz-2.7.0.tgz#95008057a56cafadc2bc63dde7f9ff6955948e32"
dependencies:
@@ -4537,6 +4555,12 @@ readdirp@^2.0.0:
readable-stream "^2.0.2"
set-immediate-shim "^1.0.1"
rechoir@^0.6.2:
version "0.6.2"
resolved "https://registry.npmjs.org/rechoir/-/rechoir-0.6.2.tgz#85204b54dba82d5742e28c96756ef43af50e3384"
dependencies:
resolve "^1.1.6"
redent@^2.0.0:
version "2.0.0"
resolved "https://registry.npmjs.org/redent/-/redent-2.0.0.tgz#c1b2007b42d57eb1389079b3c8333639d5e1ccaa"
@@ -4731,7 +4755,7 @@ resolve-url@^0.2.1:
version "0.2.1"
resolved "https://registry.npmjs.org/resolve-url/-/resolve-url-0.2.1.tgz#2c637fe77c893afd2a663fe21aa9080068e2052a"
resolve@^1.2.0, resolve@^1.6.0:
resolve@^1.1.6, resolve@^1.2.0, resolve@^1.6.0:
version "1.7.1"
resolved "https://registry.npmjs.org/resolve/-/resolve-1.7.1.tgz#aadd656374fd298aee895bc026b8297418677fd3"
dependencies:
@@ -4896,6 +4920,14 @@ shebang-regex@^1.0.0:
version "1.0.0"
resolved "https://registry.npmjs.org/shebang-regex/-/shebang-regex-1.0.0.tgz#da42f49740c0b42db2ca9728571cb190c98efea3"
shelljs@0.7.7:
version "0.7.7"
resolved "https://registry.npmjs.org/shelljs/-/shelljs-0.7.7.tgz#b2f5c77ef97148f4b4f6e22682e10bba8667cff1"
dependencies:
glob "^7.0.0"
interpret "^1.0.0"
rechoir "^0.6.2"
signal-exit@^3.0.0, signal-exit@^3.0.2:
version "3.0.2"
resolved "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.2.tgz#b5fdc08f1287ea1178628e415e25132b73646c6d"