fix: sync WebK compatibility paths
This commit is contained in:
parent
766c5db992
commit
76bfc5100f
12 changed files with 387 additions and 8 deletions
|
|
@ -14,7 +14,7 @@ import (
|
|||
// (记录于 docs/compatibility-matrix.md)。
|
||||
func BuildConfig(dc int, ip string, port int, now time.Time, publicBaseURL string) *tg.Config {
|
||||
meURLPrefix := links.NormalizeBaseURL(publicBaseURL) + "/"
|
||||
return &tg.Config{
|
||||
config := &tg.Config{
|
||||
Date: int(now.Unix()),
|
||||
Expires: int(now.Add(time.Hour).Unix()),
|
||||
TestMode: false,
|
||||
|
|
@ -55,6 +55,8 @@ func BuildConfig(dc int, ip string, port int, now time.Time, publicBaseURL strin
|
|||
MessageLengthMax: 4096,
|
||||
WebfileDCID: dc,
|
||||
}
|
||||
config.SetReactionsDefault(&tg.ReactionEmoji{Emoticon: DefaultReactionEmoticon})
|
||||
return config
|
||||
}
|
||||
|
||||
// NearestDC 构造 help.getNearestDc 返回值。
|
||||
|
|
|
|||
20
internal/compat/tdesktop/config_test.go
Normal file
20
internal/compat/tdesktop/config_test.go
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
package tdesktop
|
||||
|
||||
import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/iamxvbaba/td/tg"
|
||||
)
|
||||
|
||||
func TestBuildConfigIncludesDefaultReaction(t *testing.T) {
|
||||
config := BuildConfig(2, "127.0.0.1", 2398, time.Unix(1, 0), "https://telesrv.net")
|
||||
reaction, ok := config.GetReactionsDefault()
|
||||
if !ok {
|
||||
t.Fatal("reactions_default is absent")
|
||||
}
|
||||
emoji, ok := reaction.(*tg.ReactionEmoji)
|
||||
if !ok || emoji.Emoticon != DefaultReactionEmoticon {
|
||||
t.Fatalf("reactions_default = %#v, want %q emoji", reaction, DefaultReactionEmoticon)
|
||||
}
|
||||
}
|
||||
|
|
@ -194,7 +194,7 @@ func UniqueGiftChatThemes(hash int64) tg.AccountChatThemesClass {
|
|||
}
|
||||
}
|
||||
|
||||
// WallPapers returns the read-only Default wallpaper catalog. User wallpaper
|
||||
// WallPapers returns the read-only default wallpaper catalog. User wallpaper
|
||||
// upload/save/install remains outside the current TDesktop compatibility scope.
|
||||
func WallPapers(hash int64) tg.AccountWallPapersClass {
|
||||
if hash == wallPapersHash {
|
||||
|
|
@ -256,13 +256,17 @@ func DefaultGroupPhotoEmojis() tg.EmojiListClass {
|
|||
const availableReactionsHash = 20260602
|
||||
const emptyStickerSetHash = 20260602
|
||||
|
||||
// DefaultReactionEmoticon is the account fallback used by config and the
|
||||
// built-in available-reactions catalog.
|
||||
const DefaultReactionEmoticon = "\U0001f44d"
|
||||
|
||||
type defaultReaction struct {
|
||||
emoticon string
|
||||
title string
|
||||
}
|
||||
|
||||
var defaultAvailableReactions = []defaultReaction{
|
||||
{emoticon: "\U0001f44d", title: "Thumbs Up"},
|
||||
{emoticon: DefaultReactionEmoticon, title: "Thumbs Up"},
|
||||
{emoticon: "\u2764\ufe0f", title: "Red Heart"},
|
||||
{emoticon: "\U0001f602", title: "Face With Tears of Joy"},
|
||||
{emoticon: "\U0001f62e", title: "Face With Open Mouth"},
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue