Repository navigation
Feat/js plugins - #220
Open
vnikolas2009 wants to merge 84 commits into
Open
Feat/js plugins#220vnikolas2009 wants to merge 84 commits into
vnikolas2009 wants to merge 84 commits into
Conversation
- EmbeddedPython: unzip stdlib with SSZipArchive (iOS 15 compatible) instead of FileManager.unzipItem (iOS 16 only); link Python.framework from //third-party/python so canImport(Python) is true. - Drop the PythonBridge C-extension host; the bridge is pure Python now. - PythonPluginsInstaller/ChatController: add missing imports. - setup_python.py: also pack the exteraGram SDK shims into python.zip. - Workflow: emit compiler errors as check-run annotations so failures stay readable when artifact/log downloads are blocked; never nest Python.framework when rules_apple already embeds it. - Add README.md.
Make.py requires one of --gitCodesigningRepository, --codesigningInformationPath or --xcodeManagedCodesigning even for an unsigned build; the missing flag aborted the build step before Bazel started.
ValuePromise<T: Equatable> is used for the plugin state stream, so State must be Equatable (Plugin already was).
--overrideXcodeVersion is a store_true flag ('use the Xcode reported by
xcode-select'), not an option taking a version string; passing a value
made argparse abort every build. Add --continueOnError so a failing run
reports every compile error at once.
… not a framework bundle)
…12 + mobileprovision secrets) Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01616uboUyBDHhrKF1C8JJzp
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01616uboUyBDHhrKF1C8JJzp
…hout app group - build-ipa.yml: the "Fetch Python runtime" step had lost its command (stray --configuration/--buildNumber lines were run as a command, exit 127). Restore `python3 build-system/setup_python.py`. - build-ipa.yml: restore ImportCertificates, --skipDsym, parallel swiftmodule generation, bazel profile and the keep_going input in the build step, keeping --disableProvisioningProfiles (the fake profiles belong to the old bundle id, so none matches com.TrollCerts.Gram). Drop the expired one-off cron trigger. - AppDelegate: when group.<bundle id> does not resolve (profile without the App Group), use Application Support/TrollGramData instead of showing an alert on an empty window, which left a black screen. - sign_ipa.py: warn when the profile lacks group.<bundle id>. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01616ubo6N8jx57Z3nV5HTB6
…screen fix(ci): restore Python fetch/build steps, avoid black screen without app group
…esolve_configuration The unsigned-build shortcut was added at module level while the rest of the block stayed in the function, so importing Make.py raised NameError: name 'arguments' is not defined and the build died before Bazel ran. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
The unsigned build failed in analysis: "Building for device, but no provisioning_profile attribute was set" (//Telegram:IntentsExtension). --disableProvisioningProfiles only works for simulator configurations; rules_apple's provisioning_profile_partial fails every device build without a profile. The bundled fake profiles are for ph.telegra.Telegraph, and Make.py only copies a profile whose application-identifier starts with <team_id>.<bundle_id> from appstore-configuration.json, so with com.TrollCerts.Gram none matched. - fix_fake_profiles.py: new --bundle-id/--out (and --from-bundle-id) retarget the profiles (names, app ids, app groups) and re-sign them with the fake certificate into a separate directory, leaving the bundled files untouched. - build-ipa.yml: generate the profiles for the bundle id read from appstore-configuration.json, use them as --codesigningInformationPath and drop --disableProvisioningProfiles. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01616ubo6N8jx57Z3nV5HTB6
fix(ci): retarget fake provisioning profiles to the configured bundle id
…untime AssetCatalogCompile (actool) failed for //Telegram:WidgetExtension: "No simulator runtime version from ["23C54", "23E254a", "23F77"] available to use with iphonesimulator SDK version 23A339". versions.json asks for Xcode 26.0 (SDK 23A339), but the macos-latest image only has simulator runtimes for newer iOS releases, and actool needs a runtime that fits the SDK even for device builds. The Select Xcode step now uses the Xcode from versions.json if its simulator SDK build has an installed runtime, and otherwise the newest non-beta Xcode that does. Make.py --overrideXcodeVersion follows the selected Xcode. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01616ubo6N8jx57Z3nV5HTB6
fix(ci): select an Xcode whose iphonesimulator SDK has an installed runtime
The signing step failed with "security: SecKeychainItemImport: Unable to decode the provided data." and gave no hint why, so the CI published only the unsigned IPA. - unwrap_base64_p12: if the P12_BASE64 secret was base64-encoded twice, decode it once more. - convert_p12_for_macos: when `security import` rejects the file (OpenSSL 3 AES-256/PBKDF2 containers), re-export it with 3DES/SHA-1 through openssl and retry; the password goes through the environment, not the command line. - Otherwise fail with a message that names the P12_BASE64 / P12_PASSWORD secrets. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01616ubo6N8jx57Z3nV5HTB6
fix(sign): make the .p12 import robust and explain failures
The app aborted ~0.3 s after launch: SIGABRT on a SwiftSignalKit queue, an Objective-C exception thrown inside CloudKit, called from TelegramCoreFramework. CloudDataContextImpl (the "emergency datacenter" fallback started from Network.swift) calls CKContainer.default(), which raises an NSException when the signed app has no iCloud entitlements. Swift cannot catch it. - appstore-configuration.json: enable_icloud = false, so the build no longer asks for iCloud entitlements the personal profile does not have. - CloudData: build with TELEGRAM_ENABLE_ICLOUD only when telegram_enable_icloud is set; otherwise fetchRawData fails with .generic right away and CloudKit is never imported or called. The record lives in the original app's container anyway. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01616ubo6N8jx57Z3nV5HTB6
fix: do not touch CloudKit without iCloud entitlements (launch abort)
Two problems, both visible in the annotations of the last runs.
No login code arrived ("мне не приходит код при регистрации"). The build
logs in with the bundled api_id 8, which is Telegram's own iOS application:
the servers address the code to that application and deliver it to the
official App Store build, so a fork built with the same api_id receives
nothing at all - no SMS, no in-app message. Registering the fork's own
application is the only way to make the handshake its own. The workflow now
takes TG_API_ID / TG_API_HASH from the repository secrets, validates them and
writes them into build-system/appstore-configuration.json, which Make.py
turns into the generated variables.bzl that BuildConfig compiles. Without
the secrets it warns instead of silently producing a build that cannot log
in. The identity is used only for this handshake; authorised sessions are
unaffected.
Signing reported "no code signing identity found in the .p12 (wrong
password?)" while the same log printed the identity and "1 valid identities
found". `security find-identity` writes ` 1) <SHA-1> "iPhone Distribution:
..."`, and the pattern expected the name right after the closing parenthesis:
the hash in between meant it could never match. Parse the hash, and print the
listing in the error so the next failure is readable.
Also:
- try_run returns the command's stderr, so a rejected .p12 names the real
reason ("Unable to decode the provided data") instead of guessing at a
wrong password.
- The signing step no longer sets continue-on-error, which turned a failed
signing run into a green step with no signed IPA; the failure is now a
warning plus the log lines, and the unsigned IPA is still published.
The password goes through the environment, out of any command trace.
- datetime.utcnow() is deprecated and was removed-warned on the runner; use
a timezone-aware now().
fix: deliver the login code and report signing failures
…orted errors Python layer (Swiftgram/PythonPlugins/stdlib): - trollgram_host: AST metadata (__id__, __name__, ...) read without executing plugin code, load/unload lifecycle, priority-ordered send hooks with CANCEL / MODIFY / MODIFY_FINAL, broken plugins cannot block sending. - trollgram_bridge: calls plugins make (send_text, toasts, logs, delayed tasks) are queued as actions that Swift executes; the old outbox file was never read. - base_plugin/client_utils/ui follow the exteraGram API (HookStrategy, HookResult, settings persistence, BulletinHelper). Features without an iOS backend raise UnsupportedOnIOS and are listed per plugin instead of failing silently. - peer_utils converts Postbox PeerId.toInt64() to Bot-API ids and back. - 21 unit tests: python3 -m unittest discover -s Swiftgram/PythonPlugins/tests Swift: - EmbeddedPython: one base64-JSON call into trollgram_host, main thread only; the SDK root is now on sys.path (import base_plugin never worked before); stdlib is re-extracted when the bundled build changes; plugin files are no longer on sys.path so they cannot shadow stdlib modules. - PythonPluginManager: plugins are off until enabled (the old `enabled.isEmpty || contains` turned everything on), persisted correctly, started on the first send after launch, status/author/version/errors exposed. - ChatController applies cancel/modify per text message and wires send_text and toasts to the real engine/UI. - Plugins screen shows author, version, running state, errors and unsupported features. The Swift changes were not compiled locally (no Swift toolchain in the sandbox). Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01616ubo6N8jx57Z3nV5HTB6
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01616ubo6N8jx57Z3nV5HTB6
…ram API access Adds Swiftgram/JSPlugins (no embedded interpreter), a native settings screen, commands, Bot API and client API helpers, tests, examples and docs. Updates README, CONTRIBUTING, LICENSE header and adds CONTRIBUTORS.md.
- TrollPluginsBridge imports PresentationDataUtils (textAlertController(context:)). - Plugin API/toast/alert handlers are installed when a chat appears, not only on the first send, so getPeer/sendMessage work right after opening a chat. - Settings written while a plugin loads are no longer dropped. - JSContext/JSValue guards compile whether the SDK imports them as optional or not. - Add a CI workflow that runs the prelude tests and syntax-checks the examples. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01616ubkqg2hPw6HF5BgtXri
vnikolas2009
force-pushed
the
feat/js-plugins
branch
from
November 18, 2026 14:36
7ef7514 to
5aa3a4d
Compare
…plugins - Accept `.plugin` (Python source) next to `.py`; load them with an explicit SourceFileLoader because importlib does not know the extension. - Render `ui.settings` widgets natively (Header, Switch, Input, EditText, Selector, Text/button) through two new ops in the existing host protocol, with on_change / on_click callbacks. No new bridge. - One shared settings screen for JavaScript and Python plugins. - Document the plugin API (Swiftgram/PythonPlugins/README.md) and add docs/SECRETS.md with the Actions secret names. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01616ubkqg2hPw6HF5BgtXri
- New Settings > TrollGram > TrollTweaks screen built from grouped rows (TrollPrivacyOptions.groups); all switches default to ON. - Ghost mode with sub-switches: online, read receipts, typing, upload, story views, channel post views. - Saved Messages: local JSONL log with media copies for deleted messages, edit history and self-destructing media (copied before the countdown), plus a log viewer with clear. Deleted messages are logged, not restored, so state sync behaviour is unchanged (docs/state-sync.md updated). - Content toggles (sponsored, copy protected) moved into TrollTweaks. - Docs (EN/RU README, CONTRIBUTING), CI check for the options tests. Swift is not compiled in this environment; validate with build-ipa.yml. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01616ubkqg2hPw6HF5BgtXri
…tribute) Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01616ubkqg2hPw6HF5BgtXri
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01616ubkqg2hPw6HF5BgtXri
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.