<?php require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/util/session.inc"; global $isLoggedIn; if (isset($_GET["e"])) { header("Access-Control-Allow-Origin: chrome-extension://foioekefbipjjonpgpbjahmplcealhhg"); } else { header("Access-Control-Allow-Origin: *"); } header("Access-Control-Allow-Credentials: true"); header("Access-Control-Allow-Methods: *"); header("Access-Control-Allow-Headers: *"); if (!isset($_GET["t"])) { header("Content-Type: application/json"); if ($isLoggedIn) { die("true"); } else { die("false"); } } else { switch ($_GET["t"]) { case "onboarding": header("Content-Type: text/html"); ?> <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <link rel="icon" href="https://git.equestria.dev/repo-avatars/1c0dad449a8e21ad16fa0efb1426c1a3301b1f26a8cb3b3902eec88bb568e34c" type="image/png"> <title>Luna for Chrome OS</title> <style> html, body { background-color: #0d0b16; color: white; font-family: sans-serif; overflow: hidden; } button:hover { opacity: .75; } button:active { opacity: .5; } </style> </head> <body> <div style="max-width: 65vw; margin-left: auto; margin-right: auto; height: 100vh; display: flex; align-items: center; justify-content: center; text-align: center;"> <div> <img src="https://git.equestria.dev/repo-avatars/1c0dad449a8e21ad16fa0efb1426c1a3301b1f26a8cb3b3902eec88bb568e34c" width="128px"> <h1>Please login to Cold Haze</h1> <p>To proceed with activating Luna on this Chromebook, you need to login to Cold Haze. You also need to make sure you properly enroled this computer into Chrome Enterprise.</p> <button onclick='window.open("https://ponies.equestria.horse/-/login/?return=/api/close&mini", "_blank", "popup,top=100,width=100,height:250")' style="cursor: pointer; background: #5958ad; color: white; border: none; padding: 5px 10px; border-radius: 5px;">Login</button> </div> </div> <script> setTimeout(async () => { if (JSON.parse(await (await fetch("https://ponies.equestria.horse/api/chrome")).text())) { window.close(); } }); setInterval(async () => { if (JSON.parse(await (await fetch("https://ponies.equestria.horse/api/chrome")).text())) { window.close(); } }, 5000); </script> </body> </html> <?php die(); case "unique": header("Content-Type: text/plain"); die("Chromebook-" . strtoupper(substr(sha1($_COOKIE['PEH2_SESSION_TOKEN']), 0, 5))); default: header("Location: /"); die(); } }