Merge pull request #830 from ckken/pr/ccswitch-import-improvements
fix(ccswitch): improve import provider name and usage parsing
This commit is contained in:
@@ -1638,17 +1638,21 @@ const executeCcsImport = (row: ApiKey, clientType: 'claude' | 'gemini') => {
|
|||||||
headers: { "Authorization": "Bearer {{apiKey}}" }
|
headers: { "Authorization": "Bearer {{apiKey}}" }
|
||||||
},
|
},
|
||||||
extractor: function(response) {
|
extractor: function(response) {
|
||||||
|
const remaining = response?.remaining ?? response?.quota?.remaining ?? response?.balance;
|
||||||
|
const unit = response?.unit ?? response?.quota?.unit ?? "USD";
|
||||||
return {
|
return {
|
||||||
isValid: response.is_active || true,
|
isValid: response?.is_active ?? response?.isValid ?? true,
|
||||||
remaining: response.balance,
|
remaining,
|
||||||
unit: "USD"
|
unit
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
})`
|
})`
|
||||||
|
const providerName = (publicSettings.value?.site_name || 'sub2api').trim() || 'sub2api'
|
||||||
|
|
||||||
const params = new URLSearchParams({
|
const params = new URLSearchParams({
|
||||||
resource: 'provider',
|
resource: 'provider',
|
||||||
app: app,
|
app: app,
|
||||||
name: 'sub2api',
|
name: providerName,
|
||||||
homepage: baseUrl,
|
homepage: baseUrl,
|
||||||
endpoint: endpoint,
|
endpoint: endpoint,
|
||||||
apiKey: row.key,
|
apiKey: row.key,
|
||||||
|
|||||||
Reference in New Issue
Block a user