Skip to content

Fix Sub2API account sync with redacted credentials#7

Merged
ZyphrZero merged 1 commit into
ZyphrZero:mainfrom
JokerIvanZK:fix/sub2api-redacted-account-sync
May 26, 2026
Merged

Fix Sub2API account sync with redacted credentials#7
ZyphrZero merged 1 commit into
ZyphrZero:mainfrom
JokerIvanZK:fix/sub2api-redacted-account-sync

Conversation

@JokerIvanZK

Copy link
Copy Markdown

Summary

  • support Sub2API v0.1.129 redacted account list responses by honoring credentials_status.has_access_token
  • import OpenAI OAuth accounts through the admin data export endpoint before falling back to the legacy detail endpoint
  • keep local account import access-token-only and discard refresh/id tokens from remote responses

Root cause

Sub2API v0.1.129 redacts sensitive credentials in the normal admin account list/detail payloads. The existing Go importer only kept accounts that exposed raw credentials.access_token, so OpenAI OAuth accounts with credentials_status.has_access_token=true were filtered out and sync showed 0 accounts.

Verification

  • gofmt -w internal/service/sub2api.go internal/service/sub2api_test.go
  • GOPROXY=https://goproxy.cn,direct go test ./internal/service -run 'TestSub2API'
  • local runtime self-test with a mock Sub2API v0.1.129 response: groups loaded, redacted accounts listed, import called /api/v1/admin/accounts/data?ids=...&include_proxies=false, and SQLite account storage contained only the access token
  • user verified the fix against a real Sub2API v0.1.129 server through the local runtime
  • GOPROXY=https://goproxy.cn,direct go test ./... was attempted after building frontend assets; all affected packages passed, but an existing internal/config test fails on macOS because t.TempDir() resolves as /var/... while os.Getwd() returns /private/var/...

Fixes basketikun#187
Fixes basketikun#189

@ZyphrZero ZyphrZero merged commit e362532 into ZyphrZero:main May 26, 2026
ZyphrZero added a commit that referenced this pull request May 26, 2026
Stuck queued runs from closed PRs (e.g. PR #7 run 26442447544) were
holding the workflow scheduler. Adding cancel-in-progress lets new
pushes on the same ref supersede prior runs and lets GitHub clear
zombie entries.
sofs2005 added a commit to sofs2005/chatgpt2api that referenced this pull request Jun 16, 2026
- ZyphrZero#7 web search compatible interface (backend + protocol)
- basketikun#8 image edit mask alpha compositing for /v1/images/edits
- All tests passing, TDD workflow followed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

sub2api同步找不到账号,数量提示为0 从sub2api同步不到账号了

2 participants