GramSieve

Telegram 本地增强 LSPosed 模块,提供消息过滤、宿主设置集成、浏览位置跳转、防撤回、防修改/编辑拦截、多版本编辑历史查看和原始媒体预览等能力。

An LSPosed module for local Telegram enhancements, including message filtering, host-settings integration, browsing position redirection, anti-recall, anti-edit/edit interception, multi-version edit-history viewing, and original media preview.

Telegram 官方群

功能 Features

  • 仅本地过滤 — 所有过滤在设备上完成,无网络请求,数据不离开手机

  • 全局 + 单聊规则 — 全局设置宽泛规则,再针对特定聊天覆盖或排除

  • 丰富的匹配目标 — 消息文字、媒体说明、内联按钮文字/链接、发送者名称/ID、聊天名称/ID

  • 白名单优先 — 排除规则始终优先于过滤规则,适合管理员、公告或信任联系人

  • 三种过滤动作 — 本地隐藏、本地折叠、调试标记(测试用)

  • 完全宿主化设置 — 不提供独立应用界面;全局配置和聊天配置都在 Telegram 内完成,界面跟随宿主主题,保存后立即生效

  • 消息标记与跳转 — 单击消息可标记位置,从右上角菜单一键跳回,每个聊天独立标记

  • 浏览位置记忆 — 自动记录滚动位置,可一键跳转到上次浏览处

  • 下载页全选 — Telegram 下载管理页面多选模式下支持一键全选

  • 主动加载与防撤回防修改 — 后台和推送到达时主动加载消息,结合删除链路拦截和本地存储标记,尽量保留被撤回或修改的原始内容

  • 多版本编辑历史 — 编辑历史按版本保存,并会从 Telegram 本地历史同步写入中补齐离线期间发生的编辑

  • 编辑历史媒体查看 — 点击消息弹窗可查看编辑前内容,原始图片优先使用 Telegram 官方 PhotoViewer 并支持官方保存入口

  • 持久化诊断日志 — 运行日志写入 app-specific 外部目录,避免依赖容易溢出的 logcat 缓冲区

  • 双语界面 — 英文和简体中文,支持跟随系统

  • Local-only filtering — all filtering happens on-device; no network requests, no data leaves your phone

  • Global + per-chat rules — set broad filters globally, then override or exclude specific chats

  • Rich match targets — message text, media captions, inline button labels/URLs, sender names/IDs, chat names/IDs

  • Whitelist wins first — exclusion rules always override filter rules; use them for admins, notices, or trusted contacts

  • Three filter actions — hide locally, collapse locally, or debug-mark (for testing)

  • Fully host-native settings — provides no standalone app UI; global and per-chat settings live inside Telegram, follow the host theme, and apply immediately after saving

  • Mark & jump — tap a message to mark its position, jump back anytime from the menu; marks are per-chat

  • Browse position memory — automatically tracks scroll position, one-tap jump to last viewed message

  • Download page select all — select all loaded download items at once in Telegram's download manager

  • Anti-recall & anti-edit — proactively loads messages in the background and when push updates arrive, combining delete-path interception and local-storage marking to preserve recalled or edited content where possible

  • Multi-version edit history — stores edit history by version and recovers edits that arrive through Telegram local history-sync writes while the device was offline

  • Edit-history media viewer — open original pre-edit content from the message popup; original images prefer Telegram's official PhotoViewer and official save flow

  • Persistent diagnostics — runtime logs are written to app-specific external storage instead of relying on overflow-prone logcat buffers

  • Bilingual UI — English and Simplified Chinese, with system-follow option

规则写法 How Rules Work

GramSieve 会对消息文字、媒体说明、内联按钮文字/链接、发送者名称/ID、聊天名称/ID 进行标准化处理,然后逐行匹配规则。

GramSieve normalizes message text, media captions, inline button labels/URLs, sender names/IDs, and chat names/IDs, then matches rules line by line.

关键词规则 Keyword rules:

t.me/
buy now
sender:promo_bot
chat:airdrops
button:https://
caption:airdrop

正则规则 Regex rules:

https?://
sender:^(promo|deal)_bot$
button:https?://[^ ]+

支持的前缀 Supported prefixes:

前缀 Prefix 检查目标 Checks
text: 消息文字 Message text
caption: 媒体说明 Media captions
button: 按钮文字或链接 Button labels or URLs
sender: 发送者名称或 ID Sender name or ID
chat: 聊天名称或 ID Chat name or ID
(无/none) 以上所有字段 All fields above

在当前界面中,每个输入框已固定检查目标,通常不需要写前缀。

In the current UI, each input box is already target-specific, so prefixes are usually unnecessary.

入口 Entry Points

  • Telegram 设置列表GramSieve(唯一全局配置入口)

  • 聊天右上角三点菜单聊天过滤规则 · 主动加载 · 跳转到上次浏览 · 跳转到标记位置

  • 单击某条消息屏蔽此消息 · 标记此消息 · 编辑历史

  • 下载页面多选模式全选 按钮(一键选中所有已加载的下载项)

  • Telegram settings listGramSieve (the only global settings entry)

  • Chat top-right overflow menuChat filters · Proactive loading · Jump to last viewed · Jump to marked position

  • Click a messageBlock this message · Mark this message · Edit history

  • Download page action modeSelect All button (select all loaded download items at once)

规则直接从 Telegram 内的寄生设置页保存到 LSPosed 远程配置,并同步持久化到模块进程;无需再打开模块应用确认。

Rules are saved from the host panel directly to LSPosed remote preferences and mirrored to the module process; opening a separate module app is no longer required.

持久化日志 Persistent Logs

调试防撤回、主动加载或媒体缓存时,优先读取持久化日志。公共 /sdcard/GramSieve 路径已放弃,日志写入 app-specific 外部目录:

When debugging anti-recall, proactive loading, or media caching, read persistent logs first. The public /sdcard/GramSieve path is no longer used; logs are written to app-specific external storage:

adb -s <device> shell tail -n 300 /sdcard/Android/data/org.telegram.messenger/files/GramSieve/gramsieve.log
adb -s <device> shell tail -n 300 /sdcard/Android/data/com.tianqianguai.gramsieve/files/GramSieve/gramsieve.log

开发与诊断 Development & Diagnostics

适配新 Telegram 版本前,可以先归档设备上的 Telegram APK 与反编译材料:

Before adapting to a new Telegram version, archive the device APK and reverse-engineering materials:

./scripts/archive-telegram-apk.ps1 -Device <device>

归档会写入 local/telegram-apk-archive/,该目录已加入 .gitignore,不会提交 APK 或 apktool 输出。

Archives are stored under local/telegram-apk-archive/, which is git-ignored so APKs and apktool output are not committed.

示例规则 Sample Rules

许可证 License

GramSieve 以 GNU General Public License v3.0 or later(GPL-3.0-or-later)发布。你可以复制、修改和分发本项目,但分发修改版或二进制版本时,需要遵守 GPL-3.0-or-later 的源码提供、许可证保留和同许可证分发要求。完整许可证文本见 LICENSE

GramSieve is released under the GNU General Public License v3.0 or later (GPL-3.0-or-later). You may copy, modify, and distribute this project, but modified versions and binary distributions must follow the GPL-3.0-or-later requirements for source availability, license preservation, and same-license distribution. See LICENSE for the full license text.

参考与致谢 Acknowledgements

GramSieve 的部分反撤回和编辑历史设计参考了 TeleVip-LSPosed 对 Telegram 本地消息存储、删除标记和编辑历史捕获路径的公开研究。GramSieve 没有引入 TeleVip-LSPosed 源码;相关功能基于 GramSieve 自身的 hook、缓存、数据库和 UI 结构独立实现。

Parts of GramSieve's anti-recall and edit-history design were informed by the public research in TeleVip-LSPosed around Telegram local message storage, deletion flags, and edit-history capture paths. GramSieve does not include TeleVip-LSPosed source code; the related functionality is implemented independently using GramSieve's own hooks, cache, database, and UI structure.

Releases

9/1/2026, 1:41:16 PM

更新日志

这次更新

  • 0.2.0 是 GramSieve 首个基于 libxposed API 102 的版本,需要使用支持 API 102 的 LSPosed。
  • 现在同时支持 Google Play 官方 Telegram(org.telegram.messenger)和 telegram.org 官网官方 Telegram(org.telegram.messenger.web)。
  • 修正模块静态作用域、宿主资源和 ADB CLI 的客户端匹配;使用哪一个官方 Telegram,就自动匹配对应包名。
  • 现有的消息过滤、消息标记、防撤回、编辑历史、下载保护,以及 Telegram 内设置入口全部保留。
  • 更新安装后,请先强制停止 Telegram,再重新打开,让新版本模块生效。

兼容说明

  • 若 LSPosed 尚未支持 API 102,或仍需 API 101 兼容版本,请继续使用数小时前发布的上一版本 0.1.5;0.1.5 是最后一个 API 102 之前的版本。

支持项目

如果 GramSieve 对你有帮助,欢迎给项目点个 Star!你的支持会让它继续更新。

Changelog

What's new

  • 0.2.0 is GramSieve's first libxposed API 102 release and requires an LSPosed version that supports API 102.
  • GramSieve now supports both official Telegram clients: Google Play (org.telegram.messenger) and the official telegram.org build (org.telegram.messenger.web).
  • Static scope, host resources, and ADB CLI client matching are corrected; the matching package is selected automatically for the Telegram client you use.
  • Existing message filtering, message marks, anti-recall, edit history, download protection, and the in-Telegram settings entry are all preserved.
  • After updating, force-stop Telegram once and reopen it so the new module version can take effect.

Compatibility

  • If LSPosed does not support API 102 yet, or you still need API 101 compatibility, continue using the previous 0.1.5 release published a few hours ago; 0.1.5 is the final pre-API-102 version.

Support the project

If GramSieve helps you, please give the project a Star! Your support helps keep it moving forward.

Assets

1

9/1/2026, 9:06:43 AM

更新日志

这次更新

  • GramSieve 设置现在直接放在 Telegram 里,打开和调整更方便。
  • 多账号的数据会分别保存,不会再互相混在一起。
  • 如果和其他 Telegram 模块发生冲突,可以针对单个模块切换处理方案;这些开关默认关闭。
  • 支持通过 ADB 查看状态和调整开关,不再依赖截图或模拟点击。
  • 下载与历史记录日志更加完整,发生异常时更容易查出停止或受影响的原因。
  • 现有的消息过滤、消息标记、防撤回和编辑历史功能全部保留。

兼容说明

  • 实验性增强功能仍然默认关闭,需要时再逐项开启。
  • 0.1.5 是最后一个非 libxposed API 102 版本;下一版本将升级到 API 102。

支持项目

如果 GramSieve 对你有帮助,欢迎给项目点个 Star!你的支持会让它继续更新。

Changelog

What changed

  • GramSieve settings now live directly inside Telegram for easier access.
  • Multi-account data is stored separately so accounts no longer mix with each other.
  • If another Telegram module conflicts with GramSieve, you can switch the handling method for that module; these switches remain off by default.
  • ADB can inspect status and change switches without screenshots or simulated taps.
  • Download and history logs now provide clearer evidence when something stops or is affected.
  • Existing filtering, message marks, anti-recall, and edit-history features are preserved.

Compatibility notice

  • Experimental enhancements remain disabled by default and can be enabled individually when needed.
  • 0.1.5 is the final pre-libxposed-API-102 release; the next version will migrate to API 102.

Support the project

If GramSieve helps you, please give the project a Star! Your support helps keep it moving forward.

Assets

1

7/25/2026, 4:42:47 AM

更新日志

新增

  • 新增 Telegram 历史加载适配层,将 GramSieve 主动加载与 Telegram 自身的聊天分页、滚动加载和跳转请求隔离,并按当前版本的重载签名安全构造调用参数。
  • 新增更直观的下载控制,真正做到按你的意图下载和取消下载:取消后不允许 Telegram 自动恢复;点击下载后也不允许 Telegram 擅自取消,若因内部原因中断会自动继续。
  • 新增可靠视频下载管理,覆盖 Telegram 的普通文件加载、流式加载、内部队列创建和下载进度通知;下载中断或长时间无进度时会按退避策略自动恢复。
  • 新增明确取消登记:用户点击下载按钮上的 X 后,该文件会进入硬停止状态,自动重试、播放器清理和后续隐藏加载路径都不能重新拉起下载;只有用户再次主动点击下载才会解除。
  • 设置界面改为完全寄生于 Telegram:全局设置统一从 Telegram 设置页进入,聊天设置从右上角菜单进入,不再提供独立应用界面或“打开完整配置”跳转。
  • 寄生设置页现在读取 Telegram 主题颜色并适配系统栏,支持全局规则、聊天规则和主动加载配置在宿主内直接保存并立即生效。

修复与优化

  • 修复主动加载与 Telegram 正常分页共用请求状态时可能互相覆盖、重复回调或使用错误消息偏移的问题,并增强 Telegram 12.9.x 重载兼容性。
  • 修复用户点击 X 取消视频下载后,播放链路、FileLoader 队列或播放器清理流程仍可能让下载重新出现的问题,同时保留用户手动重新下载能力。
  • 修复配置持久化对新旧规则做并集合并,导致已经删除的规则重新出现的问题;配置现在按更新时间选择完整快照,相同时间以宿主刚保存的快照为准。
  • 空配置广播或持久化请求现在会被忽略,避免异常入口覆盖现有配置。
  • 修复寄生设置页只能点击左上角返回的问题;系统返回按钮和边缘返回手势现在都会优先关闭 GramSieve 面板,并停留在原 Telegram 页面。
  • 修复寄生面板关闭、重新打开或宿主窗口销毁后系统返回回调可能残留的问题。
  • 主动加载和清理模式菜单不再在状态文字后显示聊天 ID,保留原有按聊天独立生效的行为。
  • 移除独立配置 Activity、启动器入口、旧弹窗主题和模块配置页回退路径,避免设置在 Telegram 与模块应用之间割裂。
  • 配置保存提示改为明确显示“已保存并立即生效”,并同步更新中英文 README 的入口与持久化说明。

工程、测试与发布

  • 新增 TelegramHistoryApiAdapterReliableVideoDownloadManagerReliableDownloadStateDownloadCancellationRegistry,并将后台加载与下载可靠性逻辑从主 Hook 编排器中拆分。
  • 新增并扩展后台加载、历史 API 适配、下载取消、可靠下载状态和配置快照的 JVM 回归测试。
  • 完成 testDebugUnitTestassembleDebuglintDebug 和 Release 构建检查,并在 Telegram 12.9.x 真机验证寄生设置、系统返回及下载 Hook 路径。
  • 版本号更新为 versionName 0.1.4、versionCode 5。

Changelog

Compared with 0.1.3, this 0.1.4 release includes:

Added

  • Added a Telegram history-loading adapter that isolates GramSieve proactive loads from Telegram chat pagination, scrolling, and jump requests while safely constructing arguments for the active overload.
  • Added straightforward download control so downloads follow your intent: after you cancel, Telegram cannot restart the download automatically; after you tap Download, Telegram cannot stop it on its own, and internal interruptions resume automatically.
  • Added reliable video download management across regular file loading, stream loading, internal queue creation, and download-progress notifications; interrupted or stalled downloads recover automatically with backoff.
  • Added explicit cancellation tracking: after the user taps X on a download, automatic retries, player cleanup, and hidden loading paths cannot restart that file. Only a new user-initiated download clears the hard stop.
  • Made configuration fully host-native: global settings now live in Telegram Settings, chat settings live in the top-right chat menu, and the standalone app UI plus Full Settings fallback are removed.
  • The host panel now follows Telegram theme colors, handles system bars, and saves global rules, chat rules, and proactive-loading configuration directly inside Telegram with immediate effect.

Fixed And Improved

  • Fixed proactive loading sharing request state with Telegram pagination, which could overwrite offsets, duplicate callbacks, or select an incompatible overload; Telegram 12.9.x compatibility is improved.
  • Fixed video downloads rebounding after an explicit X through playback, FileLoader queue, or player-cleanup paths while preserving manual restart.
  • Fixed persistence union-merging old and new rules and resurrecting deleted entries; persistence now selects the newest complete snapshot, with the newly saved host snapshot winning equal timestamps.
  • Empty configuration broadcasts and persistence requests are now ignored instead of risking an overwrite.
  • Fixed the host settings panel requiring the top-left Back button; the system Back button and edge-back gesture now close GramSieve first and remain on the underlying Telegram page.
  • Fixed system-back callbacks potentially surviving panel close, replacement, or host-window teardown.
  • Proactive Loading and Cleanup Mode menu labels no longer append chat IDs, while their per-chat behavior is unchanged.
  • Removed the standalone configuration Activity, launcher entry, obsolete dialog themes, and module-activity fallback so configuration no longer crosses between Telegram and a separate app.
  • Updated the save confirmation to state that changes are saved and immediately applied, and refreshed the bilingual README entry-point and persistence documentation.

Engineering, Tests, And Release

  • Added TelegramHistoryApiAdapter, ReliableVideoDownloadManager, ReliableDownloadState, and DownloadCancellationRegistry, separating background-history and download-reliability responsibilities from the main hook orchestrator.
  • Added and expanded JVM regression coverage for background loading, Telegram history API adaptation, explicit cancellation, reliable download state, and complete configuration snapshots.
  • Completed testDebugUnitTest, assembleDebug, lintDebug, and Release build checks, with Telegram 12.9.x device verification for host settings, system Back, and download hook paths.
  • Updated the app to versionName 0.1.4 and versionCode 5.

Assets

1

7/13/2026, 10:15:37 AM

更新日志

新增

  • 新增模块冲突检测,识别 Telegami、TeleVip、Re:Telegram、Killergram、Telegram Speed Hook 和 Telegram Tweaks/SideStories,并按防撤回、编辑历史、下载参数、Secret Media、保存限制、去广告、Stories、隐私与 UI 注入等重叠能力给出分级风险与避让建议。
  • 冲突检测在获得 root 授权后仅以只读方式查询 LSPosed 私有数据库,确认模块总开关和 Telegram 作用域;界面会显示各模块实际状态,查询失败时自动退回已安装包检测,且不会修改 LSPosed 数据库。
  • 新增主动加载与防撤回/防修改能力,可在模块全局设置中开启总开关。
  • Telegram 聊天右上角菜单新增按会话开启/关闭主动加载的入口,并直接显示当前状态。
  • 聊天右上角菜单新增“清理模式”,开启后 5 分钟内放行当前会话的批量删除操作,并可再次点击提前关闭。
  • 后台主动加载器会定期拉取已启用会话的最近消息,并在重启后自动恢复已启用的会话。
  • 收到 Telegram/MiPush 相关推送入口时会立即触发主动加载,减少进入聊天后才开始加载的延迟。
  • 新增媒体预取流程,主动调用 Telegram 文件加载路径并把可用的图片、视频等原始媒体复制到 GramSieve 缓存,降低打开编辑历史时转圈等待的概率。
  • 新增撤回/编辑检测,覆盖 Telegram 更新流、删除消息、编辑消息和已加载消息缓存路径。
  • 对方撤回产生的删除更新仍会在 Telegram 正式处理前清空待删除 ID,尽量阻止官方删除动作继续移除本地消息;用户主动删除则通过短时删除意图识别正常放行,并同步清理 GramSieve 中对应的消息、编辑历史和缓存媒体。
  • 用户确认删除整个对话后,GramSieve 会停止该会话的主动加载,清除模块侧消息、编辑历史和媒体缓存,并按 Telegram 账号隔离持久化本地隐藏状态;重启后的本地清理仅作用于经验证与该对话直接关联的 cache4 白名单表,避免已删对话被旧缓存重新带回列表。
  • 新增消息缓存体系:LRU 内存缓存 + SQLite 持久化,保存原始文本、媒体说明、发送者、媒体类型、媒体 ID、编辑/撤回状态和缓存媒体路径。
  • 新增媒体缓存,将原始图片、视频和其他可解析媒体复制到模块缓存中,供编辑历史和撤回后预览使用。
  • 消息绑定时会缓存普通文本、媒体说明、图片、视频、文档等内容,并用内容 + 媒体类型 + 媒体 ID 指纹区分真实编辑和非内容更新。
  • 点击消息弹窗中在“标记此消息”下方新增“编辑历史”入口;没有可展示编辑历史的消息不再显示该入口。
  • 编辑历史支持显示原始文本/媒体说明与编辑后内容。
  • 编辑前图片优先接入 Telegram 官方 PhotoViewer,保留顶部栏、右上角菜单和官方“保存到图库”入口。
  • 有 Telegram 原始媒体对象的历史图片/视频会优先尝试官方 PhotoViewer;缓存视频提供本地全屏播放器兜底。
  • 对仅有持久化缓存文件的原始图片构造隔离的临时 Telegram 图片消息,避免查看或保存后影响聊天中当前图片。
  • 原始媒体尚未缓存但仍有 Telegram 媒体对象时,会触发媒体预取并提示稍后重试;纯媒体历史缺失时会给出明确提示而不是打开空白页。
  • 被撤回消息会保留原内容提示,并尽量还原缓存媒体预览。
  • 运行日志现在写入 Telegram 进程 app-specific 外部目录,早期尚未拿到宿主 Context 的日志会先排队并在初始化后刷新进文件。
  • 模块进程收到 Provider 持久化日志时也会写入模块自身 app-specific 外部日志文件。
  • README 新增主动加载、防撤回、防修改、编辑历史媒体查看和持久化日志说明,并同步修正消息标记入口文案。
  • 配置入口现在寄生到 Telegram 设置列表中的 GramSieve 行,点击后在宿主设置页内打开模块配置。
  • 聊天页右上角配置入口优先打开宿主内嵌配置面板,不再直接跳出到模块 Activity。
  • 编辑历史改为多版本保存,新增 edit_history 持久化记录,连续编辑会保留多个版本。
  • MessagesStorage.putMessages 写入前会只读 Telegram 本地 messages_v2/messages_topics 旧消息,与新消息比较,补齐离线或历史同步期间发生的编辑。

修复与优化

  • 修复 Telegram 启动早期 ActivityThread.currentApplication 为空导致防撤回初始化失败的问题,改为在宿主或聊天 Context 可用时初始化。
  • 修复当前 Telegram 版本 loadMessages 反射签名不匹配导致主动加载失效的问题,改为按重载参数动态构造调用参数。
  • 修复 TL_updateEditChannelMessage / TL_updateEditMessage 字段识别问题,正确从 message 字段读取编辑后的消息。
  • 修复频道/群组删除更新中的 dialogId 解析,支持 channel_id + messages 的撤回更新。
  • 修复 Telegram 12.8.3 的 deleteMessages 同时携带 messageIdsrandomIds 时,把随机 ID 误当消息 ID 的问题;现在只解析第一个 Integer 消息 ID 列表。
  • 修复私聊 messagesDeleted 事件使用 dialogId=0 时,用户主动删除仍被防撤回拦截的问题;仅在全部消息 ID 唯一匹配同一条未过期删除意图时放行,歧义场景继续保守保护。
  • 修复删除操作仍处于 Undo 暂存阶段就提前清理缓存并隐藏对话的问题;本地清理现在只在实际删除提交边界触发。
  • 修复单独拉黑联系人被误判为删除对话并清空 GramSieve 历史的问题;blockPeer 不再触发对话清理。
  • 修复已开启主动加载的会话没有持久化、重启后不会自动加载的问题。
  • 修复本地隐藏状态仅按 dialogId 保存,导致多个 Telegram 账号中相同 peer 相互影响的问题;持久化键、旧键迁移、列表过滤和启动清理现在均按账号隔离。
  • 修复消息数据库读取 is_recalled / is_edited、媒体字段和缓存路径不完整的问题,并补齐游标关闭与线程安全处理。
  • 通过数据库迁移和 putFresh 逻辑重置旧的 isEdited / isRecalled 脏状态,避免普通消息被历史标记污染。
  • 修复反应、浏览量等非内容更新被误判为消息编辑的问题。
  • 修复普通消息误出现黄色或红色背景的问题,并移除编辑/撤回消息区域的强背景色显示。
  • 修复被复用的消息 Cell 残留撤回/编辑视觉状态,导致其他正常消息被污染的问题。
  • 修复没有编辑内容的消息仍显示“编辑历史”入口的问题。
  • 修复编辑前图片打开黑屏、被误判为视频、顶部栏缺失、右上角菜单不可用的问题。
  • 修复官方保存原始图片后返回聊天,当前图片区域变透明/空白的问题。
  • 修复部分编辑历史图片点击无反应时缺少可诊断日志的问题,现在会记录媒体类型、媒体 ID、缓存路径和 Telegram 媒体对象状态。
  • 修复 Telegram 菜单项 setText / setTextAndIcon 反射兼容性和点击处理,提升“主动加载”“编辑历史”“标记此消息”等菜单注入稳定性。
  • 提升防撤回、主动加载和媒体缓存相关日志可见性,并改为读取持久化文件而不是易溢出的 logcat 缓冲区。
  • 放弃公共 /sdcard/GramSieve 日志路径,避免 scoped-storage 权限导致文件不存在;诊断路径改为 app-specific 外部目录。
  • 修复 README 中消息标记入口描述,将长按更正为单击。
  • 回退未发布的系统 TranslationManager 翻译实验,本版不包含该隐藏 API 功能。
  • 移除了 Telegram 设置页右上角三点菜单里的“过滤规则”寄生入口,避免入口重复。
  • 宿主内嵌配置页改为固定全黑背景,并修复从该页返回时直接退出 Telegram 设置页或回到桌面的问题。
  • SQLite 持久化写入改为单线程序列化队列,降低 hook 流程阻塞 Telegram UI 的风险。
  • 收紧 Telegram cache4 本地清理白名单,排除并非 dialogId 归属的 download_queue.uidsaved_dialogs.didrequested_holes.uid,避免误删下载队列、Saved Messages 分组或秘密聊天重传状态。
  • 反撤回链路增强了对方撤回的本地删除拦截、NotificationCenter 删除通知拦截和 Telegram 本地消息 deleted flag 标记,减少图片/媒体消息在滑动重绑后被 Telegram 自身状态覆盖的问题;同时明确区分用户主动删除,确保对应的本地数据库、通知和 UI 更新能够正常放行。

工程、测试与发布

  • 新增 InstalledModuleScanner、LSPosedModuleStateReader、ModuleConflictDetector 及对应 JVM 测试,并补充 Android 包可见性声明与 app_process 保留规则。
  • 新增 AntiRecallConfigStore、BackgroundMessageLoader、MessageCache、MessageDatabaseHelper、MediaCache、MediaPrefetcher、RecallDetector 等防撤回核心模块,并增加 SelfDeleteTracker、LocalDialogDeleteStore、TelegramDialogDatabasePruner 和 TelegramDialogPrunePlan,承载用户主动删除识别、账号隔离隐藏和白名单本地清理。
  • 新增 AntiRecallConfigStoreTest、BackgroundMessageLoaderTest、MessageCacheTest、RecallDetectorTest、SelfDeleteTrackerTest、LocalDialogDeleteStoreTest、TelegramDialogPrunePlanTest 和 TelegramHookInstallerTest 等 JVM 测试,并补充删除拦截、真实编辑判断、多列表参数解析、私聊全局删除唯一匹配、账号键迁移、Undo 提交边界、blockPeer 隔离和 cache4 白名单回归覆盖。
  • 新增 AntiRecallIntegrationTest 仪器测试,覆盖防撤回集成路径。
  • 新增 Mockito 测试依赖,用于 SharedPreferences 等配置存储测试。
  • 新增防撤回方案与设计文档,记录主动加载、撤回/编辑检测、缓存和 UI 集成方案。
  • AGENTS.md 新增发布说明规范、持久化日志排查流程、Telegram Hook 生命周期和防撤回架构说明,并更新日志读取路径为 app-specific 外部目录。
  • CI 新增 GitHub Release 发布时自动构建并上传 APK 的 release-apk job。
  • 新增 SOURCE_URL 元数据文件。
  • 版本号更新为 versionName 0.1.3、versionCode 4,版本线保持 0.1.x。
  • 增加 Telegram APK 版本化归档脚本,便于复用反编译材料并避免 APK、apktool 输出进入仓库。
  • 补充宿主配置面板、序列化存储、多版本编辑历史和反撤回缓存相关测试。

Changelog

Compared with v0.1.1, this v0.1.3 release includes:

Added

  • Added module conflict detection for Telegami, TeleVip, Re:Telegram, Killergram, Telegram Speed Hook, and Telegram Tweaks/SideStories, with graded risks and avoidance guidance for overlapping anti-recall, edit-history, download, Secret Media, save-restriction, ad-blocking, Stories, privacy, and UI-injection capabilities.
  • After root authorization, conflict detection uses read-only queries against the private LSPosed database to confirm each module's master switch and Telegram scope; the UI shows the confirmed state, falls back to installed-package detection when the query fails, and never modifies the LSPosed database.
  • Added proactive loading with anti-recall and anti-edit support, controlled by a new global module setting.
  • Added a per-chat proactive loading toggle to Telegram's top-right chat menu, with the current state shown directly in the menu text.
  • Added Cleanup Mode to the top-right chat menu; while enabled, bulk deletion in the current chat is allowed for five minutes and can be turned off early with another tap.
  • Added a background loader that periodically loads recent messages for enabled chats and restores enabled chats after restart.
  • Telegram/MiPush-related push entry points now trigger an immediate proactive load, reducing the delay before messages are cached after push delivery.
  • Added media prefetching that asks Telegram's file-loading path for original images/videos and copies available files into GramSieve's cache, reducing spinner time when opening edit history.
  • Added recall/edit detection across Telegram update processing, delete calls, edit calls, and loaded-message caching paths.
  • Delete updates caused by remote recalls still clear message IDs before Telegram handles them, helping prevent official local deletion from removing preserved messages; user-initiated deletes are now recognized through short-lived deletion intents, allowed to proceed, and purge the corresponding GramSieve messages, edit history, and cached media.
  • After a full-dialog deletion is confirmed, GramSieve stops proactive loading for that chat, clears module-side messages, edit history, and media caches, and persists the local hide per Telegram account; restart cleanup is restricted to a verified cache4 allowlist of dialog-owned tables so stale local data does not bring the deleted dialog back into the list.
  • Added a message cache stack: LRU memory cache plus SQLite persistence for original text, captions, sender, media type, media ID, edit/recall flags, and cached media paths.
  • Added media caching for original images, videos, and other resolvable media so edit history and recalled-message previews can use preserved files.
  • Message binding now caches text, captions, photos, videos, documents, and media fingerprints based on content + media type + media ID.
  • Added an Edit History item below Mark this message in the message popup; messages without renderable edit history no longer show that item.
  • Edit history can show the original text/caption together with the edited content.
  • Original pre-edit images now prefer Telegram's official PhotoViewer, preserving the top bar, overflow menu, and official Save to Gallery entry.
  • Historical images/videos with an original Telegram media object try the official PhotoViewer first; cached videos keep a local full-screen player fallback.
  • Cached-only original images use an isolated temporary Telegram photo message, preventing the current chat image from being affected after viewing or saving.
  • If original media is not cached yet but a Telegram media object is still available, GramSieve triggers media prefetch and asks the user to retry shortly; missing media-only history now shows a clear message instead of opening a blank view.
  • Recalled messages retain an original-content hint and try to restore cached media previews.
  • Runtime logs now write to Telegram's app-specific external directory, and early logs emitted before host Context exists are queued and flushed once initialization completes.
  • Logs persisted through the module ContentProvider are also written to the module app's own app-specific external log file.
  • README now documents proactive loading, anti-recall, anti-edit, edit-history media viewing, and persistent log paths, and updates message-marking entry text.
  • The configuration entry is now injected into Telegram's settings list as a GramSieve row and opens inside the host settings page.
  • The chat menu configuration entry now prefers the host-embedded panel instead of launching the module Activity directly.
  • Edit history now stores multiple versions through the new edit_history persistence path.
  • MessagesStorage.putMessages now compares incoming messages with Telegram's existing messages_v2/messages_topics blobs to recover edits that happened during offline or history sync windows.

Fixed And Improved

  • Fixed anti-recall initialization failing when ActivityThread.currentApplication is unavailable early in Telegram startup by initializing once host or chat Context is available.
  • Fixed proactive loading failing on the current Telegram loadMessages signature by dynamically building arguments for compatible overloads.
  • Fixed TL_updateEditChannelMessage / TL_updateEditMessage handling by reading the edited message from the message field.
  • Fixed dialogId resolution for channel/group delete updates using channel_id + messages.
  • Fixed Telegram 12.8.3 deleteMessages parsing when messageIds and randomIds are supplied together; only the first Integer message-ID list is now treated as deletions.
  • Fixed user-initiated private-chat deletions still being blocked when messagesDeleted reports dialogId=0; deletion is allowed only when every ID uniquely matches one unexpired intent, while ambiguous cases remain protected.
  • Fixed GramSieve clearing caches and hiding a dialog while Telegram's delete action was still staged in UndoView; local cleanup now starts only at the committed deletion boundary.
  • Fixed standalone blockPeer calls being treated as dialog deletion and purging GramSieve history.
  • Fixed enabled proactive-loading chats not being persisted or restored after restart.
  • Fixed local hide state being keyed only by dialogId and leaking across Telegram accounts that share the same peer ID; persisted keys, legacy migration, row filtering, and startup cleanup are now account-scoped.
  • Fixed incomplete database reads for is_recalled / is_edited, media fields, and cached paths, and tightened cursor cleanup plus thread safety.
  • Reset stale isEdited / isRecalled state through database migration and putFresh logic so normal messages are not polluted by old flags.
  • Fixed reactions, view updates, and other non-content updates being treated as real message edits.
  • Fixed normal messages showing false yellow or red backgrounds, and removed strong background coloring from edited/recalled message areas.
  • Fixed reused message cells retaining stale recall/edit visual state and contaminating unrelated normal messages.
  • Fixed the Edit History item appearing on messages that have no edit content.
  • Fixed original images opening as a black screen, being misdetected as video, losing the top bar, or having an unusable overflow menu.
  • Fixed the current chat image turning transparent/blank after saving an original image through the official viewer.
  • Added diagnostic logs for edit-history media taps that cannot find a cached file, including media type, media ID, cached path, and Telegram media-object state.
  • Improved Telegram menu item reflection and click handling for Proactive Loading, Edit History, and Mark this message.
  • Improved anti-recall, proactive loading, and media-cache logging, with diagnostics based on persistent files instead of overflow-prone logcat buffers.
  • Dropped the public /sdcard/GramSieve log path to avoid scoped-storage failures; diagnostics now use app-specific external storage paths.
  • Fixed README wording for message marking from long-press to click.
  • Reverted the unreleased system TranslationManager experiment; this release does not include that hidden API feature.
  • Removed the duplicate “Filter rules” entry from Telegram settings' three-dot menu.
  • The host-embedded configuration page now uses a fixed black background and fixes back navigation so returning from GramSieve stays inside Telegram settings.
  • SQLite persistence now uses a single-thread serialized queue to reduce the risk of blocking Telegram UI hooks.
  • Restricted Telegram cache4 cleanup to verified dialog-owned tables, excluding download_queue.uid, saved_dialogs.did, and requested_holes.uid so unrelated downloads, Saved Messages grouping, and secret-chat retry state are preserved.
  • Anti-recall handling now strengthens local interception of remote recalls, NotificationCenter deletion interception, and Telegram local deleted-flag marking to reduce media messages disappearing after rebinding or scrolling; user-initiated deletion is now handled separately so the corresponding database, notification, and UI updates can proceed normally.

Engineering, Tests, And Release

  • Added InstalledModuleScanner, LSPosedModuleStateReader, ModuleConflictDetector, their JVM tests, Android package-visibility declarations, and the app_process keep rule.
  • Added the anti-recall core modules: AntiRecallConfigStore, BackgroundMessageLoader, MessageCache, MessageDatabaseHelper, MediaCache, MediaPrefetcher, and RecallDetector, plus SelfDeleteTracker, LocalDialogDeleteStore, TelegramDialogDatabasePruner, and TelegramDialogPrunePlan for user-deletion intent tracking, per-account local hiding, and allowlisted local cleanup.
  • Added JVM tests for AntiRecallConfigStore, BackgroundMessageLoader, MessageCache, RecallDetector, SelfDeleteTracker, LocalDialogDeleteStore, TelegramDialogPrunePlan, and TelegramHookInstaller, with regression coverage for delete interception, real-edit detection, multi-list parameter parsing, unique matching for private-chat global deletion events, account-key migration, Undo commit boundaries, blockPeer isolation, and cache4 allowlisting.
  • Added AntiRecallIntegrationTest for the instrumented anti-recall integration path.
  • Added Mockito for SharedPreferences and configuration-store tests.
  • Added anti-recall planning and design documentation for proactive loading, recall/edit detection, caching, and UI integration.
  • Updated AGENTS.md with release-note rules, persistent-log diagnostics, Telegram hook lifecycle notes, anti-recall architecture notes, and app-specific log paths.
  • Added a GitHub Release release-apk workflow job to build and upload an APK when a release is published.
  • Added SOURCE_URL metadata.
  • Updated the app to versionName 0.1.3 and versionCode 4, keeping the 0.1.x release line.
  • Added a versioned Telegram APK archive script so reverse-engineering evidence can be reused without committing APK or apktool output.
  • Added and updated tests for the host config panel, serialized storage, multi-version edit history, and anti-recall cache behavior.

Assets

1