feat: sync chatlist sharing support

This commit is contained in:
A 2026-07-06 21:06:33 +08:00
parent ec6e8fd13d
commit 2a9c12263f
62 changed files with 3408 additions and 212 deletions

View file

@ -4,13 +4,16 @@ import (
"time"
"github.com/gotd/td/tg"
"telesrv/internal/links"
)
// BuildConfig 构造 help.getConfig 返回的 tg.Config含自建 DC 的 DCOptions。
//
// 字段值取 Telegram 常见默认TDesktop 联调阶段按客户端实际需要微调
// (记录于 docs/compatibility-matrix.md
func BuildConfig(dc int, ip string, port int, now time.Time) *tg.Config {
func BuildConfig(dc int, ip string, port int, now time.Time, publicBaseURL string) *tg.Config {
meURLPrefix := links.NormalizeBaseURL(publicBaseURL) + "/"
return &tg.Config{
Date: int(now.Unix()),
Expires: int(now.Add(time.Hour).Unix()),
@ -47,7 +50,7 @@ func BuildConfig(dc int, ip string, port int, now time.Time) *tg.Config {
CallRingTimeoutMs: 90000,
CallConnectTimeoutMs: 30000,
CallPacketTimeoutMs: 10000,
MeURLPrefix: "https://telesrv.net/",
MeURLPrefix: meURLPrefix,
CaptionLengthMax: 1024,
MessageLengthMax: 4096,
WebfileDCID: dc,

View file

@ -7,7 +7,7 @@ import (
)
const (
appConfigHash = 15 // app config 内容变更时必须递增,否则缓存端只会收到 notModified。
appConfigHash = 16 // app config 内容变更时必须递增,否则缓存端只会收到 notModified。
countriesListHash = 1
timezonesListHash = 1
)
@ -44,6 +44,11 @@ func readMarkAppConfig(mapboxToken string) *tg.JSONObject {
{Key: "rich_message_posting", Value: &tg.JSONString{Value: "enabled"}},
// dialog_filters_enabled=trueTDesktop 据此(或已有文件夹)才显示 Settings→Folders 入口。
{Key: "dialog_filters_enabled", Value: &tg.JSONBool{Value: true}},
{Key: "chatlist_update_period", Value: &tg.JSONNumber{Value: 3600}},
{Key: "chatlist_invites_limit_default", Value: &tg.JSONNumber{Value: 3}},
{Key: "chatlist_invites_limit_premium", Value: &tg.JSONNumber{Value: 20}},
{Key: "chatlists_joined_limit_default", Value: &tg.JSONNumber{Value: 2}},
{Key: "chatlists_joined_limit_premium", Value: &tg.JSONNumber{Value: 20}},
{Key: "stories_stealth_future_period", Value: &tg.JSONNumber{Value: 1500}},
{Key: "stories_stealth_past_period", Value: &tg.JSONNumber{Value: 300}},
{Key: "stories_stealth_cooldown_period", Value: &tg.JSONNumber{Value: 10800}},