mirror of
https://github.com/tiennm99/ccs.git
synced 2026-10-14 00:16:38 +00:00
fix(cliproxy): address edge cases in sync module
- Reset isSyncing flag in stopAutoSyncWatcher (prevents stale state) - Validate empty profile names in mapProfileToClaudeKey - Add whitespace validation in API routes (POST/DELETE /aliases) - Add Number.isInteger check for port validation - Wrap response.json() in try-catch for React hooks (handles non-JSON 502)
This commit is contained in:
1 parent
75a4e68f95
commit
9924b2fb25
5 files changed
+69
-22
No files matched your search
@@ -152,6 +152,9 @@ export async function stopAutoSyncWatcher(): Promise<void> {
|
||||
watcherInstance = null;
|
||||
log('Watcher stopped');
|
||||
}
|
||||
|
||||
// Reset flag to prevent stale state
|
||||
isSyncing = false;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -111,7 +111,11 @@ export function mapProfileToClaudeKey(profile: SyncableProfile): ClaudeKey | nul
|
||||
const baseUrl = env.ANTHROPIC_BASE_URL;
|
||||
|
||||
// Generate prefix from profile name (e.g., "glm" -> "glm-")
|
||||
const prefix = `${sanitizeProfileName(profile.name)}-`;
|
||||
const sanitizedName = sanitizeProfileName(profile.name);
|
||||
if (!sanitizedName || sanitizedName === '') {
|
||||
return null; // Skip profiles with invalid names
|
||||
}
|
||||
const prefix = `${sanitizedName}-`;
|
||||
|
||||
// Load model aliases for this profile
|
||||
const aliases = getProfileAliases(profile.name);
|
||||
|
||||
Reference in new issue
Block a user