mirror of
https://github.com/btcpayserver/btcpayserver.git
synced 2025-01-19 05:33:31 +01:00
parent
321b67efd4
commit
36868644dc
@ -85,7 +85,7 @@ namespace BTCPayServer.Tests
|
||||
var views = Path.Combine(TestUtils.TryGetSolutionDirectoryInfo().FullName, "BTCPayServer", "Views");
|
||||
var viewFiles = Directory.EnumerateFiles(views, "*.cshtml", SearchOption.AllDirectories).ToArray();
|
||||
Assert.NotEmpty(viewFiles);
|
||||
Regex regex = new Regex("href=\"(http.*?)[\"#]");
|
||||
Regex regex = new Regex("href=\"(http.*?)\"");
|
||||
var httpClient = new HttpClient();
|
||||
List<Task> checkLinks = new List<Task>();
|
||||
foreach (var file in viewFiles)
|
||||
@ -155,16 +155,33 @@ namespace BTCPayServer.Tests
|
||||
|
||||
private static async Task AssertLinkNotDead(HttpClient httpClient, string url, string file)
|
||||
{
|
||||
var uri = new Uri(url);
|
||||
|
||||
try
|
||||
{
|
||||
using var request = new HttpRequestMessage(HttpMethod.Get, new Uri(url));
|
||||
using var request = new HttpRequestMessage(HttpMethod.Get, uri);
|
||||
request.Headers.TryAddWithoutValidation("Accept",
|
||||
"text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8");
|
||||
request.Headers.TryAddWithoutValidation("User-Agent",
|
||||
"Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:75.0) Gecko/20100101 Firefox/75.0");
|
||||
Assert.Equal(HttpStatusCode.OK, (await httpClient.SendAsync(request)).StatusCode);
|
||||
var response = await httpClient.SendAsync(request);
|
||||
Assert.Equal(HttpStatusCode.OK, response.StatusCode);
|
||||
if (uri.Fragment.Length != 0)
|
||||
{
|
||||
var fragment = uri.Fragment.Substring(1);
|
||||
var contents = await response.Content.ReadAsStringAsync();
|
||||
Assert.Matches($"id=\"{fragment}\"", contents);
|
||||
}
|
||||
|
||||
Logs.Tester.LogInformation($"OK: {url} ({file})");
|
||||
}
|
||||
catch (Exception ex) when (ex is MatchesException)
|
||||
{
|
||||
var details = ex.Message;
|
||||
Logs.Tester.LogInformation($"FAILED: {url} ({file}) – anchor not found: {uri.Fragment}");
|
||||
|
||||
throw;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
var details = ex is EqualException ? (ex as EqualException).Actual : ex.Message;
|
||||
|
@ -100,7 +100,7 @@
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label asp-for="CustomCSSLink" class="control-label"></label>
|
||||
<a href="https://docs.btcpayserver.org/Theme/#_2-bootstrap-themes" target="_blank"><span class="fa fa-question-circle-o" title="More information..."></span></a>
|
||||
<a href="https://docs.btcpayserver.org/Theme/#2-bootstrap-themes" target="_blank"><span class="fa fa-question-circle-o" title="More information..."></span></a>
|
||||
<input asp-for="CustomCSSLink" class="form-control" />
|
||||
<span asp-validation-for="CustomCSSLink" class="text-danger"></span>
|
||||
</div>
|
||||
|
@ -79,7 +79,7 @@
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label asp-for="CustomCSSLink" class="control-label"></label>
|
||||
<a href="https://docs.btcpayserver.org/Theme/#_2-bootstrap-themes" target="_blank"><span class="fa fa-question-circle-o" title="More information..."></span></a>
|
||||
<a href="https://docs.btcpayserver.org/Theme/#2-bootstrap-themes" target="_blank"><span class="fa fa-question-circle-o" title="More information..."></span></a>
|
||||
<input asp-for="CustomCSSLink" class="form-control" />
|
||||
<span asp-validation-for="CustomCSSLink" class="text-danger"></span>
|
||||
</div>
|
||||
|
@ -85,7 +85,7 @@
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label asp-for="CustomCSSLink" class="control-label"></label>
|
||||
<a href="https://docs.btcpayserver.org/Theme/#_2-bootstrap-themes" target="_blank">
|
||||
<a href="https://docs.btcpayserver.org/Theme/#2-bootstrap-themes" target="_blank">
|
||||
<span class="fa fa-question-circle-o" title="More information..."></span>
|
||||
</a>
|
||||
<input asp-for="CustomCSSLink" class="form-control" />
|
||||
|
@ -27,14 +27,14 @@
|
||||
</div>
|
||||
<div class="form-group mb-5">
|
||||
<label asp-for="CustomThemeCssUri"></label>
|
||||
<a href="https://docs.btcpayserver.org/Theme/#_1-custom-themes" target="_blank"><span class="fa fa-question-circle-o" title="More information..."></span></a>
|
||||
<a href="https://docs.btcpayserver.org/Theme/#1-custom-themes" target="_blank"><span class="fa fa-question-circle-o" title="More information..."></span></a>
|
||||
<input asp-for="CustomThemeCssUri" class="form-control" />
|
||||
<span asp-validation-for="CustomThemeCssUri" class="text-danger"></span>
|
||||
</div>
|
||||
<h4>Bootstrap theme</h4>
|
||||
<div class="form-group">
|
||||
<label asp-for="BootstrapCssUri"></label>
|
||||
<a href="https://docs.btcpayserver.org/Theme/#_2-bootstrap-themes" target="_blank"><span class="fa fa-question-circle-o" title="More information..."></span></a>
|
||||
<a href="https://docs.btcpayserver.org/Theme/#2-bootstrap-themes" target="_blank"><span class="fa fa-question-circle-o" title="More information..."></span></a>
|
||||
<input asp-for="BootstrapCssUri" class="form-control" />
|
||||
<span asp-validation-for="BootstrapCssUri" class="text-danger"></span>
|
||||
<p class="form-text text-muted">
|
||||
|
Loading…
Reference in New Issue
Block a user