mirror of
https://github.com/btcpayserver/btcpayserver.git
synced 2024-11-19 18:11:36 +01:00
31 lines
825 B
C#
31 lines
825 B
C#
|
using Ganss.XSS;
|
||
|
using Microsoft.AspNetCore.Html;
|
||
|
using Microsoft.AspNetCore.Mvc.Rendering;
|
||
|
|
||
|
namespace BTCPayServer.Services
|
||
|
{
|
||
|
public class Safe
|
||
|
{
|
||
|
private readonly IHtmlHelper _htmlHelper;
|
||
|
private readonly IJsonHelper _jsonHelper;
|
||
|
private readonly HtmlSanitizer _htmlSanitizer;
|
||
|
|
||
|
public Safe(IHtmlHelper htmlHelper, IJsonHelper jsonHelper, HtmlSanitizer htmlSanitizer)
|
||
|
{
|
||
|
_htmlHelper = htmlHelper;
|
||
|
_jsonHelper = jsonHelper;
|
||
|
_htmlSanitizer = htmlSanitizer;
|
||
|
}
|
||
|
|
||
|
public IHtmlContent Raw(string value)
|
||
|
{
|
||
|
return _htmlHelper.Raw(_htmlSanitizer.Sanitize(value));
|
||
|
}
|
||
|
|
||
|
public IHtmlContent Json(object model)
|
||
|
{
|
||
|
return _htmlHelper.Raw(_jsonHelper.Serialize(model));
|
||
|
}
|
||
|
}
|
||
|
}
|