fix: sync WebK compatibility paths
This commit is contained in:
parent
766c5db992
commit
76bfc5100f
12 changed files with 387 additions and 8 deletions
|
|
@ -13,9 +13,7 @@ import (
|
|||
|
||||
// registerHelp 注册 help.* RPC handler(DC 配置、最近 DC)。
|
||||
func (r *Router) registerHelp(d *tg.ServerDispatcher) {
|
||||
d.OnHelpGetConfig(func(ctx context.Context) (*tg.Config, error) {
|
||||
return tdesktop.BuildConfig(r.cfg.DC, r.cfg.IP, r.cfg.Port, r.clock.Now(), r.cfg.PublicBaseURL), nil
|
||||
})
|
||||
d.OnHelpGetConfig(r.onHelpGetConfig)
|
||||
d.OnHelpGetNearestDC(func(ctx context.Context) (*tg.NearestDC, error) {
|
||||
return tdesktop.NearestDC(r.cfg.DC), nil
|
||||
})
|
||||
|
|
@ -81,6 +79,29 @@ func (r *Router) registerHelp(d *tg.ServerDispatcher) {
|
|||
d.OnHelpGetPremiumPromo(r.onHelpGetPremiumPromo)
|
||||
}
|
||||
|
||||
func (r *Router) onHelpGetConfig(ctx context.Context) (*tg.Config, error) {
|
||||
config := tdesktop.BuildConfig(r.cfg.DC, r.cfg.IP, r.cfg.Port, r.clock.Now(), r.cfg.PublicBaseURL)
|
||||
userID, authorized, err := r.currentUserID(ctx)
|
||||
if err != nil {
|
||||
return nil, internalErr()
|
||||
}
|
||||
if !authorized || userID == 0 {
|
||||
return config, nil
|
||||
}
|
||||
if svc, ok := r.deps.Account.(accountReactionSettingsReader); ok {
|
||||
settings, err := svc.GetReactionSettings(ctx, userID)
|
||||
if err != nil {
|
||||
return nil, internalErr()
|
||||
}
|
||||
reaction := tgMessageReaction(settings.DefaultReaction)
|
||||
if reaction == nil {
|
||||
return nil, internalErr()
|
||||
}
|
||||
config.SetReactionsDefault(reaction)
|
||||
}
|
||||
return config, nil
|
||||
}
|
||||
|
||||
// onHelpDismissSuggestion 为 DrKLO 改号成功后的 suggestion 清理提供有界兼容。
|
||||
// Android 会先把 suggestion 从本地状态删除,再发送该 RPC,且 generic 500 会被
|
||||
// 连接层持续重试。当前 server 不发布 pending suggestions,故非空 dismissal
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue