Skip to content

Remove helpers.hideAd()#1925

Merged
RohitKushvaha01 merged 12 commits intoAcode-Foundation:mainfrom
RohitKushvaha01:main
Mar 13, 2026
Merged

Remove helpers.hideAd()#1925
RohitKushvaha01 merged 12 commits intoAcode-Foundation:mainfrom
RohitKushvaha01:main

Conversation

@RohitKushvaha01
Copy link
Member

@RohitKushvaha01 RohitKushvaha01 commented Mar 7, 2026

removed helpers.hideAd() from plugin api

@RohitKushvaha01 RohitKushvaha01 marked this pull request as draft March 7, 2026 13:26
@greptile-apps
Copy link
Contributor

greptile-apps bot commented Mar 7, 2026

Greptile Summary

This PR extracts the hideAd() function out of the helpers utility object and into a dedicated named export in src/lib/startAd.js, then updates all 12+ call sites to import and call it directly. The primary motivation is to remove hideAd() from the public plugin API — since helpers is exposed wholesale via acode.require("helpers"), any plugin could previously call helpers.hideAd() to suppress banner ads.

Key points:

  • Plugin API breaking change (intentional): acode.require("helpers").hideAd will now be undefined. Any third-party plugin that previously called it will get a TypeError at runtime. No stub or deprecation path is provided, which is by design per the PR description.
  • tag global dependency in startAd.js: The new hideAd() export uses tag.getAll() without an explicit import. This mirrors the identical pre-existing pattern in helpers.js and relies on the html-tag-js polyfill setting tag as a browser global. Adding an explicit import tag from "html-tag-js" would make this dependency self-documenting.
  • Import style inconsistency: src/lib/removeAds.js imports via "./startAd.js" (relative + .js extension) while all other 11 changed files use "lib/startAd" (webpack module resolution). Both forms resolve correctly at build time.
  • All helpers imports in the updated pages are still needed for their helpers.showAd() calls, so no orphaned imports are introduced.

Confidence Score: 4/5

  • Safe to merge — the logic refactor is correct and the breaking API change is intentional; minor style inconsistencies remain.
  • The core logic is a clean extraction of an identical function body with no behavioral change. All call sites are updated, no orphaned imports are left behind, and the module graph is consistent. The two deductions are: (1) an implicit tag global that should be made explicit in startAd.js for maintainability, and (2) a minor import-style inconsistency in removeAds.js. Neither affects runtime correctness.
  • src/lib/startAd.js — implicit tag global dependency; src/lib/removeAds.js — relative import style differs from the rest of the PR.

Important Files Changed

Filename Overview
src/lib/startAd.js New hideAd() export added with logic identical to the removed helpers.hideAd(). tag is used without an explicit import, mirroring the same pattern already present in helpers.js (which also uses tag globally). Logic is correct.
src/lib/removeAds.js Correctly swaps helpers import for { hideAd } from "./startAd.js". Relative path is valid since both files live in src/lib/, but it differs in style from the "lib/startAd" form used in all 11 other changed files.
src/utils/helpers.js hideAd() removed from the helpers object. The remaining showAd() and other methods are untouched. Since helpers is exposed via acode.require("helpers") in the plugin API, this is a deliberate breaking change for plugins that called helpers.hideAd().
src/components/settingsPage.js Correctly adds import { hideAd } from "lib/startAd" and replaces the helpers.hideAd() call. helpers import is still needed for helpers.showAd().
src/pages/plugins/plugins.js Correctly adds hideAd import and replaces the call site. helpers is still used for showAd(), toInternalUri(), promisify(), and errorMessage().
src/pages/about/about.js Import added and call site updated correctly. A blank line between the last import and the function declaration was incidentally removed in this diff.
package-lock.json Reflects the @biomejs/biome version constraint relaxation (exact pin → ^2.1.4) and a dedent patch-level update. These are unrelated to the ad-blocking refactor.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A["Plugin code\n(acode.require('helpers'))"] -->|"hideAd() ❌ removed"| B["helpers.js\n(utils/helpers)"]
    B -->|"showAd() ✅ still present"| C["window.ad.show()"]

    D["Page onhide callbacks\n(12 files)"] -->|"hideAd() import"| E["startAd.js\n(lib/startAd)"]
    E -->|"hideAd(force)"| F{"ad?.active?"}
    F -->|"yes + (force OR single page)"| G["ad.active = false\nad.hide()"]
    F -->|"no"| H["no-op"]

    I["removeAds.js\n(lib/removeAds)"] -->|"hideAd(true)"| E
    J["adRewards/index.js"] -->|"hideAd(true)"| E

    style A fill:#f88,stroke:#c00
    style E fill:#8f8,stroke:#080
    style B fill:#adf,stroke:#06c
Loading

Last reviewed commit: 7fff162

RohitKushvaha01 and others added 4 commits March 10, 2026 11:41
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
RohitKushvaha01 and others added 2 commits March 10, 2026 13:51
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
@RohitKushvaha01 RohitKushvaha01 added CI: RUN ON-DEMAND PREVIEW RELEASES Triggers an on-demand preview build for this pull request via CI workflow. and removed CI: RUN ON-DEMAND PREVIEW RELEASES Triggers an on-demand preview build for this pull request via CI workflow. labels Mar 10, 2026
@RohitKushvaha01

This comment was marked as resolved.

@RohitKushvaha01 RohitKushvaha01 marked this pull request as ready for review March 13, 2026 03:58
@RohitKushvaha01 RohitKushvaha01 changed the title Make ad blocking harder Remove helpers.hideAd() Mar 13, 2026
@RohitKushvaha01 RohitKushvaha01 merged commit d144a65 into Acode-Foundation:main Mar 13, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant