feat(providers): account calls (auth/refresh/credits) egress on the local IP

Now only the generate/video submit uses proxy.url; cookie-exchange/login, token refresh, credit-balance and project/session bootstrap all go direct. Also splits adobe GenerateVideo (submit=proxy, poll/download=local). Verified live: adobe gpt 1K cookie-exchange via local IP, submit 23.244.30.102 (proxy) vs local 76.209.9.65, 2.0MB PNG. Build+vet pass.
This commit is contained in:
2026-07-09 16:36:04 +08:00
parent 6c2a942a88
commit 622bc9ba9a
7 changed files with 23 additions and 17 deletions
+11 -6
View File
@@ -74,7 +74,7 @@ func (c *Client) SetProxy(proxy string) {
}
func (c *Client) ExchangeCookie(ctx context.Context, cookie string) (*CookieExchangeResult, error) {
sess, err := c.newTLSClient()
sess, err := c.newDirectTLSClient()
if err != nil {
return nil, err
}
@@ -234,7 +234,12 @@ func (c *Client) GenerateImage(ctx context.Context, token, modelID, prompt, aspe
// in meta["video_url"] — used by the async /v1/videos job, which proxies that URL
// on /content instead of persisting the file.
func (c *Client) GenerateVideo(ctx context.Context, token, engine, prompt, aspectRatio string, durationSeconds int, resolution, referenceMode, upstreamModel string, blobIDs []string, downloadResult bool) ([]byte, map[string]any, error) {
sess, err := c.newTLSClient()
// Only the submit goes through the proxy; polling + download run on the local IP.
submitSess, err := c.newTLSClient()
if err != nil {
return nil, nil, err
}
pollSess, err := c.newDirectTLSClient()
if err != nil {
return nil, nil, err
}
@@ -244,12 +249,12 @@ func (c *Client) GenerateVideo(ctx context.Context, token, engine, prompt, aspec
if engine == "firefly-video" {
endpoint = fireflyVideoSubmitURL
}
respBody, pollURL, err := c.submitVideo(ctx, sess, token, endpoint, payload)
respBody, pollURL, err := c.submitVideo(ctx, submitSess, token, endpoint, payload)
if err != nil {
return nil, nil, err
}
_ = respBody
meta, data, pollErr := c.pollVideo(ctx, sess, token, pollURL, downloadResult)
meta, data, pollErr := c.pollVideo(ctx, pollSess, token, pollURL, downloadResult)
if pollErr != nil {
return nil, nil, pollErr
}
@@ -261,7 +266,7 @@ func (c *Client) FetchAccountProfile(ctx context.Context, token string) (map[str
if token == "" {
return map[string]any{}, nil
}
sess, err := c.newTLSClient()
sess, err := c.newDirectTLSClient()
if err != nil {
return nil, err
}
@@ -346,7 +351,7 @@ func (c *Client) FetchCreditsBalance(ctx context.Context, token string) (map[str
}, nil
}
sess, err := c.newTLSClient()
sess, err := c.newDirectTLSClient()
if err != nil {
return nil, err
}