mirror of
https://github.com/bitwarden/browser.git
synced 2024-10-29 07:59:42 +01:00
Forwardfix (#803)
* fix default forwardedService property name * fixes to apis for forwarding services
This commit is contained in:
parent
de2eb0359b
commit
65584c6496
@ -112,11 +112,7 @@ export class UsernameGenerationService implements BaseUsernameGenerationService
|
||||
if (o.forwardedSimpleLoginApiKey == null || o.forwardedSimpleLoginApiKey === "") {
|
||||
return null;
|
||||
}
|
||||
return this.generateSimpleLoginAlias(
|
||||
o.forwardedSimpleLoginApiKey,
|
||||
o.forwardedSimpleLoginHostname,
|
||||
o.website
|
||||
);
|
||||
return this.generateSimpleLoginAlias(o.forwardedSimpleLoginApiKey, o.website);
|
||||
} else if (o.forwardedService === "anonaddy") {
|
||||
if (
|
||||
o.forwardedAnonAddyApiToken == null ||
|
||||
@ -173,15 +169,12 @@ export class UsernameGenerationService implements BaseUsernameGenerationService
|
||||
: new Array(width - number.length + 1).join("0") + number;
|
||||
}
|
||||
|
||||
private async generateSimpleLoginAlias(
|
||||
apiKey: string,
|
||||
hostname: string,
|
||||
websiteNote: string
|
||||
): Promise<string> {
|
||||
private async generateSimpleLoginAlias(apiKey: string, website: string): Promise<string> {
|
||||
if (apiKey == null || apiKey === "") {
|
||||
throw "Invalid SimpleLogin API key.";
|
||||
}
|
||||
const requestInit: RequestInit = {
|
||||
redirect: "manual",
|
||||
cache: "no-store",
|
||||
method: "POST",
|
||||
headers: new Headers({
|
||||
@ -190,12 +183,11 @@ export class UsernameGenerationService implements BaseUsernameGenerationService
|
||||
}),
|
||||
};
|
||||
let url = "https://app.simplelogin.io/api/alias/random/new";
|
||||
if (hostname != null) {
|
||||
url += "?hostname=" + hostname;
|
||||
if (website != null) {
|
||||
url += "?hostname=" + website;
|
||||
}
|
||||
requestInit.body = JSON.stringify({
|
||||
note:
|
||||
(websiteNote != null ? "Website: " + websiteNote + ". " : "") + "Generated by Bitwarden.",
|
||||
note: (website != null ? "Website: " + website + ". " : "") + "Generated by Bitwarden.",
|
||||
});
|
||||
const request = new Request(url, requestInit);
|
||||
const response = await this.apiService.nativeFetch(request);
|
||||
@ -226,6 +218,7 @@ export class UsernameGenerationService implements BaseUsernameGenerationService
|
||||
throw "Invalid AnonAddy API token.";
|
||||
}
|
||||
const requestInit: RequestInit = {
|
||||
redirect: "manual",
|
||||
cache: "no-store",
|
||||
method: "POST",
|
||||
headers: new Headers({
|
||||
@ -256,6 +249,7 @@ export class UsernameGenerationService implements BaseUsernameGenerationService
|
||||
throw "Invalid Firefox Relay API token.";
|
||||
}
|
||||
const requestInit: RequestInit = {
|
||||
redirect: "manual",
|
||||
cache: "no-store",
|
||||
method: "POST",
|
||||
headers: new Headers({
|
||||
|
Loading…
Reference in New Issue
Block a user