Show other tor services

This commit is contained in:
nicolas.dorier
2019-03-18 16:45:46 +09:00
parent 014d08f38a
commit c2754b324d
3 changed files with 45 additions and 5 deletions

View File

@@ -470,12 +470,20 @@ namespace BTCPayServer.Controllers
{
if (torService.VirtualPort == 80)
{
result.TorServices.Add(new ServicesViewModel.OtherExternalService()
result.TorHttpServices.Add(new ServicesViewModel.OtherExternalService()
{
Name = torService.Name,
Link = $"http://{torService.OnionHost}"
});
}
else
{
result.OtherExternalServices.Add(new ServicesViewModel.OtherExternalService()
{
Name = torService.Name,
Link = $"{torService.OnionHost}:{torService.VirtualPort}"
});
}
}
return View(result);
}

View File

@@ -18,6 +18,7 @@ namespace BTCPayServer.Models.ServerViewModels
public List<ExternalService> ExternalServices { get; set; } = new List<ExternalService>();
public List<OtherExternalService> OtherExternalServices { get; set; } = new List<OtherExternalService>();
public List<OtherExternalService> TorServices { get; set; } = new List<OtherExternalService>();
public List<OtherExternalService> TorHttpServices { get; set; } = new List<OtherExternalService>();
public List<OtherExternalService> TorOtherServices { get; set; } = new List<OtherExternalService>();
}
}

View File

@@ -79,11 +79,11 @@
</div>
}
@if (Model.TorServices.Count != 0)
@if (Model.TorHttpServices.Count != 0)
{
<div class="row">
<div class="col-md-8">
<h4>TOR hidden services</h4>
<h4>HTTP TOR hidden services</h4>
<div class="form-group">
<span>TOR services hosted on this server, only http servers are listed here.</span>
</div>
@@ -96,7 +96,7 @@
</tr>
</thead>
<tbody>
@foreach (var s in Model.TorServices)
@foreach (var s in Model.TorHttpServices)
{
<tr>
<td>@s.Name</td>
@@ -112,6 +112,37 @@
</div>
}
@if (Model.TorOtherServices.Count != 0)
{
<div class="row">
<div class="col-md-8">
<h4>Other TOR hidden services</h4>
<div class="form-group">
<span>TOR services hosted on this server which are not http based.</span>
</div>
<div class="form-group">
<table class="table table-sm table-responsive-md">
<thead>
<tr>
<th>Name</th>
<th style="text-align:right">Actions</th>
</tr>
</thead>
<tbody>
@foreach (var s in Model.TorOtherServices)
{
<tr>
<td>@s.Name</td>
<td style="text-align:right">@s.Link</td>
</tr>
}
</tbody>
</table>
</div>
</div>
</div>
}
@section Scripts {
@await Html.PartialAsync("_ValidationScriptsPartial")
}