├── .gitignore ├── LICENSE ├── README.md ├── app ├── core │ ├── Kernel.php │ ├── Updater.php │ └── version.json ├── exception │ ├── AuthException.php │ └── Handler │ │ └── ExceptionHandlerFirst.php ├── helper │ ├── MessageHelper.php │ ├── fileController.php │ ├── jsonObjectCreator.php │ └── urlHelper.php └── http │ ├── controller │ └── authorizeController.php │ └── middleware │ └── AuthMiddleware.php ├── composer.json ├── config ├── config-sample.php ├── messages.json └── version.php ├── lang ├── lang_de.php └── lang_en.php ├── public ├── .htaccess ├── assets │ ├── .htaccess │ ├── icons │ │ ├── bed.png │ │ ├── cluster.png │ │ ├── cpu.svg │ │ ├── nether.gif │ │ ├── pen.svg │ │ ├── ram.svg │ │ ├── server.svg │ │ ├── status.svg │ │ └── user.svg │ ├── js │ │ ├── charts-cpu.js │ │ └── charts-ram.js │ ├── logo.svg │ ├── materialize │ │ ├── css │ │ │ ├── materialize.css │ │ │ └── materialize.min.css │ │ └── js │ │ │ ├── materialize.js │ │ │ └── materialize.min.js │ └── styles.css └── index.php ├── resource ├── error │ └── 500.php └── view │ ├── action-modal.php │ ├── dashboard │ ├── cluster │ │ ├── console.php │ │ └── index.php │ ├── dashboard.php │ ├── groups │ │ └── index.php │ ├── modules │ │ ├── index.php │ │ └── syncproxy.php │ ├── permissions │ │ ├── index.php │ │ └── show.php │ ├── players │ │ ├── index.php │ │ └── show.php │ ├── profile │ │ ├── help.php │ │ ├── index.php │ │ └── settings.php │ └── task │ │ ├── console.php │ │ ├── edit.php │ │ ├── index.php │ │ └── task.php │ ├── error │ └── 404.php │ ├── footer.php │ ├── header.php │ ├── login.php │ ├── setup │ ├── setup.php │ └── small-header.php │ └── small-header.php ├── routes ├── route │ ├── permissions.php │ ├── players.php │ └── tasks.php └── web.php └── storage └── version.json /.gitignore: -------------------------------------------------------------------------------- 1 | .idea/ 2 | .idea/* 3 | vendor/ 4 | vendor/* 5 | 6 | composer.lock 7 | composer.phar 8 | 9 | config/config.php 10 | 11 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "[]" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright [yyyy] [name of copyright owner] 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | [![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0) 2 | 3 | Panda-Studios Logo 4 | 5 | # CloudNet V3 Webinterface 6 | 7 | ## Vorraussetzungen: 8 | 9 | - CloudNet 3.x und das modifizierte Rest-Modul 10 | - Webserver oder Webspace 11 | - PHP 8 12 | - PHP Curl 13 | 14 | ## Download 15 | 16 | Das Module kannst du hier Herrunterladen ``https://files.panda-studios.eu/2/0.3/cloudnet-rest.jar`` 17 | 18 | ## Installation 19 | 20 | 1. Lösche ```cloudnet-rest.jar in CloudNet``` aus dem Ordner Modul 21 | 2. Downloade die modifizierte ``cloudnet-rest.jar`` 22 | 3. Starte CloudNet neu 23 | 4. Installieren Sie Apache2 24 | 5. Clonen Sie jetzt das Webinterface mit ``git clone https://github.com/Panda-Projects/CloudNet-V3-Webinterface.git`` 25 | 26 | Info: Das Webinterface funktioniert auch auf einen externen Server/Webspace! 27 | 28 | ### Installation und Webserver Konfiguration 29 | 30 | #### Apache2 31 | 32 | 1. Um Apche2 zu installieren benutzen Sie den folgenden Kommand: 33 | ```apt install apache2``` 34 | 2. Danache benutzen Sie den Kommand um eine Apache2 config zu erstellen 35 | ```nano /etc/apache2/sites-available/webinterface.conf``` 36 | 3. Danache kopieren Sie den folgenden Text 37 | ``` 38 | 39 | ServerName webinterface.example.com 40 | DocumentRoot "/var/www/webinterface/public" 41 | 42 | AllowOverride All 43 | 44 | 45 | ``` 46 | 4. Verlassen Sie die Anwendung mit ``STRG+X`` und dann mit ``y`` und ``RETURN`` speichern 47 | 5. Atkivieren Sie die Seite nun mit den folgendem Befehl 48 | ```a2ensite webinterface.conf``` 49 | 6. Starten Sie Apache2 neu 50 | ```service apache2 restart``` 51 | 52 | 53 | 54 | ### Installation von Composer 55 | #### Debian 11 56 | 1. Download von ``composer-setup.php`` 57 | 58 | php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" 59 | 60 | 2. Installieren von Composer Global 61 | 62 | php composer-setup.php --install-dir=/usr/local/bin --filename=composer 63 | chmod +x /usr/local/bin/composer 64 | 65 | ## Support 66 | 67 | - via Discord: https://discord.gg/rHD3CFB8x4 68 | - via E-Mail: [info@panda-studios.eu](mailto:info@panda-studios.eu) 69 | 70 | ## Spoiler 71 | 72 | ![image](https://user-images.githubusercontent.com/59180449/168481166-df09242b-080f-4132-aee8-0773919f1b23.png) 73 | ![image](https://user-images.githubusercontent.com/59180449/168481309-ae5a3b12-fa40-4493-b746-876cff91d207.png) 74 | ![image](https://user-images.githubusercontent.com/59180449/168481414-d8157cba-6f6a-47d9-8662-1bce642a5655.png) 75 | 76 | 77 | 78 | Contributors 79 | 80 | -------------------------------------------------------------------------------- /app/core/Kernel.php: -------------------------------------------------------------------------------- 1 | getCode()); 22 | 23 | }); 24 | 25 | if (!isset($_SESSION['csrf'])) { 26 | $_SESSION['csrf'] = uniqid(); 27 | } 28 | 29 | include_once __DIR__ . '/../../routes/web.php'; 30 | 31 | // Start the routing 32 | try { 33 | SimpleRouter::start(); 34 | } catch (TokenMismatchException | NotFoundHttpException | \Pecee\SimpleRouter\Exceptions\HttpException $e) { 35 | } catch (Error $e) { 36 | include __DIR__ . '/../../resource/error/500.php'; 37 | } 38 | -------------------------------------------------------------------------------- /app/core/Updater.php: -------------------------------------------------------------------------------- 1 | getCurrentVersion() . ".zip"; 8 | 9 | $updateFiles = json_decode($this->getUpdateFile(), true); 10 | $updateFolder = __DIR__ . "../../.."; 11 | 12 | if($zip->open($filename, ZipArchive::CREATE) !== true) 13 | $this->sendResponse(['task' => 'create zip file', 'success' => false]); 14 | 15 | 16 | if(array_key_exists('addFiles', $updateFiles)) { 17 | $addFiles = $updateFiles['addFiles']; 18 | for($i = 0, $c = count($addFiles); $i < $c; $i++) { 19 | if(file_exists($updateFolder . $addFiles[$i]['local'])) { 20 | if($zip->addFile($updateFolder . $addFiles[$i]['local'], $addFiles[$i]['local']) === false) { 21 | $this->sendResponse(['task' => 'add file into zip', 'success' => false]); 22 | } 23 | } 24 | } 25 | $deleteFiles = $updateFiles['deleteFiles']; 26 | for($i = 0, $c = count($deleteFiles); $i < $c; $i++) { 27 | if(file_exists($updateFolder . $deleteFiles[$i])) { 28 | $zip->addFile($updateFolder . $deleteFiles[$i]); 29 | } 30 | } 31 | } 32 | 33 | $zip->close(); 34 | } 35 | 36 | public function installFiles() { 37 | $this->createBackup(); 38 | 39 | $updateFiles = json_decode($this->getUpdateFile(), true); 40 | $updateFolder = __DIR__ . "../../.."; 41 | $versionUrl = 'https://files.panda-studios.eu/2/'; 42 | 43 | if(array_key_exists('addFiles', $updateFiles)) { 44 | $addFiles = $updateFiles['addFiles']; 45 | for($i = 0, $c = count($addFiles); $i < $c; $i++) { 46 | $content = @file_get_contents($versionUrl . $addFiles[$i]['remote']); 47 | $pathInfo = pathinfo($updateFolder . $addFiles[$i]['local']); 48 | 49 | if(!file_exists($pathInfo['dirname'])) { 50 | if (!mkdir($concurrentDirectory = $pathInfo['dirname'], 0775, true) && !is_dir($concurrentDirectory)) { 51 | throw new \RuntimeException(sprintf('Directory "%s" was not created', $concurrentDirectory)); 52 | } 53 | } 54 | 55 | file_put_contents($updateFolder . $addFiles[$i]['local'], $content); 56 | chmod($updateFolder . $addFiles[$i]['local'], 0777); 57 | } 58 | } 59 | 60 | if(array_key_exists('deleteFiles', $updateFiles)) { 61 | for ($i = 0, $c = count($updateFiles['deleteFiles']); $i < $c; $i++) { 62 | if (file_exists($updateFolder . $updateFiles['deleteFiles'][$i])) { 63 | if (is_dir($updateFolder . $updateFiles['deleteFiles'][$i])) { 64 | rmdir($updateFolder . $updateFiles['deleteFiles'][$i]); 65 | } else { 66 | unlink($updateFolder . $updateFiles['deleteFiles'][$i]); 67 | } 68 | } 69 | } 70 | } 71 | 72 | } 73 | 74 | public function updateVersion() { 75 | $updateVersion = json_decode($this->getUpdateFile(), true); 76 | file_put_contents(__DIR__ . "/version.json", json_encode(array("version" => $updateVersion["latestVersion"]))); 77 | } 78 | 79 | public function versionIsCurrent() { 80 | $versionChanges = json_decode($this->getRemoteVersion(), true); 81 | $currentVersion = $this->getCurrentVersion(); 82 | $updateVersion = $versionChanges; 83 | $current = true; 84 | 85 | if($updateVersion > $currentVersion) { 86 | $current = false; 87 | } 88 | 89 | return ['current' => $current, 'currentVersion' => $currentVersion, 'updateVersion' => $updateVersion]; 90 | } 91 | 92 | public function isNewVersionAvailable() { 93 | return !$this->versionIsCurrent()['current']; 94 | } 95 | 96 | public function wantsForceUpdate() { 97 | return true; 98 | } 99 | 100 | public function checkForScripts() { 101 | $spyc = Spyc::YAMLLoad($this->getUpdateFile()); 102 | $updateFolder = $_SESSION['root']; 103 | $exists = true; 104 | 105 | if(!array_key_exists('scripts', $spyc)) { 106 | $exists = false; 107 | } 108 | 109 | 110 | foreach ($spyc['scripts'] as $script) { 111 | if(!file_exists($updateFolder . $script)) { 112 | $exists = false; 113 | break; 114 | } 115 | } 116 | 117 | $this->sendResponse(['task' => 'check if scripts exists', 'exists' => $exists]); 118 | } 119 | 120 | public function checkRemoteFilesExists() { 121 | // TODO: Code to check file exists 122 | $this->sendResponse(['exists' => true]); 123 | } 124 | 125 | public function checkUpdateFileExists() { 126 | $versionUrl = 'https://api.panda-studios.eu/updater/1/info.json'; 127 | $file = @file_get_contents($versionUrl); 128 | $exists = true; 129 | 130 | if($file === false) { 131 | $exists = false; 132 | } 133 | 134 | $this->sendResponse(['exists' => $exists, 'url' => $versionUrl]); 135 | } 136 | 137 | public function executeScripts() { 138 | $changes = json_decode($this->getUpdateFile()); 139 | $updateFolder = $_SESSION['root']; 140 | $exists = true; 141 | 142 | if(!array_key_exists('scripts', $changes)) { 143 | $exists = false; 144 | } else { 145 | foreach ($changes['scripts'] as $script) { 146 | if(file_exists($updateFolder . $script)) { 147 | include_once($updateFolder . $script); 148 | } 149 | } 150 | } 151 | 152 | $this->sendResponse([]); 153 | } 154 | 155 | public function checkFilesAreWriteable() { 156 | $spyc = $this->getUpdateFile(); 157 | $writeable = $this->checkUpdateFilesWritable($spyc); 158 | 159 | if($writeable) { 160 | $writeable = $this->checkDeleteFilesWriteable($spyc); 161 | } 162 | 163 | return $writeable; 164 | } 165 | 166 | private function checkUpdateFilesWritable($update) { 167 | $updateFiles = json_decode($update, true)["addFiles"]; 168 | 169 | for($i = 0, $c = count($updateFiles); $i < $c; $i++) { 170 | $file = $updateFiles[$i]['local']; 171 | return $this->checkFileIsWriteable($file); 172 | } 173 | 174 | return true; 175 | } 176 | 177 | private function checkDeleteFilesWriteable($delete) { 178 | $writeable = true; 179 | $delete = json_decode($delete, true); 180 | if(!array_key_exists('deleteFiles', $delete)) 181 | return true; 182 | 183 | $deleteFiles = $delete['deleteFiles']; 184 | for($i = 0, $c = count($deleteFiles); $i < $c; $i++) { 185 | $file = $deleteFiles[$i]; 186 | $writeable = $this->checkFileIsWriteable($file); 187 | if(!$writeable) 188 | break; 189 | } 190 | 191 | return $writeable; 192 | } 193 | 194 | private function checkFileIsWriteable($file) { 195 | $updateFolder = __DIR__ . "../../"; 196 | $pathInfo = pathinfo($updateFolder . $file); 197 | 198 | if(file_exists($updateFolder . $file) && !is_writable($updateFolder . '/' . $file)) { 199 | return false; 200 | } 201 | 202 | if(file_exists($pathInfo['dirname']) && !is_writable($pathInfo['dirname'])) { 203 | return false; 204 | } 205 | 206 | $pathParts = explode('/', $pathInfo['dirname']); 207 | if(count($pathParts) === 1) { 208 | $pathParts = explode("\\", $pathInfo['dirname']); 209 | } 210 | 211 | foreach($pathParts as $key=>$pathPart) { 212 | if($key == 0) 213 | $pathToCheck = $pathPart; 214 | else 215 | $pathToCheck = $updateFolder . $pathPart; 216 | 217 | if(file_exists($pathToCheck)) { 218 | if(!is_writable($pathToCheck)) { 219 | return false; 220 | } 221 | } 222 | } 223 | return true; 224 | } 225 | 226 | /** 227 | * get current version from version.txt 228 | * 229 | * @return string 230 | */ 231 | public function getCurrentVersion() { 232 | return json_decode(file_get_contents(__DIR__ . "/version.json"), true)["version"]; 233 | } 234 | 235 | public function getRemoteVersion() { 236 | $content = file_get_contents("https://api.panda-studios.eu/projects/2/version"); 237 | if($content === false) { 238 | return $this->getCurrentVersion(); 239 | } 240 | return json_decode($content, true)['version']; 241 | } 242 | 243 | public function getUpdateFile() { 244 | return file_get_contents("https://api.panda-studios.eu/projects/2/updater/" . $this->getCurrentVersion() . "/changes"); 245 | } 246 | 247 | /** 248 | * send a response 249 | * 250 | * @param $array 251 | * @return void 252 | */ 253 | public function sendResponse($array) { 254 | header('Content-Type: application/json'); 255 | echo(json_encode($array)); 256 | die(); 257 | } 258 | } -------------------------------------------------------------------------------- /app/core/version.json: -------------------------------------------------------------------------------- 1 | {"version":"0.3"} -------------------------------------------------------------------------------- /app/exception/AuthException.php: -------------------------------------------------------------------------------- 1 | setUrl(new Url('/login')); 13 | } 14 | } -------------------------------------------------------------------------------- /app/helper/MessageHelper.php: -------------------------------------------------------------------------------- 1 | array( 22 | "main" => "' . $_POST["website_ip"] . '", 23 | "ssl" => "' . $_POST["website_protocol"] . '", 24 | "pfad" => "' . $_POST["website_path"] . '", 25 | "without_sub" => "' . $_POST["website_ip"] . '", 26 | "force" => "true", 27 | ), 28 | "cloudnet" => array( 29 | "protocol" => "' . $_POST["cloudnet_protocol"] . '", 30 | "ip" => "' . $_POST["cloudnet_ip"] . '", 31 | "port" => "' . $_POST["cloudnet_prot"] . '", 32 | "path" => "' . $_POST["cloudnet_apipath"] . '", 33 | ), 34 | "name" => "' . $_POST["website_name"] . '", 35 | );'; 36 | fwrite($myfile, $txt); 37 | fclose($myfile); 38 | header('Location: ' . $_POST["website_protocol"] . $_POST["website_ip"]); 39 | } 40 | } 41 | 42 | include BASE_PATH . '../../resource/view/setup/small-header.php'; 43 | include BASE_PATH . '../../resource/view/setup/setup.php'; 44 | include BASE_PATH . '../../resource/view/footer.php'; 45 | die(); 46 | } 47 | 48 | if (!file_exists(self::$path_version)) { 49 | $myfile = fopen("../storage/version.json", "w") or die("Unable to open file!"); 50 | $txt = '{ 51 | "version": 1.0, 52 | "inherit": true 53 | }'; 54 | fwrite($myfile, $txt); 55 | fclose($myfile); 56 | die(); 57 | } 58 | 59 | if (!file_exists(self::$path_message)) { 60 | die('

Ein Fehler ist aufgetreten.

Die Datei "/config/message.json" konnte nicht gefunden werden

Führe das Setup mit "wisetup" im Master erneut aus!

'); 61 | } 62 | } 63 | 64 | public static function getConfigurationPath(): string 65 | { 66 | return self::$path_config; 67 | } 68 | 69 | public static function getVersionFilePath(): string 70 | { 71 | return self::$path_version; 72 | } 73 | } -------------------------------------------------------------------------------- /app/helper/jsonObjectCreator.php: -------------------------------------------------------------------------------- 1 | $name, 13 | "runtime" => "jvm", 14 | "javaCommand" => null, 15 | "disableIpRewrite" => false, 16 | "maintenance" => $maintenance, 17 | "autoDeleteOnStop" => $autoDeleteOnStop, 18 | "staticServices" => $static, 19 | "associatedNodes" => $node, 20 | "groups" => $group, 21 | "deletedFilesAfterStop" => [], 22 | "processConfiguration" => array( 23 | "environment" => strtoupper($env), 24 | "maxHeapMemorySize" => $memory, 25 | "jvmOptions" => [], 26 | "processParameters" => [] 27 | ), 28 | "startPort" => $defaultPort, 29 | "minServiceCount" => 1, 30 | "includes" => [], 31 | "templates" => array(array( 32 | "prefix" => $name, 33 | "name" => "default", 34 | "storage" => "local", 35 | "alwaysCopyToStaticServices" => false 36 | )), 37 | "deployments" => [], 38 | "properties" => array( 39 | "smartConfig" => array( 40 | "enabled" => false, 41 | "priority" => 10, 42 | "directTemplatesAndInclusionsSetup" => true, 43 | "preparedServices" => 0, 44 | "dynamicMemoryAllocation" => false, 45 | "dynamicMemoryAllocationRange" => 256, 46 | "percentOfPlayersToCheckShouldAutoStopTheServiceInFuture" => 0, 47 | "autoStopTimeByUnusedServiceInSeconds" => 180, 48 | "percentOfPlayersForANewServiceByInstance" => 100, 49 | "forAnewInstanceDelayTimeInSeconds" => 300, 50 | "minNonFullServices" => 0, 51 | "templateInstaller" => "INSTALL_ALL", 52 | "maxServiceCount" => -1 53 | ), 54 | "requiredPermission" => null 55 | ) 56 | ); 57 | return json_encode($task); 58 | } 59 | } -------------------------------------------------------------------------------- /app/helper/urlHelper.php: -------------------------------------------------------------------------------- 1 | self::provideUrl($url), 64 | CURLOPT_RETURNTRANSFER => true, 65 | CURLOPT_MAXREDIRS => 1, 66 | CURLOPT_TIMEOUT => 5, 67 | CURLOPT_CUSTOMREQUEST => $method, 68 | CURLOPT_POSTFIELDS => $params, 69 | CURLOPT_HTTPHEADER => array( 70 | 'Accept: application/json', 71 | 'Authorization: Basic ' . $token, 72 | 'Cookie: ' . $_SESSION["cn3-wi-cookie"] 73 | ), 74 | )); 75 | 76 | $response = curl_exec($curl); 77 | $http_code = curl_getinfo($curl, CURLINFO_HTTP_CODE); 78 | curl_close($curl); 79 | 80 | if($http_code === 302) echo ''; 81 | 82 | if ($response === FALSE) { 83 | return array("success" => "false"); 84 | } 85 | 86 | if ($debug == true) { 87 | return $response; 88 | } else { 89 | return json_decode($response, true); 90 | } 91 | } 92 | 93 | } -------------------------------------------------------------------------------- /app/http/controller/authorizeController.php: -------------------------------------------------------------------------------- 1 | $url, 43 | CURLOPT_RETURNTRANSFER => true, 44 | CURLOPT_ENCODING => '', 45 | CURLOPT_MAXREDIRS => 10, 46 | CURLOPT_TIMEOUT => 0, 47 | CURLOPT_FOLLOWLOCATION => true, 48 | CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, 49 | CURLOPT_CUSTOMREQUEST => 'GET', 50 | CURLOPT_HTTPHEADER => array( 51 | 'Authorization: Basic ' . $token 52 | ), 53 | )); 54 | 55 | $response = curl_exec($curl); 56 | $responseHttpCode = curl_getinfo($curl, CURLINFO_HTTP_CODE); 57 | 58 | curl_close($curl); 59 | if ($response === FALSE || $responseHttpCode !== 200) { 60 | return LOGIN_RESULT_SERVER_DOWN; 61 | } 62 | 63 | $response = json_decode($response, true); 64 | if ($response['success'] == true) { 65 | // session_start(); 66 | $_SESSION['cn3-wi-access_token'] = $token; 67 | $_SESSION['cn3-wi-cookie'] = $response["cookie"]; 68 | $_SESSION['cn3-wi-user'] = $response["userUniqueId"]; 69 | 70 | return LOGIN_RESULT_SUCCESS; 71 | } else { 72 | return LOGIN_RESULT_INVALID_CREDENTIALS; 73 | } 74 | } 75 | 76 | public static function loginToken(string $token): int 77 | { 78 | $url = urlHelper::provideUrl("auth"); 79 | 80 | $curl = curl_init($url); 81 | curl_setopt_array($curl, array( 82 | CURLOPT_RETURNTRANSFER => true, 83 | CURLOPT_MAXREDIRS => 1, 84 | CURLOPT_TIMEOUT => 5, 85 | CURLOPT_CUSTOMREQUEST => "GET", 86 | CURLOPT_HTTPHEADER => array( 87 | 'Accept: application/json', 88 | 'Authorization: Basic ' . $token 89 | ), 90 | )); 91 | 92 | $response = curl_exec($curl); 93 | $responseHttpCode = curl_getinfo($curl, CURLINFO_HTTP_CODE); 94 | 95 | curl_close($curl); 96 | 97 | if ($response === FALSE || $responseHttpCode !== 200) { 98 | return LOGIN_RESULT_SERVER_DOWN; 99 | } 100 | 101 | $response = json_decode($response, true); 102 | if ($response['success'] == true) { 103 | // session_start(); 104 | $_SESSION['cn3-wi-access_token'] = $token; 105 | return LOGIN_RESULT_SUCCESS; 106 | } else { 107 | return LOGIN_RESULT_INVALID_CREDENTIALS; 108 | } 109 | } 110 | } 111 | -------------------------------------------------------------------------------- /app/http/middleware/AuthMiddleware.php: -------------------------------------------------------------------------------- 1 | setUrl(new Url('login')); 15 | } 16 | } -------------------------------------------------------------------------------- /composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "panda-studios/cloudnet-v3-webinterface", 3 | "description": "a webinterface for cloudnet3 by panda-studios", 4 | "minimum-stability": "stable", 5 | "license": "proprietary", 6 | "authors": [ 7 | { 8 | "name": "Fabian Evers", 9 | "email": "fabian.evers@panda-studios.eu" 10 | } 11 | ], 12 | "require": { 13 | "pecee/simple-router": "4.3.7.2", 14 | "ext-curl": "*" 15 | }, 16 | "autoload": { 17 | "psr-4": { 18 | "App\\Helper\\": "app/helper/", 19 | "App\\Http\\Controller\\": "app/http/controller/", 20 | "App\\Http\\Middleware\\": "app/http/middleware/" 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /config/config-sample.php: -------------------------------------------------------------------------------- 1 | array( 5 | "main" => "", 6 | "ssl" => "http://", 7 | "pfad" => "", 8 | "without_sub" => "", 9 | "force" => "true", 10 | ), 11 | "cloudnet" => array( 12 | "protocol" => "http://", 13 | "ip" => "", 14 | "port" => "2812", 15 | "path" => "/api/v1", 16 | ), 17 | 18 | "name" => "CloudNet3 Webinterface", 19 | 20 | ); -------------------------------------------------------------------------------- /config/messages.json: -------------------------------------------------------------------------------- 1 | { 2 | "notFoundTask": "Der Task konnte nicht gefunden werden", 3 | "errormodal": "Fehler", 4 | "closemodal": "Schließen", 5 | "successmodal": "Erfolgreich", 6 | "createService": "Der Service wurde erfolgreich erstellt", 7 | "startService": "Der Service wurde erfolgreich gestartet", 8 | "stopService": "Der Service wurde erfolgreich gestoppt", 9 | "taskCreated": "Der Task wurde erfolgreich erstellt", 10 | "taskDelete": "Der Task wurde erfolgreich gelöscht", 11 | "loginFailed": "Überpürfen Sie ihren Username und ihr Passwort", 12 | "updatePermissionGroup": "Gruppen Einstellung Erfolgreich übernommen" 13 | } -------------------------------------------------------------------------------- /config/version.php: -------------------------------------------------------------------------------- 1 | "1.0_alpha4", 4 | "version_url" => "https://project.the-systems.eu/api/resource/?resourceid=14&type=allinfos" 5 | ); -------------------------------------------------------------------------------- /lang/lang_de.php: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /public/assets/icons/nether.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Panda-Projects/CloudNet-V3-Webinterface/28ea0a040eb4383a37f9950c67734ffed780dfa2/public/assets/icons/nether.gif -------------------------------------------------------------------------------- /public/assets/icons/pen.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /public/assets/icons/ram.svg: -------------------------------------------------------------------------------- 1 | 4 | 5 | 7 | 9 | 11 | 13 | 15 | 16 | -------------------------------------------------------------------------------- /public/assets/icons/server.svg: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /public/assets/icons/status.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /public/assets/icons/user.svg: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /public/assets/js/charts-cpu.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020 CloudNetService Project and contributors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | -------------------------------------------------------------------------------- /public/assets/js/charts-ram.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020 CloudNetService Project and contributors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | const lineConfig = { 18 | type: 'line', 19 | data: { 20 | labels: ['14:00', '14:10', '14:20', '14:30', '14:40', '14:50', '15:00'], 21 | datasets: [ 22 | { 23 | label: 'Usage in MB', 24 | backgroundColor: '#10b981', 25 | borderColor: '#10b981', 26 | data: [512, 1536, 2048, 2048, 1536, 1536, 2048], 27 | fill: false, 28 | } 29 | ], 30 | }, 31 | options: { 32 | responsive: true, 33 | legend: { 34 | display: false, 35 | }, 36 | tooltips: { 37 | mode: 'index', 38 | intersect: false, 39 | }, 40 | hover: { 41 | mode: 'nearest', 42 | intersect: true, 43 | }, 44 | scales: { 45 | x: { 46 | display: true, 47 | scaleLabel: { 48 | display: true, 49 | labelString: 'Value', 50 | }, 51 | }, 52 | y: { 53 | display: true, 54 | scaleLabel: { 55 | display: true, 56 | labelString: 'Value', 57 | }, 58 | }, 59 | }, 60 | }, 61 | } 62 | 63 | const lineCtx = document.getElementById('ram') 64 | if (lineCtx !== null) { 65 | window.myLine = new Chart(lineCtx, lineConfig) 66 | } -------------------------------------------------------------------------------- /public/index.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Interner Server Error 6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 | 15 | 16 |
17 |
18 |
19 |

We're sorry, but something went wrong.

20 |

If you are the application owner check the logs for more information.

21 | Back To Homepage 22 |
23 |
24 | 25 | 26 | -------------------------------------------------------------------------------- /resource/view/action-modal.php: -------------------------------------------------------------------------------- 1 | 7 |
8 | 9 |
14 |
19 | 20 |
28 | 29 | 30 |
31 | 36 | 37 | 38 | 39 | 40 |
41 | 42 | 43 |
44 | 46 | 47 | 48 | 49 | 50 |
51 | 52 | 53 | 54 | 55 | 56 | 57 |
58 | 60 |
61 |
62 |
63 |
64 | -------------------------------------------------------------------------------- /resource/view/dashboard/cluster/console.php: -------------------------------------------------------------------------------- 1 | 2 | 38 | 39 |
40 |
41 |
42 |
43 |
44 | 45 |
46 |
47 |
48 |

49 |
50 |
51 |
52 | 55 |
56 |
57 | 62 |
63 |
64 | 65 |
66 |
67 |
68 | 69 | '.$log.'
'; 74 | #} 75 | ?> 76 | 77 |
78 |
79 |
80 |
81 |
82 | 83 | -------------------------------------------------------------------------------- /resource/view/dashboard/cluster/index.php: -------------------------------------------------------------------------------- 1 |
2 |
3 |
4 |
5 |
6 | 7 | 15 | 16 |
17 |
18 |

19 | 20 | 21 | Online 22 | 23 | Offline 24 | 25 |
26 |
27 | 28 |

Memory 29 | : 30 | MB/MB

31 |
32 |
33 | 34 |

CPU 35 | : 36 | %

37 |
38 |
39 | 40 |

41 | :

42 |
43 |
44 | 45 |

46 | Host: 47 |

48 |
49 |
50 |
51 |
52 | 53 | 54 | 55 | 56 | 60 |
61 | 1) { ?> 62 |
63 | 64 | 66 | 67 | 68 | 72 |
73 | 74 |
75 |
76 |
77 | 78 | 79 |
80 |
81 |
82 |
83 | 84 |
85 |
86 |
87 |
88 | 89 |
90 |
91 |
92 |

Create Node

93 |
94 |
95 | 96 | 97 | 98 |
99 |
100 | 102 |
103 |
104 | 106 |
107 |
108 | 110 |
111 |
112 | 116 |
117 |
118 |
119 |
120 |
121 |
122 |
123 |
-------------------------------------------------------------------------------- /resource/view/dashboard/dashboard.php: -------------------------------------------------------------------------------- 1 | 36 | 37 |
38 |
39 |
40 |
41 |
42 | 43 |
44 |
45 | 46 |
47 |
48 |

Nodes

49 |

50 |

51 |
52 | 53 |
54 |
55 | 56 |
57 |
58 |

59 |

60 |
61 |
62 | 63 |
64 |
65 | 66 |
67 |
68 |

CPU

69 |

70 | %/%

71 |
72 |
73 | 74 |
75 |
76 | 77 |
78 |
79 |

Ram

80 |

81 | MB/MB

82 |
83 |
84 |
85 |
86 |
87 |
88 | 89 |
90 |
91 |
92 |
93 | 94 |
95 |

96 | 97 |
98 |
99 | 100 | Usage in MB 101 |
102 |
103 |
104 | 105 |
106 |

107 | 108 |
109 |
110 | 111 | Usage in % 112 |
113 |
114 |
115 |
116 |
117 |
118 |
119 | 120 |
121 |
122 |
123 |
124 | 125 |
126 |
127 |
128 |
129 |
130 |
131 |
132 |
133 | cloudnet:~$ 134 |

Registered: 6482

135 | 136 |
137 |
138 | cloudnet:~$ 139 |

Highest OnlineCount: 157

140 | 141 |
142 |
143 | cloudnet:~$ 144 |

Logins: 102372

145 | 146 |
147 |
148 | cloudnet:~$ 149 |

Command Executions: 345272

150 | 151 |
152 |
153 |
154 | isNewVersionAvailable()) { 155 | if ($update->wantsForceUpdate()) { 156 | $update->installFiles(); 157 | $update->updateVersion(); 158 | } 159 | ?> 160 |
161 |

Update available!

162 |

163 | Currently you are using an outdated CloudNet Webinterface 164 | version getCurrentVersion() ?>! 165 | The latest version is the getRemoteVersion() ?> 166 |

167 |
168 |
169 | 170 |
171 |
172 |
173 |
174 | 190 | 191 | 295 | -------------------------------------------------------------------------------- /resource/view/dashboard/groups/index.php: -------------------------------------------------------------------------------- 1 | 7 |
8 |
9 |
10 |
11 |
12 | 13 | 14 |
15 |

16 |
17 | 18 |

Templates: 19 |
"; 23 | } 24 | } else { 25 | echo "» "; 26 | } 27 | ?>

28 |
29 |
30 | 31 |

Environment: 32 |

39 |
40 | 48 |
49 | 50 | 51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 | 60 |
61 |
62 |
63 |

64 |
65 |
66 |
67 | 69 |
70 |
71 | 73 |
74 |
75 | 77 |
78 |
79 | 81 |
82 |
83 | 87 |
88 |
89 |
90 |
91 |
92 |
93 |
-------------------------------------------------------------------------------- /resource/view/dashboard/modules/index.php: -------------------------------------------------------------------------------- 1 | 8 |
9 | 47 |
-------------------------------------------------------------------------------- /resource/view/dashboard/modules/syncproxy.php: -------------------------------------------------------------------------------- 1 | 8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |

MOTD of SyncProxy

18 |
19 | 20 |
21 |
  • 22 |
    23 |
    24 |
    25 |
    26 |
    27 |
    28 | 29 |
    30 |
    31 | 32 |
    33 |
    34 | 35 |
    36 |
    37 |
    0/
    38 | 39 | 40 |
    41 | 48 | 50 | 52 | 54 |
    55 |
    56 |
    57 |
  • 58 | 59 |
    60 |
    61 |
    62 |
    63 |
    64 |
    65 |
    66 |
    67 |
    68 |

    MOTD of SyncProxy with Maintenance

    69 |
    70 | 71 |
    72 |
  • 73 |
    74 |
    75 |
    76 |
    77 |
    78 |
    79 | 80 |
    81 |
    82 | 83 |
    84 |
    85 | 86 |
    87 |
    88 |
    0/
    89 | 90 | 91 |
    92 | 99 | 101 | 103 | 105 |
    106 |
    107 |
    108 |
  • 109 | 110 |
    111 |
    112 |
    113 |
    114 |
    115 |
    116 |
    117 |
    118 | -------------------------------------------------------------------------------- /resource/view/dashboard/permissions/index.php: -------------------------------------------------------------------------------- 1 | 8 |
    9 |
    10 |
    11 |
    12 |
    13 | 14 |
    15 |

    16 |
    17 |

    18 |
    19 |
    20 | 21 |

    22 | :

    23 |
    24 |
    25 |
    26 | 28 | 30 |
    31 |
    32 |
    33 | 34 |
    35 |
    36 |
    37 |
    -------------------------------------------------------------------------------- /resource/view/dashboard/players/index.php: -------------------------------------------------------------------------------- 1 | 8 |
    9 | 58 |
    -------------------------------------------------------------------------------- /resource/view/dashboard/profile/help.php: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Panda-Projects/CloudNet-V3-Webinterface/28ea0a040eb4383a37f9950c67734ffed780dfa2/resource/view/dashboard/profile/help.php -------------------------------------------------------------------------------- /resource/view/dashboard/profile/index.php: -------------------------------------------------------------------------------- 1 | 6 |
    7 |
    8 |
    9 |
    10 |
    11 |
    12 |
    13 | "/> 17 |
    18 |
    19 |
    20 | 21 |
    22 |
    23 |
    -------------------------------------------------------------------------------- /resource/view/dashboard/profile/settings.php: -------------------------------------------------------------------------------- 1 | 6 |
    7 |
    8 |
    9 |
    10 |
    11 |
    12 |
    13 | 14 |
    15 |
    16 |
    17 |

    18 |
    19 |
    20 |
    21 | 25 |
    26 |
    27 | 32 |
    33 |
    34 | 35 |
    36 |
    37 | urlHelper::provideUrl("services/" . $service_name . "/log"), 41 | CURLOPT_RETURNTRANSFER => true, 42 | CURLOPT_MAXREDIRS => 10, 43 | CURLOPT_TIMEOUT => 5, 44 | CURLOPT_CUSTOMREQUEST => 'GET', 45 | CURLOPT_POSTFIELDS => '', 46 | CURLOPT_HTTPHEADER => array( 47 | 'Accept: application/json', 48 | 'Authorization: Basic ' . $_SESSION['cn3-wi-access_token'], 49 | 'Cookie: ' . $_SESSION["cn3-wi-cookie"] 50 | ), 51 | )); 52 | 53 | $response = curl_exec($curl); 54 | curl_close($curl); 55 | 56 | $newlines = preg_split("/\r\n|\n|\r/", $response); 57 | 58 | foreach ($newlines as $newline) { 59 | echo '
    ' . $newline . '
    '; 60 | } 61 | ?> 62 | 63 |
    64 | 65 |
    66 |
    67 |
    68 |
    69 |
    70 |
    71 |
    72 | 73 | -------------------------------------------------------------------------------- /resource/view/dashboard/task/edit.php: -------------------------------------------------------------------------------- 1 | 6 |
    7 |
    8 |
    9 |
    10 |
    Edit
    11 |
    12 | 13 |
    14 |
    15 | 16 | 17 |
    18 | 19 | 20 |
    21 |
    22 |

    Edit Task

    23 |
    24 |
    25 |
    26 | 27 | 35 |
    36 |
    37 | 38 | 47 |
    48 |
    49 | 50 | 88 |
    89 |
    90 | 91 | 108 |
    109 |
    110 | 111 | 128 |
    129 |
    130 | 131 | 141 |
    142 |
    143 | 147 | 152 | 156 |
    157 |
    158 | 162 |
    163 |
    164 |
    165 |
    166 |
    167 |
    168 |
    169 |
    170 |
    -------------------------------------------------------------------------------- /resource/view/dashboard/task/index.php: -------------------------------------------------------------------------------- 1 |
    2 |
    3 |
    4 |
    5 | 6 |
    7 | 8 | 16 |
    17 |

    18 |
    19 | 20 |

    21 | Memory: MB

    22 |
    23 |
    24 | 25 |

    Nodes: 26 | 37 |

    38 |
    39 |
    40 | 41 |

    42 | AutoDeleteOnStop:

    43 |
    44 |
    45 | 46 |

    47 | Static:

    48 |
    49 |
    50 | 51 |

    52 | StartPort:

    53 |
    54 |
    55 | 56 |

    Groups: 57 | 68 |

    69 |
    70 |
    71 | 72 |

    73 | Environment:

    74 |
    75 |
    76 |
    77 | 79 | 81 | 83 |
    84 |
    85 |
    86 | 87 | 88 |
    89 |
    90 |
    91 |
    92 |
    93 |
    94 |
    95 |
    96 | 97 |
    98 |
    99 | 100 | 101 |
    102 |
    103 |

    104 |
    105 |
    106 |
    107 | 113 |
    114 |
    115 | 123 |
    124 |
    125 | 157 |
    158 |
    159 | 177 |
    178 |
    179 | 188 |
    189 |
    190 | 194 | 199 | 204 |
    205 |
    206 | 210 |
    211 |
    212 |
    213 |
    214 |
    215 |
    216 |
    217 |
    -------------------------------------------------------------------------------- /resource/view/dashboard/task/task.php: -------------------------------------------------------------------------------- 1 | 6 |
    7 |
    8 |
    9 |
    10 |
    11 |
    12 |
    13 |
    14 |
    15 |

    All services of 16 | task

    17 |
    18 | 19 |
    20 |
  • 21 |
    22 |
    23 |
    24 |
    25 |
    26 |
    27 | on 28 | |
    29 | 30 |
    31 |
    32 | Static: 33 | | 34 | AutoDeleteOnStop: 35 | | 36 | Groups: 37 | | 44 | Environment: 45 |
    46 | 47 |
    48 |
    49 | Node: 50 | | 51 | Static: 52 | | 53 | AutoDeleteOnStop: 54 | | 55 | Groups: 56 | | 63 | Environment: 64 |
    65 | 66 |
    67 |
    68 | 69 | 70 |
    71 | 78 | 80 | 82 | 84 |
    85 | 86 |
    87 | 94 | 96 | 98 | 100 |
    101 | 102 |
    103 |
    104 |
  • 105 | 106 |
    107 | Console 109 | 110 |
    111 | 112 | 113 | 114 | 118 |
    119 |
    120 | 121 |
    122 |
    123 | 124 | 125 | 126 | 130 |
    131 |
    132 | 133 |
    134 | 135 |
    136 |
    137 |
    138 |
    139 |
    140 |

    Start

    141 |
    142 | 143 |
    144 | 145 | 146 |
    147 |
    148 | 151 | 152 | 157 | 158 |
    159 |
    160 | 165 |
    166 |
    167 |
    168 |
    169 |
    170 |
    171 |
    172 |
    -------------------------------------------------------------------------------- /resource/view/error/404.php: -------------------------------------------------------------------------------- 1 | 2 | Test 3 | -------------------------------------------------------------------------------- /resource/view/footer.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 17 | 18 | -------------------------------------------------------------------------------- /resource/view/header.php: -------------------------------------------------------------------------------- 1 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | <?= urlHelper::getConfig()["name"] ?> 13 | 14 | 15 | 22 | 23 | 24 | 25 |
    26 | 104 |
    105 |
    106 | 207 |
    -------------------------------------------------------------------------------- /resource/view/login.php: -------------------------------------------------------------------------------- 1 | 6 |
    7 |
    8 | 9 | 10 |
    11 | logo 13 |
    14 |

    CloudNet Webinterface

    15 |
    16 |
    17 |
    18 | 19 | 21 |
    22 |
    23 |
    24 |
    25 | 26 | 28 |
    29 |
    30 |
    31 | 34 | 35 |
    36 | -------------------------------------------------------------------------------- /resource/view/setup/setup.php: -------------------------------------------------------------------------------- 1 |
    2 |
    3 | 4 |

    CloudNet Webinterface - Setup

    5 |

    Website

    6 |
    7 |
    8 | 11 |
    12 | 18 |
    19 | 20 | 21 | 22 |
    23 |
    24 |
    25 |
    26 | 29 | 32 |
    33 |
    34 |
    35 |
    36 | 39 | 42 |
    43 |
    44 | 47 | 50 |
    51 |
    52 |

    CloudNet

    53 |
    54 |
    55 | 58 |
    59 | 65 |
    66 | 67 | 68 | 69 |
    70 |
    71 |
    72 |
    73 | 76 | 79 |
    80 |
    81 |
    82 |
    83 | 86 | 89 |
    90 |
    91 | 94 | 97 |
    98 |
    99 |
    100 | 103 |
    104 |
    105 | -------------------------------------------------------------------------------- /resource/view/setup/small-header.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | CloudNet | Setup 8 | 9 | 10 | 11 | 12 |
    13 |
    14 | -------------------------------------------------------------------------------- /resource/view/small-header.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | CloudNet | Login 8 | 9 | 10 | 11 | 12 |
    13 |
    14 | -------------------------------------------------------------------------------- /routes/route/permissions.php: -------------------------------------------------------------------------------- 1 | '/permissions'], function () { 7 | SimpleRouter::get('/', function () { 8 | include "../resource/view/header.php"; 9 | include "../resource/view/action-modal.php"; 10 | include "../resource/view/dashboard/permissions/index.php"; 11 | include "../resource/view/footer.php"; 12 | }); 13 | 14 | SimpleRouter::form('/{group_name}', function ($group_name) { 15 | if (isset($_POST["action"])) { 16 | if (!urlHelper::validCSRF()) { 17 | header('Location: ' . urlHelper::get() . "/permissions/" . $group_name . "?action&success=false&message=csrfFailed"); 18 | die(); 19 | } 20 | 21 | if ($_POST["action"] == "groupSettings") { 22 | urlHelper::buildDefaultRequest("permissions", "PUT", json_encode(array("name" => $_POST["groupName"], "defaultGroup" => isset($_POST["defaultGroup"]), "edit_name" => $_POST["name"], "prefix" => $_POST["prefix"], "display" => $_POST["display"], "color" => $_POST["color"], "suffix" => $_POST["suffix"], "sortId" => $_POST["sortId"]))); 23 | header('Location: ' . urlHelper::get() . "/permissions/" . $group_name . "?action&success=true&message=updatePermissionGroup"); 24 | die(); 25 | } 26 | 27 | if ($_POST["action"] == "deletePermission") { 28 | urlHelper::buildDefaultRequest("permissions/permission/delete", "POST", json_encode(array("permission" => $_POST["permissionName"], "groupName" => $group_name))); 29 | header('Location: ' . urlHelper::get() . "/permissions/" . $group_name . "?action&success=true&message=deletePermission"); 30 | die(); 31 | } 32 | 33 | if ($_POST["action"] == "deleteGroup") { 34 | urlHelper::buildDefaultRequest("permissions/group/delete", "POST", json_encode(array("name" => $_POST["groupName"], "groupName" => $group_name))); 35 | header('Location: ' . urlHelper::get() . "/permissions/" . $group_name . "?action&success=true&message=deleteGroupFromGroup"); 36 | die(); 37 | } 38 | 39 | if ($_POST["action"] == "addPermission") { 40 | urlHelper::buildDefaultRequest("permissions/permission/add", "POST", json_encode(array("permission" => $_POST["name"], "groupName" => $group_name))); 41 | header('Location: ' . urlHelper::get() . "/permissions/" . $group_name . "?action&success=true&message=addPermission"); 42 | die(); 43 | } 44 | 45 | } 46 | 47 | include "../resource/view/header.php"; 48 | include "../resource/view/action-modal.php"; 49 | include "../resource/view/dashboard/permissions/show.php"; 50 | include "../resource/view/footer.php"; 51 | }); 52 | }); -------------------------------------------------------------------------------- /routes/route/players.php: -------------------------------------------------------------------------------- 1 | '/players'], function () { 7 | SimpleRouter::get('/', function () { 8 | include "../resource/view/header.php"; 9 | include "../resource/view/action-modal.php"; 10 | include "../resource/view/dashboard/players/index.php"; 11 | include "../resource/view/footer.php"; 12 | }); 13 | 14 | SimpleRouter::form('/{player}', function ($uuid) { 15 | if (isset($_POST["action"])) { 16 | if (!urlHelper::validCSRF()) { 17 | header('Location: ' . urlHelper::get() . "/players/" . $uuid . "?action&success=false&message=csrfFailed"); 18 | die(); 19 | } 20 | 21 | if ($_POST["action"] == "addGroup") { 22 | urlHelper::buildDefaultRequest("players/" . $uuid . "/add", 'PUT', json_encode(array("group" => $_POST["permissionGroup"], "time" => $_POST["time"], "time_number" => $_POST["time_number"]))); 23 | header('Location: ' . urlHelper::get() . "/players/" . $uuid . "?action&success=true&message=addGroupToPlayer"); 24 | die(); 25 | } 26 | 27 | if ($_POST["action"] == "deleteGroup") { 28 | urlHelper::buildDefaultRequest("players/" . $uuid . "/remove", 'PUT', json_encode(array("group" => $_POST["groupName"]))); 29 | header('Location: ' . urlHelper::get() . "/players/" . $uuid . "?action&success=true&message=deleteGroupFromPlayer"); 30 | die(); 31 | } 32 | 33 | if ($_POST["action"] == "addPermission") { 34 | urlHelper::buildDefaultRequest("players/" . $uuid . "/add", 'PUT', $_POST["serviceGroup"] == "all" ? 35 | json_encode(array("permission" => $_POST["permission"])) : 36 | json_encode(array("permission" => $_POST["permission"], "serviceGroup" => $_POST["serviceGroup"]))); 37 | header('Location: ' . urlHelper::get() . "/players/" . $uuid . "?action&success=true&message=addPermissionFromPlayer"); 38 | die(); 39 | } 40 | 41 | if ($_POST["action"] == "deletePermission") { 42 | urlHelper::buildDefaultRequest("players/" . $uuid . "/remove", 'PUT', json_encode(array("permission" => $_POST["permission"]))); 43 | header('Location: ' . urlHelper::get() . "/players/" . $uuid . "?action&success=true&message=deletePermissionFromPlayer"); 44 | die(); 45 | } 46 | } 47 | 48 | include "../resource/view/header.php"; 49 | include "../resource/view/action-modal.php"; 50 | include "../resource/view/dashboard/players/show.php"; 51 | include "../resource/view/footer.php"; 52 | }); 53 | }); -------------------------------------------------------------------------------- /routes/route/tasks.php: -------------------------------------------------------------------------------- 1 | '/tasks'], function () { 8 | SimpleRouter::form('/', function () { 9 | if (isset($_POST['action'])) { 10 | if (!urlHelper::validCSRF()) { 11 | header('Location: ' . urlHelper::get() . "/cluster?action&success=false&message=csrfFailed"); 12 | die(); 13 | } 14 | 15 | if ($_POST['action'] == "createTask" and isset($_POST['name'])) { 16 | // validate that all required values are there 17 | $name = $_POST['name']; 18 | $ram = $_POST['ram']; 19 | $env = $_POST['environment']; 20 | $node = $_POST['node']; 21 | $startPort = $_POST['port']; 22 | $static = $_POST['static']; 23 | $autoDeleteOnStop = $_POST['auto_delete_on_stop']; 24 | $maintenance = $_POST['maintenance']; 25 | 26 | if (isset($name, $ram, $env, $node, $startPort)) { 27 | $taskData = jsonObjectCreator::createServiceTaskObject( 28 | $name, $ram, $env, 29 | $node === "all" ? array() : array($node), 30 | $startPort, isset($static), isset($autoDeleteOnStop), isset($maintenance) 31 | ); 32 | $response = urlHelper::buildDefaultRequest("tasks", "POST", params: $taskData); 33 | 34 | header('Location: ' . urlHelper::get() . "/tasks?action&success=true&message=taskCreated"); 35 | die(); 36 | } 37 | } 38 | } 39 | 40 | include "../resource/view/header.php"; 41 | include "../resource/view/action-modal.php"; 42 | include "../resource/view/dashboard/task/index.php"; 43 | include "../resource/view/footer.php"; 44 | }); 45 | 46 | SimpleRouter::form('/{name}', function ($task_name) { 47 | $task = urlHelper::buildDefaultRequest("tasks/" . strtolower($task_name), "GET", array(), array()); 48 | if (empty($task)) { 49 | header('Location: ' . urlHelper::get() . "/tasks?action&success=false&message=notFoundTask"); 50 | die(); 51 | } 52 | 53 | $services_r = urlHelper::buildDefaultRequest("services", "GET", array(), array()); 54 | $services = array(); 55 | foreach ($services_r as $service) { 56 | if (strtolower($service['configuration']['serviceId']['taskName']) == strtolower($task_name)) { 57 | array_push($services, $service); 58 | } 59 | } 60 | 61 | if (isset($_POST['action'])) { 62 | if (!urlHelper::validCSRF()) { 63 | header('Location: ' . urlHelper::get() . "/tasks/" . $task_name . "?action&success=false&message=csrfFailed"); 64 | die(); 65 | } 66 | 67 | if ($_POST['action'] == "stopService" and isset($_POST['service_id'])) { 68 | $response = urlHelper::buildDefaultRequest("services/" . $_POST['service_id'] . "/stop", "GET"); 69 | header('Location: ' . urlHelper::get() . "/tasks/" . $task_name . "?action&success=true&message=stopService"); 70 | die(); 71 | } 72 | 73 | if ($_POST['action'] == "createService" and isset($_POST['count'])) { 74 | urlHelper::buildDefaultRequest("services/" . strtolower($task_name) . "/" . $_POST['count'] . "/" . (isset($_POST['start']) ? "true" : "false"), "GET"); 75 | header('Location: ' . urlHelper::get() . "/tasks/" . $task_name . "?action&success=true&message=createService"); 76 | die(); 77 | } 78 | 79 | if ($_POST['action'] == "startService" and isset($_POST['service_id'])) { 80 | urlHelper::buildDefaultRequest("services/" . $_POST['service_id'] . '/start', "GET"); 81 | 82 | header('Location: ' . urlHelper::get() . "/tasks/" . $task_name . "?action&success=true&message=startService"); 83 | die(); 84 | } 85 | } 86 | 87 | include "../resource/view/header.php"; 88 | include "../resource/view/action-modal.php"; 89 | include "../resource/view/dashboard/task/task.php"; 90 | include "../resource/view/footer.php"; 91 | }); 92 | 93 | SimpleRouter::get('/{name}/delete', function ($task_name) { 94 | $task = urlHelper::buildDefaultRequest("tasks/" . strtolower($task_name), "DELETE", array(), array()); 95 | header('Location: ' . urlHelper::get() . "/tasks?action&success=true&message=taskDelete"); 96 | die(); 97 | }); 98 | 99 | SimpleRouter::form('/{name}/edit', function ($task_name) { 100 | $task = urlHelper::buildDefaultRequest("tasks/" . strtolower($task_name), "GET", array(), array()); 101 | if (empty($task)) { 102 | header('Location: ' . urlHelper::get() . "/tasks?action&success=false&message=notFound"); 103 | die(); 104 | } 105 | 106 | if (isset($_POST['action'])) { 107 | if (!urlHelper::validCSRF()) { 108 | header('Location: ' . urlHelper::get() . "/tasks/" . $task_name . "?action&success=false&message=csrfFailed"); 109 | die(); 110 | } 111 | // FUNCTIONS 112 | if ($_POST['action'] == "editTask") { 113 | $name = $_POST['name']; 114 | $ram = $_POST['memory']; 115 | $env = $_POST['environment']; 116 | if (isset($_POST['node'])) { 117 | $node = $_POST['node']; 118 | } else { 119 | $node = array(); 120 | } 121 | if (isset($_POST['group'])) { 122 | $group = $_POST['group']; 123 | } else { 124 | $group = array(); 125 | } 126 | 127 | $startPort = $_POST['port']; 128 | $static = $_POST['static']; 129 | $autoDeleteOnStop = $_POST['auto_delete_on_stop']; 130 | $maintenance = $_POST['maintenance']; 131 | 132 | if (isset($name, $ram, $env, $node, $startPort)) { 133 | $taskData = jsonObjectCreator::createServiceTaskObject( 134 | $name, $ram, $env, $node, 135 | $startPort, isset($static), isset($autoDeleteOnStop), isset($maintenance), $group 136 | ); 137 | urlHelper::buildDefaultRequest("tasks", "POST", $taskData); 138 | header('Location: ' . urlHelper::get() . "/tasks/" . $task_name . "/edit?action&success=true"); 139 | die(); 140 | } else { 141 | header('Location: ' . urlHelper::get() . "/tasks/" . $task_name . "/edit?action&success=false&message=errorTask"); 142 | } 143 | } 144 | } 145 | include "../resource/view/header.php"; 146 | include "../resource/view/action-modal.php"; 147 | include "../resource/view/dashboard/task/edit.php"; 148 | include "../resource/view/footer.php"; 149 | }); 150 | 151 | SimpleRouter::form('/{task_name}/{service_name}/console', function ($task_name, $service_name) { 152 | $service = urlHelper::buildDefaultRequest("services/" . strtolower($service_name), "GET"); 153 | if (empty($service)) { 154 | header('Location: ' . urlHelper::get() . "/tasks?action&success=false&message=notFound"); 155 | die(); 156 | } 157 | 158 | if (isset($_POST['action'])) { 159 | if (!urlHelper::validCSRF()) { 160 | header('Location: ' . urlHelper::get() . "/tasks/" . $task_name . "/console?action&success=false&message=csrfFailed"); 161 | die(); 162 | } 163 | 164 | if ($_POST['action'] == "sendCommand" and isset($_POST['command'])) { 165 | $response = urlHelper::buildDefaultRequest("services/" . $service_name . "/command","PUT", json_encode(array("command" => $_POST['command']))); 166 | header('Location: ' . urlHelper::get() . "/tasks/" . $task_name . "/" . $service_name . "/console?action&success=true&message=stopService"); 167 | die(); 168 | } 169 | } 170 | 171 | include "../resource/view/header.php"; 172 | include "../resource/view/action-modal.php"; 173 | include "../resource/view/dashboard/task/console.php"; 174 | include "../resource/view/footer.php"; 175 | }); 176 | }); -------------------------------------------------------------------------------- /routes/web.php: -------------------------------------------------------------------------------- 1 | '/modules'], function () { 29 | SimpleRouter::get('/', function () { 30 | include "../resource/view/header.php"; 31 | include "../resource/view/action-modal.php"; 32 | include "../resource/view/dashboard/modules/index.php"; 33 | include "../resource/view/footer.php"; 34 | }); 35 | 36 | SimpleRouter::get('/syncproxy', function () { 37 | include "../resource/view/header.php"; 38 | include "../resource/view/action-modal.php"; 39 | include "../resource/view/dashboard/modules/syncproxy.php"; 40 | include "../resource/view/footer.php"; 41 | }); 42 | }); 43 | 44 | SimpleRouter::group(['prefix' => '/groups'], function () { 45 | SimpleRouter::form('/', function () { 46 | if (isset($_POST['action'])) { 47 | if (!urlHelper::validCSRF()) { 48 | header('Location: ' . urlHelper::get() . "/cluster?action&success=false&message=csrfFailed"); 49 | die(); 50 | } 51 | 52 | if ($_POST["action"] == "createGroup") { 53 | $response = urlHelper::buildDefaultRequest("groups", "POST"); 54 | } 55 | } 56 | 57 | include "../resource/view/header.php"; 58 | include "../resource/view/action-modal.php"; 59 | include "../resource/view/dashboard/groups/index.php"; 60 | include "../resource/view/footer.php"; 61 | }); 62 | 63 | SimpleRouter::get('/{name}/delete', function ($task_name) { 64 | urlHelper::buildDefaultRequest("groups/" . strtolower($task_name), "DELETE", array(), array()); 65 | header('Location: ' . urlHelper::get() . "/groups?action&success=true&message=groupDelete"); 66 | die(); 67 | }); 68 | }); 69 | 70 | SimpleRouter::group(['prefix' => '/cluster'], function () { 71 | SimpleRouter::get('/', function () { 72 | include "../resource/view/header.php"; 73 | include "../resource/view/action-modal.php"; 74 | include "../resource/view/dashboard/cluster/index.php"; 75 | include "../resource/view/footer.php"; 76 | }); 77 | }); 78 | 79 | SimpleRouter::get('/logout', function () { 80 | urlHelper::buildDefaultRequest("session/logout"); 81 | unset($_SESSION['cn3-wi-access_token']); 82 | header('Location: ' . urlHelper::get()); 83 | die(); 84 | }); 85 | 86 | SimpleRouter::group(['prefix' => '/lang'], function () { 87 | SimpleRouter::get('/{name}', function ($name) { 88 | $_SESSION["lang"] = $name; 89 | header('Location: ' . urlHelper::get()); 90 | }); 91 | }); 92 | }); 93 | 94 | } else { 95 | 96 | SimpleRouter::form('/', function () { 97 | if (isset($_POST['action'])) { 98 | if (!urlHelper::validCSRF()) { 99 | header('Location: ' . urlHelper::get() . "/?action&success=false&message=csrfFailed"); 100 | die(); 101 | } 102 | 103 | if ($_POST['action'] == "login" and isset($_POST['username']) and isset($_POST['password'])) { 104 | $action = authorizeController::login($_POST['username'], $_POST['password']); 105 | if ($action == LOGIN_RESULT_SUCCESS) { 106 | header('Location: ' . urlHelper::get()); 107 | } else { 108 | header('Location: ' . urlHelper::get() . "?action&success=false&message=loginFailed"); 109 | } 110 | die(); 111 | } 112 | } 113 | 114 | include "../resource/view/small-header.php"; 115 | include "../resource/view/action-modal.php"; 116 | include "../resource/view/login.php"; 117 | include "../resource/view/footer.php"; 118 | })->name('login'); 119 | 120 | } -------------------------------------------------------------------------------- /storage/version.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": 1.0, 3 | "inherit": true 4 | } --------------------------------------------------------------------------------