fix(webui): add missing config fields to API handler
The POST /api/config endpoint was missing validation for several Advanced Server Settings fields, causing the sliders to fail silently. Added support for: rateLimitDedupWindowMs, maxConsecutiveFailures, extendedCooldownMs, capacityRetryDelayMs, maxCapacityRetries. Fixes #181 Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -287,7 +287,7 @@ export function mountWebUI(app, dirname, accountManager) {
|
|||||||
*/
|
*/
|
||||||
app.post('/api/config', (req, res) => {
|
app.post('/api/config', (req, res) => {
|
||||||
try {
|
try {
|
||||||
const { debug, logLevel, maxRetries, retryBaseMs, retryMaxMs, persistTokenCache, defaultCooldownMs, maxWaitBeforeErrorMs, maxAccounts, accountSelection } = req.body;
|
const { debug, logLevel, maxRetries, retryBaseMs, retryMaxMs, persistTokenCache, defaultCooldownMs, maxWaitBeforeErrorMs, maxAccounts, accountSelection, rateLimitDedupWindowMs, maxConsecutiveFailures, extendedCooldownMs, capacityRetryDelayMs, maxCapacityRetries } = req.body;
|
||||||
|
|
||||||
// Only allow updating specific fields (security)
|
// Only allow updating specific fields (security)
|
||||||
const updates = {};
|
const updates = {};
|
||||||
@@ -316,6 +316,21 @@ export function mountWebUI(app, dirname, accountManager) {
|
|||||||
if (typeof maxAccounts === 'number' && maxAccounts >= 1 && maxAccounts <= 100) {
|
if (typeof maxAccounts === 'number' && maxAccounts >= 1 && maxAccounts <= 100) {
|
||||||
updates.maxAccounts = maxAccounts;
|
updates.maxAccounts = maxAccounts;
|
||||||
}
|
}
|
||||||
|
if (typeof rateLimitDedupWindowMs === 'number' && rateLimitDedupWindowMs >= 1000 && rateLimitDedupWindowMs <= 30000) {
|
||||||
|
updates.rateLimitDedupWindowMs = rateLimitDedupWindowMs;
|
||||||
|
}
|
||||||
|
if (typeof maxConsecutiveFailures === 'number' && maxConsecutiveFailures >= 1 && maxConsecutiveFailures <= 10) {
|
||||||
|
updates.maxConsecutiveFailures = maxConsecutiveFailures;
|
||||||
|
}
|
||||||
|
if (typeof extendedCooldownMs === 'number' && extendedCooldownMs >= 10000 && extendedCooldownMs <= 300000) {
|
||||||
|
updates.extendedCooldownMs = extendedCooldownMs;
|
||||||
|
}
|
||||||
|
if (typeof capacityRetryDelayMs === 'number' && capacityRetryDelayMs >= 500 && capacityRetryDelayMs <= 10000) {
|
||||||
|
updates.capacityRetryDelayMs = capacityRetryDelayMs;
|
||||||
|
}
|
||||||
|
if (typeof maxCapacityRetries === 'number' && maxCapacityRetries >= 1 && maxCapacityRetries <= 10) {
|
||||||
|
updates.maxCapacityRetries = maxCapacityRetries;
|
||||||
|
}
|
||||||
// Account selection strategy validation
|
// Account selection strategy validation
|
||||||
if (accountSelection && typeof accountSelection === 'object') {
|
if (accountSelection && typeof accountSelection === 'object') {
|
||||||
const validStrategies = ['sticky', 'round-robin', 'hybrid'];
|
const validStrategies = ['sticky', 'round-robin', 'hybrid'];
|
||||||
|
|||||||
Reference in New Issue
Block a user