Skip to content

Commit

Permalink
fixed denyNewSessions config option (deny all new sessions when set)
Browse files Browse the repository at this point in the history
  • Loading branch information
pk910 committed Jun 22, 2023
1 parent 854cfbe commit 4d69d04
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/session/FaucetSession.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,12 @@ export class FaucetSession {

try {
await ServiceManager.GetService(ModuleManager).processActionHooks([
{prio: 1, hook: () => { // prio 1: check if faucet is in maintenance mode
if(faucetConfig.denyNewSessions) {
let denyMessage = typeof faucetConfig.denyNewSessions === "string" ? faucetConfig.denyNewSessions : "The faucet is currently not allowing new sessions";
throw new FaucetError("FAUCET_DISABLED", denyMessage);
}
}},
{prio: 5, hook: () => { // prio 5: get target address from userInput if not set provided by a module
let targetAddr = this.targetAddr || userInput.addr;
if(typeof targetAddr !== "string")
Expand Down

0 comments on commit 4d69d04

Please sign in to comment.