mirror of
https://gh-proxy.org/https://github.com/klinsmaya/new-api.git
synced 2026-11-08 01:17:09 +08:00
Use authorization code flow with PKCE and verified ID tokens for Telegram login, binding, and security verification. Preserve existing bindings and require administrator OAuth configuration. Keep the restricted WeChat first-enrollment session proof, fix missing-target authentication errors, and preserve callback requests after OAuth popups close.
27 lines
546 B
Go
27 lines
546 B
Go
package system_setting
|
|
|
|
import (
|
|
"strings"
|
|
|
|
"github.com/QuantumNous/new-api/setting/config"
|
|
)
|
|
|
|
type TelegramSettings struct {
|
|
ClientID string `json:"client_id"`
|
|
ClientSecret string `json:"client_secret"`
|
|
}
|
|
|
|
var telegramSettings TelegramSettings
|
|
|
|
func init() {
|
|
config.GlobalConfig.Register("telegram", &telegramSettings)
|
|
}
|
|
|
|
func GetTelegramSettings() *TelegramSettings {
|
|
return &telegramSettings
|
|
}
|
|
|
|
func (s *TelegramSettings) IsConfigured() bool {
|
|
return strings.TrimSpace(s.ClientID) != "" && strings.TrimSpace(s.ClientSecret) != ""
|
|
}
|