Unverified Commit 421b4c0a authored by Wesley Liddick's avatar Wesley Liddick Committed by GitHub
Browse files

Merge pull request #830 from ckken/pr/ccswitch-import-improvements

fix(ccswitch): improve import provider name and usage parsing
parents cd69a7cb 97bf1d85
...@@ -1638,17 +1638,21 @@ const executeCcsImport = (row: ApiKey, clientType: 'claude' | 'gemini') => { ...@@ -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,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment