mirror of
https://github.com/bitwarden/browser
synced 2025-12-10 05:13:29 +00:00
[PM-3554] Add support for alias creation via self-hosted SimpleLogin (#6077)
* Add support for alias creation via self-hosted SimpleLogin * Add forwardedSimpleLoginBaseUrl to username-gen-options type * Only show Server Url on web if on selfhosted bitwarden --------- Co-authored-by: Daniel James Smith <djsmith85@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
55bc275f40
commit
8067b26dc6
@@ -4,6 +4,7 @@ export class ForwarderOptions {
|
||||
fastmail = new FastmailForwarderOptions();
|
||||
anonaddy = new AnonAddyForwarderOptions();
|
||||
forwardemail = new ForwardEmailForwarderOptions();
|
||||
simplelogin = new SimpleLoginForwarderOptions();
|
||||
}
|
||||
|
||||
export class FastmailForwarderOptions {
|
||||
@@ -18,3 +19,7 @@ export class AnonAddyForwarderOptions {
|
||||
export class ForwardEmailForwarderOptions {
|
||||
domain: string;
|
||||
}
|
||||
|
||||
export class SimpleLoginForwarderOptions {
|
||||
baseUrl: string;
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@ export class SimpleLoginForwarder implements Forwarder {
|
||||
"Content-Type": "application/json",
|
||||
}),
|
||||
};
|
||||
let url = "https://app.simplelogin.io/api/alias/random/new";
|
||||
let url = options.simplelogin.baseUrl + "/api/alias/random/new";
|
||||
if (options.website != null) {
|
||||
url += "?hostname=" + options.website;
|
||||
}
|
||||
|
||||
@@ -17,4 +17,5 @@ export type UsernameGeneratorOptions = {
|
||||
forwardedForwardEmailApiToken?: string;
|
||||
forwardedForwardEmailDomain?: string;
|
||||
forwardedSimpleLoginApiKey?: string;
|
||||
forwardedSimpleLoginBaseUrl?: string;
|
||||
};
|
||||
|
||||
@@ -26,6 +26,7 @@ const DefaultOptions: UsernameGeneratorOptions = {
|
||||
forwardedAnonAddyDomain: "anonaddy.me",
|
||||
forwardedAnonAddyBaseUrl: "https://app.addy.io",
|
||||
forwardedForwardEmailDomain: "hideaddress.net",
|
||||
forwardedSimpleLoginBaseUrl: "https://app.simplelogin.io",
|
||||
};
|
||||
|
||||
export class UsernameGenerationService implements UsernameGenerationServiceAbstraction {
|
||||
@@ -128,6 +129,7 @@ export class UsernameGenerationService implements UsernameGenerationServiceAbstr
|
||||
if (o.forwardedService === "simplelogin") {
|
||||
forwarder = new SimpleLoginForwarder();
|
||||
forwarderOptions.apiKey = o.forwardedSimpleLoginApiKey;
|
||||
forwarderOptions.simplelogin.baseUrl = o.forwardedSimpleLoginBaseUrl;
|
||||
} else if (o.forwardedService === "anonaddy") {
|
||||
forwarder = new AnonAddyForwarder();
|
||||
forwarderOptions.apiKey = o.forwardedAnonAddyApiToken;
|
||||
|
||||
Reference in New Issue
Block a user