diff options
Diffstat (limited to '_site/includes')
-rw-r--r-- | _site/includes/.htaccess | 4 | ||||
-rw-r--r-- | _site/includes/admin/authorized.json | 6 | ||||
-rw-r--r-- | _site/includes/admin/credentials.default.json | 8 | ||||
-rw-r--r-- | _site/includes/articles/getlist.php | 396 | ||||
-rw-r--r-- | _site/includes/dom/footer.php | 31 | ||||
-rw-r--r-- | _site/includes/dom/header.php | 517 | ||||
-rw-r--r-- | _site/includes/dom/v1/footer.php | 24 | ||||
-rw-r--r-- | _site/includes/dom/v1/header.php | 512 | ||||
-rw-r--r-- | _site/includes/dom/v2/footer.php | 50 | ||||
-rw-r--r-- | _site/includes/dom/v2/header.php | 500 | ||||
-rw-r--r-- | _site/includes/eggs | 16 | ||||
-rw-r--r-- | _site/includes/modules/admin.php | 17 | ||||
-rw-r--r-- | _site/includes/modules/desktop.php | 40 | ||||
-rw-r--r-- | _site/includes/modules/errors.php | 182 | ||||
-rw-r--r-- | _site/includes/modules/github.php | 22 | ||||
-rw-r--r-- | _site/includes/modules/mobile.php | 38 | ||||
-rw-r--r-- | _site/includes/modules/search.php | 16 |
17 files changed, 1645 insertions, 734 deletions
diff --git a/_site/includes/.htaccess b/_site/includes/.htaccess index 58ac8d7..9ec3932 100644 --- a/_site/includes/.htaccess +++ b/_site/includes/.htaccess @@ -1,3 +1,3 @@ -Deny from All -Order deny,allow +Deny from All
+Order deny,allow
Require all denied
\ No newline at end of file diff --git a/_site/includes/admin/authorized.json b/_site/includes/admin/authorized.json index 72784f0..e01b4d3 100644 --- a/_site/includes/admin/authorized.json +++ b/_site/includes/admin/authorized.json @@ -1,4 +1,4 @@ -[ - "antoine62", - "Minteck" +[
+ "antoine62",
+ "Minteck"
]
\ No newline at end of file diff --git a/_site/includes/admin/credentials.default.json b/_site/includes/admin/credentials.default.json index 83b9e5b..67d1959 100644 --- a/_site/includes/admin/credentials.default.json +++ b/_site/includes/admin/credentials.default.json @@ -1,5 +1,5 @@ -{ - "id": "your client id", - "secret": "your client secret", - "token": "the personnal access token of a user that has access to the repository" +{
+ "id": "your client id",
+ "secret": "your client secret",
+ "token": "the personal access token of a user that has access to the repository"
}
\ No newline at end of file diff --git a/_site/includes/articles/getlist.php b/_site/includes/articles/getlist.php index 8a342f1..2716e3e 100644 --- a/_site/includes/articles/getlist.php +++ b/_site/includes/articles/getlist.php @@ -1,194 +1,204 @@ -<?php - -$listGetTimeout = 0; - -function getArticlesList($ordered = true) { - $listGetStart = new DateTime("now"); - global $Parsedown; - global $listGetTimeout; - - $list = []; - $files = scandir($_SERVER['DOCUMENT_ROOT'] . "/../_posts"); - - foreach ($files as $file) { - if (is_file($_SERVER['DOCUMENT_ROOT'] . "/../_posts/" . $file)) { - $content = file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/../_posts/" . $file); - $lines = explode("\n", $content); - $unlined = []; - - $id = substr($file, 0, -3); - $list[$id] = [ - "date" => date("Y-m-d"), - "title" => $id, - "author" => "UnchainedTech", - "cover" => null, - "extract" => "", - "admin" => false - ]; - $list[$id]["id"] = $id; - - $propertiesMode = false; - $propertiesDone = false; - $cline = 0; - $upline = 0; - foreach ($lines as $line) { - if (!$propertiesDone) { - if (trim($line) === "---") { - if ($propertiesMode) { - $propertiesDone = true; - $propertiesMode = false; - $upline = $cline + 1; - } else { - $propertiesMode = true; - } - } else if ($propertiesMode) { - $parts = explode(":", $line); - $p_ins = trim($parts[0]); - array_shift($parts); - $p_data = trim(implode(":", $parts)); - - switch ($p_ins) { - case "date": - $pp_dt = DateTime::createFromFormat('Y-m-d', $p_data); - $list[$id]["date"] = $pp_dt->format("Ymd"); - break; - - case "title": - $list[$id]["title"] = $p_data; - break; - - case "author": - $list[$id]["author"] = explode("|", $p_data); - break; - - case "cover": - $list[$id]["cover"] = $p_data; - break; - } - } - } - $cline++; - } - - $i = 0; - while ($i++ < $upline) { - array_shift($lines); - } - - $text = implode("\n", $lines); - - $list[$id]["content"] = []; - $list[$id]["content"]["full"] = $Parsedown->text($text); - $list[$id]["content"]["clean"] = strip_tags($list[$id]["content"]["full"]); - if (strlen($list[$id]["content"]["clean"]) > 100) { - $list[$id]["content"]["mini"] = substr($list[$id]["content"]["clean"], 0, 100) . "…"; - } else { - $list[$id]["content"]["mini"] = $list[$id]["content"]["clean"]; - } - if (strlen($list[$id]["content"]["clean"]) > 500) { - $list[$id]["content"]["little"] = substr($list[$id]["content"]["clean"], 0, 500) . "…"; - } else { - $list[$id]["content"]["little"] = $list[$id]["content"]["clean"]; - } - } - } - - $files = scandir($_SERVER['DOCUMENT_ROOT'] . "/../_posts/_drafts"); - - foreach ($files as $file) { - if (is_file($_SERVER['DOCUMENT_ROOT'] . "/../_posts/_drafts/" . $file) && $file !== "_template.md" && $file !== ".gitkeep") { - $content = file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/../_posts/_drafts/" . $file); - $lines = explode("\n", $content); - $unlined = []; - - $id = substr($file, 0, -3); - $list[$id] = [ - "date" => date("Ymd"), - "title" => $id, - "author" => [ "UnchainedTech Authors" ], - "cover" => null, - "extract" => "", - "admin" => true - ]; - $list[$id]["id"] = $id; - - $propertiesMode = false; - $propertiesDone = false; - $cline = 0; - $upline = 0; - foreach ($lines as $line) { - if (!$propertiesDone) { - if (trim($line) === "---") { - if ($propertiesMode) { - $propertiesDone = true; - $propertiesMode = false; - $upline = $cline + 1; - } else { - $propertiesMode = true; - } - } else if ($propertiesMode) { - $parts = explode(":", $line); - $p_ins = trim($parts[0]); - array_shift($parts); - $p_data = trim(implode(":", $parts)); - - switch ($p_ins) { - case "date": - $pp_dt = DateTime::createFromFormat('Y-m-d', $p_data); - $list[$id]["date"] = $pp_dt->format("Ymd"); - break; - - case "title": - $list[$id]["title"] = $p_data; - break; - - case "author": - $list[$id]["author"] = explode("|", $p_data); - break; - - case "cover": - $list[$id]["cover"] = $p_data; - break; - } - } - } - $cline++; - } - - $i = 0; - while ($i++ < $upline) { - array_shift($lines); - } - - $text = implode("\n", $lines); - - $list[$id]["content"] = []; - $list[$id]["content"]["full"] = $Parsedown->text($text); - $list[$id]["content"]["clean"] = strip_tags($list[$id]["content"]["full"]); - if (strlen($list[$id]["content"]["clean"]) > 100) { - $list[$id]["content"]["mini"] = substr($list[$id]["content"]["clean"], 0, 100) . "…"; - } else { - $list[$id]["content"]["mini"] = $list[$id]["content"]["clean"]; - } - if (strlen($list[$id]["content"]["clean"]) > 500) { - $list[$id]["content"]["little"] = substr($list[$id]["content"]["clean"], 0, 500) . "…"; - } else { - $list[$id]["content"]["little"] = $list[$id]["content"]["clean"]; - } - } - } - - $listGetEnd = new DateTime("now"); - - $listGetTimeoutA = $listGetStart->diff($listGetEnd); - $listGetTimeout = $listGetTimeoutA->f; - - if ($ordered) { - usort($list, function($a, $b) { - return strtoupper($a['date']) <=> strtoupper($b['date']); - }); - $list = array_reverse($list); - } - - return $list; +<?php
+
+$listGetTimeout = 0;
+
+function getArticlesList($ordered = true) {
+ $listGetStart = new DateTime("now");
+ global $Parsedown;
+ global $listGetTimeout;
+
+ $list = [];
+ $files = scandir($_SERVER['DOCUMENT_ROOT'] . "/../_posts");
+
+ foreach ($files as $file) {
+ if (is_file($_SERVER['DOCUMENT_ROOT'] . "/../_posts/" . $file)) {
+ $content = file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/../_posts/" . $file);
+ $lines = explode("\n", $content);
+ $unlined = [];
+
+ $id = substr($file, 0, -3);
+ $list[$id] = [
+ "date" => date("Y-m-d"),
+ "title" => $id,
+ "author" => "UnchainedTech",
+ "cover" => null,
+ "extract" => "",
+ "admin" => false,
+ "category" => "Uncategorized"
+ ];
+ $list[$id]["id"] = $id;
+
+ $propertiesMode = false;
+ $propertiesDone = false;
+ $cline = 0;
+ $upline = 0;
+ foreach ($lines as $line) {
+ if (!$propertiesDone) {
+ if (trim($line) === "---") {
+ if ($propertiesMode) {
+ $propertiesDone = true;
+ $propertiesMode = false;
+ $upline = $cline + 1;
+ } else {
+ $propertiesMode = true;
+ }
+ } else if ($propertiesMode) {
+ $parts = explode(":", $line);
+ $p_ins = trim($parts[0]);
+ array_shift($parts);
+ $p_data = trim(implode(":", $parts));
+
+ switch ($p_ins) {
+ case "date":
+ $pp_dt = DateTime::createFromFormat('Y-m-d', $p_data);
+ $list[$id]["date"] = $pp_dt->format("Ymd");
+ break;
+
+ case "title":
+ $list[$id]["title"] = $p_data;
+ break;
+
+ case "author":
+ $list[$id]["author"] = explode("|", $p_data);
+ break;
+
+ case "cover":
+ $list[$id]["cover"] = $p_data;
+ break;
+
+ case "category":
+ $list[$id]["category"] = $p_data;
+ break;
+ }
+ }
+ }
+ $cline++;
+ }
+
+ $i = 0;
+ while ($i++ < $upline) {
+ array_shift($lines);
+ }
+
+ $text = implode("\n", $lines);
+
+ $list[$id]["content"] = [];
+ $list[$id]["content"]["full"] = $Parsedown->text($text);
+ $list[$id]["content"]["clean"] = strip_tags($list[$id]["content"]["full"]);
+ if (strlen($list[$id]["content"]["clean"]) > 100) {
+ $list[$id]["content"]["mini"] = substr($list[$id]["content"]["clean"], 0, 100) . "…";
+ } else {
+ $list[$id]["content"]["mini"] = $list[$id]["content"]["clean"];
+ }
+ if (strlen($list[$id]["content"]["clean"]) > 500) {
+ $list[$id]["content"]["little"] = substr($list[$id]["content"]["clean"], 0, 500) . "…";
+ } else {
+ $list[$id]["content"]["little"] = $list[$id]["content"]["clean"];
+ }
+ }
+ }
+
+ $files = scandir($_SERVER['DOCUMENT_ROOT'] . "/../_posts/_drafts");
+
+ foreach ($files as $file) {
+ if (is_file($_SERVER['DOCUMENT_ROOT'] . "/../_posts/_drafts/" . $file) && $file !== "_template.md" && $file !== ".gitkeep") {
+ $content = file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/../_posts/_drafts/" . $file);
+ $lines = explode("\n", $content);
+ $unlined = [];
+
+ $id = substr($file, 0, -3);
+ $list[$id] = [
+ "date" => date("Ymd"),
+ "title" => $id,
+ "author" => [ "UnchainedTech Authors" ],
+ "cover" => null,
+ "extract" => "",
+ "admin" => true,
+ "category" => "Uncategorized"
+ ];
+ $list[$id]["id"] = $id;
+
+ $propertiesMode = false;
+ $propertiesDone = false;
+ $cline = 0;
+ $upline = 0;
+ foreach ($lines as $line) {
+ if (!$propertiesDone) {
+ if (trim($line) === "---") {
+ if ($propertiesMode) {
+ $propertiesDone = true;
+ $propertiesMode = false;
+ $upline = $cline + 1;
+ } else {
+ $propertiesMode = true;
+ }
+ } else if ($propertiesMode) {
+ $parts = explode(":", $line);
+ $p_ins = trim($parts[0]);
+ array_shift($parts);
+ $p_data = trim(implode(":", $parts));
+
+ switch ($p_ins) {
+ case "date":
+ $pp_dt = DateTime::createFromFormat('Y-m-d', $p_data);
+ $list[$id]["date"] = $pp_dt->format("Ymd");
+ break;
+
+ case "title":
+ $list[$id]["title"] = $p_data;
+ break;
+
+ case "author":
+ $list[$id]["author"] = explode("|", $p_data);
+ break;
+
+ case "cover":
+ $list[$id]["cover"] = $p_data;
+ break;
+
+ case "category":
+ $list[$id]["category"] = $p_data;
+ break;
+ }
+ }
+ }
+ $cline++;
+ }
+
+ $i = 0;
+ while ($i++ < $upline) {
+ array_shift($lines);
+ }
+
+ $text = implode("\n", $lines);
+
+ $list[$id]["content"] = [];
+ $list[$id]["content"]["full"] = $Parsedown->text($text);
+ $list[$id]["content"]["clean"] = strip_tags($list[$id]["content"]["full"]);
+ if (strlen($list[$id]["content"]["clean"]) > 100) {
+ $list[$id]["content"]["mini"] = substr($list[$id]["content"]["clean"], 0, 100) . "…";
+ } else {
+ $list[$id]["content"]["mini"] = $list[$id]["content"]["clean"];
+ }
+ if (strlen($list[$id]["content"]["clean"]) > 500) {
+ $list[$id]["content"]["little"] = substr($list[$id]["content"]["clean"], 0, 500) . "…";
+ } else {
+ $list[$id]["content"]["little"] = $list[$id]["content"]["clean"];
+ }
+ }
+ }
+
+ $listGetEnd = new DateTime("now");
+
+ $listGetTimeoutA = $listGetStart->diff($listGetEnd);
+ $listGetTimeout = $listGetTimeoutA->f;
+
+ if ($ordered) {
+ usort($list, function($a, $b) {
+ return strtoupper($a['date']) <=> strtoupper($b['date']);
+ });
+ $list = array_reverse($list);
+ }
+
+ return $list;
}
\ No newline at end of file diff --git a/_site/includes/dom/footer.php b/_site/includes/dom/footer.php index af25872..7b2fade 100644 --- a/_site/includes/dom/footer.php +++ b/_site/includes/dom/footer.php @@ -1,24 +1,7 @@ - -<p style="margin-top:20px;text-align:center;"><a href="/feed.xml" style="text-decoration: underline;">View RSS feed</a><?= $admin ? "<span class='admin-text'> (doesn't include unreleased articles)</span>" : "" ?></p> - -<hr> - -<div class="container"> - <p># unchainedtech <a href="https://twitter.com/_Minteck" target="_blank">--support</a> <a href="https://github.com/Minteck/UnchainedTech-Software" target="_blank">--code</a> <a href="/about">--version</a>_<br> - <span style="color:black !important;"> - <?php - - /** @var float $listGetTimeout */ - if ($listGetTimeout !== 0) { - echo("Articles list loading took " . round($listGetTimeout*1000, 4) . " ms"); - } else { - echo("No articles list loading"); - } - - ?> - </span></p> - <small><p style="text-align: center;">© <?= date('Y') ?> UnchainedTech Authors, All rights reserved. · <a href="https://minteck-projects.alwaysdata.net/legal" target="_blank" style="text-decoration: underline;">Legal</a></p></small> -</div> - -</body> -</html>
\ No newline at end of file +<?php
+
+if ((isset($_COOKIE['_UnchainedTech_ExperimentalUI']) && $_COOKIE['_UnchainedTech_ExperimentalUI'] === "true") || $GLOBALS["experimentalUIisStable"]) {
+ require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/dom/v2/footer.php";
+} else {
+ require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/dom/v1/footer.php";
+}
\ No newline at end of file diff --git a/_site/includes/dom/header.php b/_site/includes/dom/header.php index 978e766..15beaa1 100644 --- a/_site/includes/dom/header.php +++ b/_site/includes/dom/header.php @@ -1,508 +1,9 @@ -<?php - -$listGetTimeout = 0; -ob_start(); - -$admin = true; -if (!isset($_COOKIE["ADMIN_TOKEN"])) { - $admin = false; - if (isset($__ADMIN)) header("Location: /admin/offline") and die(); -} else { - if (!(strpos("/", $_COOKIE['ADMIN_TOKEN']) === false && strpos(".", $_COOKIE['ADMIN_TOKEN']) === false && file_exists($_SERVER['DOCUMENT_ROOT'] . "/includes/admin/tokens/" . $_COOKIE['ADMIN_TOKEN']))) { - $admin = false; - if (isset($__ADMIN)) header("Location: /admin/offline") and die(); - } else { - $_USER = trim(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/admin/tokens/" . $_COOKIE['ADMIN_TOKEN'])); - } -} - -require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/markdown.php"; -$Parsedown = new Parsedown(); - -function gh_api($api) { - $crl = curl_init("https://api.github.com/" . $api); - curl_setopt($crl, CURLOPT_RETURNTRANSFER, true); - curl_setopt($crl, CURLINFO_HEADER_OUT, true); - curl_setopt($crl, CURLOPT_POST, false); - - curl_setopt($crl, CURLOPT_HTTPHEADER, array( - 'Content-Type: application/json', - "Accept: application/json", - "Authorization: token " . json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/admin/credentials.json"), true)["token"], - "User-Agent: UnchainedTech-Admin/0.0.0 (nekostarfan@gmail.com)" - )); - - $result = curl_exec($crl); - - if ($result === false) { - throw new ErrorException("GitHub API unexpectedly interrupted", 214, E_ERROR); - } - - return $result; -} - -require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/articles/getlist.php"; - -function customShutdown() { - if (!is_null(error_get_last())) { - ob_clean(); - $d = error_get_last(); - echo " -<!DOCTYPE html> -<html> -<head> - <title>Something went wrong on UnchainedTech 🌙</title> - <style> - - @font-face { - src: url(\"/font/regular.ttf\"); - font-family: \"JetBrains Mono\"; - font-style: normal; - } - - @font-face { - src: url(\"/font/italic.ttf\"); - font-family: \"JetBrains Mono\"; - font-style: italic; - } - - *, pre { - font-family: \"JetBrains Mono\", sans-serif; - transition: none !important; - } - - nav, * { - color: #00ff00 !important; - } - - html, body, nav.navbar, .card { - background-color: black !important; - } - - a:hover { - color: black !important; - background: #00ff00; - } - - pre { - background: #00ff00; - border-radius: 5px; - padding: 10px; - color: black !important; - text-align: left; - } - - @media (min-width: 700px) { - pre { - margin-left: 25%; - margin-right: 25%; - } - } - - </style> -</head> -<body> - <div style='margin-top:50px;text-align: center;'> - <h1>Something went wrong <small>(like, for real!)</small></h1> - <p>An error occured and UnchainedTech cannot load right now. Even us can make mistakes sometimes, and because you are really nice you will <a href='mailto:nekostarfan@gmail.com'>report this bug</a>.</p> - <p>For you, really tech-savvy people, here is that alien language thing you're probably looking for:</p> - <pre> -#99{$d["type"]}: "; - -$pparts = explode(": ", $d["message"]); -array_shift($pparts); - -$parts = explode(" in ", implode(": ", $pparts)); -echo($parts[0]); - -$stp = explode("\nStack trace:", $parts[1]); -echo("\n at " . $stp[0]); - -$stlines = explode("\n", $stp[1]); -array_shift($stlines); - -foreach ($stlines as $stline) { - $stpparts = explode(" ", $stline); - array_shift($stpparts); - $stline = implode(" ", $stpparts); - - if ($stline !== " thrown" && $stline !== "{main}") { - $pp2 = explode("(", $stline); - $pp2n = explode(")", $pp2[1]); - - echo("\n at " . $pp2[0] . ":" . $pp2n[0]); - } else if ($stline === "{main}") { - echo("\n at UnchainedTech.\$Core (PHP " . PHP_VERSION . ")"); - } -} - -echo " -</pre> - </div> -</body> -</html> - "; - die(); - } -} - -function customError($errno, $errstr, $errfile = "<unknown file>", $errline = "<unknown line>") { - ob_clean(); - echo " -<!DOCTYPE html> -<html> -<head> - <title>Something went wrong on UnchainedTech 🌙</title> - <style> - - @font-face { - src: url(\"/font/regular.ttf\"); - font-family: \"JetBrains Mono\"; - font-style: normal; - } - - @font-face { - src: url(\"/font/italic.ttf\"); - font-family: \"JetBrains Mono\"; - font-style: italic; - } - - *, pre { - font-family: \"JetBrains Mono\", sans-serif; - transition: none !important; - } - - nav, * { - color: #00ff00 !important; - } - - html, body, nav.navbar, .card { - background-color: black !important; - } - - a:hover { - color: black !important; - background: #00ff00; - } - - pre { - background: #00ff00; - border-radius: 5px; - padding: 10px; - color: black !important; - text-align: left; - } - - @media (min-width: 700px) { - pre { - margin-left: 25%; - margin-right: 25%; - } - } - - </style> -</head> -<body> - <div style='margin-top:50px;text-align: center;'> - <h1>Something went wrong <small>(like, for real!)</small></h1> - <p>An error occured and UnchainedTech cannot load right now. Even us can make mistakes sometimes, and because you are really nice you will <a href='mailto:nekostarfan@gmail.com'>report this bug</a>.</p> - <p>For you, really tech-savvy people, here is that alien language thing you're probably looking for:</p> - <pre> -#{$errno}: {$errstr} - at {$errfile}:{$errline} - at UnchainedTech.\$Core (PHP " . PHP_VERSION . ") -</pre> - </div> -</body> -</html> - "; - die(); -} -set_error_handler("customError", E_ALL); -register_shutdown_function("customShutdown"); - -?> - -<!DOCTYPE html> -<html lang="en"> -<head> - <meta charset="UTF-8"> - <meta name="description" content="<?= $_DESCRIPTION ?? "A page from UnchainedTech, a blog made by technology enthusiasts that talks about all sorts of stuff." ?>"> - <title><?= isset($_TITLE) ? $_TITLE . " on UnchainedTech 🌙" : "UnchainedTech" ?></title> - <meta name="viewport" content="width=device-width, initial-scale=1"> - <link rel="icon" href="/logo.svg"> - <link rel="stylesheet" href="/css/bootstrap.min.css"> - <style> - - @font-face { - src: url("/font/regular.ttf"); - font-family: "JetBrains Mono"; - font-style: normal; - } - - @font-face { - src: url("/font/italic.ttf"); - font-family: "JetBrains Mono"; - font-style: italic; - } - - *, code { - font-family: "JetBrains Mono", sans-serif; - transition: none !important; - } - - nav, * { - color: #00ff00 !important; - } - - html, body, nav.navbar, .card { - background-color: black !important; - } - - nav.navbar { - border-bottom: 3px solid #00ff00 !important; - } - - .card { - border-color: #00ff00 !important; - } - - .btn-primary { - background-color: black !important; - border-color: #00ff00 !important; - border-style: dashed; - } - - .list-group-item { - background: black; - border: 1px solid #00ff00; - } - - .list-group:not(.no-link) .list-group-item:hover { - background: #00ff00; - color: black !important; - } - - .btn-primary:hover { - background: #00ff00 !important; - color: black !important; - } - - hr { - border-color: #00ff00; - border-width: 3px; - } - - td { - border: 1px solid #00ff00; - } - - th { - border: 1px solid #00ff00; - border-bottom-width: 2px; - } - - code { - background: #00ff00; - color: black !important; - } - - pre { - background: #00ff00; - border-radius: 5px; - padding: 10px; - } - - img { - max-width: 100%; - max-height: 50vh; - } - - .nav-link:hover, .nav-link:focus { - outline: 1px dotted #00ff00; - } - - .nav-link:active { - outline: 1px solid #00ff00; - } - - .btn:focus { - box-shadow: none; - } - - #article-cover { - width: 100%; - height: 50vh; - background-size: cover; - background-position: center; - } - - .badge-secondary { - background: black; - border: 1px solid #ffff00; - color: #ffff00 !important; - font-weight: normal; - } - - .nav-admin { - color: #ffff00 !important; - outline-color: #ffff00 !important; - } - - a.list-group-item.list-group-item-action.list-group-item-admin { - border-color: #ffff00; - color: #ffff00 !important; - } - - a.list-group-item.list-group-item-action.list-group-item-admin:hover { - background-color: #ffff00 !important; - } - - .card-admin { - filter: hue-rotate(-45deg); - } - - .admin-text { - color: #ffff00 !important; - } - - .list-admin-warning, .list-admin-warning * { - color: #ff0000 !important; - } - - #apps_outer { - background: transparent; - border: none; - } - - #apps_outer::after { - display: none; - } - - #apps_path { - fill: #00ff00; - } - - #apps_outer:hover #apps_path { - opacity: .75; - } - - #apps_outer:active #apps_path, #apps_outer:focus #apps_path { - opacity: .5; - } - - .app-icon { - width: 24px; - height: 24px; - vertical-align: middle; - margin-right: 5px; - filter: invert(1); - } - - .app-title { - vertical-align: middle; - } - - .nav-item.dropdown { - float: right; - display: block; - position: fixed; - right: 10px; - } - - .nav-item.dropdown, .nav-item.dropdown * { - outline: none !important; - } - - #apps, #apps * { - color: #212529 !important; - font-family: system-ui,-apple-system,"Segoe UI",Roboto,"Helvetica Neue",Arial,"Noto Sans","Liberation Sans",sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji"; - } - - #apps { - filter: invert(1); - } - - ::-webkit-scrollbar { - width: 10px; - margin-left: 1px; - } - - ::-webkit-scrollbar-track { - background: transparent; - margin-left: 1px; - } - - ::-webkit-scrollbar-thumb { - background-color: #00dd00; - margin-left: 1px; - } - - ::-webkit-scrollbar-thumb:hover { - background-color: #00bb00; - } - - ::-webkit-scrollbar-thumb:active { - background-color: #009900; - } - - .navbar-toggler { - border-color: #00ff00 !important; - border-radius: 0; - } - - .navbar-collapse.collapse.show { - height: calc(100vh - 63px); - } - - .navbar-toggler-icon { - background-image: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' width='30' height='30' viewBox='0 0 30 30'><path stroke='rgba%280, 255, 0, 1%29' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/></svg>") !important; - } - - </style> - <script src="/js/jquery.js"></script> - <script src="/js/bootstrap.bundle.min.js"></script> -</head> -<body> - <nav class="navbar navbar-expand-md bg-dark navbar-dark fixed-top"> - <a class="navbar-brand" href="/"><img id="siteicon" src="/logo-alt.svg" width="32px"> <span style="vertical-align: middle;"># unchainedtech_ <?= $admin ? '<span class="badge badge-secondary">admin</span>' : '' ?></span></a> - - <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#collapsibleNavbar"> - <span class="navbar-toggler-icon"></span> - </button> - - <div id="collapsibleNavbar" class="collapse navbar-collapse"> - <ul class="navbar-nav"> - <li class="nav-item"> - <a class="nav-link" href="/home">Home</a> - </li> - <li class="nav-item"> - <a class="nav-link" href="/articles">All Articles</a> - </li> - <li class="nav-item"> - <a class="nav-link" href="/about">About</a> - </li> - <?php if ($admin): ?> - <li class="nav-item"> - <a class="nav-link nav-admin" href="/admin">Administration</a> - </li> - <?php endif; ?> - - <li class="nav-item dropdown"> - <a class="nav-link dropdown-toggle" href="#" id="apps_outer" data-toggle="dropdown"> - <svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 20 20" class="glyph_f10"><path d="M1 19h4v-4H1zm7 0h4v-4H8zm7 0h4v-4h-4zM1 12h4V8H1zm7 0h4V8H8zm7 0h4V8h-4zM1 5h4V1H1zm7 0h4V1H8zm7-4v4h4V1z" id="apps_path"></path></svg> - </a> - <div class="dropdown-menu" id="apps" style="position:fixed;top:48px;left:initial;right:10px;"> - <a href="https://github.com/Minteck" class="dropdown-item"><img alt="" src="/apps/github.png" class="app-icon"> <span class="app-title">GitHub</span></a> - <a href="https://kartik.hopto.org/online" class="dropdown-item"><img alt="" src="/apps/kartik.png" class="app-icon"> <span class="app-title">Kartik Online</span></a> - <a href="https://minteck.ro.lt" class="dropdown-item"><span class="app-title"><img alt="" src="/apps/minteck.svg" class="app-icon"> Minteck's Space</span></a> - <a href="https://unchainedtech.minteck.ro.lt" class="dropdown-item"><span class="app-title"><img alt="" src="/apps/unchainedtech.png" class="app-icon"> UnchainedTech</span></a> - <a href="https://jetbrains.minteck.ro.lt/hub" class="dropdown-item"><img alt="" src="/apps/hub.svg" class="app-icon"> <span class="app-title">Minteck's Hub</span></a> - <a href="https://jetbrains.minteck.ro.lt/youtrack" class="dropdown-item"><img alt="" src="/apps/youtrack.svg" class="app-icon"> <span class="app-title">YouTrack</span></a> - </div> - </li> - </ul> - </div> - - </nav> -<div id="separator" style="margin-top:72px;"></div>
\ No newline at end of file +<?php
+
+$GLOBALS["experimentalUIisStable"] = false;
+
+if ((isset($_COOKIE['_UnchainedTech_ExperimentalUI']) && $_COOKIE['_UnchainedTech_ExperimentalUI'] === "true") || $GLOBALS["experimentalUIisStable"]) {
+ require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/dom/v2/header.php";
+} else {
+ require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/dom/v1/header.php";
+}
\ No newline at end of file diff --git a/_site/includes/dom/v1/footer.php b/_site/includes/dom/v1/footer.php new file mode 100644 index 0000000..9852780 --- /dev/null +++ b/_site/includes/dom/v1/footer.php @@ -0,0 +1,24 @@ +
+<p style="margin-top:20px;text-align:center;"><a href="/feed.xml" style="text-decoration: underline;">View RSS feed</a><?= $admin ? "<span class='admin-text'> (doesn't include unreleased articles)</span>" : "" ?></p>
+
+<hr>
+
+<div class="container">
+ <p># unchainedtech <a href="https://twitter.com/_Minteck" target="_blank">--support</a> <a href="https://github.com/Minteck/UnchainedTech-Software" target="_blank">--code</a> <a href="/about">--version</a>_<br>
+ <span style="color:black !important;">
+ <?php
+
+ /** @var float $listGetTimeout */
+ if ($listGetTimeout !== 0) {
+ echo("Articles list loading took " . round($listGetTimeout*1000, 4) . " ms");
+ } else {
+ echo("No articles list loading");
+ }
+
+ ?>
+ </span></p>
+ <small><p style="text-align: center;">© <?= date('Y') ?> UnchainedTech Authors, All rights reserved. · <a href="https://minteck-projects.alwaysdata.net/legal" target="_blank" style="text-decoration: underline;">Legal</a><?php if (!$GLOBALS["experimentalUIisStable"]): ?> · <a href="/experiment/1" style="text-decoration: underline;">Enable UI experiments</a><?php endif; ?></p></small>
+</div>
+
+</body>
+</html>
\ No newline at end of file diff --git a/_site/includes/dom/v1/header.php b/_site/includes/dom/v1/header.php new file mode 100644 index 0000000..5dbac97 --- /dev/null +++ b/_site/includes/dom/v1/header.php @@ -0,0 +1,512 @@ +<?php
+
+$listGetTimeout = 0;
+ob_start();
+
+$admin = true;
+if (!isset($_COOKIE["ADMIN_TOKEN"])) {
+ $admin = false;
+ if (isset($__ADMIN)) header("Location: /admin/offline") and die();
+} else {
+ if (!(strpos("/", $_COOKIE['ADMIN_TOKEN']) === false && strpos(".", $_COOKIE['ADMIN_TOKEN']) === false && (file_exists($_SERVER['DOCUMENT_ROOT'] . "/includes/admin/tokens/" . $_COOKIE['ADMIN_TOKEN']) || file_exists("/mnt/minteckrolt-main/admin/private/tokens/" . $_COOKIE['ADMIN_TOKEN'])))) {
+ $admin = false;
+ if (isset($__ADMIN)) header("Location: /admin/offline") and die();
+ } else {
+ if (file_exists("/mnt/minteckrolt-main/admin/private/tokens/" . $_COOKIE['ADMIN_TOKEN'])) {
+ $_USER = trim(file_get_contents("/mnt/minteckrolt-main/admin/private/tokens/" . $_COOKIE['ADMIN_TOKEN']));
+ } else {
+ $_USER = trim(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/admin/tokens/" . $_COOKIE['ADMIN_TOKEN']));
+ }
+ }
+}
+
+require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/markdown.php";
+$Parsedown = new Parsedown();
+
+function gh_api($api) {
+ $crl = curl_init("https://api.github.com/" . $api);
+ curl_setopt($crl, CURLOPT_RETURNTRANSFER, true);
+ curl_setopt($crl, CURLINFO_HEADER_OUT, true);
+ curl_setopt($crl, CURLOPT_POST, false);
+
+ curl_setopt($crl, CURLOPT_HTTPHEADER, array(
+ 'Content-Type: application/json',
+ "Accept: application/json",
+ "Authorization: token " . json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/admin/credentials.json"), true)["token"],
+ "User-Agent: UnchainedTech-Admin/0.0.0 (nekostarfan@gmail.com)"
+ ));
+
+ $result = curl_exec($crl);
+
+ if ($result === false) {
+ throw new ErrorException("GitHub API unexpectedly interrupted", 214, E_ERROR);
+ }
+
+ return $result;
+}
+
+require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/articles/getlist.php";
+
+function customShutdown() {
+ if (!is_null(error_get_last())) {
+ ob_clean();
+ $d = error_get_last();
+ echo "
+<!DOCTYPE html>
+<html>
+<head>
+ <title>Something went wrong on UnchainedTech 🌙</title>
+ <style>
+
+ @font-face {
+ src: url(\"/font/regular.ttf\");
+ font-family: \"JetBrains Mono\";
+ font-style: normal;
+ }
+
+ @font-face {
+ src: url(\"/font/italic.ttf\");
+ font-family: \"JetBrains Mono\";
+ font-style: italic;
+ }
+
+ *, pre {
+ font-family: \"JetBrains Mono\", sans-serif;
+ transition: none !important;
+ }
+
+ nav, * {
+ color: #00ff00 !important;
+ }
+
+ html, body, nav.navbar, .card {
+ background-color: black !important;
+ }
+
+ a:hover {
+ color: black !important;
+ background: #00ff00;
+ }
+
+ pre {
+ background: #00ff00;
+ border-radius: 5px;
+ padding: 10px;
+ color: black !important;
+ text-align: left;
+ }
+
+ @media (min-width: 700px) {
+ pre {
+ margin-left: 25%;
+ margin-right: 25%;
+ }
+ }
+
+ </style>
+</head>
+<body>
+ <div style='margin-top:50px;text-align: center;'>
+ <h1>Something went wrong <small>(like, for real!)</small></h1>
+ <p>An error occured and UnchainedTech cannot load right now. Even us can make mistakes sometimes, and because you are really nice you will <a href='mailto:nekostarfan@gmail.com'>report this bug</a>.</p>
+ <p>For you, really tech-savvy people, here is that alien language thing you're probably looking for:</p>
+ <pre>
+#99{$d["type"]}: ";
+
+$pparts = explode(": ", $d["message"]);
+array_shift($pparts);
+
+$parts = explode(" in ", implode(": ", $pparts));
+echo($parts[0]);
+
+$stp = explode("\nStack trace:", $parts[1]);
+echo("\n at " . $stp[0]);
+
+$stlines = explode("\n", $stp[1]);
+array_shift($stlines);
+
+foreach ($stlines as $stline) {
+ $stpparts = explode(" ", $stline);
+ array_shift($stpparts);
+ $stline = implode(" ", $stpparts);
+
+ if ($stline !== " thrown" && $stline !== "{main}") {
+ $pp2 = explode("(", $stline);
+ $pp2n = explode(")", $pp2[1]);
+
+ echo("\n at " . $pp2[0] . ":" . $pp2n[0]);
+ } else if ($stline === "{main}") {
+ echo("\n at UnchainedTech.\$Core (PHP " . PHP_VERSION . ")");
+ }
+}
+
+echo "
+</pre>
+ </div>
+</body>
+</html>
+ ";
+ die();
+ }
+}
+
+function customError($errno, $errstr, $errfile = "<unknown file>", $errline = "<unknown line>") {
+ ob_clean();
+ echo "
+<!DOCTYPE html>
+<html>
+<head>
+ <title>Something went wrong on UnchainedTech 🌙</title>
+ <style>
+
+ @font-face {
+ src: url(\"/font/regular.ttf\");
+ font-family: \"JetBrains Mono\";
+ font-style: normal;
+ }
+
+ @font-face {
+ src: url(\"/font/italic.ttf\");
+ font-family: \"JetBrains Mono\";
+ font-style: italic;
+ }
+
+ *, pre {
+ font-family: \"JetBrains Mono\", sans-serif;
+ transition: none !important;
+ }
+
+ nav, * {
+ color: #00ff00 !important;
+ }
+
+ html, body, nav.navbar, .card {
+ background-color: black !important;
+ }
+
+ a:hover {
+ color: black !important;
+ background: #00ff00;
+ }
+
+ pre {
+ background: #00ff00;
+ border-radius: 5px;
+ padding: 10px;
+ color: black !important;
+ text-align: left;
+ }
+
+ @media (min-width: 700px) {
+ pre {
+ margin-left: 25%;
+ margin-right: 25%;
+ }
+ }
+
+ </style>
+</head>
+<body>
+ <div style='margin-top:50px;text-align: center;'>
+ <h1>Something went wrong <small>(like, for real!)</small></h1>
+ <p>An error occured and UnchainedTech cannot load right now. Even us can make mistakes sometimes, and because you are really nice you will <a href='mailto:nekostarfan@gmail.com'>report this bug</a>.</p>
+ <p>For you, really tech-savvy people, here is that alien language thing you're probably looking for:</p>
+ <pre>
+#{$errno}: {$errstr}
+ at {$errfile}:{$errline}
+ at UnchainedTech.\$Core (PHP " . PHP_VERSION . ")
+</pre>
+ </div>
+</body>
+</html>
+ ";
+ die();
+}
+set_error_handler("customError", E_ALL);
+register_shutdown_function("customShutdown");
+
+?>
+
+<!DOCTYPE html>
+<html lang="en">
+<head>
+ <meta charset="UTF-8">
+ <meta name="description" content="<?= $_DESCRIPTION ?? "A page from UnchainedTech, a blog made by technology enthusiasts that talks about all sorts of stuff." ?>">
+ <title><?= isset($_TITLE) ? $_TITLE . " on UnchainedTech 🌙" : "UnchainedTech" ?></title>
+ <meta name="viewport" content="width=device-width, initial-scale=1">
+ <link rel="icon" href="/logo.svg">
+ <link rel="stylesheet" href="/css/bootstrap.min.css">
+ <style>
+
+ @font-face {
+ src: url("/font/regular.ttf");
+ font-family: "JetBrains Mono";
+ font-style: normal;
+ }
+
+ @font-face {
+ src: url("/font/italic.ttf");
+ font-family: "JetBrains Mono";
+ font-style: italic;
+ }
+
+ *, code {
+ font-family: "JetBrains Mono", sans-serif;
+ transition: none !important;
+ }
+
+ nav, * {
+ color: #00ff00 !important;
+ }
+
+ html, body, nav.navbar, .card {
+ background-color: black !important;
+ }
+
+ nav.navbar {
+ border-bottom: 3px solid #00ff00 !important;
+ }
+
+ .card {
+ border-color: #00ff00 !important;
+ }
+
+ .btn-primary {
+ background-color: black !important;
+ border-color: #00ff00 !important;
+ border-style: dashed;
+ }
+
+ .list-group-item {
+ background: black;
+ border: 1px solid #00ff00;
+ }
+
+ .list-group:not(.no-link) .list-group-item:hover {
+ background: #00ff00;
+ color: black !important;
+ }
+
+ .btn-primary:hover {
+ background: #00ff00 !important;
+ color: black !important;
+ }
+
+ hr {
+ border-color: #00ff00;
+ border-width: 3px;
+ }
+
+ td {
+ border: 1px solid #00ff00;
+ }
+
+ th {
+ border: 1px solid #00ff00;
+ border-bottom-width: 2px;
+ }
+
+ code {
+ background: #00ff00;
+ color: black !important;
+ }
+
+ pre {
+ background: #00ff00;
+ border-radius: 5px;
+ padding: 10px;
+ }
+
+ img {
+ max-width: 100%;
+ max-height: 50vh;
+ }
+
+ .nav-link:hover, .nav-link:focus {
+ outline: 1px dotted #00ff00;
+ }
+
+ .nav-link:active {
+ outline: 1px solid #00ff00;
+ }
+
+ .btn:focus {
+ box-shadow: none;
+ }
+
+ #article-cover {
+ width: 100%;
+ height: 50vh;
+ background-size: cover;
+ background-position: center;
+ }
+
+ .badge-secondary {
+ background: black;
+ border: 1px solid #ffff00;
+ color: #ffff00 !important;
+ font-weight: normal;
+ }
+
+ .nav-admin {
+ color: #ffff00 !important;
+ outline-color: #ffff00 !important;
+ }
+
+ a.list-group-item.list-group-item-action.list-group-item-admin {
+ border-color: #ffff00;
+ color: #ffff00 !important;
+ }
+
+ a.list-group-item.list-group-item-action.list-group-item-admin:hover {
+ background-color: #ffff00 !important;
+ }
+
+ .card-admin {
+ filter: hue-rotate(-45deg);
+ }
+
+ .admin-text {
+ color: #ffff00 !important;
+ }
+
+ .list-admin-warning, .list-admin-warning * {
+ color: #ff0000 !important;
+ }
+
+ #apps_outer {
+ background: transparent;
+ border: none;
+ }
+
+ #apps_outer::after {
+ display: none;
+ }
+
+ #apps_path {
+ fill: #00ff00;
+ }
+
+ #apps_outer:hover #apps_path {
+ opacity: .75;
+ }
+
+ #apps_outer:active #apps_path, #apps_outer:focus #apps_path {
+ opacity: .5;
+ }
+
+ .app-icon {
+ width: 24px;
+ height: 24px;
+ vertical-align: middle;
+ margin-right: 5px;
+ filter: invert(1);
+ }
+
+ .app-title {
+ vertical-align: middle;
+ }
+
+ .nav-item.dropdown {
+ float: right;
+ display: block;
+ position: fixed;
+ right: 10px;
+ }
+
+ .nav-item.dropdown, .nav-item.dropdown * {
+ outline: none !important;
+ }
+
+ #apps, #apps * {
+ color: #212529 !important;
+ font-family: system-ui,-apple-system,"Segoe UI",Roboto,"Helvetica Neue",Arial,"Noto Sans","Liberation Sans",sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji";
+ }
+
+ #apps {
+ filter: invert(1);
+ }
+
+ ::-webkit-scrollbar {
+ width: 10px;
+ margin-left: 1px;
+ }
+
+ ::-webkit-scrollbar-track {
+ background: transparent;
+ margin-left: 1px;
+ }
+
+ ::-webkit-scrollbar-thumb {
+ background-color: #00dd00;
+ margin-left: 1px;
+ }
+
+ ::-webkit-scrollbar-thumb:hover {
+ background-color: #00bb00;
+ }
+
+ ::-webkit-scrollbar-thumb:active {
+ background-color: #009900;
+ }
+
+ .navbar-toggler {
+ border-color: #00ff00 !important;
+ border-radius: 0;
+ }
+
+ .navbar-collapse.collapse.show {
+ height: calc(100vh - 63px);
+ }
+
+ .navbar-toggler-icon {
+ background-image: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' width='30' height='30' viewBox='0 0 30 30'><path stroke='rgba%280, 255, 0, 1%29' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/></svg>") !important;
+ }
+
+ </style>
+ <script src="/js/jquery.js"></script>
+ <script src="/js/bootstrap.bundle.min.js"></script>
+</head>
+<body>
+ <nav class="navbar navbar-expand-md bg-dark navbar-dark fixed-top">
+ <a class="navbar-brand" href="/"><img id="siteicon" src="/logo-alt.svg" width="32px"> <span style="vertical-align: middle;"># unchainedtech_ <?= $admin ? '<span class="badge badge-secondary">admin</span>' : '' ?></span></a>
+
+ <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#collapsibleNavbar">
+ <span class="navbar-toggler-icon"></span>
+ </button>
+
+ <div id="collapsibleNavbar" class="collapse navbar-collapse">
+ <ul class="navbar-nav">
+ <li class="nav-item">
+ <a class="nav-link" href="/home">Home</a>
+ </li>
+ <li class="nav-item">
+ <a class="nav-link" href="/articles">All Articles</a>
+ </li>
+ <li class="nav-item">
+ <a class="nav-link" href="/about">About</a>
+ </li>
+ <?php if ($admin): ?>
+ <li class="nav-item">
+ <a class="nav-link nav-admin" href="/admin">Administration</a>
+ </li>
+ <?php endif; ?>
+
+ <li class="nav-item dropdown">
+ <a class="nav-link dropdown-toggle" href="#" id="apps_outer" data-toggle="dropdown">
+ <svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 20 20" class="glyph_f10"><path d="M1 19h4v-4H1zm7 0h4v-4H8zm7 0h4v-4h-4zM1 12h4V8H1zm7 0h4V8H8zm7 0h4V8h-4zM1 5h4V1H1zm7 0h4V1H8zm7-4v4h4V1z" id="apps_path"></path></svg>
+ </a>
+ <div class="dropdown-menu" id="apps" style="position:fixed;top:48px;left:initial;right:10px;">
+ <a href="https://github.com/Minteck" class="dropdown-item"><img alt="" src="/apps/github.png" class="app-icon"> <span class="app-title">GitHub</span></a>
+ <a href="https://kartik.hopto.org/online" class="dropdown-item"><img alt="" src="/apps/kartik.png" class="app-icon"> <span class="app-title">Kartik Online</span></a>
+ <a href="https://minteck.ro.lt" class="dropdown-item"><span class="app-title"><img alt="" src="/apps/minteck.svg" class="app-icon"> Minteck's Space</span></a>
+ <a href="https://unchainedtech.minteck.ro.lt" class="dropdown-item"><span class="app-title"><img alt="" src="/apps/unchainedtech.png" class="app-icon"> UnchainedTech</span></a>
+ <a href="https://jetbrains.minteck.ro.lt/hub" class="dropdown-item"><img alt="" src="/apps/hub.svg" class="app-icon"> <span class="app-title">Minteck's Hub</span></a>
+ <a href="https://jetbrains.minteck.ro.lt/youtrack" class="dropdown-item"><img alt="" src="/apps/youtrack.svg" class="app-icon"> <span class="app-title">YouTrack</span></a>
+ </div>
+ </li>
+ </ul>
+ </div>
+
+ </nav>
+<div id="separator" style="margin-top:72px;"></div>
\ No newline at end of file diff --git a/_site/includes/dom/v2/footer.php b/_site/includes/dom/v2/footer.php new file mode 100644 index 0000000..d2f5c57 --- /dev/null +++ b/_site/includes/dom/v2/footer.php @@ -0,0 +1,50 @@ +<p class="footer-pre"></p>
+
+<footer>
+ <!--<small><p style="text-align: center;">© <?= date('Y') ?> UnchainedTech Authors, All rights reserved.</p></small>-->
+ <div class="container">
+ <div>
+ <a href="https://minteck.ro.lt" title="made by Minteck" target="_blank"><img src="/apps/minteck.svg" style="width: 72px;filter: contrast(0) brightness(2);opacity: .75;"></a>
+ <br>
+ <a class="rss-logo" title="UnchainedTech RSS feed" href="/feed.xml" style="text-align: center;margin-top:5px;color: black;filter: invert(1);display: block;margin-left: -58px;"><img src="/feed.png" alt="RSS"></a>
+ </div>
+ <div>
+ <h5 class="footer-heading">Support</h5>
+ <a href="https://github.com/Minteck/UnchainedTech-Software" target="_blank" class="footer-item">Source Code</a>
+ <a href="https://jetbrains.minteck.ro.lt:1024/youtrack/newIssue?project=UT" target="_blank" class="footer-item">Report a bug</a>
+ <a href="https://twitter.com/_Minteck" target="_blank" class="footer-item">Technical Support</a>
+ <a href="https://stats.uptimerobot.com/9XlG2ImByW" target="_blank" class="footer-item">Status</a>
+ </div>
+ <div>
+ <h5 class="footer-heading">UnchainedTech</h5>
+ <a href="/about" class="footer-item">About</a>
+ <a href="/about/#version" class="footer-item">Version information</a>
+ <a href="/about/#team" class="footer-item">The Unchained Team</a>
+ <a href="/admin" class="footer-item">Admin Mode</a>
+ </div>
+ <div>
+ <h5 class="footer-heading">Terms & Policies</h5>
+ <a href="https://mt.ro.lt/legal" class="footer-item">Legal Notices</a>
+ <a href="https://mt.ro.lt/terms" class="footer-item">Terms of Use</a>
+ <a href="https://mt.ro.lt/cond" class="footer-item">Code of Conduct</a>
+ </div>
+ <!--
+ <p># unchainedtech <a href="https://twitter.com/_Minteck" target="_blank">--support</a> <a href="https://github.com/Minteck/UnchainedTech-Software" target="_blank">--code</a> <a href="/about">--version</a>_<br>
+ <span style="color:black !important;">
+ <?php
+
+ /** @var float $listGetTimeout */
+ if ($listGetTimeout !== 0) {
+ echo("Articles list loading took " . round($listGetTimeout*1000, 4) . " ms");
+ } else {
+ echo("No articles list loading");
+ }
+
+ ?>
+ </span></p>
+ · <a href="https://minteck-projects.alwaysdata.net/legal" target="_blank" style="text-decoration: underline;">Legal</a><?php if (!$GLOBALS["experimentalUIisStable"]): ?> · <a href="/experiment/0" style="text-decoration: underline;">Disable UI experiments</a><?php endif; ?></p></small> -->
+ </div>
+</footer>
+
+</body>
+</html>
\ No newline at end of file diff --git a/_site/includes/dom/v2/header.php b/_site/includes/dom/v2/header.php new file mode 100644 index 0000000..56f946f --- /dev/null +++ b/_site/includes/dom/v2/header.php @@ -0,0 +1,500 @@ +<?php
+
+$listGetTimeout = 0;
+ob_start();
+
+// DEBUGGING
+if ($GLOBALS["experimentalUIisStable"]) {
+ $debug = false;
+} else {
+ $debug = true;
+}
+// DEBUGGING
+
+require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/modules/admin.php";
+require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/markdown.php";
+$Parsedown = new Parsedown();
+
+require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/modules/github.php";
+require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/articles/getlist.php";
+require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/modules/errors.php";
+
+$eggs = explode("\n", trim(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/eggs")));
+$egg = trim($eggs[array_rand($eggs)]);
+
+?>
+
+<!DOCTYPE html>
+<html lang="en">
+<head>
+ <meta charset="UTF-8">
+ <meta name="description" content="<?= $_DESCRIPTION ?? "A page from UnchainedTech, a blog made by technology enthusiasts that talks about all sorts of stuff." ?>">
+ <script type="text/javascript" src="https://latest.cactus.chat/cactus.js"></script>
+ <link rel="stylesheet" href="https://latest.cactus.chat/style.css" type="text/css">
+ <title><?= $debug ? "1:" . file_get_contents($_SERVER["DOCUMENT_ROOT"] . "/../version.txt") . ".debugkeys - " : "" ?><?= isset($_TITLE) ? $_TITLE . " on UnchainedTech 🌙" : "UnchainedTech" ?></title>
+ <meta name="viewport" content="width=device-width, initial-scale=1">
+ <link rel="icon" href="/logo.svg">
+ <link rel="stylesheet" href="/css/bootstrap.min.css">
+ <style>
+
+ #navbar-primary, #navbar-mobile {
+ border-width: 10px 0 0;
+ border-top-style: solid;
+ border-image: linear-gradient(
+ 139deg
+ , rgba(250, 136, 22, 0.5), rgba(255, 72, 0, 0.5), rgba(194, 33, 38, 0.5), rgba(223, 41, 255, 0.5)) 3;
+ background: rgb(24, 26, 27) !important;
+ }
+
+ [name="q"], [name="q"]:hover, [name="q"]:focus, [name="q"]:active {
+ border: 1px solid rgb(52, 56, 58);
+ border-radius: 0;
+ background: rgb(31, 34, 35) !important;
+ color: white !important;
+ font-family: "Fira Mono", monospace;
+ }
+
+ #navbar-search {
+ background: rgb(24, 26, 27) !important;
+ border-top: 1px solid rgba(140, 130, 115, 0.1);
+ height: 56px;
+ }
+
+ header {
+ box-shadow: rgba(0, 0, 0, 0.1) 0 4px 13px -3px;
+ border-bottom: 1px solid rgb(61, 66, 68);
+ }
+
+ @font-face {
+ src: url("/font/new/Poppins-Regular.woff2");
+ font-family: "Poppins";
+ font-style: normal;
+ font-weight: normal;
+ }
+
+ @font-face {
+ src: url("/font/new/Poppins-Italic.woff2");
+ font-family: "Poppins";
+ font-style: italic;
+ font-weight: normal;
+ }
+
+ @font-face {
+ src: url("/font/new/Poppins-Bold.woff2");
+ font-family: "Poppins";
+ font-style: normal;
+ font-weight: bold;
+ }
+
+ @font-face {
+ src: url("/font/new/Poppins-BoldItalic.woff2");
+ font-family: "Poppins";
+ font-style: italic;
+ font-weight: bold;
+ }
+
+ @font-face {
+ src: url("/font/new/Poppins-Light.woff2");
+ font-family: "Poppins";
+ font-style: normal;
+ font-weight: 300;
+ }
+
+ @font-face {
+ src: url("/font/new/FiraMono-Regular.woff2");
+ font-family: "Fira Mono";
+ font-weight: normal;
+ }
+
+ @font-face {
+ src: url("/font/new/FiraMono-Bold.woff2");
+ font-family: "Fira Mono";
+ font-weight: bold;
+ }
+
+ nav, h1, h2, h3, h4, h5, h6, .display-01, .display-02, .display-03, .display-04, .display-05, .display-06 {
+ font-family: "Poppins", sans-serif;
+ }
+
+ h1, h2, h3, h4, h5, h6, .display-01, .display-02, .display-03, .display-04, .display-05, .display-06 {
+ font-weight: bold;
+ }
+
+ /**, code {*/
+ /* font-family: "JetBrains Mono", sans-serif;*/
+ /* transition: none !important;*/
+ /*}*/
+
+ /*nav, * {*/
+ /* color: #00ff00 !important;*/
+ /*}*/
+
+ /*html, body, nav.navbar, .card {*/
+ /* background-color: black !important;*/
+ /*}*/
+
+ /*nav.navbar {*/
+ /* border-bottom: 3px solid #00ff00 !important;*/
+ /*}*/
+
+ .card {
+ background: #222;
+ }
+
+ /*.btn-primary {*/
+ /* background-color: black !important;*/
+ /* border-color: #00ff00 !important;*/
+ /* border-style: dashed;*/
+ /*}*/
+
+ /*.list-group-item {*/
+ /* background: black;*/
+ /* border: 1px solid #00ff00;*/
+ /*}*/
+
+ /*.list-group:not(.no-link) .list-group-item:hover {*/
+ /* background: #00ff00;*/
+ /* color: black !important;*/
+ /*}*/
+
+ /*.btn-primary:hover {*/
+ /* background: #00ff00 !important;*/
+ /* color: black !important;*/
+ /*}*/
+
+ /*hr {*/
+ /* border-color: #00ff00;*/
+ /* border-width: 3px;*/
+ /*}*/
+
+ .btn-primary {
+ background: linear-gradient(180deg, rgba(0, 123, 255, 0.25) 0%, rgba(0, 90, 186, 0.25) 100%);
+ border-color: rgba(0, 123, 255, 0.25);
+ }
+
+ .list-group-item {
+ background: #222;
+ color: white;
+ }
+
+ .list-group-item-action:hover {
+ background: #333;
+ color: white;
+ }
+
+ .list-group-item-action:active, .list-group-item-action:focus {
+ background: #444;
+ color: white;
+ }
+
+ .footer-pre {
+ border-top: 1px solid rgba(140, 130, 115, 0.1);
+ margin-top: 20px;
+ }
+
+ footer {
+ border-bottom: 10px solid;
+ margin-top: 40px;
+ padding-bottom: 40px;
+ border-image: linear-gradient(
+ 139deg
+ , rgba(250, 136, 22, 0.5), rgba(255, 72, 0, 0.5), rgba(194, 33, 38, 0.5), rgba(223, 41, 255, 0.5)) 3;
+ }
+
+ td {
+
+ }
+
+ footer > .container {
+ display: grid;
+ grid-template-columns: 128px 1fr 1fr 1fr;
+ }
+
+ hr {
+ border-top: 1px solid rgba(255,255,255,.1);
+ }
+
+ .footer-heading {
+ margin-bottom: 20px;
+ }
+
+ .footer-item {
+ font-family: "Poppins", sans-serif;
+ color: white !important;
+ display: block;
+ margin-top: 15px;
+ margin-bottom: 15px;
+ text-decoration: none;
+ }
+
+ .footer-item:hover {
+ text-decoration: underline;
+ }
+
+ @media (max-width: 800px) {
+ footer > .container {
+ grid-template-columns: 1fr !important;
+ }
+ }
+
+ .list-group-item-admin {
+ color: yellow !important;
+ }
+
+ /*td {*/
+ /* border: 1px solid #00ff00;*/
+ /*}*/
+
+ /*th {*/
+ /* border: 1px solid #00ff00;*/
+ /* border-bottom-width: 2px;*/
+ /*}*/
+
+ /*code {*/
+ /* background: #00ff00;*/
+ /* color: black !important;*/
+ /*}*/
+
+ /*pre {*/
+ /* background: #00ff00;*/
+ /* border-radius: 5px;*/
+ /* padding: 10px;*/
+ /*}*/
+
+ img {
+ max-width: 100%;
+ max-height: 50vh;
+ }
+
+ pre {
+ color: white;
+ padding: 10px 15px;
+ background: black;
+ border-radius: 10px;
+ }
+
+ /*.nav-link:hover, .nav-link:focus {*/
+ /* outline: 1px dotted #00ff00;*/
+ /*}*/
+
+ /*.nav-link:active {*/
+ /* outline: 1px solid #00ff00;*/
+ /*}*/
+
+ /*.btn:focus {*/
+ /* box-shadow: none;*/
+ /*}*/
+
+ #article-cover {
+ width: 100%;
+ height: 50vh;
+ background-size: cover;
+ background-position: center;
+ }
+
+ /*.badge-secondary {*/
+ /* background: black;*/
+ /* border: 1px solid #ffff00;*/
+ /* color: #ffff00 !important;*/
+ /* font-weight: normal;*/
+ /*}*/
+
+ /*.nav-admin {*/
+ /* color: #ffff00 !important;*/
+ /* outline-color: #ffff00 !important;*/
+ /*}*/
+
+ /*a.list-group-item.list-group-item-action.list-group-item-admin {*/
+ /* border-color: #ffff00;*/
+ /* color: #ffff00 !important;*/
+ /*}*/
+
+ /*a.list-group-item.list-group-item-action.list-group-item-admin:hover {*/
+ /* background-color: #ffff00 !important;*/
+ /*}*/
+
+ /*.card-admin {*/
+ /* filter: hue-rotate(-45deg);*/
+ /*}*/
+
+ /*.admin-text {*/
+ /* color: #ffff00 !important;*/
+ /*}*/
+
+ /*.list-admin-warning, .list-admin-warning * {*/
+ /* color: #ff0000 !important;*/
+ /*}*/
+
+ #apps_outer {
+ background: transparent;
+ border: none;
+ }
+
+ #apps_outer::after {
+ display: none;
+ }
+
+ #apps_path {
+ fill: #9a9a9a;
+ }
+
+ #apps_outer > svg {
+ border-radius: 5px;
+ }
+
+ #apps_outer:hover #apps_path {
+ opacity: .75;
+ }
+
+ #apps_outer:active #apps_path, #apps_outer:focus #apps_path {
+ opacity: .5;
+ }
+
+ .app-icon {
+ width: 24px;
+ height: 24px;
+ vertical-align: middle;
+ margin-right: 5px;
+ filter: invert(1);
+ }
+
+ .app-title {
+ vertical-align: middle;
+ }
+
+ .nav-item.dropdown {
+ vertical-align: middle;
+ display: block;
+ }
+
+ .nav-item.dropdown, .nav-item.dropdown * {
+ outline: none !important;
+ }
+
+ #apps, #apps * {
+ color: #212529 !important;
+ font-family: system-ui,-apple-system,"Segoe UI",Roboto,"Helvetica Neue",Arial,"Noto Sans","Liberation Sans",sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji";
+ }
+
+ /*::-webkit-scrollbar {*/
+ /* width: 10px;*/
+ /* margin-left: 1px;*/
+ /*}*/
+
+ /*::-webkit-scrollbar-track {*/
+ /* background: transparent;*/
+ /* margin-left: 1px;*/
+ /*}*/
+
+ /*::-webkit-scrollbar-thumb {*/
+ /* background-color: #00dd00;*/
+ /* margin-left: 1px;*/
+ /*}*/
+
+ /*::-webkit-scrollbar-thumb:hover {*/
+ /* background-color: #00bb00;*/
+ /*}*/
+
+ /*::-webkit-scrollbar-thumb:active {*/
+ /* background-color: #009900;*/
+ /*}*/
+
+ .navbar-toggler {
+ border-color: #00ff00 !important;
+ border-radius: 0;
+ }
+
+ .navbar-collapse.collapse.show {
+ height: calc(100vh - 63px);
+ }
+
+ .navbar-toggler-icon {
+ background-image: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' width='30' height='30' viewBox='0 0 30 30'><path stroke='rgba%280, 255, 0, 1%29' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/></svg>") !important;
+ }
+
+ .collapse.navbar-collapse {
+ display: block !important;
+ }
+
+ #easteregg {
+ font-size: 15px;
+ }
+
+ .dropdown-menu {
+ border: none;
+ background: transparent;
+ }
+
+ .dropdown-menu-inner {
+ max-width: max-content;
+ margin-left: auto;
+ background: #efefef;
+ border: 1px solid #ccc;
+ border-radius: 10px;
+ filter: invert(1);
+ padding-top: 10px;
+ padding-bottom: 10px;
+ }
+
+ mark {
+ padding: 0;
+ background: rgba(255, 255, 0, 0.5);
+ }
+
+ @media (max-width: 800px) {
+ #navbar-primary {
+ display: none;
+ }
+
+ #navbar-mobile {
+ display: flex !important;
+ }
+
+ #navbar-search .navbar-brand {
+ display: none;
+ }
+
+ .rss-logo {
+ margin-bottom: 19px !important;
+ margin-left: 24px !important;
+ display: inline-block !important;
+ }
+ }
+
+ .uc-logo-about {
+ margin-bottom: 15px;
+ text-align: center;
+ margin-left: auto;
+ max-width: 512px;
+ margin-right: auto;
+ display: block;
+ }
+
+ #search-form {
+ width: 100%;
+ display: grid;
+ grid-template-columns: 1fr 128px;
+ margin-left: 40px;
+ }
+
+ #search-submit {
+ background: transparent;
+ border: none;
+ font-weight: bold;
+ }
+
+ body {
+ background-color: rgb(24, 26, 27);
+ color: white;
+ }
+
+ </style>
+ <script src="/js/jquery.js"></script>
+ <script src="/js/bootstrap.bundle.min.js"></script>
+</head>
+<body>
+ <header>
+ <?php require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/modules/desktop.php"; ?>
+ <?php require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/modules/mobile.php"; ?>
+ <?php require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/modules/search.php"; ?>
+ </header>
\ No newline at end of file diff --git a/_site/includes/eggs b/_site/includes/eggs new file mode 100644 index 0000000..ae52732 --- /dev/null +++ b/_site/includes/eggs @@ -0,0 +1,16 @@ +Chromatic
+Chained
+Canine
+Cubic
+Cetacean
+Camelid
+Cancrine
+Caprine
+Cervine
+Columbine
+Corvine
+Calf
+Caterpillar
+Cria
+Codling
+Cub
diff --git a/_site/includes/modules/admin.php b/_site/includes/modules/admin.php new file mode 100644 index 0000000..099ea00 --- /dev/null +++ b/_site/includes/modules/admin.php @@ -0,0 +1,17 @@ +<?php
+$admin = true;
+if (!isset($_COOKIE["ADMIN_TOKEN"])) {
+ $admin = false;
+ if (isset($__ADMIN)) header("Location: /admin/offline") and die();
+} else {
+ if (!(strpos("/", $_COOKIE['ADMIN_TOKEN']) === false && strpos(".", $_COOKIE['ADMIN_TOKEN']) === false && (file_exists($_SERVER['DOCUMENT_ROOT'] . "/includes/admin/tokens/" . $_COOKIE['ADMIN_TOKEN']) || file_exists("/mnt/minteckrolt-main/admin/private/tokens/" . $_COOKIE['ADMIN_TOKEN'])))) {
+ $admin = false;
+ if (isset($__ADMIN)) header("Location: /admin/offline") and die();
+ } else {
+ if (file_exists("/mnt/minteckrolt-main/admin/private/tokens/" . $_COOKIE['ADMIN_TOKEN'])) {
+ $_USER = trim(file_get_contents("/mnt/minteckrolt-main/admin/private/tokens/" . $_COOKIE['ADMIN_TOKEN']));
+ } else {
+ $_USER = trim(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/admin/tokens/" . $_COOKIE['ADMIN_TOKEN']));
+ }
+ }
+}
\ No newline at end of file diff --git a/_site/includes/modules/desktop.php b/_site/includes/modules/desktop.php new file mode 100644 index 0000000..9f93735 --- /dev/null +++ b/_site/includes/modules/desktop.php @@ -0,0 +1,40 @@ +<nav class="navbar navbar-expand-sm bg-dark navbar-dark" id="navbar-primary">
+ <div class="container">
+ <a class="navbar-brand" id="easteregg" href="/">♥ (Un)<?= $egg ?>Tech</a>
+
+ <ul class="navbar-nav" style="float:right;">
+ <li class="nav-item">
+ <a class="nav-link" href="/articles">Articles</a>
+ </li>
+ <li class="nav-item">
+ <a class="nav-link" href="/latest">Latest</a>
+ </li>
+ <li class="nav-item">
+ <a class="nav-link" href="/random">Random</a>
+ </li>
+ <?php if ($admin): ?>
+ <li class="nav-item">
+ <a class="nav-link nav-admin" href="/admin">Administration</a>
+ </li>
+ <?php endif; ?>
+
+ <li class="nav-item dropdown">
+ <a class="nav-link dropdown-toggle" href="#" id="apps_outer" data-toggle="dropdown">
+ <svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 20 20" class="glyph_f10"><path d="M1 19h4v-4H1zm7 0h4v-4H8zm7 0h4v-4h-4zM1 12h4V8H1zm7 0h4V8H8zm7 0h4V8h-4zM1 5h4V1H1zm7 0h4V1H8zm7-4v4h4V1z" id="apps_path"></path></svg>
+ </a>
+ <div class="dropdown-menu" id="apps" style="position:fixed;top:48px;left:0;right:0;pointer-events: none;">
+ <div class="dropdown-menu-outer container" style="pointer-events: none;">
+ <div class="dropdown-menu-inner" style="pointer-events: fill;max-width:max-content;margin-left:auto;">
+ <a href="https://github.com/Minteck" class="dropdown-item"><img alt="" src="/apps/github.png" class="app-icon"> <span class="app-title">GitHub</span></a>
+ <a href="https://kartik.hopto.org/online" class="dropdown-item"><img alt="" src="/apps/kartik.png" class="app-icon"> <span class="app-title">Kartik Online</span></a>
+ <a href="https://minteck.ro.lt" class="dropdown-item"><span class="app-title"><img alt="" src="/apps/minteck.svg" class="app-icon"> Minteck's Space</span></a>
+ <a href="https://unchainedtech.minteck.ro.lt" class="dropdown-item"><span class="app-title"><img alt="" src="/apps/unchainedtech.png" class="app-icon"> UnchainedTech</span></a>
+ <a href="https://jetbrains.minteck.ro.lt/hub" class="dropdown-item"><img alt="" src="/apps/hub.svg" class="app-icon"> <span class="app-title">Minteck's Hub</span></a>
+ <a href="https://jetbrains.minteck.ro.lt/youtrack" class="dropdown-item"><img alt="" src="/apps/youtrack.svg" class="app-icon"> <span class="app-title">YouTrack</span></a>
+ </div>
+ </div>
+ </div>
+ </li>
+ </ul>
+ </div>
+</nav>
\ No newline at end of file diff --git a/_site/includes/modules/errors.php b/_site/includes/modules/errors.php new file mode 100644 index 0000000..ecb640f --- /dev/null +++ b/_site/includes/modules/errors.php @@ -0,0 +1,182 @@ +<?php
+function customShutdown() {
+ global $debug;
+
+ if (!is_null(error_get_last())) {
+ ob_clean();
+ $d = error_get_last();
+ echo "
+<!DOCTYPE html>
+<html>
+<head>
+ <title>Something went wrong on UnchainedTech 🌙</title>
+ <style>
+
+ @font-face {
+ src: url(\"/font/regular.woff2\");
+ font-family: \"JetBrains Mono\";
+ font-style: normal;
+ }
+
+ @font-face {
+ src: url(\"/font/italic.woff2\");
+ font-family: \"JetBrains Mono\";
+ font-style: italic;
+ }
+
+ *, pre {
+ font-family: \"JetBrains Mono\", sans-serif;
+ transition: none !important;
+ }
+
+ nav, * {
+ color: #00ff00 !important;
+ }
+
+ html, body, nav.navbar, .card {
+ background-color: black !important;
+ }
+
+ a:hover {
+ color: black !important;
+ background: #00ff00;
+ }
+
+ pre {
+ background: #00ff00;
+ border-radius: 5px;
+ padding: 10px;
+ color: black !important;
+ text-align: left;
+ }
+
+ @media (min-width: 700px) {
+ pre {
+ margin-left: 25%;
+ margin-right: 25%;
+ }
+ }
+
+ </style>
+</head>
+<body>
+ <div style='margin-top:50px;text-align: center;'>
+ <h1>Something went wrong <small>(like, for real!)</small></h1>
+ <p>An error occured and UnchainedTech cannot load right now. Even us can make mistakes sometimes, and because you are really nice you will <a href='https://jetbrains.minteck.ro.lt:1024/youtrack/newIssue?project=UT' target='_blank'>report this bug</a>.</p>
+ <p>For you, really tech-savvy people, here is that alien language thing you're probably looking for:</p>
+ <pre>
+#99{$d["type"]}: ";
+
+ $pparts = explode(": ", $d["message"]);
+ array_shift($pparts);
+
+ $parts = explode(" in ", implode(": ", $pparts));
+ echo($parts[0]);
+
+ $stp = explode("\nStack trace:", $parts[1]);
+ echo("\n at " . $stp[0]);
+
+ $stlines = explode("\n", $stp[1]);
+ array_shift($stlines);
+
+ foreach ($stlines as $stline) {
+ $stpparts = explode(" ", $stline);
+ array_shift($stpparts);
+ $stline = implode(" ", $stpparts);
+
+ if ($stline !== " thrown" && $stline !== "{main}") {
+ $pp2 = explode("(", $stline);
+ $pp2n = explode(")", $pp2[1]);
+
+ echo("\n at " . $pp2[0] . ":" . $pp2n[0]);
+ } else if ($stline === "{main}") {
+ echo("\n at UnchainedTech.\$Core (UCT Core " . file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/../version.txt") . ", PHP " . PHP_VERSION . ")");
+ }
+ }
+
+ echo "
+</pre>
+ </div>
+</body>
+</html>
+ ";
+ die();
+ }
+}
+
+function customError($errno, $errstr, $errfile = "<unknown file>", $errline = "<unknown line>") {
+ global $debug;
+
+ ob_clean();
+ echo "
+<!DOCTYPE html>
+<html>
+<head>
+ <title>Something went wrong on UnchainedTech 🌙</title>
+ <style>
+
+ @font-face {
+ src: url(\"/font/regular.woff2\");
+ font-family: \"JetBrains Mono\";
+ font-style: normal;
+ }
+
+ @font-face {
+ src: url(\"/font/italic.woff2\");
+ font-family: \"JetBrains Mono\";
+ font-style: italic;
+ }
+
+ *, pre {
+ font-family: \"JetBrains Mono\", sans-serif;
+ transition: none !important;
+ }
+
+ nav, * {
+ color: #00ff00 !important;
+ }
+
+ html, body, nav.navbar, .card {
+ background-color: black !important;
+ }
+
+ a:hover {
+ color: black !important;
+ background: #00ff00;
+ }
+
+ pre {
+ background: #00ff00;
+ border-radius: 5px;
+ padding: 10px;
+ color: black !important;
+ text-align: left;
+ }
+
+ @media (min-width: 700px) {
+ pre {
+ margin-left: 25%;
+ margin-right: 25%;
+ }
+ }
+
+ </style>
+</head>
+<body>
+ <div style='margin-top:50px;text-align: center;'>
+ <h1>Something went wrong <small>(like, for real!)</small></h1>
+ <p>An error occured and UnchainedTech cannot load right now. Even us can make mistakes sometimes, and because you are really nice you will <a href='https://jetbrains.minteck.ro.lt:1024/youtrack/newIssue?project=UT' target='_blank'>report this bug</a>.</p>
+ <p>For you, really tech-savvy people, here is that alien language thing you're probably looking for:</p>
+ <pre>
+#{$errno}: {$errstr}
+ at {$errfile}:{$errline}
+ at UnchainedTech.\$Core (UCT Core " . file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/../version.txt") . ", PHP " . PHP_VERSION . ")
+</pre>
+ </div>
+</body>
+</html>
+ ";
+ die();
+}
+set_error_handler("customError", E_ALL);
+register_shutdown_function("customShutdown");
\ No newline at end of file diff --git a/_site/includes/modules/github.php b/_site/includes/modules/github.php new file mode 100644 index 0000000..596d984 --- /dev/null +++ b/_site/includes/modules/github.php @@ -0,0 +1,22 @@ +<?php
+function gh_api($api) {
+ $crl = curl_init("https://api.github.com/" . $api);
+ curl_setopt($crl, CURLOPT_RETURNTRANSFER, true);
+ curl_setopt($crl, CURLINFO_HEADER_OUT, true);
+ curl_setopt($crl, CURLOPT_POST, false);
+
+ curl_setopt($crl, CURLOPT_HTTPHEADER, array(
+ 'Content-Type: application/json',
+ "Accept: application/json",
+ "Authorization: token " . json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/admin/credentials.json"), true)["token"],
+ "User-Agent: UnchainedTech-Admin/0.0.0 (nekostarfan@gmail.com)"
+ ));
+
+ $result = curl_exec($crl);
+
+ if ($result === false) {
+ throw new ErrorException("GitHub API unexpectedly interrupted", 214, E_ERROR);
+ }
+
+ return $result;
+}
\ No newline at end of file diff --git a/_site/includes/modules/mobile.php b/_site/includes/modules/mobile.php new file mode 100644 index 0000000..967925e --- /dev/null +++ b/_site/includes/modules/mobile.php @@ -0,0 +1,38 @@ +<nav class="navbar navbar-expand-sm bg-dark navbar-dark" id="navbar-mobile" style="display:none;">
+ <a class="navbar-brand" href="/">UnchainedTech</a>
+
+ <ul class="navbar-nav" style="text-align: center;display: grid;grid-template-columns: 1fr 1fr;">
+ <li class="nav-item">
+ <a class="nav-link" href="/articles">Articles</a>
+ </li>
+ <li class="nav-item">
+ <a class="nav-link" href="/latest">Latest</a>
+ </li>
+ <li class="nav-item">
+ <a class="nav-link" href="/random">Random</a>
+ </li>
+ <?php if ($admin): ?>
+ <li class="nav-item">
+ <a class="nav-link nav-admin" href="/admin">Administration</a>
+ </li>
+ <?php endif; ?>
+
+ <li class="nav-item dropdown" style="text-align: center;">
+ <a class="nav-link dropdown-toggle" href="#" id="apps_outer" data-toggle="dropdown">
+ <svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 20 20" class="glyph_f10"><path d="M1 19h4v-4H1zm7 0h4v-4H8zm7 0h4v-4h-4zM1 12h4V8H1zm7 0h4V8H8zm7 0h4V8h-4zM1 5h4V1H1zm7 0h4V1H8zm7-4v4h4V1z" id="apps_path"></path></svg>
+ </a>
+ <div class="dropdown-menu" id="apps" style="position:fixed;top:48px;left:0;right:0;pointer-events: none;">
+ <div class="dropdown-menu-outer container" style="pointer-events: none;">
+ <div class="dropdown-menu-inner" style="pointer-events: fill;max-width:max-content;margin-left:auto;">
+ <a href="https://github.com/Minteck" class="dropdown-item"><img alt="" src="/apps/github.png" class="app-icon"> <span class="app-title">GitHub</span></a>
+ <a href="https://kartik.hopto.org/online" class="dropdown-item"><img alt="" src="/apps/kartik.png" class="app-icon"> <span class="app-title">Kartik Online</span></a>
+ <a href="https://minteck.ro.lt" class="dropdown-item"><span class="app-title"><img alt="" src="/apps/minteck.svg" class="app-icon"> Minteck's Space</span></a>
+ <a href="https://unchainedtech.minteck.ro.lt" class="dropdown-item"><span class="app-title"><img alt="" src="/apps/unchainedtech.png" class="app-icon"> UnchainedTech</span></a>
+ <a href="https://jetbrains.minteck.ro.lt/hub" class="dropdown-item"><img alt="" src="/apps/hub.svg" class="app-icon"> <span class="app-title">Minteck's Hub</span></a>
+ <a href="https://jetbrains.minteck.ro.lt/youtrack" class="dropdown-item"><img alt="" src="/apps/youtrack.svg" class="app-icon"> <span class="app-title">YouTrack</span></a>
+ </div>
+ </div>
+ </div>
+ </li>
+ </ul>
+</nav>
\ No newline at end of file diff --git a/_site/includes/modules/search.php b/_site/includes/modules/search.php new file mode 100644 index 0000000..fe37786 --- /dev/null +++ b/_site/includes/modules/search.php @@ -0,0 +1,16 @@ +<nav class="navbar navbar-expand-sm bg-dark navbar-dark" id="navbar-search">
+ <div class="container">
+ <a class="navbar-brand" href="/"><img src="/logo.svg" width="36px" style="vertical-align: middle;"> <span style="vertical-align: middle;">UnchainedTech</span></a>
+
+ <form class="form-inline" action="/search" id="search-form">
+ <input class="form-control mr-sm-2" type="text" name="q" value="<?php
+
+ if (isset($_GET['q']) && strpos($_GET['q'], "/") === false && strpos($_GET['q'], "&") === false && strpos($_GET['q'], ">") === false && strpos($_GET['q'], ">") === false) {
+ echo($_GET['q']);
+ }
+
+ ?>" placeholder="Search articles">
+ <button class="btn btn-success" type="submit" id="search-submit">Search</button>
+ </form>
+ </div>
+</nav>
\ No newline at end of file |