Small refactor

This commit is contained in:
nicolas.dorier 2019-03-01 14:46:32 +09:00
parent d898f716d1
commit 013054fb82
2 changed files with 4 additions and 3 deletions

View File

@ -141,7 +141,8 @@ namespace BTCPayServer.Configuration
.Select(p => (Name: p.p.Substring(0, p.SeparatorIndex), .Select(p => (Name: p.p.Substring(0, p.SeparatorIndex),
Link: p.p.Substring(p.SeparatorIndex + 1)))) Link: p.p.Substring(p.SeparatorIndex + 1))))
{ {
OtherExternalServices.AddOrReplace(service.Name, service.Link); if (Uri.TryCreate(service.Link, UriKind.RelativeOrAbsolute, out var uri))
OtherExternalServices.AddOrReplace(service.Name, uri);
} }
} }
@ -247,7 +248,7 @@ namespace BTCPayServer.Configuration
public string RootPath { get; set; } public string RootPath { get; set; }
public Dictionary<string, LightningConnectionString> InternalLightningByCryptoCode { get; set; } = new Dictionary<string, LightningConnectionString>(); public Dictionary<string, LightningConnectionString> InternalLightningByCryptoCode { get; set; } = new Dictionary<string, LightningConnectionString>();
public Dictionary<string, string> OtherExternalServices { get; set; } = new Dictionary<string, string>(); public Dictionary<string, Uri> OtherExternalServices { get; set; } = new Dictionary<string, Uri>();
public ExternalServices ExternalServices { get; set; } = new ExternalServices(); public ExternalServices ExternalServices { get; set; } = new ExternalServices();
public BTCPayNetworkProvider NetworkProvider { get; set; } public BTCPayNetworkProvider NetworkProvider { get; set; }

View File

@ -460,7 +460,7 @@ namespace BTCPayServer.Controllers
result.OtherExternalServices.Add(new ServicesViewModel.OtherExternalService() result.OtherExternalServices.Add(new ServicesViewModel.OtherExternalService()
{ {
Name = externalService.Key, Name = externalService.Key,
Link = this.Request.GetRelativePathOrAbsolute(externalService.Value) Link = this.Request.GetAbsoluteUriNoPathBase(externalService.Value).AbsoluteUri
}); });
} }
if (_Options.SSHSettings != null) if (_Options.SSHSettings != null)