|
|
@ -4,7 +4,26 @@
|
|
|
|
return "$QR_CODES/$room_id.png";
|
|
|
|
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
|
|
|
|
* Use Google API to generate QR codes and encode them as base64
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
function base64_qr_code($room_id, $join_url, $size = "512x512") {
|
|
|
|
function base64_qr_code($room_id, $join_url, $size = "512x512") {
|
|
|
@ -37,10 +56,20 @@
|
|
|
|
<span class="qr-code-modal-close" onclick='hideQRModal("<?=$id?>")'>
|
|
|
|
<span class="qr-code-modal-close" onclick='hideQRModal("<?=$id?>")'>
|
|
|
|
×
|
|
|
|
×
|
|
|
|
</span>
|
|
|
|
</span>
|
|
|
|
|
|
|
|
<!--
|
|
|
|
<img
|
|
|
|
<img
|
|
|
|
src="data:image/png;base64,<?=base64_qr_code($id, $room->join_link)?>"
|
|
|
|
src="data:image/png;base64,<?=base64_qr_code($id, $room->join_link)?>"
|
|
|
|
alt="Community join link encoded as QR code"
|
|
|
|
alt="Community join link encoded as QR code"
|
|
|
|
class="qr-code"
|
|
|
|
class="qr-code"
|
|
|
|
|
|
|
|
loading="lazy"
|
|
|
|
|
|
|
|
>
|
|
|
|
|
|
|
|
-->
|
|
|
|
|
|
|
|
<img
|
|
|
|
|
|
|
|
src="<?=room_qr_code_native($room->join_link)?>"
|
|
|
|
|
|
|
|
alt="Community join link encoded as QR code"
|
|
|
|
|
|
|
|
class="qr-code"
|
|
|
|
|
|
|
|
loading="lazy"
|
|
|
|
|
|
|
|
referrerpolicy="no-referrer"
|
|
|
|
>
|
|
|
|
>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|