Do not activate Blazor in Wizard screens (#5435)

This commit is contained in:
Nicolas Dorier 2023-10-27 17:16:36 +09:00 committed by GitHub
parent b702621a04
commit 609ec0989f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 31 additions and 18 deletions

View file

@ -20,6 +20,15 @@ namespace BTCPayServer.Abstractions.Extensions
Relative
}
public static void SetBlazorAllowed(this ViewDataDictionary viewData, bool allowed)
{
viewData["BlazorAllowed"] = allowed;
}
public static bool IsBlazorAllowed(this ViewDataDictionary viewData)
{
return viewData["BlazorAllowed"] is not false;
}
public static void SetActivePage<T>(this ViewDataDictionary viewData, T activePage, string title = null, string activeId = null)
where T : IConvertible
{

View file

@ -4,7 +4,7 @@
<script src="~/vendor/flatpickr/flatpickr.js" asp-append-version="true"></script>
<script src="~/js/copy-to-clipboard.js" asp-append-version="true"></script>
<script src="~/main/utils.js" asp-append-version="true"></script>
@if (User.Identity.IsAuthenticated)
@if (User.Identity.IsAuthenticated && ViewData.IsBlazorAllowed())
{
<script src="~/_blazorfiles/_framework/blazor.server.js" autostart="false" asp-append-version="true"></script>
}

View file

@ -1,5 +1,6 @@
@{
Layout = "_LayoutSimple";
@{
Layout = "_LayoutSimple";
ViewData.SetBlazorAllowed(false);
}
@section PageHeadContent {

View file

@ -27,6 +27,7 @@
return status.ToString().ToLowerInvariant();
}
}
ViewData.SetBlazorAllowed(false);
}
<!DOCTYPE html>

View file

@ -7,22 +7,23 @@
@inject DisplayFormatter DisplayFormatter
@model BTCPayServer.Models.ViewPullPaymentModel
@{
ViewData["Title"] = Model.Title;
ViewData["Title"] = Model.Title;
Csp.UnsafeEval();
Layout = null;
string StatusTextClass(string status)
{
switch (status)
{
case "Completed":
case "In Progress":
return "bg-success";
case "Cancelled":
return "bg-danger";
default:
return "bg-warning";
}
}
Layout = null;
string StatusTextClass(string status)
{
switch (status)
{
case "Completed":
case "In Progress":
return "bg-success";
case "Cancelled":
return "bg-danger";
default:
return "bg-warning";
}
}
ViewData.SetBlazorAllowed(false);
}
<!DOCTYPE html>
<html lang="en" @(Env.IsDeveloping ? " data-devenv" : "")>

View file

@ -9,6 +9,7 @@
@using BTCPayServer.Models.StoreViewModels
@using BTCPayServer.Data
@using Microsoft.AspNetCore.Routing;
@using BTCPayServer.Abstractions.Extensions;
@inject Safe Safe
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
@addTagHelper *, BTCPayServer