Commit graph

92 commits

Author SHA1 Message Date
f33e25af8d admin: add account spam restriction (join/message gate)
Adds a narrower spam sanction alongside the existing account freeze: a
restricted account keeps every existing membership and conversation, but
cannot join new channels/groups (public join or invite link) and cannot
start a new conversation with a non-contact. Reachable both as a standalone
admin action and as a decision on a reported user's moderation case, with
the same idempotent-supersession and appeal wiring freeze already has.
2026-09-16 14:03:15 +01:00
ea17d7da0d admin: bypass the reserved-username blocklist at write time too
UpdateUsernameAdmin already skipped the reserved-word check in the
availability lookup, but UserStore.UpdateUsername's own write path
(replacePeerUsernameTx / CollectibleUsernameStore.SetEditableUsername)
enforces the same operator blocklist a second time, independently and
unconditionally. That second check is what was still rejecting an admin
handing out a word they'd deliberately reserved, with "username occupied".

Add UpdateUsernameAdmin/SetEditableUsernameAdmin bypass variants down the
write path (postgres and memory) and route users.Service's actual write
through them when the availability check was already bypassed.
2026-09-15 16:22:00 +01:00
206bde18e0 channels: give kicked/banned/promoted/transferred users a real qts so their client applies it
updateChannelParticipant carries the account's qts per the MTProto spec, but
the server always sent Qts: 0, so real clients silently discarded it as a
stale duplicate -- the banned/kicked user's channel never vanished locally
and no correct "removed by admin" message showed, even though the update was
delivered successfully at the transport layer.

Add a durable per-device qts queue (channel_participant_event_queue) sharing
its qts number space with the existing secret-chat queue (one qts sequence
per device, per spec), and use it to stamp a correct, monotonically
increasing qts on the update for every device of the affected user -- for
channel bans/kicks, admin promotion/demotion, and ownership transfer. A
device offline when it happened can now recover the event via
updates.getDifference instead of missing it permanently.
2026-09-15 15:43:52 +01:00
2b3f417b24 channels: clear stale banned rights when promoting a member to admin
EditChannelAdmin reactivates a previously kicked/banned member to Active
status but left BannedRights.ViewMessages set from the old ban, an
Active+banned-from-viewing state nothing else in the codebase expects.
TransferChannelOwnership's participant check trips on it and rejects the
transfer with PARTICIPANT_MISSING, even though the target is now a
visibly active admin.
2026-09-15 12:11:04 +01:00
f1c24e483c usernames: report reserved names as taken in the check paths too
account.checkUsername / channels.checkUsername / bots.checkUsername said a
reserved name was available and only updateUsername rejected it. Add the
blocklist check to peerUsernameAvailable (covers account + channel, both
backends) and to bots.Service.CheckUsername, so the client shows "username is
taken" immediately.
2026-09-14 12:05:28 +01:00
2bdb1ecf37 usernames: operator reserved-username blocklist
A plain blocklist for names like @support - separate from the collectible
system, so a reservation has no owner, no price and no "bought on Fragment"
badge.

- reserved_usernames table + migration.
- Enforced in replacePeerUsernameTx (the single editable-username write point:
  account.updateUsername, channels.updateUsername, @BotFather /setusername) and
  in the collectible mint path; a reserved name returns USERNAME_OCCUPIED.
- admin.Service: ReserveUsername / UnreserveUsername (journalled commands) and
  the ReservedUsernames listing.
- adminapi: /v1/reserved-usernames{,/reserve,/unreserve}.
- telesrv-admin panel + a "Reserved Usernames" page in the web UI (dist rebuilt).
- Postgres and in-memory store implementations; the memory registry gains an
  optional reserved-name check so tests exercise the same rule.
2026-09-14 12:04:43 +01:00
2014c98386 forum: let non-members preview topic replies in a public channel
ListChannelReplies used getChannelForMemberOrLinkedGuest, so messages.getReplies
was member-only. ListChannelHistory (flat history) uses getChannelForViewer and
already allows a public channel's non-members to preview it. The mismatch meant
that on a public forum you could preview the flat history but not the topics -
and after leaving, tdesktop's topic view got CHANNEL_PRIVATE and sat on
"Loading..." forever instead of rendering a preview.

Switch the primary channel lookup in ListChannelReplies (both stores) to the
viewer-scope path. Private channels still return CHANNEL_PRIVATE to non-members;
the broadcast comment-thread lookup is unchanged.
2026-09-14 11:58:47 +01:00
012f8a8d0e channels: force pre-history visible when a group gets a public username
New supergroups are created with "chat history for new members" hidden (the
client sets this right after creation, matching official Telegram). The
official server then forces it back to visible when the group is made public;
owpengram's UpdateUsername left the flag alone, leaving public groups in a
state where non-members (and post-join members) see no history at all.

UpdateUsername now clears pre_history_hidden whenever a non-empty username is
assigned, in the same transaction, with a matching admin-log event. Removing
the username leaves the flag untouched, so the creator can hide history again
once the group is private.
2026-09-14 11:57:12 +01:00
c7a77c23c8 forum: fix reply_to_top_id for replies inside a forum
resolveChannelReply applied discussion-thread logic (reply_to_top_id =
the replied-to message's own id) to forum replies. Replying to a General
message produced reply_to_top_id = <that id>, a topic no client can
resolve: the reply vanished from every topic view and reply-jump on
strict clients said "message doesn't exist".

Forum replies now inherit the target's topic via domain.ForumReplyTopicID
(target's topic, or its own id if it's a topic-create, else General), and
General (topic 1) is accepted as a valid virtual topic everywhere, so
sends carrying top_msg_id: 1 are no longer rejected. Non-forum discussion
threads are unchanged.
2026-09-14 11:55:23 +01:00
f0bf315bf3 forum: let non-members browse a public forum's topic list
ListForumTopics / GetForumTopicsByID / GeneralForumTopic gated on
membership while channel history uses the public-preview path, so a
public forum's topics (General included) were invisible until you joined.
Switch them to getChannelForViewer / channelForViewerLocked; private
forums and write paths keep the membership gate.
2026-09-14 11:55:23 +01:00
onysd
7c0639cf6a fix for comments in groups 2026-09-12 19:14:53 +03:00
onysd
2f1818d656 merged with fixes 2026-09-09 02:49:30 +03:00
onysd
7cd1f64d0d added messages templates 2026-09-01 14:40:06 +03:00
onysd
e8dc967e6a fixes 2026-09-01 12:50:18 +03:00
onysd
21a0856587 merged from gramsrv upstream 2026-09-01 12:06:31 +03:00
onysd
354128c106 added full gifts support 2026-08-07 10:13:11 +03:00
onysd
21d8e91756 removed all "paid" features - no more stars, gifts, or grams 2026-08-07 01:50:10 +03:00
onysd
2491088e81 added ability to broadcast 2026-08-06 15:22:36 +03:00
onysd
0b3c861057 updated bots,channels and supergroups lists and edit screens 2026-08-05 21:49:30 +03:00
onysd
40d49d5e97 added ability to change user info 2026-08-05 21:19:50 +03:00
onysd
ac6a50c5ff Merge remote-tracking branch 'upstream/main' into merge-gramsrv-9106877 2026-08-03 23:29:20 +03:00
iamxvbaba
3a123f38db fix(stars): sync filter transaction history by direction 2026-08-02 01:51:02 +08:00
iamxvbaba
35d3908660 fix: sync harden star gift upgrade projections 2026-08-01 00:12:01 +08:00
iamxvbaba
80c36a8ab4 fix: sync authorize monoforum message views 2026-07-30 20:09:47 +08:00
iamxvbaba
fd47dd765a fix(channels): sync monoforum suggested forwards and reactions 2026-07-30 16:05:34 +08:00
iamxvbaba
73cf6a8184 fix(channels): sync preserve locally cleared dialogs 2026-07-29 16:19:04 +08:00
iamxvbaba
e22fac1c3f fix(messages): sync preserve private dialogs after clearing history 2026-07-29 13:51:02 +08:00
iamxvbaba
5156b17c1b fix(usernames): sync index active collectible aliases 2026-07-28 16:22:34 +08:00
iamxvbaba
209a0d279b fix: sync harden channel reads and suggested approvals 2026-07-28 16:22:33 +08:00
iamxvbaba
037ce017d4 fix: sync support private chat content protection 2026-07-28 16:22:33 +08:00
Egor Egorov
fff8de783a
feat: add NFT usernames and bot verification (#22)
Implements collectible usernames, official verification workflows, and third-party bot verification after maintainer protocol and migration review.

The composite activity/moderation rating remains an admin-only read model; Telegram Stars Rating wire fields stay unset pending a dedicated official-semantics implementation.

Reviewed-Head: 2796345775ea0f908fb7734601e5e1dee4b653b9
Original-Head: fa082b892fd5180c9c9bc53c81c21cf5d250a75b

Co-authored-by: Egor Egorov <business.egor.sg@gmail.com>
2026-07-28 01:18:00 +08:00
iamxvbaba
5433801380 fix(stargifts): sync correct channel gift notifications 2026-07-27 22:18:31 +08:00
iamxvbaba
e75fd04a28 fix(messages): sync exact channel pinned counts 2026-07-27 00:17:25 +08:00
iamxvbaba
6b3eba6c5d feat(messages): sync saved message tags 2026-07-25 19:23:19 +08:00
onysd
b443ff0c73 Merge remote-tracking branch 'upstream/main' into merge-gramsrv-0e2fcdf9 2026-07-24 17:15:53 +03:00
iamxvbaba
0dcfaf0a65 fix: sync remote authorization revoke logout 2026-07-24 21:39:00 +08:00
iamxvbaba
b4aaf57d6b fix: sync public channel preview updates 2026-07-24 14:50:17 +08:00
iamxvbaba
cc76cd3679 fix: sync non-PTS privacy updates 2026-07-24 11:57:00 +08:00
iamxvbaba
9f467f4be7 feat: sync durable moderation and appeals 2026-07-24 11:56:59 +08:00
iamxvbaba
e1a95c7318 fix: sync contact phone privacy disclosure 2026-07-24 11:56:58 +08:00
iamxvbaba
234061ef83 fix(admin): close PR review blockers
Keep bot credentials out of durable command results, fail bot deletion closed when session revocation fails, reject invalid scam/fake states at every write boundary, and make direct collectible grants a single replayable PostgreSQL aggregate.

Also lock admin gift sender/message limits and add regression coverage for rollback, replay, moderation constraints, and credential redaction.
2026-07-23 13:29:04 +08:00
epilepticseizureee
313624eab2 admin: gift granting, collectible attribute/number control, and Layer 228 moderation tools
Admin console additions (Layer 228):
- Give Gifts: dedicated tab with sorted Lottie/TGS gift picker + inline form; grant any catalog gift to a user/channel from 777000 (no charge)
- Upgraded/collectible delivery: mint a unique gift with admin-selected model/pattern/backdrop and custom number, or random/auto (DB FK + UNIQUE(gift_id,num) enforce invariants)
- SCAM/FAKE flags for users/channels (migration 0136) with configurable profile warning (TELESRV_SCAM_WARNING/TELESRV_FAKE_WARNING)
- Support toggle, force channel settings incl. gigagroup (migration 0137), username management, cosmetic color/emoji-status
- Emoji admin tab (custom emoji list + document IDs + Lottie/TGS preview)
- Bot management; soft UI / dark theme
Wired through Router -> admin.Service -> adminapi -> BFF -> React panel (en/zh/ru).
2026-07-23 04:00:29 +03:00
A
401a8f148e fix: sync monoforum suggested post flow 2026-07-22 16:08:44 +08:00
A
d9875b5caa feat: sync bot setup and webhook diagnostics 2026-07-22 00:51:52 +08:00
A
d69a34a4a8 fix: sync StarGift lifecycle hardening 2026-07-21 15:47:55 +08:00
A
ebead9e98c feat: sync Telegram Login OIDC provider 2026-07-21 15:46:24 +08:00
A
1a2d03f529 feat: sync bot rich messages and inline menus 2026-07-21 15:44:43 +08:00
onysd
ebb0be38d9 Merge remote-tracking branch 'upstream/main' into merge-gramsrv-2965f5d 2026-07-20 23:43:51 +03:00
A
da6a57e1a3 feat: sync community aggregates
Sync telesrv 36eda30 (feat(communities): implement Layer 228 community aggregates).

Skipped telesrv docs changes per public sync rules; normalized the public appearance seed label.
2026-07-20 16:46:02 +08:00
A
f49c817def feat: sync ephemeral transient messages
Sync telesrv 570ccf8 (feat(ephemeral): implement Layer 228 transient messages).

Skipped telesrv docs changes per public sync rules; normalized the public appearance seed label.
2026-07-20 16:43:27 +08:00