diff --git a/core/scripts/webpanel/templates/users.html b/core/scripts/webpanel/templates/users.html index 619af73..096e618 100644 --- a/core/scripts/webpanel/templates/users.html +++ b/core/scripts/webpanel/templates/users.html @@ -678,32 +678,48 @@ // QR Code Modal $("#qrcodeModal").on("show.bs.modal", function (event) { - const button = $(event.relatedTarget); - const username = button.data("username"); - const configContainer = $(`#userConfigs-${username}`); - const qrcodesContainer = $("#qrcodesContainer"); - qrcodesContainer.empty(); + const button = $(event.relatedTarget); + const configContainer = $(`#userConfigs-${button.data("username")}`); + const qrcodesContainer = $("#qrcodesContainer"); + qrcodesContainer.empty(); - configContainer.find(".config-container").each(function () { - const configLink = $(this).data("link"); - const configType = $(this).find(".config-type").text().replace(":", ""); - - // Create a card for each QR code + configContainer.find(".config-container").each(function () { + const configLink = $(this).data("link"); + const configType = $(this).find(".config-type").text().replace(":", ""); + + let displayType = configType; + + const hashMatch = configLink.match(/#(.+)$/); + if (hashMatch && hashMatch[1]) { + const hashValue = hashMatch[1]; + if (hashValue.includes("IPv4") || hashValue.includes("IPv6")) { + displayType = hashValue; + } + } else if (configLink.includes("ipv4") || configLink.includes("IPv4")) { + displayType = "IPv4"; + } else if (configLink.includes("ipv6") || configLink.includes("IPv6")) { + displayType = "IPv6"; + } + + const qrCodeId = `qrcode-${displayType}-${Math.random().toString(36).substring(2, 10)}`; + const card = $(` -