diff --git a/sites/+components/qr_modals.php b/sites/+components/qr_modals.php
index 909d0cf..2652747 100644
--- a/sites/+components/qr_modals.php
+++ b/sites/+components/qr_modals.php
@@ -4,7 +4,26 @@
return "$QR_CODES/$room_id.png";
}
- /*
+ /*
+ * Takes join URL and derives the invite.png path from it
+ */
+ function room_qr_code_native($join_url) {
+ // Ex.: https://open.getsession.org/session?public_key=[...]
+ // Goal: https://open.getsession.org/r/session/invite.png
+ // Note: No @legacy support (Ex.: https://reccacon.com/view/Ukraine/invite.png)
+ // TODO: How does this behave with unreliable connections to Chinese servers?
+ $exploded = explode("/", explode("?", $join_url)[0]); // everything before "?"
+ $png_url =
+ $exploded[0] . "//" . // https://
+ $exploded[2] . "/r/" . // open.getsession.org/r/
+ $exploded[3] . "/invite.png"; // session/invite.png
+
+// fwrite(STDERR, "PNG URL: " . $png_url . PHP_EOL);
+ return $png_url;
+ }
+
+ /*
+ * @Deprecated
* Use Google API to generate QR codes and encode them as base64
*/
function base64_qr_code($room_id, $join_url, $size = "512x512") {
@@ -37,10 +56,20 @@
×
+
+