Cohee
645b8063e1
Intellectual Webpack cache management ( #5295 )
...
* Intellectual Webpack cache management
* Check if webpackRoot exists.
* Wrap webpack directory reading in try-catch
* Enhance cache pruning console output
2026-03-15 23:30:57 +02:00
HimeHina
df0e1256e6
Fix: HTTP Basic Auth fails when password contains colons ( #5153 )
...
* Fix: HTTP Basic Auth fails when password contains colons
The credentials in HTTP Basic Auth are formatted as base64(username:password).
Per RFC 7617, the username must not contain a colon, but the password can.
The previous code used `.split(':')` which splits on all colons, truncating
passwords that contain ':' characters. Fix by splitting only on the first colon.
* Use spread syntax for credential parsing
2026-02-14 17:44:54 +02:00
Wolfsblvt
bc06f3e3e0
Refactor: make whitelist validation a bit more robust ( #4757 )
...
* refactor: extract IP whitelist validation into helper function
- Added isIPInWhitelist helper with error handling for individual whitelist entry checks
- Replaced inline whitelist matching logic with reusable function calls
- Added JSDoc type annotations and error logging for failed IP matching attempts
* refactor: simplify whitelist validation with upfront filtering
- Moved IP validation to startup time instead of per-request checking
- Extracted validateWhitelist function to filter invalid entries once at initialization
- Simplified isIPInWhitelist by removing redundant error handling after validation
* fix: correct IP whitelist matching to use parsed CIDR notation
2025-11-12 21:13:58 +02:00
Cohee
20c7286ea1
Webpack: Only serve lib.js under root path
2025-10-09 01:22:10 +03:00
Cohee and Copilot
d134abd50e
Server: Add host whitelisting ( #4476 )
...
* Add host whitelisting middleware
* Add prompt to enable hostWhitelist
* perf: Freeze config array
* Update src/middleware/hostWhitelist.js
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com >
* perf: Add max known hosts limit
* Add validation warning disable hint
* Add conditional host whitelist middleware based on SSL configuration
* Check for cache exhaustion before logging
* Revert "Add conditional host whitelist middleware based on SSL configuration"
This reverts commit 968104c6f4 .
---------
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com >
2025-09-04 20:52:23 +03:00
cloudskytian
d1a82c85a5
Console access log output is now controlled by enableAccessLog
2025-07-24 19:16:21 +08:00
Cohee
c627d77c46
Add toggle and user agent filter for CacheBuster middleware ( #4301 )
...
* Add toggle and user agent filter for CacheBuster middleware
Closes #4290 [BUG] SillyTavern takes ~45 seconds to load initially
* Use single instance of CacheBuster class
* Cache config values
* Consistent log header
* Remove unnecessary empty line at the beginning of byaf.js
2025-07-24 00:45:42 +03:00
Cohee
4efed978f0
Enhance file name validation by allowing objects with toString method
2025-06-28 22:36:21 +03:00
Cohee
947a307b25
Update function comment
2025-03-01 20:25:55 +02:00
Cohee
61132dd7b9
Set default for whitelistDockerHosts to true
2025-03-01 20:25:00 +02:00
Cohee
1d995fb92d
Rewrite to only consider Docker
2025-03-01 20:22:33 +02:00
Cohee
8aa7ed8635
Rewrite whitelist resolve logic to skip unresolved hosts from whitelist
2025-03-01 19:57:36 +02:00
Cohee
7e8471f28f
Enhance logging for resolved whitelist hostnames with color formatting
2025-03-01 00:30:00 +02:00
Cohee
60e8ffbf90
Improve logging in resolveHostnames function to provide clearer output for resolved IP addresses
2025-02-28 00:39:32 +02:00
Cohee
50ad31f8e8
Update the resolveHostnames function to clarify its behavior and improve documentation
2025-02-28 00:36:27 +02:00
Cohee
978b2cdb21
Refactor whitelist middleware to return a promise and update server.js to handle async initialization
2025-02-28 00:25:59 +02:00
Cohee
0bc4396427
Resolve hostnames from whitelist
2025-02-27 23:14:57 +02:00
Cohee
e7fcd0072b
Refactor server startup
2025-02-26 14:46:54 +00:00
Stephen Brown
6947ca7433
Show forwarded IP in whitelist denied message
2025-02-25 23:58:12 +00:00
Cohee
252ae9f534
Update access log configuration to enforce boolean type
2025-02-22 20:20:23 +02:00
Cohee
a73dfa7586
Merge branch 'staging' into immutable-config
2025-02-22 20:15:13 +02:00
Cohee
3e26b93971
Do not register whitelist middleware if whitelist disabled
2025-02-22 14:14:40 +02:00
KevinSun
42f850239f
fix(middleware): skip logging for blocked connections to specific paths
2025-02-22 19:42:38 +08:00
KevinSun
f755c3d4cb
refactor(middleware): rename accessLogger to accessLogWriter
2025-02-21 23:56:31 +08:00
KevinSun
9c3e8c935b
refactor(Middleware): only mount accessLogger when listen is enabled
2025-02-21 23:49:15 +08:00
KevinSun
bfc609c2a8
fix(middleware): skip New connection message and access.log writes for localhost
2025-02-21 22:17:12 +08:00
KevinSun
db500188d8
feat(middleware): add separate access log middleware with config option
2025-02-21 20:32:23 +08:00
Cohee
00bb36f764
Fix setting basic auth creds with env
2025-02-20 22:38:47 +02:00
Cohee
3f03936125
Add config value type converters for numbers and booleans
2025-02-20 21:53:48 +02:00
Cohee
380bd4ef4b
refactor: update runWebpackCompiler to accept options object
2025-02-19 22:03:43 +02:00
Cohee
1ef5154770
Merge branch 'staging' into webpack-cache-dataroot
2025-02-19 21:34:02 +02:00
Cohee
441e5c6f7e
Move webpack cache to data root
2025-02-17 23:41:59 +02:00
Cohee
da3b620f74
Move access.log to data root
2025-02-17 22:58:06 +02:00
Cohee
fd38ca503a
Evict cache per user agent
2025-02-15 23:05:08 +02:00
Cohee
bae02a44ed
Add cache buster middleware to clear browser cache on server restart
2025-02-15 12:56:43 +02:00
Cohee
0c8a11e28b
Further loglevel updates
...
1. Fix missed endpoints
2. Exclude console.log from loglevel
2025-02-02 15:40:37 +02:00
Cohee
9aac5a22f1
Defer middleware HTML file reads
2025-01-26 01:46:30 +02:00
Cohee
44ad69ceca
Merge pull request #3342 from Spappz/staging
...
Allow customisation of the 403 page
2025-01-25 23:00:23 +02:00
Spappz
6099ffece1
No exceptions on missing error webpages
...
- Create a `safeReadFileSync()` function in `src/utils.js` to wrap around `fs.readFileSync()`
- Migrate error-webpage loads to use `safeReadFileSync()`, with default values of an empty string
- Move the 404 error middleware to explicitly only be called *after* extensions are registered
2025-01-25 20:29:31 +00:00
Spappz
538d66191e
add 401 error page for basicAuth mode
...
Most modern browsers don't actually show users 401 responses, but it doesn't hurt to have it in there anyway ¯\_(ツ)_/¯
2025-01-25 03:40:47 +00:00
Spappz
928487985d
defer 403 HTML to file
2025-01-25 03:38:52 +00:00
Cohee
0937f44f39
Validate avatar_url field with a middleware ( #3314 )
...
* Validate avatar_url field with a middleware
* Fix validating wrong endpoint
2025-01-24 23:47:32 +02:00
Spappz
075368b5ae
Ensure Handlebars template is only compiled once
2025-01-24 19:56:19 +00:00
Spappz
90459116e3
woohoo
2025-01-24 03:39:05 +00:00
Cohee
49fb2f4d79
Declare compiler in the inner scope #3272
2025-01-07 20:24:57 +02:00
Cohee
5af7852465
Null Webpack compiler after run
...
Fixes #3272
2025-01-07 19:54:31 +02:00
Cohee
dd273a7727
Docker build: Pre-compile public libraries
2025-01-03 12:30:55 +00:00
Cohee
7fbff41329
Unasync route handler
2024-11-29 13:14:40 +00:00
Cohee
53514b5e1a
Prettify compilation console logs
2024-11-29 13:12:46 +00:00
Cohee
768b3e48f7
Remove webpack watch unhook
2024-11-29 00:25:31 +02:00