diff options
author | 2022-04-22 15:04:21 -0500 | |
---|---|---|
committer | 2022-04-22 20:04:21 +0000 | |
commit | 759d93dc198a3cc8c5265245c0144efa5435682b (patch) | |
tree | 53e963a085d3d12af5a2efa2f1ab6f3e5574edc7 /src/models/UserAgent.js | |
parent | Added build scripts for linux, macos and windows to help new contributors get... (diff) | |
download | ferdium-app-759d93dc198a3cc8c5265245c0144efa5435682b.tar.gz ferdium-app-759d93dc198a3cc8c5265245c0144efa5435682b.tar.zst ferdium-app-759d93dc198a3cc8c5265245c0144efa5435682b.zip |
Turn off usage of 'debug' npm package using with electron-16 (fixes #17)
Diffstat (limited to 'src/models/UserAgent.js')
-rw-r--r-- | src/models/UserAgent.js | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/models/UserAgent.js b/src/models/UserAgent.js index caacb6797..f818ee9d0 100644 --- a/src/models/UserAgent.js +++ b/src/models/UserAgent.js | |||
@@ -2,7 +2,8 @@ import { action, computed, observe, observable } from 'mobx'; | |||
2 | 2 | ||
3 | import defaultUserAgent from '../helpers/userAgent-helpers'; | 3 | import defaultUserAgent from '../helpers/userAgent-helpers'; |
4 | 4 | ||
5 | const debug = require('debug')('Ferdium:UserAgent'); | 5 | // TODO: Go back to 'debug' from 'console.log' when https://github.com/electron/electron/issues/31689 is fixed |
6 | // const debug = require('debug')('Ferdium:UserAgent'); | ||
6 | 7 | ||
7 | export default class UserAgent { | 8 | export default class UserAgent { |
8 | _willNavigateListener = null; | 9 | _willNavigateListener = null; |
@@ -78,7 +79,7 @@ export default class UserAgent { | |||
78 | @action _handleNavigate(url, forwardingHack = false) { | 79 | @action _handleNavigate(url, forwardingHack = false) { |
79 | if (url.startsWith('https://accounts.google.com')) { | 80 | if (url.startsWith('https://accounts.google.com')) { |
80 | if (!this.chromelessUserAgent) { | 81 | if (!this.chromelessUserAgent) { |
81 | debug('Setting user agent to chromeless for url', url); | 82 | console.log('Setting user agent to chromeless for url', url); |
82 | this.chromelessUserAgent = true; | 83 | this.chromelessUserAgent = true; |
83 | this.webview.userAgent = this.userAgent; | 84 | this.webview.userAgent = this.userAgent; |
84 | if (forwardingHack) { | 85 | if (forwardingHack) { |
@@ -86,14 +87,14 @@ export default class UserAgent { | |||
86 | } | 87 | } |
87 | } | 88 | } |
88 | } else if (this.chromelessUserAgent) { | 89 | } else if (this.chromelessUserAgent) { |
89 | debug('Setting user agent to contain chrome for url', url); | 90 | console.log('Setting user agent to contain chrome for url', url); |
90 | this.chromelessUserAgent = false; | 91 | this.chromelessUserAgent = false; |
91 | this.webview.userAgent = this.userAgent; | 92 | this.webview.userAgent = this.userAgent; |
92 | } | 93 | } |
93 | } | 94 | } |
94 | 95 | ||
95 | _addWebviewEvents(webview) { | 96 | _addWebviewEvents(webview) { |
96 | debug('Adding event handlers'); | 97 | console.log('Adding event handlers'); |
97 | 98 | ||
98 | this._willNavigateListener = event => this._handleNavigate(event.url, true); | 99 | this._willNavigateListener = event => this._handleNavigate(event.url, true); |
99 | webview.addEventListener('will-navigate', this._willNavigateListener); | 100 | webview.addEventListener('will-navigate', this._willNavigateListener); |
@@ -103,7 +104,7 @@ export default class UserAgent { | |||
103 | } | 104 | } |
104 | 105 | ||
105 | _removeWebviewEvents(webview) { | 106 | _removeWebviewEvents(webview) { |
106 | debug('Removing event handlers'); | 107 | console.log('Removing event handlers'); |
107 | 108 | ||
108 | webview.removeEventListener('will-navigate', this._willNavigateListener); | 109 | webview.removeEventListener('will-navigate', this._willNavigateListener); |
109 | webview.removeEventListener('did-navigate', this._didNavigateListener); | 110 | webview.removeEventListener('did-navigate', this._didNavigateListener); |