Improve XMPP regex

This commit is contained in:
Yarmo Mackenbach 2020-07-22 14:32:10 +02:00
parent 39fc871749
commit 3401810fac

View file

@ -535,7 +535,9 @@ async function verifyProof(url, fingerprint) {
// XMPP // XMPP
if (/^xmpp:/.test(url)) { if (/^xmpp:/.test(url)) {
output.type = "xmpp"; output.type = "xmpp";
match = url.match(/xmpp:(.*)@(.*)/); console.log(url);
match = url.match(/xmpp:([a-zA-Z0-9\.\-\_]*)@([a-zA-Z0-9\.\-\_]*)(?:\?(.*))?/);
console.log(match);
output.display = `${match[1]}@${match[2]}`; output.display = `${match[1]}@${match[2]}`;
output.proofUrl = `https://xmpp-vcard.keyoxide.org/api/vcard/${output.display}/DESC`; output.proofUrl = `https://xmpp-vcard.keyoxide.org/api/vcard/${output.display}/DESC`;
try { try {