init repo

This commit is contained in:
VaalaCat
2024-08-28 00:02:28 +08:00
committed by vaalacat
commit 13148b95e3
97 changed files with 10214 additions and 0 deletions

40
rpc/manager.go Normal file
View File

@@ -0,0 +1,40 @@
package rpc
import (
"github.com/Timothylock/go-signin-with-apple/apple"
"github.com/nose7en/ToyBoomServer/config"
)
type Manager interface {
AppleCli() *AppleClient
}
var (
mgr Manager = (*manager)(nil)
)
func GetManager() Manager {
return mgr
}
func InitManager() {
mgr = &manager{}
}
type manager struct {
appleCli *AppleClient
}
func (m *manager) AppleCli() *AppleClient {
if m.appleCli == nil {
m.appleCli = &AppleClient{
Client: apple.New(),
teamID: config.GetSettings().AppleCfg.TeamID,
clientID: config.GetSettings().AppleCfg.ClientID,
keyID: config.GetSettings().AppleCfg.KeyID,
secret: config.GetSettings().AppleCfg.Secret,
}
}
return m.appleCli
}