diff --git a/lib/app.js b/lib/app.js index 39979dffc..c958f0f6f 100644 --- a/lib/app.js +++ b/lib/app.js @@ -13,6 +13,7 @@ const cache = require('./middleware/cache'); const parameter = require('./middleware/parameter'); const template = require('./middleware/template'); const favicon = require('koa-favicon'); +const serve = require('koa-static'); const debug = require('./middleware/debug'); const accessControl = require('./middleware/access-control'); const antiHotlink = require('./middleware/anti-hotlink'); @@ -37,6 +38,7 @@ app.proxy = true; // favicon app.use(favicon(__dirname + '/favicon.png')); +app.use(serve(__dirname + '/static')); // global error handing app.use(onerror); diff --git a/lib/static/logo.png b/lib/static/logo.png new file mode 100644 index 000000000..dc5e7dbf9 Binary files /dev/null and b/lib/static/logo.png differ diff --git a/lib/views/error.art b/lib/views/error.art index 431c9063c..8579fc0e6 100644 --- a/lib/views/error.art +++ b/lib/views/error.art @@ -26,13 +26,17 @@ a { color: #F5712C; } + + img { + filter: grayscale(1); + }

- RSSHub + RSSHub

Looks like something went wrong

@@ -46,14 +50,14 @@ Node version: {{@ nodeVersion}} Git Hash: {{@ gitHash}}
-如果您认为 RSSHub 导致了该错误,请在Github按照模版,复制本页面信息进行汇报
 If you believe this is an error caused by RSSHub, please report on github
+如果您认为 RSSHub 导致了该错误,请在 GitHub 按照模版,复制本页面信息进行 汇报
         
-

在线文档与支持,请访问docs.rsshub.app

For online documentation and support please refer to docs.rsshub.app.

+

在线文档与支持,请访问 docs.rsshub.app

diff --git a/lib/views/rss.art b/lib/views/rss.art index 4c80c65ae..3bcaac41a 100644 --- a/lib/views/rss.art +++ b/lib/views/rss.art @@ -1,5 +1,5 @@ - (i.itunes_item_image || i.itunes_duration))) }} xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd" {{ /if }} diff --git a/lib/views/welcome.art b/lib/views/welcome.art index 9dd5f8d49..fa32d7244 100644 --- a/lib/views/welcome.art +++ b/lib/views/welcome.art @@ -79,13 +79,13 @@

- RSSHub + RSSHub

Welcome to RSSHub!

-

If you see this page, the RSSHub{{ if hash }} ({{ hash }}){{ /if }} is successfully installed and working.

+

If you see this page, the RSSHub is successfully installed and working.

For online documentation and support please refer to docs.rsshub.app.

diff --git a/package.json b/package.json index c5dafce49..6703651af 100644 --- a/package.json +++ b/package.json @@ -109,6 +109,7 @@ "koa-basic-auth": "4.0.0", "koa-favicon": "2.1.0", "koa-mount": "4.0.0", + "koa-static": "5.0.0", "lru-cache": "9.1.1", "lz-string": "1.5.0", "mailparser": "3.6.4", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index f21955189..aeedf8fc6 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -103,6 +103,9 @@ dependencies: koa-mount: specifier: 4.0.0 version: 4.0.0 + koa-static: + specifier: 5.0.0 + version: 5.0.0 lru-cache: specifier: 9.1.1 version: 9.1.1 @@ -2517,7 +2520,6 @@ packages: dependencies: ms: 2.1.3 supports-color: 5.5.0 - dev: true /debug@4.3.4: resolution: {integrity: sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==} @@ -3820,6 +3822,16 @@ packages: resolution: {integrity: sha512-er295DKPVsV82j5kw1Gjt+ADA/XYHsajl82cGNQG2eyoPkvgUhX+nDIyelzhIWbbsXP39EHcI6l5tYs2FYqYXQ==} dev: false + /http-errors@1.6.3: + resolution: {integrity: sha512-lks+lVC8dgGyh97jxvxeYTWQFvh4uw4yC12gVl63Cg30sjPX4wuGcdkICVXDAESr6OJGjqGA8Iz5mkeN6zlD7A==} + engines: {node: '>= 0.6'} + dependencies: + depd: 1.1.2 + inherits: 2.0.3 + setprototypeof: 1.1.0 + statuses: 1.5.0 + dev: false + /http-errors@1.8.1: resolution: {integrity: sha512-Kpk9Sm7NmI+RHhnj6OIWDI1d6fIoFAtFt9RLaTMRlg/8w49juAStsrBgp0Dp4OdxdVbRIeKhtCUvoi/RuAhO4g==} engines: {node: '>= 0.6'} @@ -4017,6 +4029,10 @@ packages: once: 1.4.0 wrappy: 1.0.2 + /inherits@2.0.3: + resolution: {integrity: sha512-x00IRNXNy63jwGkJmzPigoySHbaqpNuzKbBOmzK+g2OdZpQ9w+sxCN+VSB3ja7IAge2OP2qpfxTjeNcyjmW1uw==} + dev: false + /inherits@2.0.4: resolution: {integrity: sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==} @@ -4921,6 +4937,27 @@ packages: - supports-color dev: false + /koa-send@5.0.1: + resolution: {integrity: sha512-tmcyQ/wXXuxpDxyNXv5yNNkdAMdFRqwtegBXUaowiQzUKqJehttS0x2j0eOZDQAyloAth5w6wwBImnFzkUz3pQ==} + engines: {node: '>= 8'} + dependencies: + debug: 4.3.4 + http-errors: 1.8.1 + resolve-path: 1.4.0 + transitivePeerDependencies: + - supports-color + dev: false + + /koa-static@5.0.0: + resolution: {integrity: sha512-UqyYyH5YEXaJrf9S8E23GoJFQZXkBVJ9zYYMPGz919MSX1KuvAcycIuS0ci150HCoPf4XQVhQ84Qf8xRPWxFaQ==} + engines: {node: '>= 7.6.0'} + dependencies: + debug: 3.2.7(supports-color@5.5.0) + koa-send: 5.0.1 + transitivePeerDependencies: + - supports-color + dev: false + /koa@2.14.2: resolution: {integrity: sha512-VFI2bpJaodz6P7x2uyLiX6RLYpZmOJqNmoCst/Yyd7hQlszyPwG/I9CQJ63nOtKSxpt5M7NH67V6nJL2BwCl7g==} engines: {node: ^4.8.4 || ^6.10.1 || ^7.10.1 || >= 8.1.4} @@ -6702,6 +6739,14 @@ packages: engines: {node: '>=8'} dev: true + /resolve-path@1.4.0: + resolution: {integrity: sha512-i1xevIst/Qa+nA9olDxLWnLk8YZbi8R/7JPbCMcgyWaFR6bKWaexgJgEB5oc2PKMjYdrHynyz0NY+if+H98t1w==} + engines: {node: '>= 0.8'} + dependencies: + http-errors: 1.6.3 + path-is-absolute: 1.0.1 + dev: false + /resolve.exports@2.0.2: resolution: {integrity: sha512-X2UW6Nw3n/aMgDVy+0rSqgHlv39WZAlZrXCdnbyEiKm17DSqHX4MmQMaST3FbeWR5FTuRcUwYAziZajji0Y7mg==} engines: {node: '>=10'} @@ -6818,6 +6863,10 @@ packages: /set-blocking@2.0.0: resolution: {integrity: sha512-KiKBS8AnWGEyLzofFfmvKwpdPzqiy16LvQfK3yv/fVH7Bj13/wl3JSR1J+rfgRE9q7xUJK4qvgS8raSOeLUehw==} + /setprototypeof@1.1.0: + resolution: {integrity: sha512-BvE/TwpZX4FXExxOxZyRGQQv651MSwmWKZGqvmPcRIjDqWub67kTKuIMx43cZZrS/cBBzwBcNDWoFxt2XEFIpQ==} + dev: false + /setprototypeof@1.2.0: resolution: {integrity: sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw==} dev: false diff --git a/test/app.js b/test/app.js new file mode 100644 index 000000000..6688035fe --- /dev/null +++ b/test/app.js @@ -0,0 +1,16 @@ +const supertest = require('supertest'); +const server = require('../lib/index'); +const request = supertest(server); + +afterAll(() => { + server.close(); +}); + +describe('index', () => { + it('serve logo', async () => { + const response = await request.get('/logo.png'); + expect(response.status).toBe(200); + expect(response.headers['content-type']).toBe('image/png'); + expect(response.headers['content-length']).toBe('89034'); + }); +});