added default stickers
This commit is contained in:
parent
6c04fd8ed0
commit
ef73dfcd17
8308 changed files with 252010 additions and 0 deletions
|
|
@ -108,6 +108,9 @@ type Service struct {
|
|||
emailSignupPhonePrefixes []string
|
||||
// premiumGrantMonths 是新注册账号默认赠送的会员月数;0 表示关闭赠送。
|
||||
premiumGrantMonths int
|
||||
// stickerSets/defaultStickerSetID:新注册账号默认安装的贴纸集(见 WithDefaultStickerSet)。
|
||||
stickerSets userStickerSetInstaller
|
||||
defaultStickerSetID int64
|
||||
}
|
||||
|
||||
type loginEmailStore interface {
|
||||
|
|
@ -172,6 +175,20 @@ func WithPremiumGrant(months int) Option {
|
|||
}
|
||||
}
|
||||
|
||||
// userStickerSetInstaller 是 WithDefaultStickerSet 所需的最小写入面。
|
||||
type userStickerSetInstaller interface {
|
||||
InstallUserStickerSet(ctx context.Context, userID int64, setID int64, kind domain.StickerSetKind, archived bool, installedDate int) error
|
||||
}
|
||||
|
||||
// WithDefaultStickerSet 让新注册账号自动安装一个默认贴纸集(setID<=0 关闭)。
|
||||
// 存量账号的同等安装由迁移 20260721202007 一次性 backfill。
|
||||
func WithDefaultStickerSet(installer userStickerSetInstaller, setID int64) Option {
|
||||
return func(s *Service) {
|
||||
s.stickerSets = installer
|
||||
s.defaultStickerSetID = setID
|
||||
}
|
||||
}
|
||||
|
||||
func WithCodeTTL(ttl time.Duration) Option {
|
||||
return func(s *Service) {
|
||||
if ttl > 0 {
|
||||
|
|
@ -1249,6 +1266,11 @@ func (s *Service) SignUp(ctx context.Context, auth domain.Authorization, phone,
|
|||
if err := s.bind(ctx, auth, u.ID); err != nil {
|
||||
return domain.User{}, domain.Message{}, err
|
||||
}
|
||||
// 给新账号预装一个默认贴纸集,让贴纸面板不至于空空如也。best-effort:装不上不阻断注册。
|
||||
// 存量账号的同等安装见迁移 20260721202007。
|
||||
if s.stickerSets != nil && s.defaultStickerSetID > 0 {
|
||||
_ = s.stickerSets.InstallUserStickerSet(ctx, u.ID, s.defaultStickerSetID, domain.StickerSetKindStickers, false, int(time.Now().Unix()))
|
||||
}
|
||||
loginMessage := domain.Message{}
|
||||
// A new account has no owner/dialog at issuance time. Only the development
|
||||
// phone/App registration path creates its bootstrap 777000 message here;
|
||||
|
|
|
|||
|
|
@ -326,6 +326,10 @@ type Config struct {
|
|||
// 存量账号的一次性赠送由迁移 0094 backfill,不受该配置影响。
|
||||
PremiumGrantMonths int
|
||||
|
||||
// DefaultStickerSetID 是新注册账号自动安装的默认贴纸集 id;<=0 关闭。
|
||||
// 存量账号的一次性安装由迁移 20260721202007 backfill,不受该配置影响。
|
||||
DefaultStickerSetID int64
|
||||
|
||||
// PasskeyRPID 是 passkey(WebAuthn) relying-party id(域名)。服务端据此校验
|
||||
// authData.rpIdHash;真机经 Android CredentialManager 时须与托管 assetlinks.json
|
||||
// 的公网域名一致(详见 docs)。本地/软件 authenticator 验证用任意稳定值即可。
|
||||
|
|
@ -616,6 +620,7 @@ func Load() (Config, error) {
|
|||
CallExpiryInterval: envDurationOr("TELESRV_CALL_EXPIRY_INTERVAL", time.Second),
|
||||
|
||||
PremiumGrantMonths: envIntOr("TELESRV_PREMIUM_GRANT_MONTHS", 3),
|
||||
DefaultStickerSetID: envInt64Or("TELESRV_DEFAULT_STICKER_SET_ID", 773947703670341644),
|
||||
PasskeyRPID: envOr("TELESRV_PASSKEY_RP_ID", "telesrv.net"),
|
||||
PasskeyAllowedOrigins: envListOr("TELESRV_PASSKEY_ALLOWED_ORIGINS", nil),
|
||||
StarsStartingGrant: int64(envIntOr("TELESRV_STARS_STARTING_GRANT", 1000)),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue