Update manifest generation to work with the electron embeeded proxy

This commit is contained in:
Hinton 2020-11-25 14:29:53 +01:00
parent 03a52d4d63
commit a05677ab7f
3 changed files with 16 additions and 15 deletions

View File

@ -127,6 +127,10 @@
"filter": [ "filter": [
"**/*" "**/*"
] ]
},
{
"from": "resources/native-messaging.bat",
"to": "native-messaging.bat"
} }
] ]
}, },

View File

@ -0,0 +1,7 @@
@echo off
:: Helper script for starting the Native Messaging Proxy on Windows.
cd ../
set ELECTRON_RUN_AS_NODE=1
set ELECTRON_NO_ATTACH_CONSOLE=1
Bitwarden.exe resources/app.asar %*

View File

@ -63,7 +63,7 @@ export class NativeMessagingMain {
} }
const firefoxJson = {...baseJson, ...{ 'allowed_extensions': ['{446900e4-71c2-419f-a6a7-df9c091e268b}']}} const firefoxJson = {...baseJson, ...{ 'allowed_extensions': ['{446900e4-71c2-419f-a6a7-df9c091e268b}']}}
const chromeJson = {...baseJson, ...{ 'allowed_origins': ['chrome-extension://ijeheppnniijonkinoakkofcdhdfojda/']}} const chromeJson = {...baseJson, ...{ 'allowed_origins': ['chrome-extension://nngceckbapebfimnlniiiahkandclblb/']}}
switch (process.platform) { switch (process.platform) {
case 'win32': case 'win32':
@ -134,24 +134,14 @@ export class NativeMessagingMain {
} }
private binaryPath() { private binaryPath() {
const isPackaged = process.mainModule.filename.indexOf('app.asar') !== -1; const dir = path.join(this.appPath, '..');
if (isPackaged) {
const dir = path.join(this.appPath, '..');
if (process.platform === 'win32') {
return path.join(dir, 'proxy.exe');
}
return path.join(dir, 'proxy');
}
if (process.platform === 'win32') { if (process.platform === 'win32') {
return path.join(this.appPath, 'proxies', 'app-win.exe'); return path.join(dir, 'native-messaging.bat');
} else if (process.platform === 'darwin') { } else if (process.platform === 'darwin') {
return path.join(this.appPath, 'proxies', 'app-macos.exe'); return path.join(dir, '..', 'MacOS', 'Bitwarden');
} }
return path.join(this.appPath, 'proxies', 'app-linux.exe'); return path.join(dir, 'proxy');
} }
private async createWindowsRegistry(check: string, location: string, jsonFile: string) { private async createWindowsRegistry(check: string, location: string, jsonFile: string) {