<?php
declare(strict_types=1);

require_once dirname(__DIR__) . '/includes/auth.php';
require_once dirname(__DIR__) . '/includes/qrcode.php';

$publicQrUrl = gpc_qrcode_configured_url();

if (isset($_GET['url']) || isset($_GET['link'])) {
    header('Content-Type: text/plain; charset=utf-8');
    header('Cache-Control: no-cache, no-store, must-revalidate');
    echo $publicQrUrl;
    exit;
}

if (isset($_GET['json']) || isset($_GET['info'])) {
    gpc_qrcode_json_out($publicQrUrl);
}

gpc_qrcode_stream_or_redirect($publicQrUrl, 300);
