Support entinyGram development & CI build serversDonate
entinyGram
Downloads

#Source map

Where the code lives, and where to read it when these pages are not enough. The plugin system is open source in three places: the typings, the command line tool and the plugins in one repository, the app side in the entinyGram client, and the original engine upstream in Inugram.

#The three repositories

RepositoryWhat is in it
entinyGram/pluginsthe typings, the command line tool, the official plugins, the catalog and the build scripts
entinyGram/androidthe entinyGram client: the patchset and the Kotlin code that hosts plugins inside the app
teidesu/inugramInugram, the project entinyGram is built on. The plugin engine, the API and the original docs come from here

#The plugins repository

Everything a plugin author touches is in entinyGram/plugins.

#sdk/types: the typings

sdk/types is the package @inugram/plugin-types. It is the most important thing to read: every call is documented there, with its grant, its limits and whether it is experimental.

FileContents
common.d.tsthe core of the API: inu, accounts, messages, inu.ui, inu.icons, inu.utils, interceptors
android.d.tsinu.android: the current screen, bundles, native views
android.jvm.d.tsinu.jvm: reflection, handles, defineClass, routines
android.xposed.d.tsinu.xposed: hooks
android.notification-center.d.tsthe app's internal event bus (unsafe.notificationCenter)
android.tl.d.tsevery Telegram TL type, method and update
canvas.d.tsinu.canvas
fs.d.tsinu.fs
dom.d.tsthe web-like globals: fetch, Blob, localStorage, timers
grants.jsonthe grant catalogue: every permission, its scopes and its level
grants.d.tsthe same grants as types
tl-names.txtthe names of TL methods and updates a grant scope can use

#sdk/cli: the inu command line tool

sdk/cli is @inugram/cli. Read it to see exactly what a command does.

PathContents
src/commandsone file per command: build, check, dev, eval, init, list, push, remove, verify
src/utils/config.tsthe inu.config.ts schema and how it is loaded
src/utils/manifest.tsthe manifest schema, how the header is written, and the grant validation
src/utils/device.tshow the tool talks to the phone over adb
src/routinesthe routine compiler: finding calls, captures, bytecode
src/templatesthe starter project inu init creates

#sdk/docs: the original guides

sdk/docs holds the plugin guides as they come from Inugram: getting started, engine, grants, ui, telegram, interception, io, canvas, jvm, xposed and routines. The pages you are reading explain the same ideas, with entinyGram's additions.

#plugins: the official plugins

plugins/ has one folder per plugin, each with an inu.config.ts and a src. They are the best examples of real code: see Worked examples.

#The scripts

PathContents
scripts/pack-release.tsbuilds every plugin into release/, named and ready to post to the plugins channel

#The client

The plugin host inside the app is Kotlin, in src/fork of the client repository. Read it when you want to know what happens on the other side of a call.

PathContents
helpers/pluginsthe host: loading, permissions, sessions, the Telegram and JVM bridges, icons and UI
helpers/plugins/PluginManager.ktinstalling, enabling, updating and the dependency checks
helpers/plugins/PluginImportHelper.ktthe import and permission sheet
helpers/plugins/ui/PluginUi.kthow declarative pages become native screens
helpers/plugins/PluginRepos.ktplugin repositories: reading a channel, caching headers, finding updates
ui/settings/PluginsActivity.ktthe plugin list in the settings
ui/settings/PluginSettingsActivity.ktthe generic host of a plugin's settings page

The user facing list of what entinyGram adds is FEATURES.md.

#Inugram upstream

The plugin engine, the inu API and the command line tool were written in Inugram. Its sdk folder holds the same three parts you saw above: cli, docs and types.

#Finding what to hook

When you hook the app, you need the name of a class and a method. The app is Telegram for Android with a patchset, so almost every class has the stock name:

  1. Read the original source: DrKLO/Telegram. The classes you will see most are AndroidUtilities, LocaleController, MessagesController, ChatActivity, DialogCell and ChatMessageCell.
  2. For the entinyGram and Inugram classes, such as desu.inugram.InuConfig, read the client repository above.
  3. To see the exact names and signatures in the build you target, decompile the APK with jadx.
  4. Hook a method with its descriptor, such as formapMapUrl(IDDIIZII)Ljava/lang/String;, so the right overload is chosen. See Method hooks.

#Other references