account.ignore_limits

Massimo Melina committed Jan 10, 2022 at 11:01 UTC b70682cc14fb9771ddbdc3a9205d49037cb55ba3
4 files changed +12 -3
README.md
+10 -1
@@ -81,9 +81,18 @@ accounts:
81 group1:
82 ```
83
84 -As soon as the file is read HFS will encrypt passwords in a non-reversible way.
84 +As soon as the file is read HFS will encrypt passwords in a non-reversible way. It means that `password` property is replaced with an encrypted property: `srp`.
85 For this reason HFS needs that your accounts file is writable.
86
87 +As you can see in the example, `group1` has no password. This implies that you cannot log in as `group1`, but still `group1` exists and its purpose is to
88 +gather multiple accounts and refer to them collectively as `group1`, so you can quickly share powers among several accounts.
89 +
90 +## Account options
91 +
92 +Other options you can define as properties of an account:
93 +
94 +- `ignore_limits` to ignore speed limits. Default is `false`.
95 +
96 # Building instructions
97
98 0. Install [Node.js](https://nodejs.org/) 16+
src/perm.ts
+1
@@ -16,6 +16,7 @@ interface Account {
16 hashedPassword?: string
17 srp?: string
18 belongs?: string[]
19 + ignore_limits?: boolean
20 }
21 interface Accounts { [username:string]: Account }
22
src/throttler.ts
+1 -1
@@ -16,7 +16,7 @@ export function throttler(): Koa.Middleware {
16 return async (ctx, next) => {
17 await next()
18 const { body } = ctx
19 - if (!body || !(body instanceof Readable))
19 + if (!body || !(body instanceof Readable) || ctx.account?.ignore_limits)
20 return
21 const ipGroup = getOrSet(ip2group, ctx.ip, ()=> {
22 const tg = new ThrottleGroup(Infinity, mainThrottleGroup)
todo.md
-1
@@ -8,7 +8,6 @@
8 - search and login dialogs should push to history so that mobile can use back button to close them
9 - node.comment
10 - config: max connections (total/per-ip)
11 -- account.ignoreLimits
11 - account.redirect
12 - config: bans
13 - config: min disk space