fix(wireguard-dashboard): Use qrcode module in wizard.js

The wizard.js was looking for a global QRCode object that doesn't exist.
Updated to import and use our qrcode module like other views do.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
CyberMind-FR 2026-01-23 12:42:16 +01:00
parent 2a4423d036
commit 14690ebe9e
2 changed files with 7 additions and 9 deletions

View File

@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=luci-app-wireguard-dashboard
PKG_VERSION:=0.7.0
PKG_RELEASE:=4
PKG_RELEASE:=5
PKG_ARCH:=all
PKG_LICENSE:=Apache-2.0

View File

@ -5,6 +5,7 @@
'require form';
'require network';
'require wireguard-dashboard/api as api';
'require wireguard-dashboard/qrcode as qrcode';
// Zone presets for peer creation
var ZONE_PRESETS = {
@ -718,15 +719,12 @@ return view.extend({
])
]);
// Load QR library and generate
if (typeof QRCode !== 'undefined') {
new QRCode(qrContainer, {
text: config,
width: 256,
height: 256
});
// Generate QR code using our library
var svg = qrcode.generateSVG(config, 256);
if (svg) {
qrContainer.innerHTML = svg;
} else {
qrContainer.innerHTML = '<p>' + _('QR library not loaded') + '</p>';
qrContainer.innerHTML = '<p>' + _('QR generation failed - config too long') + '</p>';
}
},