mirror of
https://github.com/bitwarden/browser
synced 2025-12-12 14:23:32 +00:00
Adding the processDeepLink call to app.component (#7734)
This commit is contained in:
@@ -444,6 +444,9 @@ export class AppComponent implements OnInit, OnDestroy {
|
|||||||
case "redrawMenu":
|
case "redrawMenu":
|
||||||
await this.updateAppMenu();
|
await this.updateAppMenu();
|
||||||
break;
|
break;
|
||||||
|
case "deepLink":
|
||||||
|
this.processDeepLink(message.urlString);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@@ -744,4 +747,30 @@ export class AppComponent implements OnInit, OnDestroy {
|
|||||||
private isAccountCleanUpInProgress(userId: string): boolean {
|
private isAccountCleanUpInProgress(userId: string): boolean {
|
||||||
return this.accountCleanUpInProgress[userId] === true;
|
return this.accountCleanUpInProgress[userId] === true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Process the sso callback links
|
||||||
|
private processDeepLink(urlString: string) {
|
||||||
|
const url = new URL(urlString);
|
||||||
|
const code = url.searchParams.get("code");
|
||||||
|
const receivedState = url.searchParams.get("state");
|
||||||
|
let message = "";
|
||||||
|
|
||||||
|
if (code === null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (urlString.indexOf("bitwarden://duo-callback") === 0) {
|
||||||
|
message = "duoCallback";
|
||||||
|
} else if (receivedState === null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (urlString.indexOf("bitwarden://import-callback-lp") === 0) {
|
||||||
|
message = "importCallbackLastPass";
|
||||||
|
} else if (urlString.indexOf("bitwarden://sso-callback") === 0) {
|
||||||
|
message = "ssoCallback";
|
||||||
|
}
|
||||||
|
|
||||||
|
this.messagingService.send(message, { code: code, state: receivedState });
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -273,28 +273,7 @@ export class Main {
|
|||||||
argv
|
argv
|
||||||
.filter((s) => s.indexOf("bitwarden://") === 0)
|
.filter((s) => s.indexOf("bitwarden://") === 0)
|
||||||
.forEach((s) => {
|
.forEach((s) => {
|
||||||
const url = new URL(s);
|
this.messagingService.send("deepLink", { urlString: s });
|
||||||
const code = url.searchParams.get("code");
|
|
||||||
const receivedState = url.searchParams.get("state");
|
|
||||||
let message = "";
|
|
||||||
|
|
||||||
if (code === null) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (s.indexOf("bitwarden://duo-callback") === 0) {
|
|
||||||
message = "duoCallback";
|
|
||||||
} else if (receivedState === null) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (s.indexOf("bitwarden://import-callback-lp") === 0) {
|
|
||||||
message = "importCallbackLastPass";
|
|
||||||
} else if (s.indexOf("bitwarden://sso-callback") === 0) {
|
|
||||||
message = "ssoCallback";
|
|
||||||
}
|
|
||||||
|
|
||||||
this.messagingService.send(message, { code: code, state: receivedState });
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user