Based on QuantumNous/new-api v1.0.0-rc.36 (shallow history squashed). - CNY quota display mode: RMB-denominated top-up and crediting across Epay/Waffo channels - New CheckinButton in both authenticated and public headers (Turnstile supported) - New /subscribe page with public plan snapshot, Alipay/balance payment, auto group upgrade/reset - New /docs 12-section beginner guide with anchor navigation - New home PromoBanner linking to /docs; i18n synced (en/zh/zh-TW/fr/ja/ru/vi) - README: document custom features, live demo https://ai.88531.cn
31 lines
798 B
Go
31 lines
798 B
Go
package codex
|
|
|
|
import (
|
|
"errors"
|
|
|
|
"github.com/QuantumNous/new-api/common"
|
|
)
|
|
|
|
type OAuthKey struct {
|
|
IDToken string `json:"id_token,omitempty"`
|
|
AccessToken string `json:"access_token,omitempty"`
|
|
RefreshToken string `json:"refresh_token,omitempty"`
|
|
|
|
AccountID string `json:"account_id,omitempty"`
|
|
LastRefresh string `json:"last_refresh,omitempty"`
|
|
Email string `json:"email,omitempty"`
|
|
Type string `json:"type,omitempty"`
|
|
Expired string `json:"expired,omitempty"`
|
|
}
|
|
|
|
func ParseOAuthKey(raw string) (*OAuthKey, error) {
|
|
if raw == "" {
|
|
return nil, errors.New("codex channel: empty oauth key")
|
|
}
|
|
var key OAuthKey
|
|
if err := common.Unmarshal([]byte(raw), &key); err != nil {
|
|
return nil, errors.New("codex channel: invalid oauth key json")
|
|
}
|
|
return &key, nil
|
|
}
|