mirror of
https://github.com/btcpayserver/btcpayserver.git
synced 2025-02-26 23:49:57 +01:00
* Store Branding: Refactoring and logo as favicon - Encapsulates store branding properties into their own view model - Uses the logo as favicon on public pages * Refactorings * Updates
47 lines
1.8 KiB
Text
47 lines
1.8 KiB
Text
@using Microsoft.AspNetCore.Hosting
|
|
@using Newtonsoft.Json.Linq
|
|
@using System.IO
|
|
@using BTCPayServer.Services
|
|
@inject IWebHostEnvironment WebHostEnvironment
|
|
@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 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)}";
|
|
}
|
|
}
|
|
<!DOCTYPE html>
|
|
<html class="h-100" lang="en" @(Env.IsDeveloping ? " data-devenv" : "")>
|
|
<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" />
|
|
@await RenderSectionAsync("PageHeadContent", false)
|
|
</head>
|
|
<body class="min-vh-100">
|
|
@RenderBody()
|
|
<partial name="LayoutFoot"/>
|
|
@await RenderSectionAsync("PageFootContent", false)
|
|
</body>
|
|
</html>
|