summarylogtreecommitdiffstats
path: root/no-ads.patch
blob: e00fd856c20a6b8414ce99f5b39e1cb982f85bbf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
diff -ruN a/main.js b/main.js
--- a/main.js	2022-11-19 12:15:47.180054024 +0100
+++ b/main.js	2022-11-19 12:21:38.458818923 +0100
@@ -92,8 +92,6 @@
       nodeIntegration: true,
       webviewTag: true,
       contextIsolation: false,
-      // Some ads load over HTTP instead of HTTPS :(
-      webSecurity: false,
     },
   };
 
diff -ruN a/main-view.js b/main-view.js
--- a/main-view.js	2022-05-28 14:17:42.739111678 +0200
+++ b/main-view.js	2022-05-28 14:50:14.227972642 +0200
@@ -1,6 +1,5 @@
 const { dialog } = require('@electron/remote');
 const { BaseAppView } = require('./base-app-view');
-const { AdService } = require('./scripts/services/ad-service');
 const {
   ExternalLinkService,
 } = require('./scripts/services/external-link-service');
@@ -85,7 +84,6 @@
 
     this._mainWindow = mainWindow;
 
-    this._adService = AdService;
     this._externalLinkService = new ExternalLinkService();
 
     this._mainWindow.game.desktopContentLoaded?.(document);
@@ -356,12 +354,6 @@
       this.selectRegion(user.preferredRegion.id, true);
     }
 
-    if (user && user.isSubscribed) {
-      this._adService.disableAds();
-    } else {
-      this._adService.enableAds();
-    }
-
     this._mainWindow.canUseRealTimeLiveLogging = user.canUseRealTimeLiveLogging;
 
     if (this._onboarded) {
@@ -734,7 +726,6 @@
   };
 
   fillInLoginForm = () => {
-    this._adService.disableAds();
     document.getElementById('startup-panel').style.display = 'none';
     document.getElementById('logincontent').style.display = '';
     document.getElementById('email').value = this._mainWindow.userName;
@@ -846,7 +837,6 @@
 </div>`);
 
       $('body').append(settingsElement);
-      await this._adService.pauseAds();
 
       const closeOverwolfControlElement = $(
         '.settings__close-overwolf-control'
@@ -873,7 +863,6 @@
 
       $('.settings__done-button').on('click', async () => {
         settingsElement.remove();
-        await this._adService.resumeAds();
       });
     });
   };
diff -ruN a/scripts/services/ad-service.js b/scripts/services/ad-service.js
--- a/scripts/services/ad-service.js	2022-05-28 14:17:42.739111678 +0200
+++ b/scripts/services/ad-service.js	1970-01-01 01:00:00.000000000 +0100
@@ -1,44 +0,0 @@
-let adsEnabled = false;
-
-const resumeAds = () => {
-  const adContainer = document.getElementById('electron-ad-container');
-  if (!adsEnabled || !adContainer || adContainer.style.display !== 'none')
-    return;
-  adContainer.style.display = 'flex';
-  adContainer.innerHTML =
-    "<webview allowpopups httpreferrer='" +
-    window.game.host() +
-    "' style='flex:1' id='electron-ad-view' src='" +
-    window.game.scheme() +
-    '://' +
-    window.game.host() +
-    "/client/ad'></webview>";
-};
-
-const pauseAds = () => {
-  const adContainer = document.getElementById('electron-ad-container');
-  if (!adContainer || adContainer.style.display === 'none') return;
-  adContainer.style.display = 'none';
-  adContainer.innerHTML = '';
-};
-
-const enableAds = () => {
-  adsEnabled = true;
-  resumeAds();
-};
-
-const disableAds = () => {
-  adsEnabled = false;
-  pauseAds();
-};
-
-const AdService = {
-  enableAds,
-  disableAds,
-  resumeAds,
-  pauseAds,
-};
-
-module.exports = {
-  AdService,
-};