mirror of
https://github.com/bitwarden/browser.git
synced 2024-11-23 11:56:00 +01:00
callbacks for argv from window main (#141)
This commit is contained in:
parent
31a0be290b
commit
1513b25a35
@ -82,10 +82,10 @@ export class SsoComponent {
|
||||
const codeVerifierHash = await this.cryptoFunctionService.hash(codeVerifier, 'sha256');
|
||||
codeChallenge = Utils.fromBufferToUrlB64(codeVerifierHash);
|
||||
await this.storageService.save(ConstantsService.ssoCodeVerifierKey, codeVerifier);
|
||||
await this.storageService.save(ConstantsService.ssoStateKey, state);
|
||||
}
|
||||
if (state == null) {
|
||||
state = await this.passwordGenerationService.generatePassword(passwordOptions);
|
||||
await this.storageService.save(ConstantsService.ssoStateKey, state);
|
||||
}
|
||||
|
||||
const authorizeUrl = this.apiService.identityBaseUrl + '/connect/authorize?' +
|
||||
|
@ -22,7 +22,8 @@ export class WindowMain {
|
||||
private enableAlwaysOnTop: boolean = false;
|
||||
|
||||
constructor(private storageService: StorageService, private hideTitleBar = false,
|
||||
private defaultWidth = 950, private defaultHeight = 600) { }
|
||||
private defaultWidth = 950, private defaultHeight = 600,
|
||||
private argvCallback: (argv: string[]) => void = null) { }
|
||||
|
||||
init(): Promise<any> {
|
||||
return new Promise((resolve, reject) => {
|
||||
@ -33,7 +34,7 @@ export class WindowMain {
|
||||
app.quit();
|
||||
return;
|
||||
} else {
|
||||
app.on('second-instance', (event, commandLine, workingDirectory) => {
|
||||
app.on('second-instance', (event, argv, workingDirectory) => {
|
||||
// Someone tried to run a second instance, we should focus our window.
|
||||
if (this.win != null) {
|
||||
if (this.win.isMinimized() || !this.win.isVisible()) {
|
||||
@ -41,6 +42,11 @@ export class WindowMain {
|
||||
}
|
||||
this.win.focus();
|
||||
}
|
||||
if (process.platform === 'win32' || process.platform === 'linux') {
|
||||
if (this.argvCallback != null) {
|
||||
this.argvCallback(argv);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@ -57,6 +63,9 @@ export class WindowMain {
|
||||
app.on('ready', async () => {
|
||||
await this.createWindow();
|
||||
resolve();
|
||||
if (this.argvCallback != null) {
|
||||
this.argvCallback(process.argv);
|
||||
}
|
||||
});
|
||||
|
||||
// Quit when all windows are closed.
|
||||
|
Loading…
Reference in New Issue
Block a user