mirror of
https://github.com/btcpayserver/btcpayserver.git
synced 2025-02-22 06:21:44 +01:00
use thememanager instead of view component
This commit is contained in:
parent
1888e4fe2b
commit
053c2da9f1
4 changed files with 8 additions and 39 deletions
|
@ -1,29 +0,0 @@
|
|||
using System.Threading.Tasks;
|
||||
using BTCPayServer.Models;
|
||||
using BTCPayServer.Services;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace BTCPayServer.Components
|
||||
{
|
||||
public class RobotsMetaViewComponent : ViewComponent
|
||||
{
|
||||
private readonly SettingsRepository _SettingsRepository;
|
||||
|
||||
public RobotsMetaViewComponent(SettingsRepository settingsRepository)
|
||||
{
|
||||
_SettingsRepository = settingsRepository;
|
||||
}
|
||||
|
||||
public async Task<IViewComponentResult> InvokeAsync()
|
||||
{
|
||||
var policies = await _SettingsRepository.GetSettingAsync<PoliciesSettings>();
|
||||
|
||||
return View(new RobotsMetaViewModel()
|
||||
{
|
||||
DiscourageSearchEngines = policies.DiscourageSearchEngines
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -45,10 +45,12 @@ namespace BTCPayServer.HostedServices
|
|||
}
|
||||
|
||||
public bool ShowRegister { get; set; }
|
||||
public bool DiscourageSearchEngines { get; set; }
|
||||
|
||||
internal void Update(PoliciesSettings data)
|
||||
{
|
||||
ShowRegister = !data.LockSubscription;
|
||||
DiscourageSearchEngines = data.DiscourageSearchEngines;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +0,0 @@
|
|||
@model BTCPayServer.Models.RobotsMetaViewModel
|
||||
@if (Model.DiscourageSearchEngines)
|
||||
{
|
||||
<META NAME="robots" CONTENT="noindex">
|
||||
}
|
|
@ -15,9 +15,10 @@
|
|||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
||||
<meta name="description" content="">
|
||||
<meta name="author" content="">
|
||||
<cache expires-after="@TimeSpan.FromMinutes(5)">
|
||||
@await Component.InvokeAsync("RobotsMeta", new { })
|
||||
</cache>
|
||||
@if (themeManager.DiscourageSearchEngines)
|
||||
{
|
||||
<META NAME="robots" CONTENT="noindex">
|
||||
}
|
||||
|
||||
<title>BTCPay Server</title>
|
||||
|
||||
|
@ -61,7 +62,7 @@
|
|||
<ul class="navbar-nav ml-auto">
|
||||
@if (SignInManager.IsSignedIn(User))
|
||||
{
|
||||
@if (User.IsInRole(Roles.ServerAdmin))
|
||||
if (User.IsInRole(Roles.ServerAdmin))
|
||||
{
|
||||
<li class="nav-item"><a asp-area="" asp-controller="Server" asp-action="ListUsers" class="nav-link js-scroll-trigger">Server settings</a></li>
|
||||
}
|
||||
|
@ -78,7 +79,7 @@
|
|||
</li>}
|
||||
else
|
||||
{
|
||||
@if (themeManager.ShowRegister)
|
||||
if (themeManager.ShowRegister)
|
||||
{
|
||||
<li class="nav-item"><a asp-area="" asp-controller="Account" asp-action="Register" class="nav-link js-scroll-trigger">Register</a></li>
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue