btcpayserver/BTCPayServer/Views/Shared/PointOfSale/Public/_Layout.cshtml

51 lines
2 KiB
Text
Raw Normal View History

@using BTCPayServer.Abstractions.Extensions
@using Microsoft.AspNetCore.Hosting
@using Microsoft.AspNetCore.Mvc.TagHelpers
@using Newtonsoft.Json.Linq
@using System.IO
@using BTCPayServer.Services
@inject IWebHostEnvironment WebHostEnvironment
@inject BTCPayServerEnvironment Env
2022-07-18 20:51:53 +02:00
@model BTCPayServer.Plugins.PointOfSale.Models.ViewPointOfSaleViewModel
2018-04-03 11:50:41 +09:00
@{
ViewData["Title"] = string.IsNullOrEmpty(Model.Title) ? Model.StoreName : Model.Title;
2018-04-03 11:50:41 +09:00
Layout = null;
async Task<string> GetDynamicManifest(string title)
{
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());
jObject["short_name"] = title;
jObject["name"] = $"BTCPay Server: {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)}";
}
2018-04-03 11:50:41 +09:00
}
<!DOCTYPE html>
<html class="h-100" lang="en" @(Env.IsDeveloping ? " data-devenv" : "")>
2018-04-03 11:50:41 +09:00
<head>
<partial name="LayoutHead"/>
<partial name="LayoutHeadStoreBranding" model="@(Model.BrandColor, Model.CssFileId, Model.CustomCSSLink, Model.EmbeddedCSS)" />
2018-04-03 11:50:41 +09:00
<meta name="apple-mobile-web-app-capable" content="yes">
2018-12-13 21:36:19 +08:00
<link rel="apple-touch-icon" href="~/img/icons/icon-512x512.png">
<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" />
@await RenderSectionAsync("PageHeadContent", false)
2018-04-03 11:50:41 +09:00
</head>
<body class="min-vh-100">
2020-05-28 08:50:04 +02:00
@RenderBody()
<partial name="LayoutFoot"/>
@await RenderSectionAsync("PageFootContent", false)
2018-04-03 11:50:41 +09:00
</body>
</html>