Exempt the Electron desktop shell from loading Admiral ads - #4651
Merged
Conversation
Admiral (introjava.com) is injected via a runtime document.createElement call, not a static <script> tag, so it's invisible to any HTML-level stripping done downstream in the Electron/Steam build. Extend the existing adsEnabled gate (which already exempts CrazyGames) to also exempt the desktop shell, detected via the window.openfrontDesktop global its preload script exposes. Discovered via openfront-desktop's offline-network e2e test, which caught real requests to introjava.com and aax.amazon-adsystem.com during an offline app load.
Contributor
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
WalkthroughAdds Electron desktop-shell detection and disables ads when the application runs inside that shell. ChangesDesktop shell ad handling
Estimated code review effort: 2 (Simple) | ~10 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Contributor
|
Yes |
iiamlewis
enabled auto-merge
July 22, 2026 12:04
evanpelle
approved these changes
Jul 22, 2026
3 tasks
evanpelle
pushed a commit
that referenced
this pull request
Jul 25, 2026
**Add approved & assigned issue number here:**
## Description:
Admiral (`src/client/Admiral.ts`), OpenFront's ad-recovery vendor, is
injected via a runtime `document.createElement("script")` call rather
than a static HTML `<script>` tag. That makes it invisible to HTML-level
ad stripping done in the (private, separate) Electron/Steam shell repo,
so it was attempting to load — and cascading into further ad-exchange
calls — inside the paid desktop client.
`Main.ts` already exempts CrazyGames-hosted sessions from Admiral via
`window.adsEnabled = !isAdFree && !crazyGamesSDK.isOnCrazyGames()`. This
extends that same, existing gate to also cover the Electron desktop
shell, detected via a new `src/client/DesktopShell.ts`
(`isDesktopShell()`), which mirrors `CrazyGamesSDK.ts`'s
`isOnCrazyGames()` pattern: it checks for `window.openfrontDesktop`, a
global only the Electron app's own preload script ever sets. No behavior
change for web/CrazyGames users — the change is a single additional `&&`
clause.
## Please complete the following:
- [x] I have added screenshots for all UI updates — n/a, no UI change
- [x] I process any text displayed to the user through translateText()
and I've added it to the en.json file — n/a, no user-facing text added
- [ ] I have added relevant tests to the test directory — no unit test
added; following existing convention in this area (`CrazyGamesSDK.ts`'s
`isOnCrazyGames()`, the pattern this mirrors, also has no dedicated unit
test). Verified instead via `tsc --noEmit`, `eslint`/`prettier`, a full
`build-prod`, and the Electron shell's own e2e network-isolation test
confirming Admiral's script (and downstream ad-exchange calls) no longer
attempt to load when `window.openfrontDesktop` is present.
## Please put your Discord username so you can be contacted if a bug or
regression is found:
jish
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.
Add approved & assigned issue number here:
Description:
Admiral (
src/client/Admiral.ts), OpenFront's ad-recovery vendor, is injected via a runtimedocument.createElement("script")call rather than a static HTML<script>tag. That makes it invisible to HTML-level ad stripping done in the (private, separate) Electron/Steam shell repo, so it was attempting to load — and cascading into further ad-exchange calls — inside the paid desktop client.Main.tsalready exempts CrazyGames-hosted sessions from Admiral viawindow.adsEnabled = !isAdFree && !crazyGamesSDK.isOnCrazyGames(). This extends that same, existing gate to also cover the Electron desktop shell, detected via a newsrc/client/DesktopShell.ts(isDesktopShell()), which mirrorsCrazyGamesSDK.ts'sisOnCrazyGames()pattern: it checks forwindow.openfrontDesktop, a global only the Electron app's own preload script ever sets. No behavior change for web/CrazyGames users — the change is a single additional&&clause.Please complete the following:
CrazyGamesSDK.ts'sisOnCrazyGames(), the pattern this mirrors, also has no dedicated unit test). Verified instead viatsc --noEmit,eslint/prettier, a fullbuild-prod, and the Electron shell's own e2e network-isolation test confirming Admiral's script (and downstream ad-exchange calls) no longer attempt to load whenwindow.openfrontDesktopis present.Please put your Discord username so you can be contacted if a bug or regression is found:
jish