Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix bestiefy.com #2865

Closed
wants to merge 8 commits into from
Closed

Fix bestiefy.com #2865

wants to merge 8 commits into from

Conversation

ghost
Copy link

@ghost ghost commented Dec 9, 2022

I don't have the time yet to test this as an extension, though if I understand how surrogates.js is supposed to work, my testing in the browser console should show that this works. Someone else should check though.

@ghost
Copy link
Author

ghost commented Dec 9, 2022

Also, I used Prettier as a formatter, so I accidentally changed some of the quote formatting - somebody could put it back though.

@ghostwords
Copy link
Member

Hello and thank you for the PR!

Does this fix #2847? If this is about something else, could you provide examples of breakages that this resolves?

@ghost
Copy link
Author

ghost commented Dec 11, 2022

Yes, it fixes #2847

@ghostwords ghostwords added the surrogates Replacement blank/noop/dummy/neutered versions of tracking scripts used to avoid site breakages label Dec 16, 2022
@ghostwords
Copy link
Member

The following WIP patch seems to fix quiz taking at Bestiefy, but I'm not sure it makes sense to release a surrogate to fix a single minor site. Are there other sites where surrogating Playwire fixes something?

diff --git a/src/data/surrogates.js b/src/data/surrogates.js
index 54ca250..fabcd72 100644
--- a/src/data/surrogates.js
+++ b/src/data/surrogates.js
@@ -24,6 +24,10 @@ const MATCH_SUFFIX = 'suffix',
  * `hostnames` maps hostnames to surrogate pattern tokens.
  */
 const hostnames = {
+  'cdn.intergient.com': {
+    match: MATCH_SUFFIX,
+    tokens: ['/ramp.js']
+  },
   'b.scorecardresearch.com': {
     match: MATCH_SUFFIX,
     tokens: [
@@ -178,6 +195,8 @@ const surrogates = {
 
   '/omweb-v1.js': 'noop.js',
 
+  '/ramp.js': 'ramp.js',
+
   'noopjs': 'noop.js'
 };
 diff --git a/src/data/web_accessible_resources/ramp.js b/src/data/web_accessible_resources/ramp.js
new file mode 100644
index 0000000..e8bb1f6
--- /dev/null
+++ b/src/data/web_accessible_resources/ramp.js
@@ -0,0 +1,16 @@
+// https://developers.playwire.com/api/docs/ads/getting-started-ads.html
+(function () {
+    function noopfn() {}
+    function checkForOnReady() {
+        if (!window.ramp) {
+            window.ramp = {};
+        }
+        window.ramp.addUnits = () => new Promise(noopfn);
+        window.ramp.displayUnits = noopfn;
+        window.ramp.destroyUnits = noopfn;
+        if (typeof window.ramp.onReady == "function") {
+            window.ramp.onReady();
+        }
+    }
+    setTimeout(checkForOnReady, 10);
+}());

I'm going to close this for now, but please let me know if you have more broken site examples.

@ghostwords ghostwords closed this Dec 16, 2022
@ghost
Copy link
Author

ghost commented Dec 17, 2022

Yes, it does fix other sites too:

I'm sure there are even more that are unreported. I vaguely remember there being some India-related news website that had a similar breakage issue, but I forgot the exact issue with it. This is a fairly common tracking script which has functions that can be (and are) directly referenced.

@ghost
Copy link
Author

ghost commented Dec 19, 2022

Another thing I found in uBlock's unbreak list that shows more sites that this might unbreak:

! https://github.com/gorhill/uBlock/issues/182
! http://www.okgoals.com/match-highlights-1425491618---41
! To counter `intergi.com` in Peter Lowe's. For example, breaks:
! explosm.net
! lastminutegoals.org
! okgoals.com
! tvgolo.com
@@||cdn.phoenix.intergi.com^
! https://github.com/uBlockOrigin/uAssets/issues/5784
@@||cdn.intergi.com/pageos/pageos.js$script,domain=abcya.com
@@||cdn.playwire.com/bolt*/*$image,domain=abcya.com
@@||cdn.playwire.com/bolt*/js/zeus/*/frame/admgr$script,1p

I'm unsure how many more of these there are, but this seems like a script that is used more on either gaming or small sites, but is too invasive/annoying for larger sites. It seems to make bigger profits for sites that would get less money with AdSense for example and don't really care that it tracks everything users do and makes big flashy annoying popups.

@ghost ghost mentioned this pull request Dec 19, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
surrogates Replacement blank/noop/dummy/neutered versions of tracking scripts used to avoid site breakages
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant