Rename and add to greenfield HtmlTags and HtmlMetaTags for apps (#6557)

This commit is contained in:
Nicolas Dorier 2025-01-15 23:48:10 +09:00 committed by GitHub
parent 2255da4a56
commit 92a92a7fff
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
15 changed files with 54 additions and 19 deletions

View file

@ -32,6 +32,8 @@ public abstract class CrowdfundBaseData : AppBaseData
public bool? SortPerksByPopularity { get; set; }
public string[]? Sounds { get; set; }
public string[]? AnimationColors { get; set; }
public string? HtmlLang { get; set; }
public string? HtmlMetaTags { get; set; }
public string? FormId { get; set; }
}

View file

@ -24,6 +24,8 @@ public abstract class PointOfSaleBaseData : AppBaseData
public string? Description { get; set; }
public bool? RedirectAutomatically { get; set; }
public int[]? CustomTipPercentages { get; set; }
public string? HtmlLang { get; set; }
public string? HtmlMetaTags { get; set; }
public string? FormId { get; set; }
}

View file

@ -333,6 +333,8 @@ namespace BTCPayServer.Controllers.Greenfield
SortPerksByPopularity = request.SortPerksByPopularity ?? false,
Sounds = parsedSounds ?? new CrowdfundSettings().Sounds,
AnimationColors = parsedColors ?? new CrowdfundSettings().AnimationColors,
HtmlMetaTags = request.HtmlMetaTags,
HtmlLang = request.HtmlLang,
FormId = request.FormId
};
}
@ -360,6 +362,8 @@ namespace BTCPayServer.Controllers.Greenfield
NotificationUrl = request.NotificationUrl,
RedirectUrl = request.RedirectUrl,
Description = request.Description,
HtmlLang = request.HtmlLang,
HtmlMetaTags = request.HtmlMetaTags,
RedirectAutomatically = request.RedirectAutomatically,
FormId = request.FormId
};
@ -421,6 +425,8 @@ namespace BTCPayServer.Controllers.Greenfield
FormId = settings.FormId,
NotificationUrl = settings.NotificationUrl,
RedirectUrl = settings.RedirectUrl,
HtmlLang = settings.HtmlLang,
HtmlMetaTags = settings.HtmlMetaTags,
Description = settings.Description,
RedirectAutomatically = settings.RedirectAutomatically,
Items = items
@ -484,6 +490,9 @@ namespace BTCPayServer.Controllers.Greenfield
SortPerksByPopularity = settings.SortPerksByPopularity,
Sounds = settings.Sounds,
AnimationColors = settings.AnimationColors,
HtmlLang = settings.HtmlLang,
HtmlMetaTags = settings.HtmlMetaTags,
FormId = settings.FormId,
Perks = perks
};
}

View file

@ -410,7 +410,7 @@ namespace BTCPayServer.Plugins.Crowdfund.Controllers
EnforceTargetAmount = settings.EnforceTargetAmount,
StartDate = settings.StartDate,
HtmlMetaTags= settings.HtmlMetaTags,
Language = settings.Language,
Language = settings.HtmlLang,
TargetCurrency = settings.TargetCurrency,
MainImageUrl = settings.MainImageUrl == null ? null : await _uriResolver.Resolve(Request.GetAbsoluteRootUri(), settings.MainImageUrl),
Description = settings.Description,
@ -542,7 +542,7 @@ namespace BTCPayServer.Plugins.Crowdfund.Controllers
StartDate = vm.StartDate?.ToUniversalTime(),
TargetCurrency = vm.TargetCurrency,
HtmlMetaTags= _safe.RawMeta(vm.HtmlMetaTags, out wasHtmlModified),
Language = vm.Language,
HtmlLang = vm.Language,
Description = vm.Description,
EndDate = vm.EndDate?.ToUniversalTime(),
TargetAmount = vm.TargetAmount,

View file

@ -194,7 +194,7 @@ namespace BTCPayServer.Plugins.Crowdfund
{
Title = settings.Title,
Tagline = settings.Tagline,
Lang = settings.Language,
HtmlLang = settings.HtmlLang,
HtmlMetaTags= settings.HtmlMetaTags,
Description = settings.Description,
StoreName = store.StoreName,

View file

@ -14,7 +14,7 @@ namespace BTCPayServer.Plugins.Crowdfund.Models
public string AppId { get; set; }
public string Title { get; set; }
public string Description { get; set; }
public string Lang { get; set; }
public string HtmlLang { get; set; }
public string HtmlMetaTags{ get; set; }
public string MainImageUrl { get; set; }
public string StoreName { get; set; }

View file

@ -138,7 +138,7 @@ namespace BTCPayServer.Plugins.PointOfSale.Controllers
CustomTipPercentages = settings.CustomTipPercentages,
AppId = appId,
StoreId = store.Id,
Lang = settings.Language,
HtmlLang = settings.HtmlLang,
HtmlMetaTags= settings.HtmlMetaTags,
Description = settings.Description,
});
@ -619,7 +619,7 @@ namespace BTCPayServer.Plugins.PointOfSale.Controllers
CustomButtonText = settings.CustomButtonText ?? PointOfSaleSettings.CUSTOM_BUTTON_TEXT_DEF,
CustomTipText = settings.CustomTipText ?? PointOfSaleSettings.CUSTOM_TIP_TEXT_DEF,
CustomTipPercentages = settings.CustomTipPercentages != null ? string.Join(",", settings.CustomTipPercentages) : string.Join(",", PointOfSaleSettings.CUSTOM_TIP_PERCENTAGES_DEF),
Language = settings.Language,
HtmlLang = settings.HtmlLang,
HtmlMetaTags= settings.HtmlMetaTags,
Description = settings.Description,
NotificationUrl = settings.NotificationUrl,
@ -716,7 +716,7 @@ namespace BTCPayServer.Plugins.PointOfSale.Controllers
CustomTipPercentages = ListSplit(vm.CustomTipPercentages),
NotificationUrl = vm.NotificationUrl,
RedirectUrl = vm.RedirectUrl,
Language = vm.Language,
HtmlLang = vm.HtmlLang,
HtmlMetaTags = _safe.RawMeta(vm.HtmlMetaTags, out wasHtmlModified),
Description = vm.Description,
RedirectAutomatically = string.IsNullOrEmpty(vm.RedirectAutomatically) ? null : bool.Parse(vm.RedirectAutomatically),

View file

@ -86,7 +86,8 @@ namespace BTCPayServer.Plugins.PointOfSale.Models
new() { Text = "Use Store Settings", Value = "" }
}, nameof(SelectListItem.Value), nameof(SelectListItem.Text), RedirectAutomatically);
public string Language { get; set; }
[Display(Name = "HTML Lang")]
public string HtmlLang { get; set; }
[Display(Name = "HTML Meta Tags")]
public string HtmlMetaTags{ get; set; }

View file

@ -68,7 +68,7 @@ namespace BTCPayServer.Plugins.PointOfSale.Models
public string CustomButtonText { get; set; }
public string CustomTipText { get; set; }
public int[] CustomTipPercentages { get; set; }
public string Lang { get; set; }
public string HtmlLang { get; set; }
public string HtmlMetaTags{ get; set; }
public string Description { get; set; }
public SelectList AllCategories { get; set; }

View file

@ -10,12 +10,11 @@ namespace BTCPayServer.Services.Apps
{
public CrowdfundSettings()
{
Language = "en";
}
public string Title { get; set; }
public string Description { get; set; }
public string Language { get; set; }
public string HtmlLang { get; set; }
public string HtmlMetaTags{ get; set; }
public bool Enabled { get; set; } = true;
public DateTime? StartDate { get; set; }

View file

@ -8,7 +8,6 @@ namespace BTCPayServer.Services.Apps
public PointOfSaleSettings()
{
Title = "Tea shop";
Language = "en";
Template = AppService.SerializeTemplate([
new AppItem
{
@ -100,7 +99,7 @@ namespace BTCPayServer.Services.Apps
public string CustomTipText { get; set; } = CUSTOM_TIP_TEXT_DEF;
public static readonly int[] CUSTOM_TIP_PERCENTAGES_DEF = { 15, 18, 20 };
public int[] CustomTipPercentages { get; set; } = CUSTOM_TIP_PERCENTAGES_DEF;
public string Language { get; set; }
public string HtmlLang { get; set; }
public string HtmlMetaTags{ get; set; }
public string Description { get; set; }
public string NotificationUrl { get; set; }

View file

@ -14,7 +14,7 @@
}
}
<!DOCTYPE html>
<html lang="@Model.Lang" class="h-100" @(Env.IsDeveloping ? " data-devenv" : "") id="Crowdfund-@Model.AppId">
<html lang="@Model.HtmlLang" class="h-100" @(Env.IsDeveloping ? " data-devenv" : "") id="Crowdfund-@Model.AppId">
<head>
<partial name="LayoutHead" />
<link href="~/vendor/bootstrap-vue/bootstrap-vue.min.css" asp-append-version="true" rel="stylesheet" />

View file

@ -33,7 +33,7 @@
}
}
<!DOCTYPE html>
<html class="h-100" lang="@Model.Lang" @(Env.IsDeveloping ? " data-devenv" : "") id="POS-@Model.AppId">
<html class="h-100" lang="@Model.HtmlLang" @(Env.IsDeveloping ? " data-devenv" : "") id="POS-@Model.AppId">
<head>
<partial name="LayoutHead" />
<meta name="apple-mobile-web-app-capable" content="yes">

View file

@ -208,10 +208,9 @@
<div id="additional-htmlheader" class="accordion-collapse collapse" aria-labelledby="additional-htmlheader-header">
<div class="accordion-body">
<div class="form-group">
<label asp-for="Language" class="form-label"></label>
<input asp-for="Language" class="form-control" maxlength="2" required />
<div class="form-text">Fix the HTML page language</div>
<span asp-validation-for="Language" class="text-danger"></span>
<label asp-for="HtmlLang" class="form-label"></label>
<input asp-for="HtmlLang" class="form-control"/>
<span asp-validation-for="HtmlLang" class="text-danger"></span>
</div>
<div class="form-group">
<label asp-for="HtmlMetaTags" class="form-label"></label>

View file

@ -762,6 +762,18 @@
"example": true,
"nullable": true
},
"htmlLang": {
"type": "string",
"description": "Used for SEO, the [HTML Lang](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/lang) of the page",
"nullable": true,
"example": "en"
},
"htmlMetaTags": {
"type": "string",
"description": "Used for SEO, the [Meta tags](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/meta) of the page",
"nullable": true,
"example": "<meta name=\"description\" content=\"Your description\">"
},
"formId": {
"type": "string",
"description": "Form ID to request customer data",
@ -984,6 +996,18 @@
],
"nullable": true
},
"htmlLang": {
"type": "string",
"description": "Used for SEO, the [HTML Lang](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/lang) of the page",
"nullable": true,
"example": "en"
},
"htmlMetaTags": {
"type": "string",
"description": "Used for SEO, the [Meta tags](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/meta) of the page",
"nullable": true,
"example": "<meta name=\"description\" content=\"Your description\">"
},
"formId": {
"type": "string",
"description": "Form ID to request customer data",