* Send a 403 ban response.
(res: Response, ban: Ban)
| 138 | * Send a 403 ban response. |
| 139 | */ |
| 140 | function sendBanResponse(res: Response, ban: Ban): void { |
| 141 | const body: Record<string, unknown> = { |
| 142 | error: 'Account suspended', |
| 143 | reason: ban.reason, |
| 144 | }; |
| 145 | if (ban.expires_at) { |
| 146 | body.expires_at = ban.expires_at; |
| 147 | } |
| 148 | res.status(403).json(body); |
| 149 | } |
| 150 | |
| 151 | function hashSessionCookie(cookie: string): string { |
| 152 | return createHash('sha256').update(cookie).digest('hex'); |