mirror of
https://github.com/btcpayserver/btcpayserver.git
synced 2025-02-24 22:58:28 +01:00
* UI: Deprecate the custom CSS options As discussed with @pavlenex we are deprecating the custom CSS options for particular entities (payemnt request, pull payment, POS, crowdfund) in favor of the store branding approach. This displays the custom CSS section only if these values are set already. * Add IDs to html element This will allow styling of individual entities.
50 lines
2 KiB
Text
50 lines
2 KiB
Text
@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="en" @(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" />
|
|
@await RenderSectionAsync("PageHeadContent", false)
|
|
</head>
|
|
<body class="min-vh-100">
|
|
@RenderBody()
|
|
<partial name="LayoutFoot"/>
|
|
@await RenderSectionAsync("PageFootContent", false)
|
|
</body>
|
|
</html>
|