mirror of
https://github.com/tiennm99/ccs.git
synced 2026-10-13 00:14:15 +00:00
fix(hooks): deduplicate WebSearch hooks when saving via Dashboard
Add deduplicateCcsHooks() call to PUT /api/settings/:profile endpoint. This prevents WebSearch hooks from accumulating when users save settings via the Dashboard UI. Fixes #450
This commit is contained in:
1 parent
e653be06b1
commit
57d4b04c68
1 file changed
+5
@@ -18,6 +18,7 @@ import {
|
|||||||
resetAuthToDefaults,
|
resetAuthToDefaults,
|
||||||
} from '../../cliproxy';
|
} from '../../cliproxy';
|
||||||
import { regenerateConfig } from '../../cliproxy/config-generator';
|
import { regenerateConfig } from '../../cliproxy/config-generator';
|
||||||
|
import { deduplicateCcsHooks } from '../../utils/websearch/hook-utils';
|
||||||
import type { Settings } from '../../types/config';
|
import type { Settings } from '../../types/config';
|
||||||
|
|
||||||
const router = Router();
|
const router = Router();
|
||||||
@@ -136,6 +137,10 @@ router.put('/:profile', (req: Request, res: Response): void => {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Deduplicate CCS hooks to prevent accumulation (fixes #450)
|
||||||
|
// This handles cases where duplicate hooks were added by previous versions
|
||||||
|
deduplicateCcsHooks(settings as Record<string, unknown>);
|
||||||
|
|
||||||
const ccsDir = getCcsDir();
|
const ccsDir = getCcsDir();
|
||||||
|
|
||||||
// Check for missing required fields (warning, not blocking - runtime fills defaults)
|
// Check for missing required fields (warning, not blocking - runtime fills defaults)
|
||||||
|
|||||||
Reference in new issue
Block a user