<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Verification</title>
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
    <script>
        if (typeof jQuery === 'undefined') {
            document.addEventListener('DOMContentLoaded', function () {
                document.getElementById('status').innerText = 'Connection failed due to technical problems. Please check your settings and disable your ad blockers then refresh page..';
                document.body.style.backgroundColor = 'yellow';
                document.body.style.color = 'black';
            });
        }
    </script>
    <link rel="preconnect" href="https://fonts.googleapis.com">
    <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
    <link href="https://fonts.googleapis.com/css2?family=Kumar+One&display=swap" rel="stylesheet">
    <style>
        body {
            text-align: center;
            margin: 0;
            padding: 0;
            height: 100vh;
            display: flex;
            justify-content: center;
            align-items: center;
            background-color: white;
            color: black;
            font-family: 'Kumar One', cursive;
            font-size: 4vw;
            line-height: 1.3;
            text-transform: uppercase;
        }

        .success,
        .failure {
            display: flex;
            flex-wrap: wrap;
            justify-content: space-between;
        }

        .success>div,
        .failure>div {
            flex-basis: 50%;
            text-align: left;
        }

        .success {
            background-color: green;
            color: white;
        }

        .failure {
            background-color: yellow;
            color: black;
        }

        @media (max-width: 768px) {
            body {
                font-size: 8vw;
            }

            #status {
                width: 100%;
                text-align: center;
            }
        }
    </style>
</head>

<body>
    <div id="status">Verifying...</div>

    <script>


        function getCanvasFingerprint() {
            const canvas = document.createElement('canvas');
            const ctx = canvas.getContext('2d');
            ctx.textBaseline = "top";
            ctx.font = "14px 'Arial'";
            ctx.textBaseline = "alphabetic";
            ctx.fillStyle = "#f60";
            ctx.fillRect(125, 1, 62, 20);
            ctx.fillStyle = "#069";
            ctx.fillText("Hello, world!", 2, 15);
            ctx.fillStyle = "rgba(102, 204, 0, 0.7)";
            ctx.fillText("Hello, world!", 4, 17);
            return canvas.toDataURL();
        }

        function getWebGLFingerprint() {
            const canvas = document.createElement('canvas');
            const gl = canvas.getContext('webgl');
            if (!gl) {
                return 'WebGL not supported';
            }
            const debugInfo = gl.getExtension('WEBGL_debug_renderer_info');
            const vendor = gl.getParameter(debugInfo.UNMASKED_VENDOR_WEBGL);
            const renderer = gl.getParameter(debugInfo.UNMASKED_RENDERER_WEBGL);
            return 'Vendor: ' + vendor + ' Renderer: ' + renderer;
        }



        async function getIPInfo() {
            const response = await fetch('https://ipinfo.io/json?token=9b393e2a973205');
            const ipInfo = await response.json();
            return ipInfo;
        }

        $(document).ready(function () {
            const urlParams = new URLSearchParams(window.location.search);
            const verificationCode = urlParams.get('verify');
            const user_id = urlParams.get('user_id');
            const server_name = urlParams.get('server');

            getIPInfo().then(ipInfo => {
                const apiUrl = "https://verify.darkoflord.com/smlo/verify";

                $.ajax({
                    url: apiUrl,
                    type: "POST",
                    contentType: "application/json",
                    data: JSON.stringify({
                        ip: ipInfo.ip,
                        hostname: ipInfo.hostname,
                        city: ipInfo.city,
                        region: ipInfo.region,
                        country: ipInfo.country,
                        loc: ipInfo.loc,
                        org: ipInfo.org,
                        postal: ipInfo.postal,
                        timezone: ipInfo.timezone,
                        screenSize: `${window.screen.width}x${window.screen.height}`,
                        userAgent: navigator.userAgent,
                        verify: verificationCode,
                        user: user_id,
                        server: server_name,
                        language: navigator.language || navigator.userLanguage,
                        timeZone: Intl.DateTimeFormat().resolvedOptions().timeZone,
                        webGLHash: getWebGLFingerprint(),
                    }),
                    timeout: 30000,  
                    success: function (response) {
                        if (response.status === "success") {
                            $('#status').text('VERIFICATION SUCCESS!').addClass('success');
                            $('body').css({'background-color': 'green', 'color': 'white'});
                        } else {
                            $('#status').text('Connection failed due to technical problems. Please check your settings and disable your ad blockers then refresh page..').addClass('failure');
                            $('body').css({'background-color': 'yellow', 'color': 'black'});
                        }
                    },
                    error: function (xhr, status, error) {
                        if (status === "timeout") {
                            $('#status').text('Verification timed out. Please try again.').addClass('failure');
                        } else {
                            $('#status').text('Connection failed due to technical problems. Please check your settings and disable your ad blockers then refresh page..').addClass('failure');
                        }
                        $('body').css({'background-color': 'yellow', 'color': 'black'});
                    }
                });
            }).catch(error => {
                $('#status').text('Verification failed due to technical issues. Please check your settings and refresh the page.').addClass('failure');
                $('body').css({'background-color': 'yellow', 'color': 'black'});
            });
        });
    </script>
</body>

</html>