Skip to main content

RM (ReMandochka) v0.1.1 — Elyx-фреймворк хукинга, обхода защит ART/R8, UI и KDL v2

(PyPI: remandochka | Python import: import rm или import remandochka)

ReMandochka (RM) — высокопроизводительный фреймворк, созданный эксклюзивно для Elyx-плагинов (.elyx / .eaf) клиента exteraGram:

  • Прямая интеграция с системой локализаций elyx.strings (rm.tr, rm.strings) и ассетами elyx.assets.

  • Автоматическая трансляция KDL-файлов настроек (settings.kdl) в нативные элементы exteraGram.

  • Поддержка кастомных нативных Android View (Custom).

  • Обход барьеров Android Runtime (ART) и компилятора R8 (rm.Bypass).

  • Архитектурный каркас компонентов интерфейса (views, cells, fragment, layout, components).

  • PyPI: remandochka (установка: pip install remandochka).

  • Сборщик: Hatchling (PEP 621 / pyproject.toml).

  • Архитектура: ровно 1 __init__.py на всю библиотеку без оверинжиниринга.

  • Поддерживаемый формат: Строго Elyx (.elyx / .eaf).


⚡ Структура библиотеки (src/)

  • remandochka.core:
    • rm.parse_kdl(text) / rm.dumps_kdl(doc): моментальный парсер KDL 2.0.0 (~100 микросекунд с LRU-кэшем).
    • rm.tr(key, **kwargs) / rm.strings: прямая связка с локализацией Elyx (locales/strings_*.json).
    • rm.is_dev_mode(), rm.dev_log(plugin, msg): Zero Log Spam логирование (TTL-кэшировано).
    • rm.get_app_version(): автоопределение версии клиента Telegram / exteraGram.
    • rm.get_field(), rm.set_field(), rm.get_java_class(): безопасная Java-рефлексия с кэшированием Field и JNI-классов.
  • remandochka.bypass:
    • rm.Bypass(plugin): фасад управления хуками с защитой от дублирования и безопасной выгрузкой плагинов.
    • @bypass.hook("ClassName", "methodName"): декоратор для классов MethodHook или функций.
    • Внешняя база правил: remandochka/resources/rules.jsonl.
  • remandochka.ui:
    • settings: build_settings("settings.kdl", context=self) — автоматическое чтение KDL-файлов настроек Elyx.
    • views: View, SheetView, DialogView, PanelView.
    • cells: Cell, HeaderCell, TextCell, ButtonCell, SwitchCell, SelectorCell, InputCell, DividerCell, CustomCell.
    • fragment: BaseFragment, SettingsFragment, TabFragment.
    • layout: LinearLayout, FrameLayout, ScrollLayout, StackLayout.
    • components: BadgeComponent, AvatarComponent, ProgressBarComponent, SearchBarComponent, DividerComponent, IconComponent, ActionSheetComponent.

🛠️ Как писать Elyx-плагин на ReMandochka

1. Декларативные настройки (src/settings.kdl)

Плагин просто кладёт рядом файл settings.kdl — локализация авто-подтягивается из locales/strings_*.json:

header "@settings_header"
switch key="turbo" text="@feature_title" default=#true subtext="@feature_sub" icon="msg_permissions" on_change="on_turbo_toggle"
input key="api_key" text="@api_token_title" default="" hint="@api_token_hint" icon="msg_link"

selector key="render_mode" text="@render_mode_title" default=1 icon="msg_theme" {
    item "Энергосберегающий"
    item "Сбалансированный"
    item "Максимальная плавность (120 FPS)"
}

divider text="@custom_section"

// ОБЯЗАТЕЛЬНО С КАСТОМОМ: внедрение нативного Android View!
custom key="banner_view" view="create_elyx_banner"

divider
button text="@test_button" icon="msg_retry" action="on_test"
button text="@reset_button" icon="msg_clear" red=#true action="on_reset"

2. Код плагина (src/main.py)

from base_plugin import BasePlugin, MethodHook
import rm

class RMElyxPlugin(BasePlugin):
    def on_plugin_load(self):
        rm.dev_log(self, f"Elyx Plugin {rm.get_plugin_id(self)} загружен!")

        # Перехват через rm.Bypass
        self.bypass = rm.Bypass(self)

        @self.bypass.hook("InstallPluginBottomSheet", "<init>")
        class InstallDialogHook(MethodHook):
            def before_hooked_method(self, param):
                if len(param.args) > 2 and param.args[2]:
                    param.args[2].setTrusted(True)

            def after_hooked_method(self, param):
                rm.dev_log(self, f"Шторка перехвачена: {param.thisObject}")

        self.bypass.install()

    def on_plugin_unload(self):
        self.bypass.uninstall()

    def create_settings(self):
        # Передаем файл 'settings.kdl' напрямую — ReMandochka сделает всё остальное!
        return rm.build_settings("settings.kdl", context=self)

    def on_turbo_toggle(self, val: bool):
        rm.set_setting("turbo", val)
        rm.dev_log(self, f"Турбо режим: {val}")

    def on_test(self, view=None):
        rm.dev_log(self, "Кнопка нажата!")

    def on_reset(self, view=None):
        rm.set_setting("turbo", True)

    def create_elyx_banner(self, context=None):
        TextView = rm.core.get_java_class("android.widget.TextView")
        app_ctx = getattr(rm.core.get_java_class("org.telegram.messenger.ApplicationLoader"), "applicationContext", None)
        if TextView and app_ctx:
            tv = TextView(app_ctx)
            tv.setText(rm.tr("banner_text", default="✨ Нативный баннер Elyx!"))
            tv.setPadding(32, 24, 32, 24)
            return tv
        return "CustomBanner(Active)"

🏗️ Сборка плагина через ElyxBuilder (elyb)

Структура проекта плагина в examples/elyx_plugin/:

  • refmap.yml (в корне)
  • RMElyxPlugin/meta.yml
  • RMElyxPlugin/.elyxbuilder/config.yml
  • RMElyxPlugin/locales/strings_en.json и strings_ru.json
  • RMElyxPlugin/res/wave.svg
  • RMElyxPlugin/src/main.py
  • RMElyxPlugin/src/settings.kdl

Команда сборки:

elyb build -v

Результат компилируется в builds/RM Elyx Plugin Example-1.0.0.eaf (и .elyx).

requirements: "remandochka 0.1.1"

🔇 Интеллектуальное логирование (Zero Log Spam)

Библиотека не засоряет логи приложения:

  • Логи выводятся ТОЛЬКО тогда, когда в настройках плагин-системы включен Режим разработчика (rm.is_dev_mode() == True).
  • При выключенном режиме разработчика библиотека работает в режиме полной тишины.

📦 Спецификация зависимостей для Elyx

  • В meta.yml / metainfo.json:
    requirements: "remandochka 0.1.0"
    

Metadata

Release files for remandochka 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for remandochka 0.1.1
File Size Uploaded Provenance
remandochka-0.1.1.tar.gz 31.3 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for remandochka 0.1.1
File Interpreter ABI Platform
remandochka-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 65.7 kB

Release files / remandochka-0.1.1.tar.gz

Download URL remandochka-0.1.1.tar.gz
Size 31.3 kB
Tags Source
SHA-256 checksum
How to use checksums
53e94b4d2903b643850504d1ec5eae1db7244f88d3f381875be48f7a0a313902
BLAKE2b-256 checksum
How to use checksums
701601fc7b45314e04ddcb45dbdf04eb80a550b9a32ebd6021d73d515a44f60a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.9

Release files / remandochka-0.1.1-py3-none-any.whl

Download URL remandochka-0.1.1-py3-none-any.whl
Size 34.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e3f82577299ebf2feec79d427677cdf1160d43fbe4cb56741351071de56079c0
BLAKE2b-256 checksum
How to use checksums
6dc20165efd73e8c2f92cd207f62eb9aca23b9aed0ee83d2ee09933681ada34b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.9

Security for remandochka 0.1.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page