diff options
author | RaindropsSys <contact@minteck.org> | 2023-03-12 19:16:53 +0100 |
---|---|---|
committer | RaindropsSys <contact@minteck.org> | 2023-03-12 19:16:53 +0100 |
commit | eb89b15c0f044673c1206a418a21d0baba1a675e (patch) | |
tree | 39ac31a576d8b8392cbd9baf8d67621bf2cefa86 /pages/api/chrome.php | |
parent | 5385f0ed8fbb4325203a222a75e6700ffb519349 (diff) | |
download | pluralconnect-eb89b15c0f044673c1206a418a21d0baba1a675e.tar.gz pluralconnect-eb89b15c0f044673c1206a418a21d0baba1a675e.tar.bz2 pluralconnect-eb89b15c0f044673c1206a418a21d0baba1a675e.zip |
Updated 104 files, added 3 files, deleted 4 files and renamed 36 files (automated)
Diffstat (limited to 'pages/api/chrome.php')
-rw-r--r-- | pages/api/chrome.php | 87 |
1 files changed, 87 insertions, 0 deletions
diff --git a/pages/api/chrome.php b/pages/api/chrome.php new file mode 100644 index 0000000..0be8a94 --- /dev/null +++ b/pages/api/chrome.php @@ -0,0 +1,87 @@ +<?php + +require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/util/session.inc"; global $isLoggedIn; + + +if (isset($_GET["e"])) { + header("Access-Control-Allow-Origin: chrome-extension://klenhenmabddpffgdaijdkjmfkkafbno"); +} 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(); + default: + header("Location: /"); + die(); + } +}
\ No newline at end of file |