mirror of
https://github.com/sartoopjj/thefeed.git
synced 2026-05-19 05:54:34 +03:00
feat: add TitlesChannel (0xFFF9) for per-channel display names
- Add dedicated TitlesChannel (0xFFF9) following the VersionChannel pattern - Server encodes name→title map via EncodeTitlesData/DecodeTitlesData - Metadata wire format unchanged for backward compatibility with old clients - All three fetchers (public Telegram, MTProto, X/Nitter) extract and store display names - Client fetches TitlesChannel with a 10s deadline; falls back to channel handles gracefully on old servers - Old clients are unaffected — they never query 0xFFF9
This commit is contained in:
+18
-2
@@ -999,8 +999,16 @@ func (s *Server) refreshMetadataOnly() {
|
||||
return
|
||||
}
|
||||
|
||||
titles, _ := fetcher.FetchTitles(ctx)
|
||||
channels := meta.Channels
|
||||
for i := range channels {
|
||||
if t, ok := titles[channels[i].Name]; ok && t != "" {
|
||||
channels[i].DisplayName = t
|
||||
}
|
||||
}
|
||||
|
||||
s.mu.Lock()
|
||||
s.channels = meta.Channels
|
||||
s.channels = channels
|
||||
s.telegramLoggedIn = meta.TelegramLoggedIn
|
||||
s.nextFetch = meta.NextFetch
|
||||
s.metaFetchedAt = time.Now()
|
||||
@@ -1088,8 +1096,16 @@ func (s *Server) refreshChannel(channelNum int) {
|
||||
}
|
||||
return
|
||||
}
|
||||
titles, _ := fetcher.FetchTitles(ctx)
|
||||
channels := meta.Channels
|
||||
for i := range channels {
|
||||
if t, ok := titles[channels[i].Name]; ok && t != "" {
|
||||
channels[i].DisplayName = t
|
||||
}
|
||||
}
|
||||
meta.Channels = channels
|
||||
s.mu.Lock()
|
||||
s.channels = meta.Channels
|
||||
s.channels = channels
|
||||
s.telegramLoggedIn = meta.TelegramLoggedIn
|
||||
s.nextFetch = meta.NextFetch
|
||||
s.metaFetchedAt = time.Now()
|
||||
|
||||
Reference in New Issue
Block a user