suggest user to login on not found (always, to not give hint on file existence)
Massimo Melina committed
Mar 17, 2022 at 10:55 UTC
c8c32e1f8fd67e3f90011cc6bcc41b4e18b751d8
2 files changed
+4
-1
server/src/middlewares.ts
+3
-1
@@ -72,8 +72,10 @@ export const serveGuiAndSharedFiles: Koa.Middleware = async (ctx, next) => {
72
if (path.startsWith(ADMIN_URI))
73
return serveAdminPrefixed(ctx,next)
74
const node = await urlToNode(path, ctx)
75
- if (!node)
75
+ if (!node) {
76
+ ctx.body = "Not found. Sometimes you need to login first."
77
return next()
78
+ }
79
if (!hasPermission(node, 'can_read', ctx))
80
return ctx.status = cantReadStatusCode(node)
81
const { source } = node
todo.md
+1
@@ -16,6 +16,7 @@
16
- show some properties, which ones are loaded
17
- plugin config: plugin must expose gui producing object or form configuration
18
- download-counter: expose results on admin
19
+- frontend: make a "login" route, and link it in side the 404's suggest-login message
20
- plugin to show country by ip in admin/monitor
21
- config.proxies:number (will enable koa.proxy:true + maxIpsCount, default 0)
22
- log filter option