| 68 | const ipDetails = forwardedIp | 72 | const ipDetails = forwardedIp |
| 69 | ? `${clientIp} (forwarded from ${forwardedIp})` | 73 | ? `${clientIp} (forwarded from ${forwardedIp})` |
| 70 | : clientIp; | 74 | : clientIp; |
| | 75 | |
| | 76 | if (!noLogPaths.includes(req.path)) { |
| 71 | console.warn( | 77 | console.warn( |
| 72 | color.red( | 78 | color.red( |
| 73 | `Blocked connection from ${clientIp}; User Agent: ${userAgent}\n\tTo allow this connection, add its IP address to the whitelist or disable whitelist mode by editing config.yaml in the root directory of your SillyTavern installation.\n`, | 79 | `Blocked connection from ${clientIp}; User Agent: ${userAgent}\n\tTo allow this connection, add its IP address to the whitelist or disable whitelist mode by editing config.yaml in the root directory of your SillyTavern installation.\n`, |
| 74 | ), | 80 | ), |
| 75 | ); | 81 | ); |
| | 82 | } |
| | 83 | |
| 76 | return res.status(403).send(forbiddenWebpage({ ipDetails })); | 84 | return res.status(403).send(forbiddenWebpage({ ipDetails })); |
| 77 | } | 85 | } |
| 78 | next(); | 86 | next(); |