mirror of
https://github.com/btcpayserver/btcpayserver.git
synced 2025-03-01 00:59:15 +01:00
* Label Manager component closes #4464 * UI updates * Test fix * add test * fix warnings * fix select update bug * add test * fix test * Increase payment box max-width * add labels from address to tx on detection * Exclude well known label from the dropdown * Add test on transaction label attachement, tighten UpdateLabels method to only update address labels --------- Co-authored-by: Dennis Reimann <mail@dennisreimann.de> Co-authored-by: nicolas.dorier <nicolas.dorier@gmail.com>
23 lines
959 B
C#
23 lines
959 B
C#
using System;
|
|
using System.Drawing;
|
|
using Microsoft.AspNetCore.Html;
|
|
using Microsoft.AspNetCore.Mvc;
|
|
using Microsoft.AspNetCore.Mvc.ViewComponents;
|
|
using QRCoder;
|
|
|
|
namespace BTCPayServer.Components.QRCode
|
|
{
|
|
public class QRCode : ViewComponent
|
|
{
|
|
private static QRCodeGenerator _qrGenerator = new ();
|
|
|
|
public IViewComponentResult Invoke(string data)
|
|
{
|
|
var qrCodeData = _qrGenerator.CreateQrCode(data, QRCodeGenerator.ECCLevel.Q);
|
|
var qrCode = new PngByteQRCode(qrCodeData);
|
|
var bytes = qrCode.GetGraphic(5, new byte[] { 0, 0, 0, 255 }, new byte[] { 0xf5, 0xf5, 0xf7, 255 });
|
|
var b64 = Convert.ToBase64String(bytes);
|
|
return new HtmlContentViewComponentResult(new HtmlString($"<img style=\"image-rendering:pixelated;image-rendering:-moz-crisp-edges;min-width:256px;min-height:256px\" src=\"data:image/png;base64,{b64}\" class=\"qr-code\" />"));
|
|
}
|
|
}
|
|
}
|