From 047718beb4d78ad496f62c301b562ecec7144b5f Mon Sep 17 00:00:00 2001 From: Jacob Karlsson Date: Mon, 15 Apr 2024 00:26:14 +0200 Subject: [PATCH] Allow pasting http invites --- main.js | 5 ++++- src/JoinModal.js | 4 ++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/main.js b/main.js index 285135e..e106693 100644 --- a/main.js +++ b/main.js @@ -228,7 +228,10 @@ async function handlePPPPPUri(ev, uri) { setTimeout(handlePPPPPUri, 100, null, uri) return } - if (!uri.startsWith('ppppp://')) return console.log('Not a ppppp:// URI', uri) + if (uri.startsWith("http:") || uri.startsWith("https://")) { + uri = decodeURIComponent(uri.split('/invite#')[1]) + } + if (!uri.startsWith('ppppp://')) return console.log('Not a ppppp invite URI', uri) const commands = peer.invite.parse(uri) for (const command of commands) { console.log('Executing command', JSON.stringify(command)) diff --git a/src/JoinModal.js b/src/JoinModal.js index 467a081..a340884 100644 --- a/src/JoinModal.js +++ b/src/JoinModal.js @@ -16,10 +16,10 @@ function JoinModal({ isOpen, onClose }) { return ( - Insert here the ppppp:// invite code you received from your friend. + Insert here the ppppp:// or http(s):// invite code you received from your friend.