From 9852b6cd074cceec0d0b549bb6c9bd7fe50c86f2 Mon Sep 17 00:00:00 2001 From: Minteck <46352972+Minteck@users.noreply.github.com> Date: Sun, 1 Aug 2021 22:28:15 +0200 Subject: Update --- admin/api/_demo.php | 5 +++++ admin/api/getUbuntuUpgrades.php | 10 ++++++++++ admin/api/getUpdates.php | 26 ++++++++++++++++++++++++++ admin/api/refreshUpdates.php | 4 ++++ admin/api/serverLogSummary.php | 8 ++++++++ admin/api/serverTemp.php | 20 ++++++++++++++++++++ admin/api/serverTime.php | 12 ++++++++++++ admin/api/terminateAllSessions.php | 34 ++++++++++++++++++++++++++++++++++ admin/api/terminateGameSessions.php | 23 +++++++++++++++++++++++ admin/api/terminateWebSessions.php | 23 +++++++++++++++++++++++ 10 files changed, 165 insertions(+) create mode 100644 admin/api/_demo.php create mode 100644 admin/api/getUbuntuUpgrades.php create mode 100644 admin/api/getUpdates.php create mode 100644 admin/api/refreshUpdates.php create mode 100644 admin/api/serverLogSummary.php create mode 100644 admin/api/serverTemp.php create mode 100644 admin/api/serverTime.php create mode 100644 admin/api/terminateAllSessions.php create mode 100644 admin/api/terminateGameSessions.php create mode 100644 admin/api/terminateWebSessions.php (limited to 'admin/api') diff --git a/admin/api/_demo.php b/admin/api/_demo.php new file mode 100644 index 0000000..e4651f1 --- /dev/null +++ b/admin/api/_demo.php @@ -0,0 +1,5 @@ +Ubuntu " . explode("'", $ret[0])[1] . " is available, use do-release-upgrade to upgrade"); +} else { + echo("This server is running the latest version of Ubuntu"); +} \ No newline at end of file diff --git a/admin/api/getUpdates.php b/admin/api/getUpdates.php new file mode 100644 index 0000000..57ce275 --- /dev/null +++ b/admin/api/getUpdates.php @@ -0,0 +1,26 @@ + trim($parts[1]), + "version" => [ + "local" => trim(explode("]", explode("[", $parts[2])[1])[0]), + "remote" => trim(explode("(", $parts[3])[1]), + ], + "repos" => trim(explode(":", explode("(", explode("[", trim($package))[1])[1])[1]), + "architecture" => trim(explode("]", explode("[", trim($package))[2])[0]) + ]; + + $data["packages"][] = $pkg; +} + +echo(json_encode($data, JSON_PRETTY_PRINT)); \ No newline at end of file diff --git a/admin/api/refreshUpdates.php b/admin/api/refreshUpdates.php new file mode 100644 index 0000000..ea6f991 --- /dev/null +++ b/admin/api/refreshUpdates.php @@ -0,0 +1,4 @@ +" . $cnt . " system log messages since last system startup"); \ No newline at end of file diff --git a/admin/api/serverTemp.php b/admin/api/serverTemp.php new file mode 100644 index 0000000..19e383a --- /dev/null +++ b/admin/api/serverTemp.php @@ -0,0 +1,20 @@ +"); +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, 90) { + echo("completely overheating!"); +} else if ($outd["cpu_thermal-virtual-0"]["temp1"]["temp1_input"] > 60) { + echo("starting to throttle!"); +} else { + echo("under normal temperatures"); +} \ No newline at end of file diff --git a/admin/api/serverTime.php b/admin/api/serverTime.php new file mode 100644 index 0000000..d0db5e3 --- /dev/null +++ b/admin/api/serverTime.php @@ -0,0 +1,12 @@ +