-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[APD-8271] disable node integration for admob windows
- Loading branch information
1 parent
a92b582
commit c28d04e
Showing
9 changed files
with
254 additions
and
90 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import packageInfo from '../../package.json'; | ||
|
||
|
||
export function cutElectronFromUserAgent (originalUA: string): string { | ||
let appName = packageInfo.productName.split(' ').join(''), | ||
electron = 'Electron'; | ||
return originalUA.split(' ').filter(text => !(text.match(appName) || text.match(electron))).join(' '); | ||
} |
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import {cutElectronFromUserAgent} from './lib/user-agent'; | ||
|
||
|
||
function overrideGetter (target: any, key: string, getter: () => any) { | ||
if (Object.defineProperty) { | ||
Object.defineProperty(target, key, { | ||
get: getter | ||
}); | ||
} else { | ||
// @ts-ignore | ||
if (Object.prototype.__defineGetter__) { | ||
// @ts-ignore | ||
navigator.__proto__.__defineGetter__('target', getter); | ||
} | ||
} | ||
} | ||
|
||
const defaultUserAgent = navigator.userAgent; | ||
const defaultAppVersion = navigator.appVersion; | ||
|
||
overrideGetter(navigator, 'userAgent', () => cutElectronFromUserAgent(defaultUserAgent)); | ||
overrideGetter(navigator, 'appVersion', () => cutElectronFromUserAgent(defaultAppVersion)); |
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import * as path from 'path'; | ||
import webpack from 'webpack'; | ||
import {SRC_PATH} from '../default'; | ||
|
||
|
||
export default (env: webpack.Configuration): webpack.Configuration => { | ||
return { | ||
entry: { | ||
preload: path.join(SRC_PATH, './preload.ts') | ||
|
||
}, | ||
target: 'electron-preload' | ||
}; | ||
} |