mirror of
https://github.com/aljazceru/btcpayserver.git
synced 2026-01-01 13:14:30 +01:00
* HTML lang setting and Head tags for POS and Crowdfund public pages * updates #6229 * updates 6229 * resolve conflict * updated according to Nicolas' recommendations * updates #6229 * Add RawMeta method in safe.cs * ... * resolve conflicts * resolve conflict * resolve conflicts * Updates as Nicolas request * updates --------- Co-authored-by: d11n <mail@dennisreimann.de>
53 lines
2.2 KiB
Plaintext
53 lines
2.2 KiB
Plaintext
@using Microsoft.AspNetCore.Hosting
|
|
@using Newtonsoft.Json.Linq
|
|
@using System.IO
|
|
@using BTCPayServer.Services
|
|
@inject IWebHostEnvironment WebHostEnvironment
|
|
@inject SettingsRepository SettingsRepository
|
|
@inject BTCPayServerEnvironment Env
|
|
@model BTCPayServer.Plugins.PointOfSale.Models.ViewPointOfSaleViewModel
|
|
@{
|
|
ViewData["Title"] = string.IsNullOrEmpty(Model.Title) ? Model.StoreName : Model.Title;
|
|
ViewData["StoreBranding"] = Model.StoreBranding;
|
|
Layout = null;
|
|
|
|
async Task<string> GetDynamicManifest(string title)
|
|
{
|
|
var settings = await SettingsRepository.GetSettingAsync<ServerSettings>() ?? new ServerSettings();
|
|
var manifest = WebHostEnvironment.WebRootFileProvider.GetFileInfo("manifest.json");
|
|
if (!manifest.Exists)
|
|
{
|
|
return null;
|
|
}
|
|
using var reader = new StreamReader(manifest.CreateReadStream());
|
|
var jObject = JObject.Parse(await reader.ReadToEndAsync());
|
|
var serverName = string.IsNullOrWhiteSpace(settings.ServerName) ? "BTCPay Server" : settings.ServerName;
|
|
jObject["short_name"] = title;
|
|
jObject["name"] = $"{serverName}: {title}";
|
|
foreach (var jToken in jObject["icons"]!)
|
|
{
|
|
var icon = (JObject)jToken;
|
|
icon["src"] = $"{Context.Request.GetAbsoluteRoot()}/{icon["src"]}";
|
|
}
|
|
return $"data:application/manifest+json,{Safe.Json(jObject)}";
|
|
}
|
|
}
|
|
<!DOCTYPE html>
|
|
<html class="h-100" lang="@Model.Lang" @(Env.IsDeveloping ? " data-devenv" : "") id="POS-@Model.AppId">
|
|
<head>
|
|
<partial name="LayoutHead" />
|
|
<meta name="apple-mobile-web-app-capable" content="yes">
|
|
<link rel="apple-touch-startup-image" href="~/img/splash.png">
|
|
<link rel="manifest" href="@(await GetDynamicManifest(ViewData["Title"]!.ToString()))">
|
|
<link href="~/pos/common.css" asp-append-version="true" rel="stylesheet" />
|
|
@* Html.Raw OK here since Html has been cleaned before in controller *@
|
|
@Html.Raw(Model.HtmlMetaTags)
|
|
@await RenderSectionAsync("PageHeadContent", false)
|
|
</head>
|
|
<body class="min-vh-100">
|
|
@RenderBody()
|
|
<partial name="LayoutFoot"/>
|
|
@await RenderSectionAsync("PageFootContent", false)
|
|
</body>
|
|
</html>
|