Commit graph

161 commits

Author SHA1 Message Date
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
d83034e8dc admin: allow assigning a reserved username to a user via the admin console
Add users.Service.UpdateUsernameAdmin, which skips the
config.ReservedUsernames block that self-service UpdateUsername enforces.
Operators need to be able to hand a reserved word to a specific account
even though regular users can't claim it themselves.
2026-09-15 12:04:26 +01:00
669e515061 botfather: fix two remaining call sites after branding rebase
Some checks are pending
CI / Go tests (push) Waiting to run
CI / Admin web build (push) Waiting to run
CI / Grammy store bot (push) Waiting to run
CI / Docker main topology smoke (push) Waiting to run
botFatherHelpText became a func() string during the rebase onto upstream
(matching upstream's own runtime-configurable-branding-safe pattern); two
call sites still referenced it as a bare value.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-09-14 12:12:13 +01:00
6435406690 account: stop rotating the SRP challenge on every getPassword read
GetPassword minted a brand-new random SRP server secret and B on every call
while only ever assigning SRPID once (when zero). Two account.getPassword
calls in a row -- e.g. a settings screen refreshing state, then the transfer-
ownership dialog's own cloudPassword().reload() moments later -- silently
invalidated each other's B with no signal the client could detect (SRPID
unchanged), so a password check built from the first response's B failed
with PASSWORD_HASH_INVALID even though the typed password was correct.

The challenge now stays stable across reads and only rotates when it's
missing entirely; UpdatePasswordSettings/RecoverPassword already mint their
own fresh challenge whenever the password actually changes.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-09-14 12:06:46 +01:00
4ca35d2000 users: never cache a deleted user's base row
redisstore.userBaseValue has no Deleted/DeletedAt/Status field, so caching a
deleted user silently reset Deleted back to false (and Status to the zero
UserStatusUnknown) on every round trip. That never self-healed: each later
cache miss reloaded the correctly tombstoned DB row and immediately
re-corrupted it on write, so once anyone looked a deleted account up, it kept
showing a blank name with "last seen recently" instead of "Deleted Account".

Keep deleted users off the base cache entirely so lookups always hit the
authoritative store, and stop presence overlay from touching a Deleted user's
Status at all as defense in depth.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-09-14 12:06:46 +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
94b3113a37 botfather: /start <bot> opens that bot's menu
The "Manage Bot" button on a bot's profile deep-links to @BotFather with
start=<bot username>. parseBotCommand dropped the argument, so /start <bot>
just replied with the generic greeting instead of the per-bot menu.

Route "/start <arg>" to the bot's "What do you want to do?" screen (same as
/mybots then tapping the bot) when <arg> names one of the sender's own bots by
username or id; empty or unknown args keep the greeting.
2026-09-14 12:00:03 +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
eb7cdd1a77 channels: give getParticipants a stable Hash when read-model versions are missing
cachedParticipants returned a participant page with Hash=0 whenever the
channel_base / channel_participants rows in read_model_versions were never
seeded for a channel (e.g. groups created via messages.createChat). With
Hash=0 the RPC layer can never answer channels.channelParticipantsNotModified,
so a client that polls the member list re-fetches it in a tight loop forever.

Fall back to a deterministic content hash derived from the page itself
(channel id, page key, count, and each member's id/role/status/rank) so an
unchanged member list yields an identical non-zero Hash and the client
converges. The read-model-backed path is unchanged.
2026-09-14 11:55:23 +01:00
57b7829a9e media: never project zero image/video dimensions (crashes Telegram Desktop on reactions) 2026-09-14 11:55:23 +01:00
5afafc60c4 /mybots: Edit Bot summary screen, return-to-menu, clickable @mentions
- Edit Bot now shows the current value of every field (Name/About/
  Description/Botpic/Commands) like BotFather, with real botpic status
  via a new PeerHasAvatar port method.
- After editing a field the dialog lands back on a fresh Edit Bot menu
  (working "Back to bot" / "Bots list" buttons) instead of ending, so a
  follow-up button press no longer reports the button as expired.
- Service-bot messages now render @username as a tappable mention entity.
2026-09-14 11:53:43 +01:00
f474a360d7 Interactive /mybots menu for @BotFather
Button-driven bot management: paginated picker, per-bot API token /
revoke, Edit Bot (name/description/about/commands/botpic), Bot Settings
toggles (inline/groups/privacy), and delete. Navigation edits the menu
message in place via a new editServiceBotMessage helper.

Edit Botpic accepts a photo the user sends to @BotFather and sets it as
the bot's profile photo (new files.SetAvatarFromExistingPhoto, wired
through bots.SetBotUserpic / WithBotAvatarStore); photos.uploadProfilePhoto
does not accept a bot target so this is the only route.
2026-09-14 11:52:52 +01:00
onysd
2f1818d656 merged with fixes 2026-09-09 02:49:30 +03:00
onysd
87cebec9bd fix for muting an account 2026-09-07 09:31:06 +03:00
onysd
aeaf3f4596 updates for server files size limits 2026-09-06 07:14:50 +03:00
onysd
b65ad60fe8 fix for deleted file metadata 2026-09-03 11:00:50 +03:00
onysd
9cf53449fd fixes and ui improvements 2026-09-03 09:37:55 +03:00
onysd
ec888d3a26 fix for files purge 2026-09-03 08:42:01 +03:00
onysd
8ef2b58bf9 fixes for storage managament 2026-09-03 08:33:06 +03:00
onysd
e6bfe2d444 fix for retention logic 2026-09-03 05:00:42 +03:00
onysd
70c0ba44f0 adding more functions to media managament system 2026-09-03 00:54:09 +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
79c64ee916 fix 2026-08-27 13:23:17 +03:00
onysd
2cfc7a0539 quickfix 2026-08-25 00:51:43 +03:00
onysd
e6a777983c fix 2026-08-25 00:20:05 +03:00
onysd
fe1cf1184f fix 2026-08-25 00:01:59 +03:00
onysd
ed2e61d32a fix 2026-08-24 23:41:58 +03:00
onysd
58a0aed4f3 fix for gifs auto-catigorisation 2026-08-24 23:26:57 +03:00
onysd
d0669bdc5e categorisation for gifs 2026-08-24 23:09:08 +03:00
onysd
5e18bd3830 fix for gif and emojies categories 2026-08-24 22:42:40 +03:00
onysd
4ac94f00de added gifs scan at start 2026-08-07 11:02:05 +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
818c9a58a3 disabling marksbot when third-party verifications if turned off 2026-08-06 15:45:32 +03:00
onysd
2491088e81 added ability to broadcast 2026-08-06 15:22:36 +03:00
onysd
36350f83dc added ability to disable third-party verification 2026-08-06 05:27:48 +03:00
onysd
4f0fa895c1 added avatar for verification bot 2026-08-06 04:39:28 +03:00
onysd
8aad71643f added ability to copy bot token 2026-08-05 22:33:33 +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
45f79148c2 added s3 support 2026-08-05 02:34:24 +03:00
onysd
03f10b66ee s3 support 2026-08-04 23:09:11 +03:00
onysd
fa5cfaf14d changed verifier bot to marksbot 2026-08-04 03:22:46 +03:00
onysd
ac6a50c5ff Merge remote-tracking branch 'upstream/main' into merge-gramsrv-9106877 2026-08-03 23:29:20 +03:00
iamxvbaba
2512eab51d fix: sync harden auth, privacy, and PTS state 2026-08-02 14:12:04 +08:00
iamxvbaba
7e0f9d1e62 feat(stars): sync implement unified purchase flow 2026-08-02 01:51:03 +08:00
iamxvbaba
c854fc7b94 feat: sync implement Stars friend gift packages 2026-08-02 01:51:02 +08:00