aboutsummaryrefslogtreecommitdiff
path: root/admin/panes
diff options
context:
space:
mode:
authorMinteck <46352972+Minteck@users.noreply.github.com>2021-08-01 22:28:15 +0200
committerMinteck <46352972+Minteck@users.noreply.github.com>2021-08-01 22:28:15 +0200
commit9852b6cd074cceec0d0b549bb6c9bd7fe50c86f2 (patch)
tree22d9b851864f9370282f21d10113afd5d565e4cf /admin/panes
parentb028da9fea70c65ccd52d1d478859739027d756a (diff)
downloadmain-9852b6cd074cceec0d0b549bb6c9bd7fe50c86f2.tar.gz
main-9852b6cd074cceec0d0b549bb6c9bd7fe50c86f2.tar.bz2
main-9852b6cd074cceec0d0b549bb6c9bd7fe50c86f2.zip
Update
Diffstat (limited to 'admin/panes')
-rw-r--r--admin/panes/home.php136
-rw-r--r--admin/panes/kartik.php111
-rw-r--r--admin/panes/unchained.php81
-rw-r--r--admin/panes/uptime.php87
-rw-r--r--admin/panes/version.php139
5 files changed, 554 insertions, 0 deletions
diff --git a/admin/panes/home.php b/admin/panes/home.php
new file mode 100644
index 0000000..ac106e4
--- /dev/null
+++ b/admin/panes/home.php
@@ -0,0 +1,136 @@
+<?php require_once $_SERVER['DOCUMENT_ROOT'] . "/admin/private/header.php";/** @var array $_DATA */ ?>
+
+<style>
+ ::-webkit-scrollbar {
+ width: 5px;
+ }
+
+ ::-webkit-scrollbar-track {
+ border-radius: 9999px;
+ background: transparent;
+ }
+
+ ::-webkit-scrollbar-thumb {
+ border-radius: 9999px;
+ background-color: rgba(136, 136, 136, 0.5);
+ transition: background 200ms;
+ }
+
+ ::-webkit-scrollbar-thumb:hover {
+ background-color: rgba(85, 85, 85, 0.75);
+ }
+
+ ::-webkit-scrollbar-thumb:active {
+ background-color: #222;
+ }
+
+ .list-group-item {
+ background: #34373c;
+ }
+</style>
+
+<div class="container" style="color:white;padding-top:15vh;padding-bottom:15vh;">
+ <h2 style="text-align:center;">Welcome back <?= $_DATA["name"] ?>!</h2>
+ <ul class="list-group" style="margin-top:30px;">
+ <li class="list-group-item">
+ <span id="temperature">Server running at <b><?php
+
+ exec("sensors -j", $out);
+ $outp = implode("\n", $out);
+ $outd = json_decode($outp, true);
+
+ echo(round($outd["cpu_thermal-virtual-0"]["temp1"]["temp1_input"], 1));
+
+ ?>°C</b>, <?php
+
+ if ($outd["cpu_thermal-virtual-0"]["temp1"]["temp1_input"] > 90) {
+ echo("completely overheating!");
+ } else if ($outd["cpu_thermal-virtual-0"]["temp1"]["temp1_input"] > 60) {
+ echo("starting to throttle!");
+ } else {
+ echo("under normal temperatures");
+ }
+
+ ?></span> <a href="#" onclick="window.parent.activity('activity-version', '/admin/panes/version.php', window.parent.document.getElementById('activity-version'));" style="float:right;">Manage...</a></li><li class="list-group-item"><b><?php
+
+ $uca = scandir("/mnt/blogchain/_posts");
+ $uct = [];
+
+ foreach ($uca as $art) {
+ if (is_file("/mnt/blogchain/_posts/" . $art) && substr($art, 0, 1) !== "." && substr($art, 0, 1) !== "_") {
+ $uct[] = $art;
+ }
+ }
+
+ echo(count($uct));
+
+ ?></b> UnchainedTech article·s, <?php
+
+ $uca = scandir("/mnt/blogchain/_posts/_drafts");
+ $uct2 = [];
+
+ foreach ($uca as $art) {
+ if (is_file("/mnt/blogchain/_posts/_drafts/" . $art) && substr($art, 0, 1) !== "." && substr($art, 0, 1) !== "_") {
+ $uct2[] = $art;
+ }
+ }
+
+ echo(count($uct2));
+
+ ?> draft·s <a onclick="window.parent.activity('activity-unchained', '/admin/panes/unchained.php', window.parent.document.getElementById('activity-unchained'));" href="#" style="float:right;">Manage...</a></li>
+ <li class="list-group-item"><b><?php
+
+ $uca = scandir("/mnt/minteckrolt-cloud");
+ $uct3 = [];
+
+ foreach ($uca as $art) {
+ if (is_dir("/mnt/minteckrolt-cloud/" . $art) && substr($art, 0, 1) === "~") {
+ $uct3[] = $art;
+ }
+ }
+
+ echo(count($uct3));
+
+ ?></b> Neutron Cloud website·s <a onclick="window.parent.activity('activity-quotas', '/admin/panes/quotas.php', window.parent.document.getElementById('activity-quotas'));" href="#" style="float:right;">Manage...</a></li>
+ <li class="list-group-item"><b><?php
+
+ $uca = scandir("/mnt/kartik/online/private/stats");
+ $uct4 = [];
+
+ foreach ($uca as $art) {
+ if (is_file("/mnt/kartik/online/private/stats/" . $art)) {
+ $uct4[] = $art;
+ }
+ }
+
+ echo(count($uct4));
+
+ ?></b> Kartik Online player·s <a onclick="window.parent.activity('activity-kartik', '/admin/panes/kartik.php', window.parent.document.getElementById('activity-kartik'));" href="#" style="float:right;">Manage...</a></li>
+ <li class="list-group-item"><b><?php
+
+ $uca = scandir("/mnt/minteckrolt-main/includes/blog/data");
+ $uct5 = [];
+
+ foreach ($uca as $art) {
+ if (is_dir("/mnt/minteckrolt-main/includes/blog/data/" . $art)) {
+ $uct4[] = $art;
+ }
+ }
+
+ echo(count($uct4));
+
+ ?></b> blog article·s <a onclick="window.parent.activity('activity-blog', '/admin/panes/blog.php', window.parent.document.getElementById('activity-blog'));" href="#" style="float:right;">Manage...</a></li>
+ </ul>
+ <!--suppress JSUnresolvedVariable, JSUnresolvedFunction -->
+ <script>
+ setInterval(() => {
+ $.ajax("/admin/api/serverTemp.php", {
+ success: (data) => {
+ document.getElementById("temperature").innerHTML = data;
+ }
+ });
+ }, 500)
+ </script>
+</div>
+
+<?php require_once $_SERVER['DOCUMENT_ROOT'] . "/admin/private/footer.php"; ?> \ No newline at end of file
diff --git a/admin/panes/kartik.php b/admin/panes/kartik.php
new file mode 100644
index 0000000..87a975f
--- /dev/null
+++ b/admin/panes/kartik.php
@@ -0,0 +1,111 @@
+<?php require_once $_SERVER['DOCUMENT_ROOT'] . "/admin/private/header.php";/** @var array $_DATA */ ?>
+
+<style>
+ ::-webkit-scrollbar {
+ width: 5px;
+ }
+
+ ::-webkit-scrollbar-track {
+ border-radius: 9999px;
+ background: transparent;
+ }
+
+ ::-webkit-scrollbar-thumb {
+ border-radius: 9999px;
+ background-color: rgba(136, 136, 136, 0.5);
+ transition: background 200ms;
+ }
+
+ ::-webkit-scrollbar-thumb:hover {
+ background-color: rgba(85, 85, 85, 0.75);
+ }
+
+ ::-webkit-scrollbar-thumb:active {
+ background-color: #222;
+ }
+
+ .list-group-item {
+ background: #34373c;
+ }
+</style>
+
+<div class="container" style="color:white;padding-top:15vh;padding-bottom:15vh;">
+ <div>
+ <h2 style="text-align:center;">Kartik Online</h2>
+ <h4 style="text-align:center;"><?php
+
+ $uca = scandir("/mnt/kartik/online/private/stats");
+ $uct4 = [];
+
+ foreach ($uca as $art) {
+ if (is_file("/mnt/kartik/online/private/stats/" . $art)) {
+ $uct4[] = $art;
+ }
+ }
+
+ echo(count($uct4));
+
+ ?> player·s</h4>
+
+ <ul class="list-group">
+ <?php
+
+ $uca = scandir("/mnt/kartik/online/private/stats");
+ $uct4 = [];
+
+ foreach ($uca as $art) {
+ if (is_file("/mnt/kartik/online/private/stats/" . $art)): ?>
+
+ <li class="list-group-item"><?= $art ?> <?php
+
+ $osession = 0;
+ $gsession = 0;
+ $tsession = 0;
+
+ $webs = scandir("/mnt/kartik/online/private/tokens");
+ $ings = scandir("/mnt/kartik/online/private/gametokens");
+
+ foreach ($webs as $webt) {
+ if (!is_dir("/mnt/kartik/online/private/tokens/" . $webt)) {
+ $d = json_decode(file_get_contents("/mnt/kartik/online/private/tokens/" . $webt), true);
+ if ($d["id"] === $art) {
+ $osession++;
+ }
+ }
+ }
+
+ foreach ($ings as $webt) {
+ if (!is_dir("/mnt/kartik/online/private/gametokens/" . $webt)) {
+ $d = json_decode(file_get_contents("/mnt/kartik/online/private/gametokens/" . $webt), true);
+ if ($d["id"] === $art) {
+ $gsession++;
+ }
+ }
+ }
+
+ $tsession = $osession + $gsession;
+ if ($tsession > 1) {
+ $tsessions = "s";
+ } else {
+ $tsessions = "";
+ }
+
+ if ($osession > 0) {
+ echo("<span class='badge text-warning border-warning' style='border:1px solid;vertical-align: middle;'>{$tsession} session{$tsessions} ({$gsession}:{$osession})</span>");
+ } else if ($gsession > 0) {
+ echo("<span class='badge text-success border-success' style='border:1px solid;vertical-align: middle;'>{$tsession} session{$tsessions} ({$gsession}:0)</span>");
+ } else {
+ echo("<span class='badge text-light border-light' style='border:1px solid;vertical-align: middle;'>Offline (0:0)</span>");
+ }
+
+ ?> <span style="float:right;"><a href="/admin/api/terminateWebSessions.php?_=<?= $art ?>">Terminate Web</a> · <a href="/admin/api/terminateGameSessions.php?_=<?= $art ?>">Terminate Game</a> · <a href="/admin/api/terminateAllSessions.php?_=<?= $art ?>">Terminate All</a></span></li>
+
+ <?php endif;
+ }
+
+ ?>
+ </ul>
+ </div>
+</div>
+
+<?php require_once $_SERVER['DOCUMENT_ROOT'] . "/admin/private/footer.php"; ?> \ No newline at end of file
diff --git a/admin/panes/unchained.php b/admin/panes/unchained.php
new file mode 100644
index 0000000..cab35b5
--- /dev/null
+++ b/admin/panes/unchained.php
@@ -0,0 +1,81 @@
+<?php require_once $_SERVER['DOCUMENT_ROOT'] . "/admin/private/header.php";/** @var array $_DATA */ ?>
+
+<style>
+ ::-webkit-scrollbar {
+ width: 5px;
+ }
+
+ ::-webkit-scrollbar-track {
+ border-radius: 9999px;
+ background: transparent;
+ }
+
+ ::-webkit-scrollbar-thumb {
+ border-radius: 9999px;
+ background-color: rgba(136, 136, 136, 0.5);
+ transition: background 200ms;
+ }
+
+ ::-webkit-scrollbar-thumb:hover {
+ background-color: rgba(85, 85, 85, 0.75);
+ }
+
+ ::-webkit-scrollbar-thumb:active {
+ background-color: #222;
+ }
+
+ .list-group-item {
+ background: #34373c;
+ }
+</style>
+
+<div class="container" style="color:white;padding-top:15vh;padding-bottom:15vh;display: flex;align-items:center;justify-content: center;height:100%;" id="main">
+ <div>
+ <p style="text-align: center;">
+ <img src="/logo.svg" width="96px"><span class="text-muted"> ⏵⏵⏵ </span><!--suppress CheckImageSize -->
+ <img src="/static/apps/unchainedtech.png" width="96px">
+ </p>
+ <br>
+ <h2 style="text-align:center;">You already have access to UnchainedTech Admin</h2>
+
+ <h4 style="text-align:center;">We automatically logged you into UnchainedTech Admin when you logged in to Minteck Admin</h4><br>
+
+ <div style="text-align: center;width:max-content;margin-left:auto;margin-right:auto;">
+ <p class="btn-group">
+ <a href="https://unchainedtech.minteck.ro.lt/articles" target="_blank" class="btn btn-outline-light">All Articles</a>
+ <a href="https://unchainedtech.minteck.ro.lt/admin" target="_blank" class="btn btn-outline-light">Admin Tasks</a>
+ </p>
+ </div>
+
+ <small><p style="text-align: center;">
+ v<?= trim(file_get_contents("/mnt/blogchain/version.txt")) ?> • <a href="#" onclick="document.getElementById('main').style.display='none';document.getElementById('secondary').style.display='';">Manage drafts</a>
+ </p></small>
+ </div>
+</div>
+
+ <div class="container" style="color:white;padding-top:15vh;padding-bottom:15vh;display:none;" id="secondary">
+ <div>
+ <h2 style="text-align:center;">UnchainedTech</h2>
+ <h4 style="text-align:center;">Drafts List</h4>
+
+ <small><p style="text-align: center;">
+ v<?= trim(file_get_contents("/mnt/blogchain/version.txt")) ?> • <a href="#" onclick="document.getElementById('main').style.display='flex';document.getElementById('secondary').style.display='none';">Hide drafts list</a>
+ </p></small>
+
+ <ul class="list-group">
+ <?php
+
+ $drafts = false;
+ foreach (scandir("/mnt/blogchain/_posts/_drafts") as $draft) {
+ if ($draft !== "." && $draft !== ".." && $draft !== ".gitkeep" && $draft !== "_template.md") {
+ $drafts = true;
+ echo('<li class="list-group-item">' . substr($draft, 0, -3) . '<span style="float:right;"><a href="https://unchainedtech.minteck.ro.lt/admin/article/' . substr($draft, 0, -3) . '" target="_blank">Preview</a> · <a href="https://github.com/Minteck/UnchainedTech-Content/edit/production/_drafts/' . $draft . '" target="_blank">Edit</a> · <a href="https://github.com/Minteck/UnchainedTech-Content/delete/production/_drafts/' . $draft . '" target="_blank">Delete</a></span></li>');
+ }
+ }
+
+ ?>
+ </ul>
+ </div>
+ </div>
+
+<?php require_once $_SERVER['DOCUMENT_ROOT'] . "/admin/private/footer.php"; ?> \ No newline at end of file
diff --git a/admin/panes/uptime.php b/admin/panes/uptime.php
new file mode 100644
index 0000000..71a6545
--- /dev/null
+++ b/admin/panes/uptime.php
@@ -0,0 +1,87 @@
+<?php require_once $_SERVER['DOCUMENT_ROOT'] . "/admin/private/header.php";/** @var array $_DATA */ ?>
+
+<style>
+ ::-webkit-scrollbar {
+ width: 5px;
+ }
+
+ ::-webkit-scrollbar-track {
+ border-radius: 9999px;
+ background: transparent;
+ }
+
+ ::-webkit-scrollbar-thumb {
+ border-radius: 9999px;
+ background-color: rgba(136, 136, 136, 0.5);
+ transition: background 200ms;
+ }
+
+ ::-webkit-scrollbar-thumb:hover {
+ background-color: rgba(85, 85, 85, 0.75);
+ }
+
+ ::-webkit-scrollbar-thumb:active {
+ background-color: #222;
+ }
+
+ .list-group-item {
+ background: #34373c;
+ }
+</style>
+
+<div class="container" style="color:white;padding-top:15vh;padding-bottom:15vh;">
+ <h2 style="text-align:center;">The server has been running for</h2>
+
+ <h4 style="text-align:center;" id="uptime"><?php
+
+ $str = @file_get_contents('/proc/uptime');
+ $num = floatval($str);
+ $secs = fmod($num, 60); $num = intdiv($num, 60);
+ $mins = $num % 60; $num = intdiv($num, 60);
+ $hours = $num % 24; $num = intdiv($num, 24);
+ $days = $num;
+
+ echo($days . " day·s, " . $hours . " hour·s, " . $mins . " minute·s, " . ceil($secs) . " second·s")
+
+ ?></h4>
+ <!--suppress JSUnresolvedVariable, JSUnresolvedFunction -->
+ <script>
+ setInterval(() => {
+ $.ajax("/admin/api/serverTime.php", {
+ success: (data) => {
+ document.getElementById("uptime").innerText = data;
+ }
+ });
+ }, 500)
+ </script>
+
+ <ul class="list-group" style="margin-top:20px;">
+ <li class="list-group-item">
+ <b><?php
+
+ exec("journalctl --disk-usage", $ret);
+ $data = trim(implode("\n", $ret));
+
+ $val = explode(" ", $data)[6];
+ echo($val);
+
+ ?></b> of data has been collected to ensure easy system maintenance and audit
+ </li>
+ <li class="list-group-item" id="logsummary">
+ Calculating...
+ </li>
+ <!--suppress JSUnresolvedVariable, JSUnresolvedFunction -->
+ <script>
+ $.ajax("/admin/api/serverLogSummary.php", {
+ success: (data) => {
+ document.getElementById("logsummary").innerHTML = data;
+ },
+ error: () => {
+ document.getElementById("logsummary").innerText = "An error occurred while loading this content";
+ }
+ });
+ </script>
+ </ul>
+</div>
+
+<?php require_once $_SERVER['DOCUMENT_ROOT'] . "/admin/private/footer.php"; ?> \ No newline at end of file
diff --git a/admin/panes/version.php b/admin/panes/version.php
new file mode 100644
index 0000000..04ef136
--- /dev/null
+++ b/admin/panes/version.php
@@ -0,0 +1,139 @@
+<?php require_once $_SERVER['DOCUMENT_ROOT'] . "/admin/private/header.php";/** @var array $_DATA */ ?>
+
+<style>
+ ::-webkit-scrollbar {
+ width: 5px;
+ }
+
+ ::-webkit-scrollbar-track {
+ border-radius: 9999px;
+ background: transparent;
+ }
+
+ ::-webkit-scrollbar-thumb {
+ border-radius: 9999px;
+ background-color: rgba(136, 136, 136, 0.5);
+ transition: background 200ms;
+ }
+
+ ::-webkit-scrollbar-thumb:hover {
+ background-color: rgba(85, 85, 85, 0.75);
+ }
+
+ ::-webkit-scrollbar-thumb:active {
+ background-color: #222;
+ }
+
+ .list-group-item {
+ background: #34373c;
+ }
+</style>
+
+<div class="container" style="color:white;padding-top:15vh;padding-bottom:15vh;">
+ <h2 style="text-align:center;">This server is running <?= php_uname('s') ?> version</h2>
+
+ <h4 style="text-align:center;"><?= php_uname('r') . " " . php_uname('v') ?></h4>
+
+ <ul class="list-group" style="margin-top:20px;">
+ <li class="list-group-item">PHP <?= PHP_VERSION ?></li>
+ <li class="list-group-item">UnchainedTech <?= trim(file_get_contents("/mnt/blogchain/version.txt")) ?></li>
+ <li class="list-group-item">Neutron Cloud <?= trim(file_get_contents("/mnt/minteckrolt-cloud/@BASE/source/api/version")) ?></li>
+ <li class="list-group-item">Neutron Copper <?= trim(file_get_contents("/mnt/minteckrolt-cloud/@BASE/source/api/cyclic_version")) ?></li>
+ <li class="list-group-item">Neutron Titanium <?= trim(file_get_contents("/mnt/minteckrolt-cloud/@BASE/source/api/jaw_version")) ?></li>
+ <li class="list-group-item">
+ <?php
+
+ $osr = [];
+ $lines = explode("\n", file_get_contents("/etc/os-release"));
+
+ foreach ($lines as $line) {
+ if (trim($line) !== "") {
+ $parts = explode("=", $line);
+ $osr[$parts[0]] = str_replace("\"", "", $parts[1]);
+ }
+ }
+
+ echo($osr["NAME"] . " " . $osr["VERSION"]);
+
+ ?>
+ </li>
+ <li class="list-group-item">Git <?php exec("git --version", $res);$p = explode(" ", $res[0]);array_shift($p);array_shift($p);echo(implode(" ", $p)) ?></li>
+ <li class="list-group-item"><?php
+
+ $soft = $_SERVER['SERVER_SOFTWARE'];
+
+ if (strpos(strtolower($soft), "apache") !== false) {
+ echo("Apache HTTP Server");
+ } else {
+ echo("nginx");
+ }
+
+ ?> <?php
+
+ $soft = $_SERVER['SERVER_SOFTWARE'];
+
+ if (strpos(strtolower($soft), "apache") !== false) {
+ exec("apache2 -v", $res2);$p = explode(" ", $res2[0]);array_shift($p);array_shift($p);$p2 = explode("/", implode(" ", $p));array_shift($p2);echo(implode(" ", $p2));
+ } else {
+ exec("nginx -v", $res2);$p = explode(" ", $res2[0]);array_shift($p);array_shift($p);$p2 = explode("/", implode(" ", $p));array_shift($p2);echo(implode(" ", $p2));
+ }
+
+ ?></li>
+ </ul>
+
+ <ul class="list-group" style="margin-top:20px;">
+ <li id="checking" class="list-group-item">Checking for updates...</li>
+ <li id="checking2" class="list-group-item" style="display:none;"></li>
+ <li id="found" class="list-group-item" style="display:none;">
+ <b id="updates-count">0</b> package·s have updates available
+
+ <details>
+ <summary>View details</summary>
+ <ul class="list-group" id="updates-list"></ul>
+ </details>
+ </li>
+ </ul>
+ <!--suppress JSUnresolvedVariable, JSUnresolvedFunction, JSUnfilteredForInLoop -->
+ <script>
+ $.ajax("/admin/api/refreshUpdates.php", {
+ success: (data) => {
+ document.getElementById("checking").innerText = "Checking for Ubuntu upgrades...";
+ $.ajax("/admin/api/getUbuntuUpgrades.php", {
+ success: (data) => {
+ document.getElementById("checking").innerHTML = data;
+ document.getElementById("checking2").style.display = "";
+ document.getElementById("checking2").innerText = "Reading package lists...";
+ $.ajax("/admin/api/getUpdates.php", {
+ success: (data) => {
+ document.getElementById("checking2").innerText = "Please wait...";
+ document.getElementById("updates-count").innerText = data.count;
+
+ dom = "";
+ for (let index in data.packages) {
+ item = data.packages[index];
+ dom += `<li class="list-group-item"><b>${item.name}</b> (<span style="color: orange;">${item.version.local}</span> → <span style="color: green;">${item.version.remote}</span>)<br>Provided by: <code>${item.repos}</code>, target architecture: <code>${item.architecture}</code></li>`
+ }
+
+ document.getElementById("updates-list").innerHTML = dom;
+
+ document.getElementById("checking2").outerHTML = "";
+ document.getElementById("found").style.display = "";
+ },
+ error: () => {
+ document.getElementById("checking2").innerText = "An error occurred while loading this content";
+ }
+ });
+ },
+ error: () => {
+ document.getElementById("checking").innerText = "An error occurred while loading this content";
+ }
+ });
+ },
+ error: () => {
+ document.getElementById("checking").innerText = "An error occurred while loading this content";
+ }
+ });
+ </script>
+</div>
+
+<?php require_once $_SERVER['DOCUMENT_ROOT'] . "/admin/private/footer.php"; ?> \ No newline at end of file