mirror of
https://github.com/bitwarden/mobile
synced 2025-12-05 23:53:33 +00:00
Compare commits
6 Commits
v2024.3.1
...
community/
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
37b8bf9f69 | ||
|
|
9a7d2e2f93 | ||
|
|
e44c8ce7f3 | ||
|
|
8221f3b6f3 | ||
|
|
8faebde3ca | ||
|
|
c8bbad9838 |
7
global.json
Normal file
7
global.json
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
{
|
||||||
|
"sdk": {
|
||||||
|
"version": "7.0.400",
|
||||||
|
"rollForward": "latestPatch",
|
||||||
|
"allowPrerelease": false
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -46,7 +46,11 @@ namespace Bit.Core.Models.Domain
|
|||||||
case ForwardedEmailServiceType.DuckDuckGo:
|
case ForwardedEmailServiceType.DuckDuckGo:
|
||||||
return new ForwarderOptions { ApiKey = DuckDuckGoApiKey };
|
return new ForwarderOptions { ApiKey = DuckDuckGoApiKey };
|
||||||
case ForwardedEmailServiceType.Fastmail:
|
case ForwardedEmailServiceType.Fastmail:
|
||||||
return new ForwarderOptions { ApiKey = FastMailApiKey };
|
return new FastmailForwarderOptions
|
||||||
|
{
|
||||||
|
ApiKey = FastMailApiKey,
|
||||||
|
Website = EmailWebsite
|
||||||
|
};
|
||||||
case ForwardedEmailServiceType.FirefoxRelay:
|
case ForwardedEmailServiceType.FirefoxRelay:
|
||||||
return new ForwarderOptions { ApiKey = FirefoxRelayApiAccessToken };
|
return new ForwarderOptions { ApiKey = FirefoxRelayApiAccessToken };
|
||||||
case ForwardedEmailServiceType.SimpleLogin:
|
case ForwardedEmailServiceType.SimpleLogin:
|
||||||
|
|||||||
@@ -9,16 +9,21 @@ using Newtonsoft.Json.Linq;
|
|||||||
|
|
||||||
namespace Bit.Core.Services.EmailForwarders
|
namespace Bit.Core.Services.EmailForwarders
|
||||||
{
|
{
|
||||||
public class FastmailForwarder : BaseForwarder<ForwarderOptions>
|
public class FastmailForwarderOptions : ForwarderOptions
|
||||||
|
{
|
||||||
|
public string Website { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public class FastmailForwarder : BaseForwarder<FastmailForwarderOptions>
|
||||||
{
|
{
|
||||||
protected override string RequestUri => "https://api.fastmail.com/jmap/api/";
|
protected override string RequestUri => "https://api.fastmail.com/jmap/api/";
|
||||||
|
|
||||||
protected override void ConfigureHeaders(HttpRequestHeaders headers, ForwarderOptions options)
|
protected override void ConfigureHeaders(HttpRequestHeaders headers, FastmailForwarderOptions options)
|
||||||
{
|
{
|
||||||
headers.Add("Authorization", $"Bearer {options.ApiKey}");
|
headers.Add("Authorization", $"Bearer {options.ApiKey}");
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override async Task<HttpContent> GetContentAsync(IApiService apiService, ForwarderOptions options)
|
protected override async Task<HttpContent> GetContentAsync(IApiService apiService, FastmailForwarderOptions options)
|
||||||
{
|
{
|
||||||
string accountId = null;
|
string accountId = null;
|
||||||
try
|
try
|
||||||
@@ -55,7 +60,8 @@ namespace Bit.Core.Services.EmailForwarders
|
|||||||
["state"] = "enabled",
|
["state"] = "enabled",
|
||||||
["description"] = "",
|
["description"] = "",
|
||||||
["url"] = "",
|
["url"] = "",
|
||||||
["emailPrefix"] = ""
|
["emailPrefix"] = "",
|
||||||
|
["forDomain"] = options.Website ?? ""
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -148,6 +148,13 @@ namespace Bit.Core.Services
|
|||||||
.GenerateAsync(_apiService, forwardedEmailOptions);
|
.GenerateAsync(_apiService, forwardedEmailOptions);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (options.ServiceType == ForwardedEmailServiceType.Fastmail)
|
||||||
|
{
|
||||||
|
var fastmailEmailOptions = (FastmailForwarderOptions)options.GetForwarderOptions();
|
||||||
|
return await new FastmailForwarder()
|
||||||
|
.GenerateAsync(_apiService, fastmailEmailOptions);
|
||||||
|
}
|
||||||
|
|
||||||
BaseForwarder<ForwarderOptions> simpleForwarder = null;
|
BaseForwarder<ForwarderOptions> simpleForwarder = null;
|
||||||
|
|
||||||
switch (options.ServiceType)
|
switch (options.ServiceType)
|
||||||
@@ -161,9 +168,6 @@ namespace Bit.Core.Services
|
|||||||
case ForwardedEmailServiceType.DuckDuckGo:
|
case ForwardedEmailServiceType.DuckDuckGo:
|
||||||
simpleForwarder = new DuckDuckGoForwarder();
|
simpleForwarder = new DuckDuckGoForwarder();
|
||||||
break;
|
break;
|
||||||
case ForwardedEmailServiceType.Fastmail:
|
|
||||||
simpleForwarder = new FastmailForwarder();
|
|
||||||
break;
|
|
||||||
default:
|
default:
|
||||||
_logger.Value.Error($"Error UsernameGenerationService: ForwardedEmailServiceType {options.ServiceType} not implemented.");
|
_logger.Value.Error($"Error UsernameGenerationService: ForwardedEmailServiceType {options.ServiceType} not implemented.");
|
||||||
return Constants.DefaultUsernameGenerated;
|
return Constants.DefaultUsernameGenerated;
|
||||||
|
|||||||
Reference in New Issue
Block a user