Repository navigation
Rebrand as OpenStream (StudioAs Inc.) + CI: build APK → send to Telegram - #1
TheRealAshik wants to merge 2 commits into
Conversation
Product identity
- Rename the Kotlin package and applicationId/namespace app.moviedb -> app.openstream
across all modules (app, core, designsystem, feature/{home,detail,favorites}).
- MoviedbTheme -> OpenStreamTheme, Theme.Moviedb -> Theme.OpenStream,
Deps.APP_NAME -> "OpenStream", rootProject.name -> "openstream".
- Launcher label and the Home title string now read "OpenStream".
- README, docs and screenshot links rewritten for the fork, pointing at in-repo assets.
- Studio credit: StudioAs Inc., lead developer @TheRealAshik (README + docs + LICENSE).
CI: .github/workflows/android.yml
- Unit tests, then assembleDebug + assembleRelease with JDK 21.
- APKs are renamed OpenStream-{debug,release}-<sha>.apk, uploaded as artifacts, and
sent to Telegram by scripts/telegram_send.py (Telethon, MTProto bot upload).
- TMDB access_token/api_key injected into local.properties from secrets and cleaned up
afterwards, since core/build.gradle.kts reads them from that file.
- Send step needs TELEGRAM_API_ID/API_HASH/BOT_TOKEN/CHAT_ID and optional TOPIC_ID, and
is skipped for fork pull requests so secrets never reach untrusted code.
Attribution
- Upstream MIT copyright (Ainul / ainulbedjo/owl) is retained in LICENSE as the license
requires; StudioAs Inc. is listed as the copyright holder of the OpenStream changes.
There was a problem hiding this comment.
Review Summary
This PR renames the project to OpenStream and introduces a CI pipeline that builds APKs and posts them to Telegram. The rebrand itself (package/namespace/string renames) looks mechanically clean. The critical issues are in the new CI workflow and Telegram send script.
🔴 Must-Fix Before Merge
-
Supply-chain risk in
.github/workflows/android.yml— All third-party actions are pinned to mutable major-version tags (@v7,@v6,@v4). This job receivesBOT_TOKENandAPI_HASHas secrets; a tag re-point is all it takes to exfiltrate them. Every action must be pinned to an immutable full commit SHA. -
pipefail+head -n1crash risk — The release APK collection step (find ... | head -n1) underset -euo pipefailcan fail with SIGPIPE (exit 141) whenfindproduces more output thanheadreads. A|| trueguard and an explicit empty-check are needed. -
Silent over-limit failure in
scripts/telegram_send.py— When an APK exceeds the 50 MB Telegram bot limit, a warning is printed but the upload is attempted anyway, failing with a cryptic API error. The function should exit with a non-zero return code at that point. -
Missing success log for topic sends in
scripts/telegram_send.py— A successfulsend_fileviareply_tohitscontinueand skips the✅ Sentprint. CI logs will show no confirmation for topic deliveries, making it unverifiable whether the file was actually sent.
You can now have the agent implement changes and create commits directly on your pull request's source branch. Simply comment with /q followed by your request in natural language to ask the agent to make changes.
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@v7 |
There was a problem hiding this comment.
🛑 Security Vulnerability: All action steps are pinned to mutable major-version tags (@v7, @v6, @v4) rather than immutable commit SHAs. This CI job receives BOT_TOKEN and API_HASH as environment secrets — a tag can be silently re-pointed to malicious code that exfiltrates those credentials. Pin every third-party action to a full commit SHA (e.g., actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683).
| release_apk="$(find app/build/outputs/apk/release -name '*.apk' | head -n1)" | ||
| cp "$release_apk" "$out/OpenStream-release-$short.apk" |
There was a problem hiding this comment.
🛑 Crash Risk: find ... | head -n1 under set -euo pipefail can cause a spurious SIGPIPE (exit code 141) when find has more results than head consumes, which pipefail treats as a pipeline failure. Additionally, if find returns no APK (e.g., assembleRelease only produced app-release-unsigned.apk in a subdirectory), release_apk is empty and the subsequent cp "$release_apk" silently copies nothing with a confusing error. Use a || true to suppress the SIGPIPE and add an explicit check for an empty result.
| release_apk="$(find app/build/outputs/apk/release -name '*.apk' | head -n1)" | |
| cp "$release_apk" "$out/OpenStream-release-$short.apk" | |
| release_apk="$(find app/build/outputs/apk/release -name '*.apk' | head -n1 || true)" | |
| if [ -z "$release_apk" ]; then | |
| echo "::error::No release APK found under app/build/outputs/apk/release" | |
| exit 1 | |
| fi | |
| cp "$release_apk" "$out/OpenStream-release-$short.apk" |
| for path, caption in zip(files, captions): | ||
| print(f"→ {path} ({human_size(path.stat().st_size)})") | ||
| print(caption) | ||
| if path.stat().st_size > BOT_UPLOAD_LIMIT: | ||
| print( | ||
| "⚠️ Over the 50 MB bot upload limit — this send will fail. " | ||
| "Use a user session or split the build.", | ||
| file=sys.stderr, | ||
| ) |
There was a problem hiding this comment.
🛑 Logic Error: When a file exceeds the 50 MB bot upload limit, the warning is printed but execution continues and asyncio.run(upload(...)) is still called. The upload will then fail with a cryptic Telegram API rejection rather than a clean early exit. Add a hard exit after the warning to fail fast with a clear error message.
| for path, caption in zip(files, captions): | |
| print(f"→ {path} ({human_size(path.stat().st_size)})") | |
| print(caption) | |
| if path.stat().st_size > BOT_UPLOAD_LIMIT: | |
| print( | |
| "⚠️ Over the 50 MB bot upload limit — this send will fail. " | |
| "Use a user session or split the build.", | |
| file=sys.stderr, | |
| ) | |
| for path, caption in zip(files, captions): | |
| print(f"→ {path} ({human_size(path.stat().st_size)})") | |
| print(caption) | |
| if path.stat().st_size > BOT_UPLOAD_LIMIT: | |
| print( | |
| "⚠️ Over the 50 MB bot upload limit — this send will fail. " | |
| "Use a user session or split the build.", | |
| file=sys.stderr, | |
| ) | |
| return 1 |
| if topic_id: | ||
| try: | ||
| await client.send_file(entity, str(path), reply_to=int(topic_id), **kwargs) | ||
| continue | ||
| except (ValueError, TypeError): | ||
| # Older/newer Telethon naming for forum topics; fall through. | ||
| pass | ||
| except Exception as exc: # noqa: BLE001 - topic routing is best effort | ||
| print( | ||
| f"⚠️ TOPIC_ID={topic_id} rejected ({exc.__class__.__name__}); " | ||
| "sending to the chat instead.", | ||
| file=sys.stderr, | ||
| ) | ||
| await client.send_file(entity, str(path), **kwargs) | ||
| print(f"✅ Sent {path.name}") |
There was a problem hiding this comment.
🛑 Logic Error: When topic_id is set and the broad except Exception branch is hit (line 103–108), the code prints a warning and then falls through to await client.send_file(entity, str(path), **kwargs) at line 109. However, print(f"✅ Sent {path.name}") at line 110 is only reached via the fallback path — this means a successful topic send via continue correctly skips the success print. The bug is that a successful topic send never prints the ✅ confirmation, making it impossible to verify in CI logs that the file was actually sent.
| if topic_id: | |
| try: | |
| await client.send_file(entity, str(path), reply_to=int(topic_id), **kwargs) | |
| continue | |
| except (ValueError, TypeError): | |
| # Older/newer Telethon naming for forum topics; fall through. | |
| pass | |
| except Exception as exc: # noqa: BLE001 - topic routing is best effort | |
| print( | |
| f"⚠️ TOPIC_ID={topic_id} rejected ({exc.__class__.__name__}); " | |
| "sending to the chat instead.", | |
| file=sys.stderr, | |
| ) | |
| await client.send_file(entity, str(path), **kwargs) | |
| print(f"✅ Sent {path.name}") | |
| if topic_id: | |
| try: | |
| await client.send_file(entity, str(path), reply_to=int(topic_id), **kwargs) | |
| print(f"✅ Sent {path.name} (topic {topic_id})") | |
| continue | |
| except (ValueError, TypeError): | |
| # Older/newer Telethon naming for forum topics; fall through. | |
| pass | |
| except Exception as exc: # noqa: BLE001 - topic routing is best effort | |
| print( | |
| f"⚠️ TOPIC_ID={topic_id} rejected ({exc.__class__.__name__}); " | |
| "sending to the chat instead.", | |
| file=sys.stderr, | |
| ) | |
| await client.send_file(entity, str(path), **kwargs) | |
| print(f"✅ Sent {path.name}") |
The first Actions run failed at parse time (0s, no log) because the send step referenced `secrets.*` in its `if:` expression, which GitHub does not allow in step conditionals. Presence of the Telegram secrets is now probed in a preceding step that exports only a boolean output, and the branch/run values move into the step `env:` block so nothing untrusted is interpolated into the shell body. actionlint now reports no findings for this workflow.
What this does
Renames the product to OpenStream under StudioAs Inc. (lead developer @TheRealAshik) and adds a CI pipeline that builds the APKs and posts them to Telegram.
1. Rebrand
app.moviedbapp.openstreamapp.moviedb.core,.designsystem,.home,.detail,.favoritesapp.openstream.*MoviedbThemeOpenStreamThemeTheme.MoviedbTheme.OpenStreamDeps.APP_NAMEMovieDBOpenStreamrootProject.namemoviedbopenstreamapp_name)moviedbOpenStreamhome_title)MovieDBOpenStreamainulbedjo/owlimage URLsscreenshot/assetsThe diff touches 141 paths (GitHub lists one moved file as a separate delete + add, because its content changed enough to skip rename detection). Every source directory was moved with
git mvso history follows the files, and package declarations were verified against their paths (120 Kotlin files with apackagedeclaration, 0 mismatches).themoviedb.orgAPI/image URLs were explicitly protected from the rename and are unchanged.2. CI: build → Telegram
.github/workflows/android.yml— two jobs:./gradlew testDebugUnitTeston JDK 21.assembleDebug+assembleRelease, renames them toOpenStream-<flavor>-<shortsha>.apk, uploads a 30-day artifact, then sends both files to Telegram viascripts/telegram_send.py.Triggers: push to
mainandrebrand/**, tagsv*, PRs tomain, andworkflow_dispatch(with a toggle to skip the Telegram post).The send step keeps the env block you asked for:
scripts/telegram_send.pyis checked in rather than pulled from an unnamed third-party action, because that step receivesAPI_HASH+BOT_TOKENand it should be auditable. It uses Telethon over MTProto (client.start(bot_token=...), which is whyAPI_ID/API_HASHare needed at all), routes toTOPIC_IDviareply_towith a graceful fallback to the chat root, sends each APK as a document with a caption containing sha/branch/size/run link, and reads credentials only from the environment. Tested locally against a stubbed Telethon: init → bot login →get_entity→ topic send → fallback path all behave, and the missing-secret / missing-file / >50 MB cases exit with clear errors.3. Secrets to configure
Repo Settings → Secrets and variables → Actions:
TMDB_ACCESS_TOKEN,TMDB_API_KEY—core/build.gradle.ktsreadsaccess_token/api_keyfromlocal.properties, so the workflow writes that file from secrets and deletes it in analways()cleanup step. Without a token the APK still builds but every API call fails at runtime, so the step emits a::warning::.TELEGRAM_API_ID,TELEGRAM_API_HASH,TELEGRAM_BOT_TOKEN,TELEGRAM_CHAT_ID, and optionallyTELEGRAM_TOPIC_ID.The Telegram bot must be a member of the target chat (admin with "Send messages" for channels), and
TOPIC_IDonly works in a forum-enabled supergroup.Things worth knowing before merging
secrets.*inside a stepif:, which GitHub does not allow; the first Actions run died at parse time in 0s with no log. The reworked version probes secret presence in a preceding step that emits only a boolean, and moves branch/run values intoenv:so nothing untrusted is interpolated into the shell.actionlintnow reports zero findings, and both the push and pull_request runs start normally (run 42240728129 / 42240734494).assembleDebugwas never run. First CI run is the real test.sdkmanagerhas noplatforms;android-37— onlyandroid-37.0,37.1,37.2(plusbuild-tools;37.0.0, which does exist). The workflow tries the ids in a tolerant loop and lets AGP auto-download whatever remains. If the build job complains about the compile SDK, pin the exact extension version inDeps.COMPILE_SDK.app/build.gradle.ktshas nosigningConfig, soassembleReleaseproduces an APK you can't install over a signed one. The caption labels it "Release (unsigned)". Say the word and I'll wire a keystore from secrets (KEYSTORE_BASE64+ passwords) into the workflow.core/schemas/*.jsonstores table SQL only, no class names, so the package rename doesn't change schema identity. ButapplicationIdchanging fromapp.moviedbtoapp.openstreammeans an existing MovieDB install won't upgrade in place — it's a separate app now.Attribution
This is a rebrand of MovieDB by Ainul (ainulbedjo/owl), which is MIT licensed. The upstream copyright and permission notice stay in
LICENSE— the license requires that in any copy or derivative — with StudioAs Inc. added as the holder of the OpenStream modifications. The README states the lineage in plain terms rather than hiding it.Test plan
workflow_dispatch, Telegram toggle off) to confirm the build matrix.TMDB_ACCESS_TOKENset.