Release v2.5.4

This commit is contained in:
2026-08-03 21:20:54 +01:00
parent a5e8ecb21f
commit a45552fed3
22 changed files with 371 additions and 9 deletions
+36
View File
@@ -0,0 +1,36 @@
const QRCode = require('qrcode');
async function createQrCodeSvg(value) {
const text = String(value === undefined || value === null ? '' : value).trim();
if (!text) {
return '';
}
return QRCode.toString(text, {
type: 'svg',
margin: 1,
errorCorrectionLevel: 'M'
});
}
async function buildQrCodeContent(value) {
const text = String(value === undefined || value === null ? '' : value).trim();
const content = {
type: 'qr-code',
value: text
};
if (text) {
const svg = await createQrCodeSvg(text);
if (svg) {
content.qr_svg = svg;
}
}
return content;
}
module.exports = {
createQrCodeSvg,
buildQrCodeContent
};