small optimization (faster check first)

Massimo Melina committed Aug 10, 2022 at 11:55 UTC 70bf38891afdc413bb5deaabcd2d900e4c3166f5
2 files changed +4 -3
server/src/adminApis.ts
+2 -2
@@ -146,8 +146,8 @@ for (const k in adminApis) {
146 export const localhostAdmin = defineConfig('localhost_admin', true)
147
148 export function ctxAdminAccess(ctx: Koa.Context) {
149 - return isLocalHost(ctx) && localhostAdmin.get()
150 - && !ctx.state.proxiedFor // this may detect an http-proxied request on localhost
149 + return !ctx.state.proxiedFor // we consider localhost_admin only if no proxy is detected
150 + && localhostAdmin.get() && isLocalHost(ctx)
151 || getFromAccount(ctx.state.account, a => a.admin)
152 }
153
todo.md
+2 -1
@@ -4,9 +4,10 @@
4 - frontend: hide closer button on login dialog accessing a protected resource, as it's no use
5 - easier nat life
6 - show public ip use, https://github.com/sindresorhus/public-ip
7 - - configure router with upnp. If it fails, suggest a guide
7 + - configure router with upnp. If it fails, suggest a guide. https://github.com/indutny/node-nat-upnp
8 - offer ddns registration/update
9 - use dialogs instead of side-forms on mobile (admin/fs+accounts)
10 +- blacklist of plugins (as a temporary measure until GitHub's intervention)
11 - admin/fs: sort items
12 - admin/fs: render virtual folders differently
13 - admin/config: hide advanced settings