mirror of
https://github.com/tiennm99/ccs.git
synced 2026-10-19 04:15:45 +00:00
feat(config): support legacy profile target overrides
- add profile_targets map to legacy config typing - load target defaults for settings/default profiles from config.json - expose target metadata for legacy cliproxy variants in profile detection
This commit is contained in:
1 parent
8a2a7c3eb0
commit
9a63f9bd36
2 files changed
+12
No files matched your search
@@ -309,12 +309,15 @@ class ProfileDetector {
|
||||
|
||||
// Priority 2: Check user-defined CLIProxy variants (config.cliproxy section)
|
||||
const config = this.readConfig();
|
||||
const legacyTargetMap = (config as { profile_targets?: Record<string, TargetType> })
|
||||
.profile_targets;
|
||||
|
||||
if (config.cliproxy && config.cliproxy[profileName]) {
|
||||
const variant = config.cliproxy[profileName];
|
||||
return {
|
||||
type: 'cliproxy',
|
||||
name: profileName,
|
||||
target: variant.target,
|
||||
provider: variant.provider as CLIProxyProfileName,
|
||||
settingsPath: variant.settings,
|
||||
port: variant.port,
|
||||
@@ -333,6 +336,7 @@ class ProfileDetector {
|
||||
type: 'settings',
|
||||
name: profileName,
|
||||
settingsPath: config.profiles[candidate],
|
||||
target: legacyTargetMap?.[candidate],
|
||||
message: viaLegacyAlias
|
||||
? `Using legacy API profile "${candidate}" for "${profileName}".`
|
||||
: undefined,
|
||||
@@ -392,6 +396,8 @@ class ProfileDetector {
|
||||
|
||||
// Check if settings-based default exists
|
||||
const config = this.readConfig();
|
||||
const legacyTargetMap = (config as { profile_targets?: Record<string, TargetType> })
|
||||
.profile_targets;
|
||||
|
||||
if (config.profiles && config.profiles['default']) {
|
||||
const settingsPath = config.profiles['default'];
|
||||
@@ -409,6 +415,7 @@ class ProfileDetector {
|
||||
type: 'settings',
|
||||
name: 'default',
|
||||
settingsPath,
|
||||
target: legacyTargetMap?.['default'],
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user