parent
0e75c8173d
commit
c292502e14
|
|
@ -5,7 +5,7 @@ const isLocalhost = require('is-localhost-ip');
|
|||
const reject = (ctx) => {
|
||||
ctx.response.status = 403;
|
||||
|
||||
throw Error('Access denied.');
|
||||
throw Error('Authentication failed. Access denied.');
|
||||
};
|
||||
|
||||
module.exports = async (ctx, next) => {
|
||||
|
|
|
|||
|
|
@ -91,7 +91,7 @@ Please ensure you have deployed the [master branch](https://github.com/DIYgod/RS
|
|||
templateEn
|
||||
)}" target="_blank">report me on GitHub</a>.`;
|
||||
} else if (err instanceof Error) {
|
||||
message = err.stack;
|
||||
message = process.env.NODE_ENV === 'production' ? err.message : err.stack;
|
||||
}
|
||||
logger.error(`Error in ${ctx.request.path}: ${message}`);
|
||||
|
||||
|
|
@ -105,12 +105,18 @@ Please ensure you have deployed the [master branch](https://github.com/DIYgod/RS
|
|||
ctx.set({
|
||||
'Content-Type': 'text/html; charset=UTF-8',
|
||||
});
|
||||
ctx.body = art(path.resolve(__dirname, '../views/error.art'), {
|
||||
message,
|
||||
});
|
||||
if (ctx.status !== 403) {
|
||||
if (ctx.status === 403) {
|
||||
message = err.message;
|
||||
} else {
|
||||
ctx.status = 404;
|
||||
}
|
||||
|
||||
const requestPath = ctx.request.path;
|
||||
|
||||
ctx.body = art(path.resolve(__dirname, '../views/error.art'), {
|
||||
requestPath,
|
||||
message,
|
||||
});
|
||||
}
|
||||
|
||||
if (!ctx.debug.errorPaths[ctx.request.path]) {
|
||||
|
|
|
|||
|
|
@ -37,10 +37,14 @@
|
|||
|
||||
<h1>Looks like something went wrong</h1>
|
||||
|
||||
<pre class="message">{{@ message }}</pre>
|
||||
<pre class="message">Route requested: {{@ requestPath }}</pre>
|
||||
<pre class="message">Error message: {{@ message }}</pre>
|
||||
|
||||
<p style="margin: 50px 0">For online documentation and support please refer to
|
||||
<a href="https://docs.rsshub.app/" target="_blank">docs.rsshub.app</a>.</p>
|
||||
<div style="margin: 50px 0">
|
||||
<p>在线文档与支持,请访问<a href="https://docs.rsshub.app/" target="_blank">docs.rsshub.app</a>。</p>
|
||||
<p>For online documentation and support please refer to
|
||||
<a href="https://docs.rsshub.app/" target="_blank">docs.rsshub.app</a>.</p>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue