diff --git a/lib/favicon.png b/lib/assets/favicon.png
similarity index 100%
rename from lib/favicon.png
rename to lib/assets/favicon.png
diff --git a/lib/assets/rss.xsl b/lib/assets/rss.xsl
new file mode 100644
index 0000000000..8abf4fe515
--- /dev/null
+++ b/lib/assets/rss.xsl
@@ -0,0 +1,85 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ |
+
+
+
+
+ _blank
+
+
+ |
+
+
+ |
+
+ |
+
+
+ |
+
+
+
+ |
+
+
+
+
diff --git a/lib/index.js b/lib/index.js
index 4746d6cdcb..1e73ef9c73 100644
--- a/lib/index.js
+++ b/lib/index.js
@@ -19,6 +19,7 @@ const accessControl = require('./middleware/access-control');
const router = require('./router');
const protected_router = require('./protected_router');
const mount = require('koa-mount');
+const serve = require('koa-static');
// API related
@@ -44,7 +45,7 @@ if (cluster.isMaster && config.enableCluster && process.env.NODE_ENV !== 'test'
app.proxy = true;
// favicon
- app.use(favicon(__dirname + '/favicon.png'));
+ app.use(favicon(__dirname + '/assets/favicon.png'));
// global error handing
app.use(onerror);
@@ -87,6 +88,8 @@ if (cluster.isMaster && config.enableCluster && process.env.NODE_ENV !== 'test'
// API router
app.use(mount('/api', api_router.routes())).use(api_router.allowedMethods());
+ app.use(mount('/assets', serve(__dirname + '/assets')));
+
// connect
let server;
if (config.connect.socket) {
diff --git a/lib/middleware/parameter.js b/lib/middleware/parameter.js
index 9c57fa9738..2136c202c2 100644
--- a/lib/middleware/parameter.js
+++ b/lib/middleware/parameter.js
@@ -7,7 +7,7 @@ const utils = require('@/utils/common-utils');
module.exports = async (ctx, next) => {
await next();
- if (!ctx.state.data && !ctx._matchedRoute) {
+ if (!ctx.state.data && !ctx._matchedRoute && !ctx.request.url.startsWith('/assets/')) {
throw Error('wrong path');
}
diff --git a/lib/views/rss.art b/lib/views/rss.art
index 9c25a4bc80..15f80dee1c 100644
--- a/lib/views/rss.art
+++ b/lib/views/rss.art
@@ -1,4 +1,4 @@
-
+
{{ if itunes_author }}
{{else}}
diff --git a/package.json b/package.json
index 54477b559f..cf311e0dba 100644
--- a/package.json
+++ b/package.json
@@ -72,6 +72,7 @@
"koa-favicon": "2.0.1",
"koa-mount": "4.0.0",
"koa-router": "7.4.0",
+ "koa-static": "^5.0.0",
"lru-cache": "5.1.1",
"lz-string": "1.4.4",
"markdown-it": "9.0.1",
diff --git a/yarn.lock b/yarn.lock
index 04621b4164..6e62f5824e 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -6269,6 +6269,24 @@ koa-router@7.4.0:
path-to-regexp "^1.1.1"
urijs "^1.19.0"
+koa-send@^5.0.0:
+ version "5.0.0"
+ resolved "https://registry.yarnpkg.com/koa-send/-/koa-send-5.0.0.tgz#5e8441e07ef55737734d7ced25b842e50646e7eb"
+ integrity sha512-90ZotV7t0p3uN9sRwW2D484rAaKIsD8tAVtypw/aBU+ryfV+fR2xrcAwhI8Wl6WRkojLUs/cB9SBSCuIb+IanQ==
+ dependencies:
+ debug "^3.1.0"
+ http-errors "^1.6.3"
+ mz "^2.7.0"
+ resolve-path "^1.4.0"
+
+koa-static@^5.0.0:
+ version "5.0.0"
+ resolved "https://registry.yarnpkg.com/koa-static/-/koa-static-5.0.0.tgz#5e92fc96b537ad5219f425319c95b64772776943"
+ integrity sha512-UqyYyH5YEXaJrf9S8E23GoJFQZXkBVJ9zYYMPGz919MSX1KuvAcycIuS0ci150HCoPf4XQVhQ84Qf8xRPWxFaQ==
+ dependencies:
+ debug "^3.1.0"
+ koa-send "^5.0.0"
+
koa@2.7.0:
version "2.7.0"
resolved "https://registry.yarnpkg.com/koa/-/koa-2.7.0.tgz#7e00843506942b9d82c6cc33749f657c6e5e7adf"
@@ -7703,7 +7721,7 @@ path-exists@^3.0.0:
resolved "https://registry.yarnpkg.com/path-exists/-/path-exists-3.0.0.tgz#ce0ebeaa5f78cb18925ea7d810d7b59b010fd515"
integrity sha1-zg6+ql94yxiSXqfYENe1mwEP1RU=
-path-is-absolute@^1.0.0:
+path-is-absolute@1.0.1, path-is-absolute@^1.0.0:
version "1.0.1"
resolved "https://registry.yarnpkg.com/path-is-absolute/-/path-is-absolute-1.0.1.tgz#174b9268735534ffbc7ace6bf53a5a9e1b5c5f5f"
integrity sha1-F0uSaHNVNP+8es5r9TpanhtcX18=
@@ -8905,6 +8923,14 @@ resolve-from@^4.0.0:
resolved "https://registry.yarnpkg.com/resolve-from/-/resolve-from-4.0.0.tgz#4abcd852ad32dd7baabfe9b40e00a36db5f392e6"
integrity sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==
+resolve-path@^1.4.0:
+ version "1.4.0"
+ resolved "https://registry.yarnpkg.com/resolve-path/-/resolve-path-1.4.0.tgz#c4bda9f5efb2fce65247873ab36bb4d834fe16f7"
+ integrity sha1-xL2p9e+y/OZSR4c6s2u02DT+Fvc=
+ dependencies:
+ http-errors "~1.6.2"
+ path-is-absolute "1.0.1"
+
resolve-url@^0.2.1:
version "0.2.1"
resolved "https://registry.yarnpkg.com/resolve-url/-/resolve-url-0.2.1.tgz#2c637fe77c893afd2a663fe21aa9080068e2052a"