├── .github └── dependabot.yml ├── .gitignore ├── Dockerfile ├── INSTALL.md ├── LICENSE ├── README.md ├── composer.json ├── config ├── config-sample.php ├── messages.json └── version.php ├── pages ├── action-modal.php ├── footer.php ├── header.php ├── small-header.php └── webinterface │ ├── cluster │ ├── console.php │ └── index.php │ ├── dashboard.php │ ├── groups │ └── index.php │ ├── login.php │ ├── modules │ └── index.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 ├── 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 └── src └── webinterface ├── authorizeController.php ├── fileController.php ├── jsonObjectCreator.php └── main.php /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | version: 2 2 | updates: 3 | - package-ecosystem: composer 4 | directory: "/" 5 | schedule: 6 | interval: daily 7 | time: "09:00" 8 | open-pull-requests-limit: 20 9 | target-branch: master 10 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .idea/ 2 | .idea/* 3 | vendor/ 4 | vendor/* 5 | 6 | composer.lock 7 | composer.phar 8 | 9 | config/config.php 10 | 11 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM php:8.0-apache 2 | 3 | ENV APACHE_DOCUMENT_ROOT /var/www/html/public 4 | 5 | COPY . /var/www/html/ 6 | WORKDIR /var/www/html/ 7 | 8 | # Building the application 9 | COPY --from=composer:latest /usr/bin/composer /usr/bin/composer 10 | RUN apt-get update && apt-get install -y git 11 | RUN composer install --no-dev 12 | 13 | # Enabling ae2 rewrites 14 | RUN a2enmod rewrite 15 | 16 | # Change document root 17 | RUN sed -ri -e 's!/var/www/html!${APACHE_DOCUMENT_ROOT}!g' /etc/apache2/sites-available/*.conf 18 | RUN sed -ri -e 's!/var/www/!${APACHE_DOCUMENT_ROOT}!g' /etc/apache2/apache2.conf /etc/apache2/conf-available/*.conf -------------------------------------------------------------------------------- /INSTALL.md: -------------------------------------------------------------------------------- 1 | [![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0) 2 | [![Discord](https://img.shields.io/discord/340197684688453632.svg?label=&logo=discord&logoColor=ffffff&color=7389D8&labelColor=6A7EC2)](https://discord.gg/CYHuDpx) 3 |
4 | 5 | 6 | 7 | # CloudNet3-Webinterface 8 | 9 | ## Requirement 10 | 11 | - CloudNet 3.x and the Rest-Module 12 | 13 | - Webserver (or Webspace) 14 | - PHP 8 15 | - PHP Extensions: Curl (apt-get install php8-curl) 16 | - Apache2 Mods: rewrite (a2enmod rewrite) 17 | 18 | ## Download 19 | 20 | You can download the latest version from https://project.the-systems.eu/resources/cloudnet3-webinterface
21 | You can download the modul from https://github.com/The-Systems/CloudNet3-WebInterface/releases/download/1.0_alpha4/cloudnet-rest.jar 22 | 23 | ## Installation 24 | 25 | 1. Delete the ```cloudnet-rest.jar in CloudNet``` Modul folder 26 | 2. Download the modified cloudnet-rest module 27 | 3. Restart CloudNet 28 | 4. Load the files into your Webserve 29 | 5. Copy the file config/config-sample.php to config/config.php 30 | 6. run the command "composer install" (If this doesn't work, go to "Install Composer") 31 | 7. Setup the Webserver 32 | 33 | Info: The web interface also works on an external Webspace! 34 | 35 | ### Webserver Configuration 36 | 37 | #### Apache2 38 | 39 | 1. Go to /etc/apache2/sites-available 40 | 2. Create a file with the extension .conf 41 | (Example: webinterface.conf) 42 | 3. Add the following and customize it. 43 | 44 | 45 | ServerName webinterface.domain.com 46 | DocumentRoot "/var/www/webinterface/public" 47 | 48 | 49 | AllowOverride All 50 | 51 | 52 | 53 | 54 | 55 | 4. Activate the page with 56 | 57 | a2ensite webinterface.conf 58 | 59 | 5. Restart Apache2 60 | 61 | service apache2 restart 62 | 63 | 7. Install SSL Certificate with https://certbot.eff.org/ 64 | 65 | ### Install Composer 66 | 67 | #### Debian 10 68 | 69 | curl -sS https://getcomposer.org/installer | php 70 | php composer.phar install --no-dev -o 71 | 72 | ## Docker 73 | 74 | For the docker setup you just need to have `docker` and `git` installed. 75 | 76 | ## Clone the repository 77 | ``git clone https://github.com/The-Systems/CloudNet3-WebInterface.git`` 78 | 79 | ## Build the docker image 80 | 81 | ``docker build -t cloudnet-webinterface .`` 82 | 83 | ## Run the image 84 | 85 | The interface will run on port 8080 on the host. 86 | 87 | ```bash 88 | docker run -d --name cloudnet-webinterface \ 89 | --port 8080:80 \ 90 | cloudnet-webinterface 91 | ``` 92 | # GERMAN 93 | 94 | ## Vorraussetzungen 95 | 96 | - CloudNet 3.5 and the Rest-Module 97 | 98 | - Webserver (oder Webspace) 99 | - PHP 8 100 | - PHP Erweiterungen: Curl (apt-get install php8-curl) 101 | - Apache2 Mods: rewrite (a2enmod rewrite) 102 | 103 | ## Download 104 | 105 | Du kannst die aktuelle Version von https://project.the-systems.eu/resources/cloudnet3-webinterface herunterladen
106 | Du kannst hier das Modul von https://github.com/The-Systems/CloudNet3-WebInterface/releases/download/1.0_alpha4/cloudnet-rest.jar herunterladen 107 | 108 | ## Installation 109 | 110 | 1. Lösche das ```cloudnet-rest.jar``` Modul 111 | 2. Lade dir das modifizierte cloudnet-rest Moodul herrunter 112 | 3. CloudNet Neustarten 113 | 4. Lade die Dateien auf deinen Webserver 114 | 5. Kopiere die config/config-sample.php in config/config.php und stelle diese ein 115 | 6. Führe "composer install" aus (Sollte das nicht funktionieren, befolge "Composer installieren") 116 | 7. Richte den Webserver ein 117 | 118 | Info: Das Webinterface funktioniert ebenfalls auf einem Externen Webserver/Webspace! 119 | 120 | ### Webserver Configuration 121 | 122 | #### Apache2 123 | 124 | 1. Gehe zu /etc/apache2/sites-available 125 | 2. Erstelle eine Datei mit der Endung .conf 126 | (Beispiel: webinterface.conf) 127 | 3. Füge das folgende ein und füge deine Daten ein 128 | 129 | 130 | ServerName webinterface.domain.com 131 | DocumentRoot "/var/www/webinterface/public" 132 | 133 | 134 | AllowOverride All 135 | 136 | 137 | 138 | 139 | 140 | 4. Aktiviere die Seite mit 141 | 142 | a2ensite webinterface.conf 143 | 144 | 5. Starte Apache2 neu 145 | 146 | service apache2 restart 147 | 148 | 6. Sollte der Kommand nicht funktionieren, führe "a2enmod rewrite" aus 149 | 150 | 7. Installier ein SSL-Zertifikat mit https://certbot.eff.org/ 151 | 152 | ### Composer installieren 153 | 154 | #### Debian 10 155 | 156 | curl -sS https://getcomposer.org/installer | php 157 | php composer.phar install --no-dev -o 158 | 159 | ## Docker 160 | 161 | For the docker setup you just need to have `docker` and `git` installed. 162 | 163 | ## Clone the repository 164 | ``git clone https://github.com/The-Systems/CloudNet3-WebInterface.git`` 165 | 166 | ## Build the docker image 167 | 168 | ``docker build -t cloudnet-webinterface .`` 169 | 170 | ## Run the image 171 | 172 | The interface will run on port 8080 on the host. 173 | 174 | ```bash 175 | docker run -d --name cloudnet-webinterface \ 176 | --port 8080:80 \ 177 | cloudnet-webinterface 178 | ``` 179 | -------------------------------------------------------------------------------- /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 2020 TheSystems 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 | [![Discord](https://img.shields.io/discord/340197684688453632.svg?label=&logo=discord&logoColor=ffffff&color=7389D8&labelColor=6A7EC2)](https://discord.gg/CYHuDpx) 3 |
4 | 5 | 6 | 7 | # CloudNet3-Webinterface 8 | 9 | ### A Webinterface for CloudNet 3.x 10 | 11 | ## IMPORTANT: WEBINTERFACE IS NOT STABLE! 12 | 13 | ### The web interface is not compatible with CloudNet v2! 14 | 15 | ## Installation 16 | 17 | #### You can find more information about the installation in the [INSTALL.md](./INSTALL.md) file. 18 | 19 | ## Projectpage 20 | 21 | #### https://project.the-systems.eu/resources/cloudnet3-webinterface 22 | 23 | ## Support 24 | 25 | - via Discord: https://discord.gg/DbahAcW 26 | - via Github-Issue: https://github.com/The-Systems/CloudNet3-Webinterface/issues 27 | - via E-Mail to moritz.walter@the-systems.eu 28 | 29 | ## License 30 | 31 | Copyright 2022 TheSystems 32 | 33 | Licensed under the Apache License, Version 2.0 (the "License"); 34 | you may not use this file except in compliance with the License. 35 | You may obtain a copy of the License at 36 | 37 | http://www.apache.org/licenses/LICENSE-2.0 38 | 39 | Unless required by applicable law or agreed to in writing, software 40 | distributed under the License is distributed on an "AS IS" BASIS, 41 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 42 | See the License for the specific language governing permissions and 43 | limitations under the License. 44 | 45 | ## Contributors 46 | 47 | 48 | Contributors 49 | 50 | 51 |
52 | 53 | ### thank you, for using our software. 54 | -------------------------------------------------------------------------------- /composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "the-systems/cloudnet3-webinterface", 3 | "description": "a webinterface for cloudnet3 by the-systems", 4 | "minimum-stability": "stable", 5 | "license": "proprietary", 6 | "authors": [ 7 | { 8 | "name": "Moritz Walter", 9 | "email": "moritz.walter@the-systems.eu" 10 | } 11 | ], 12 | "require": { 13 | "nezamy/route": "*", 14 | "ext-curl": "*" 15 | }, 16 | "autoload": { 17 | "psr-4": { 18 | "webinterface\\": "src/webinterface/" 19 | } 20 | } 21 | } -------------------------------------------------------------------------------- /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 | ); -------------------------------------------------------------------------------- /pages/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 | -------------------------------------------------------------------------------- /pages/footer.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 11 | 23 | -------------------------------------------------------------------------------- /pages/header.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 |
14 |
17 |
18 | 20 | 24 | 27 | 28 | CloudNet 29 | 30 | 41 |
42 | 43 | 46 | 47 | 91 |
92 |
93 |
94 | 155 |
-------------------------------------------------------------------------------- /pages/small-header.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 |
14 |
15 | -------------------------------------------------------------------------------- /pages/webinterface/cluster/console.php: -------------------------------------------------------------------------------- 1 | 2 | 38 | 39 |
40 |
41 |
42 |
43 |
44 | 45 |
46 |
47 |
48 |

Send command

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 | -------------------------------------------------------------------------------- /pages/webinterface/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 | Usage: 30 | MB/MB

31 |
32 |
33 | 34 |

CPU 35 | Usage: 36 | %

37 |
38 |
39 | 40 |

41 | Version:

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 |
-------------------------------------------------------------------------------- /pages/webinterface/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 |

Service count

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 |

Ram Usage

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

CPU Usage

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 | 155 | 156 | 157 |
158 |

Warning!

159 |

160 | 161 | Currently you are using an outdated Webinterface version (), to keep the Webinterface up to 162 | date and 163 | to get support, update to the latest version (). 164 | 165 | The TheSystems control server is currently unavailable. 166 | 167 |

168 |
169 | 170 |
171 |
172 |
173 |
174 |
175 | 191 | 192 | 296 | -------------------------------------------------------------------------------- /pages/webinterface/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 |
41 |
42 | 46 | 50 |
51 |
52 |
53 | 54 | 55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 | 64 |
65 |
66 |
67 |

Create Group

68 |
69 |
70 |
71 | 73 |
74 |
75 | 77 |
78 |
79 | 81 |
82 |
83 | 85 |
86 |
87 | 91 |
92 |
93 |
94 |
95 |
96 |
97 |
-------------------------------------------------------------------------------- /pages/webinterface/login.php: -------------------------------------------------------------------------------- 1 |
2 |
3 | 4 | 5 |
6 | 8 |
9 |

CloudNet Webinterface

10 |
11 |
12 |
13 | 14 | 16 |
17 |
18 |
19 |
20 | 21 | 23 |
24 |
25 |
26 | 29 | 30 |
31 | -------------------------------------------------------------------------------- /pages/webinterface/modules/index.php: -------------------------------------------------------------------------------- 1 | 6 |
7 |
8 |
9 |
10 |
11 | 12 |
13 |

14 |
15 |

16 |
17 |
18 | 19 |

Group:

20 |
21 |
22 | 23 |

Version:

24 |
25 |
26 | 27 |
28 |
29 |
30 |
-------------------------------------------------------------------------------- /pages/webinterface/permissions/index.php: -------------------------------------------------------------------------------- 1 | 6 |
7 |
8 |
9 |
10 |
11 | 12 |
13 |

14 |
15 |

16 |
17 |
18 | 19 |

Erster 20 | Erstellt:

21 |
22 |
23 |
24 | Show 26 | Delete 28 |
29 |
30 |
31 | 32 |
33 |
34 |
35 |
-------------------------------------------------------------------------------- /pages/webinterface/permissions/show.php: -------------------------------------------------------------------------------- 1 | 6 |
7 |
8 |
9 |
10 |
11 |
12 |

13 |
14 |

15 |
16 |
17 | 18 |

19 | Erstellt:

20 |
21 |
22 | 23 |

24 | Permissions:

25 |
26 |
27 | 28 |

29 | Gruppen:

30 |
31 |
32 |
33 |
34 | 35 | 36 | 37 |
38 |
39 | 43 | " 48 | class="my-2 p-2 dark:bg-gray-900 bg-gray-100 flex border dark:border-gray-900 border-gray-100 rounded px-2 appearance-none outline-none w-full dark:text-white text-gray-900 focus:ring-2 focus:ring-blue-600" 49 | required 50 | > 51 |
52 |
53 | 57 | " 62 | class="my-2 p-2 dark:bg-gray-900 bg-gray-100 flex border dark:border-gray-900 border-gray-100 rounded px-2 appearance-none outline-none w-full dark:text-white text-gray-900 focus:ring-2 focus:ring-blue-600" 63 | required 64 | > 65 |
66 |
67 |
68 |
69 | 73 | " 78 | class="my-2 p-2 dark:bg-gray-900 bg-gray-100 flex border dark:border-gray-900 border-gray-100 rounded px-2 appearance-none outline-none w-full dark:text-white text-gray-900 focus:ring-2 focus:ring-blue-600" 79 | required 80 | > 81 |
82 |
83 | 87 | " 92 | class="my-2 p-2 dark:bg-gray-900 bg-gray-100 flex border dark:border-gray-900 border-gray-100 rounded px-2 appearance-none outline-none w-full dark:text-white text-gray-900 focus:ring-2 focus:ring-blue-600" 93 | required 94 | > 95 |
96 |
97 |
98 |
99 | 103 | " 108 | class="my-2 p-2 dark:bg-gray-900 bg-gray-100 flex border dark:border-gray-900 border-gray-100 rounded px-2 appearance-none outline-none w-full dark:text-white text-gray-900 focus:ring-2 focus:ring-blue-600" 109 | required 110 | > 111 |
112 |
113 | 117 | " 123 | class="my-2 p-2 dark:bg-gray-900 bg-gray-100 flex border dark:border-gray-900 border-gray-100 rounded px-2 appearance-none outline-none w-full dark:text-white text-gray-900 focus:ring-2 focus:ring-blue-600" 124 | required 125 | > 126 |
127 |
128 |
129 | 134 | 138 |
139 |
140 |
141 |
142 |
143 |
144 | 145 | 146 | 147 | 150 | 153 | 154 | 155 | 156 | 157 | 158 | 162 | 180 | 181 | 182 | 183 |
148 | Permission Name 149 | 151 | Delete 152 |
160 | 161 | 163 |
164 | 165 | " 166 | type="hidden"> 167 | 168 | 178 |
179 |
184 |
185 |
186 | 187 | 188 | 189 | 192 | 195 | 196 | 197 | 198 | 199 | 200 | 204 | 221 | 222 | 223 | 224 |
190 | Group 191 | 193 | Delete 194 |
202 | 203 | 205 |
206 | 207 | 208 | 209 | 219 |
220 |
225 |
226 |
227 |
228 |
229 |

Add Permission

230 |
231 |
232 | 233 | 234 | 235 |
236 |
237 | 239 |
240 |
241 | 245 |
246 |
247 |
248 |
249 |
250 |
251 |

Add Group

252 |
253 |
254 | 255 | 256 | 257 |
258 |
259 | 261 |
262 |
263 | 267 |
268 |
269 |
270 |
271 |
272 |
273 |
274 |
-------------------------------------------------------------------------------- /pages/webinterface/players/index.php: -------------------------------------------------------------------------------- 1 | 8 |
9 | 47 |
-------------------------------------------------------------------------------- /pages/webinterface/players/show.php: -------------------------------------------------------------------------------- 1 | 9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 | "/> 20 |
21 |

22 |
23 | 24 |

Letzter 25 | Login:

26 |
27 |
28 | 29 |

Erster 30 | Login:

31 |
32 |
33 |
34 | 35 | 36 | 37 | 40 | 43 | 46 | 47 | 48 | 49 | 50 | 51 | 55 | 59 | 76 | 77 | 78 | 79 |
38 | Group 39 | 41 | To 42 | 44 | Delete 45 |
53 | 54 | 57 | 58 | 60 |
61 | 62 | " type="hidden"> 63 | 64 | 74 |
75 |
80 |
81 |
82 | 83 | 84 | 85 | 88 | 91 | 94 | 95 | 96 | 97 | 98 | 99 | 103 | 107 | 124 | 125 | 126 | 127 |
86 | Permission 87 | 89 | To 90 | 92 | Delete 93 |
101 | 102 | 105 | 106 | 108 |
109 | 110 | " type="hidden"> 111 | 112 | 122 |
123 |
128 |
129 |
130 |
131 |
132 |
133 | 134 |
135 |
136 |
137 |
138 | 139 |
140 |
141 |
142 |

Add Group

143 |
144 |
145 | 146 | 147 | 148 |
149 |
150 | 171 |
172 |
173 | 199 |
200 |
201 | 203 |
204 |
205 | 209 |
210 |
211 |
212 |
213 |
214 |
215 |
216 | 217 |
218 |
219 |
220 |
221 |
222 |
223 |
224 |

Add Permission

225 |
226 |
227 | 228 | 229 | 230 |
231 |
232 | 234 |
235 |
236 | 261 |
262 |
263 | 267 |
268 |
269 |
270 |
271 |
272 |
273 |
274 |
275 | -------------------------------------------------------------------------------- /pages/webinterface/profile/help.php: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/The-Systems/CloudNet3-WebInterface/da79b5018c46f23eac162e581d6d75cf1b3d1349/pages/webinterface/profile/help.php -------------------------------------------------------------------------------- /pages/webinterface/profile/index.php: -------------------------------------------------------------------------------- 1 | 6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 | "/> 17 |
18 |
19 |
20 | 21 |
22 |
23 |
-------------------------------------------------------------------------------- /pages/webinterface/profile/settings.php: -------------------------------------------------------------------------------- 1 | 2 |
3 |
4 |
5 |
Console 6 | for
7 |
8 | 9 |
10 |
11 |
12 | 13 | 14 |
15 |

Send command

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

Edit Task

18 |
19 |
20 |
21 | 22 | 30 |
31 |
32 | 33 | 42 |
43 |
44 | 45 | 83 |
84 |
85 | 86 | 103 |
104 |
105 | 106 | 123 |
124 |
125 | 126 | 136 |
137 |
138 | 142 | 147 | 151 |
152 |
153 | 157 |
158 |
159 |
160 |
161 |
162 |
163 |
164 |
165 |
-------------------------------------------------------------------------------- /pages/webinterface/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 | Show 79 | Edit 81 | Delete 83 |
84 |
85 |
86 | 87 | 88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 | 97 |
98 |
99 | 100 | 101 |
102 |
103 |

Create Task

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 |
-------------------------------------------------------------------------------- /pages/webinterface/task/task.php: -------------------------------------------------------------------------------- 1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |

All services of 11 | task

12 |
13 | 14 |
15 |
  • 16 |
    17 |
    18 |
    19 |
    20 |
    21 |
    22 | on 23 | |
    24 | 25 |
    26 |
    27 | Static: 28 | | 29 | AutoDeleteOnStop: 30 | | 31 | Groups: 32 | | 39 | Environment: 40 |
    41 | 42 |
    43 |
    44 | Node: 45 | | 46 | Static: 47 | | 48 | AutoDeleteOnStop: 49 | | 50 | Groups: 51 | | 58 | Environment: 59 |
    60 | 61 |
    62 |
    63 | 64 | 65 |
    66 | 73 | 75 | 77 | 79 |
    80 | 81 |
    82 | 89 | 91 | 93 | 95 |
    96 | 97 |
    98 |
    99 |
  • 100 | 101 |
    102 | Console 104 | 105 |
    106 | 107 | 108 | 109 | 113 |
    114 |
    115 | 116 |
    117 |
    118 | 119 | 120 | 121 | 125 |
    126 |
    127 | 128 |
    129 | 130 |
    131 |
    132 |
    133 |
    134 |
    135 |

    Start

    136 |
    137 | 138 |
    139 | 140 | 141 |
    142 |
    143 | 146 | 147 | 152 | 153 |
    154 |
    155 | 160 |
    161 |
    162 |
    163 |
    164 |
    165 |
    166 |
    167 |
    -------------------------------------------------------------------------------- /public/.htaccess: -------------------------------------------------------------------------------- 1 | RewriteEngine On 2 | RewriteRule ^(.*)$ index.php?url=$1 [L,QSA] -------------------------------------------------------------------------------- /public/assets/.htaccess: -------------------------------------------------------------------------------- 1 | RewriteEngine Off -------------------------------------------------------------------------------- /public/assets/icons/bed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/The-Systems/CloudNet3-WebInterface/da79b5018c46f23eac162e581d6d75cf1b3d1349/public/assets/icons/bed.png -------------------------------------------------------------------------------- /public/assets/icons/cluster.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/The-Systems/CloudNet3-WebInterface/da79b5018c46f23eac162e581d6d75cf1b3d1349/public/assets/icons/cluster.png -------------------------------------------------------------------------------- /public/assets/icons/cpu.svg: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /public/assets/icons/nether.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/The-Systems/CloudNet3-WebInterface/da79b5018c46f23eac162e581d6d75cf1b3d1349/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 | request = System\Request::instance(); 22 | $app->route = System\Route::instance($app->request); 23 | $route = $app->route; 24 | 25 | // check if we already have a session 26 | session_start(); 27 | 28 | if (!isset($_SESSION['cn3-wi-csrf'])) { 29 | $_SESSION['cn3-wi-csrf'] = uniqid(); 30 | } 31 | 32 | if (isset($_SESSION['cn3-wi-access_token'])) { 33 | // check if token valid, and refresh 34 | $result = authorizeController::loginToken($_SESSION['cn3-wi-access_token']); 35 | if ($result != LOGIN_RESULT_SUCCESS) { 36 | unset($_SESSION['cn3-wi-access_token']); 37 | header('Location: ' . main::getUrl()); 38 | die(); 39 | } 40 | 41 | $route->any('/', function () use ($main) { 42 | include "../pages/header.php"; 43 | include "../pages/action-modal.php"; 44 | include "../pages/webinterface/dashboard.php"; 45 | include "../pages/footer.php"; 46 | }); 47 | 48 | $app->route->group('/tasks', function () use ($main) { 49 | $this->any('/', function () use ($main) { 50 | if (isset($_POST['action'])) { 51 | if (!main::validCSRF()) { 52 | header('Location: ' . main::getUrl() . "/cluster?action&success=false&message=csrfFailed"); 53 | die(); 54 | } 55 | 56 | if ($_POST['action'] == "createTask" and isset($_POST['name'])) { 57 | // validate that all required values are there 58 | $name = $_POST['name']; 59 | $ram = $_POST['ram']; 60 | $env = $_POST['environment']; 61 | $node = $_POST['node']; 62 | $startPort = $_POST['port']; 63 | $static = $_POST['static']; 64 | $autoDeleteOnStop = $_POST['auto_delete_on_stop']; 65 | $maintenance = $_POST['maintenance']; 66 | 67 | if (isset($name, $ram, $env, $node, $startPort)) { 68 | $taskData = webinterface\jsonObjectCreator::createServiceTaskObject( 69 | $name, $ram, $env, 70 | $node === "all" ? array() : array($node), 71 | $startPort, isset($static), isset($autoDeleteOnStop), isset($maintenance) 72 | ); 73 | $response = $main::buildDefaultRequest("tasks", "POST", params: $taskData); 74 | 75 | header('Location: ' . main::getUrl() . "/tasks?action&success=true&message=taskCreated"); 76 | die(); 77 | } 78 | } 79 | } 80 | 81 | include "../pages/header.php"; 82 | include "../pages/action-modal.php"; 83 | include "../pages/webinterface/task/index.php"; 84 | include "../pages/footer.php"; 85 | }); 86 | 87 | $this->any('/?', function ($task_name) use ($main) { 88 | $task = main::buildDefaultRequest("tasks/" . strtolower($task_name), "GET", array(), array()); 89 | if (empty($task)) { 90 | header('Location: ' . main::getUrl() . "/tasks?action&success=false&message=notFoundTask"); 91 | die(); 92 | } 93 | 94 | $services_r = main::buildDefaultRequest("services", "GET", array(), array()); 95 | $services = array(); 96 | foreach ($services_r as $service) { 97 | if (strtolower($service['configuration']['serviceId']['taskName']) == strtolower($task_name)) { 98 | array_push($services, $service); 99 | } 100 | } 101 | 102 | if (isset($_POST['action'])) { 103 | if (!main::validCSRF()) { 104 | header('Location: ' . main::getUrl() . "/tasks/" . $task_name . "?action&success=false&message=csrfFailed"); 105 | die(); 106 | } 107 | 108 | if ($_POST['action'] == "stopService" and isset($_POST['service_id'])) { 109 | $response = $main::buildDefaultRequest("services/" . $_POST['service_id'] . "/stop", "GET"); 110 | header('Location: ' . main::getUrl() . "/tasks/" . $task_name . "?action&success=true&message=stopService"); 111 | die(); 112 | } 113 | 114 | if ($_POST['action'] == "createService" and isset($_POST['count'])) { 115 | $main::buildDefaultRequest("services/" . strtolower($task_name) . "/" . $_POST['count'] . "/" . (isset($_POST['start']) ? "true" : "false"), "GET"); 116 | header('Location: ' . main::getUrl() . "/tasks/" . $task_name . "?action&success=true&message=createService"); 117 | die(); 118 | } 119 | 120 | if ($_POST['action'] == "startService" and isset($_POST['service_id'])) { 121 | $main::buildDefaultRequest("services/" . $_POST['service_id'] . '/start', "GET"); 122 | 123 | header('Location: ' . main::getUrl() . "/tasks/" . $task_name . "?action&success=true&message=startService"); 124 | die(); 125 | } 126 | } 127 | 128 | include "../pages/header.php"; 129 | include "../pages/action-modal.php"; 130 | include "../pages/webinterface/task/task.php"; 131 | include "../pages/footer.php"; 132 | }); 133 | 134 | $this->any('/?/delete', function ($task_name) use ($main) { 135 | $task = main::buildDefaultRequest("tasks/" . strtolower($task_name), "DELETE", array(), array()); 136 | header('Location: ' . main::getUrl() . "/tasks?action&success=true&message=taskDelete"); 137 | die(); 138 | }); 139 | 140 | $this->any('/?/edit', function ($task_name) use ($main) { 141 | $task = main::buildDefaultRequest("tasks/" . strtolower($task_name), "GET", array(), array()); 142 | if (empty($task)) { 143 | header('Location: ' . main::getUrl() . "/tasks?action&success=false&message=notFound"); 144 | die(); 145 | } 146 | 147 | if (isset($_POST['action'])) { 148 | if (!main::validCSRF()) { 149 | header('Location: ' . main::getUrl() . "/tasks/" . $task_name . "?action&success=false&message=csrfFailed"); 150 | die(); 151 | } 152 | // FUNCTIONS 153 | if ($_POST['action'] == "editTask") { 154 | $name = $_POST['name']; 155 | $ram = $_POST['memory']; 156 | $env = $_POST['environment']; 157 | if (isset($_POST['node'])) { 158 | $node = $_POST['node']; 159 | } else { 160 | $node = array(); 161 | } 162 | if (isset($_POST['group'])) { 163 | $group = $_POST['group']; 164 | } else { 165 | $group = array(); 166 | } 167 | 168 | $startPort = $_POST['port']; 169 | $static = $_POST['static']; 170 | $autoDeleteOnStop = $_POST['auto_delete_on_stop']; 171 | $maintenance = $_POST['maintenance']; 172 | 173 | if (isset($name, $ram, $env, $node, $startPort)) { 174 | $taskData = webinterface\jsonObjectCreator::createServiceTaskObject( 175 | $name, $ram, $env, $node, 176 | $startPort, isset($static), isset($autoDeleteOnStop), isset($maintenance), $group 177 | ); 178 | $main::buildDefaultRequest("tasks", "POST", $taskData); 179 | header('Location: ' . main::getUrl() . "/tasks/" . $task_name . "/edit?action&success=true"); 180 | die(); 181 | } else { 182 | header('Location: ' . main::getUrl() . "/tasks/" . $task_name . "/edit?action&success=false&message=errorTask"); 183 | } 184 | } 185 | } 186 | 187 | include "../pages/header.php"; 188 | include "../pages/action-modal.php"; 189 | include "../pages/webinterface/task/edit.php"; 190 | include "../pages/footer.php"; 191 | }); 192 | 193 | $this->any('/?/?/console', function ($task_name, $service_name) use ($main) { 194 | $service = main::buildDefaultRequest("services/" . strtolower($service_name), "GET"); 195 | if (empty($service)) { 196 | header('Location: ' . main::getUrl() . "/tasks?action&success=false&message=notFound"); 197 | die(); 198 | } 199 | 200 | if (isset($_POST['action'])) { 201 | if (!main::validCSRF()) { 202 | header('Location: ' . main::getUrl() . "/tasks/" . $task_name . "?action&success=false&message=csrfFailed"); 203 | die(); 204 | } 205 | 206 | if ($_POST['action'] == "sendCommand" and isset($_POST['command'])) { 207 | $response = $main::buildDefaultRequest("services/" . $_POST['service_id'] . "/stop", "GET"); 208 | header('Location: ' . main::getUrl() . "/tasks/" . $task_name . "?action&success=true&message=stopService"); 209 | die(); 210 | } 211 | } 212 | 213 | include "../pages/header.php"; 214 | include "../pages/action-modal.php"; 215 | include "../pages/webinterface/task/console.php"; 216 | include "../pages/footer.php"; 217 | }); 218 | }); 219 | 220 | $route->group('/groups', function () use ($main) { 221 | $this->any('/', function () use ($main) { 222 | 223 | if (isset($_POST['action'])) { 224 | if (!main::validCSRF()) { 225 | header('Location: ' . main::getUrl() . "/cluster?action&success=false&message=csrfFailed"); 226 | die(); 227 | } 228 | 229 | if ($_POST["action"] == "createGroup") { 230 | $response = $main::buildDefaultRequest("groups", "POST"); 231 | } 232 | } 233 | include "../pages/header.php"; 234 | include "../pages/action-modal.php"; 235 | include "../pages/webinterface/groups/index.php"; 236 | include "../pages/footer.php"; 237 | }); 238 | }); 239 | 240 | $route->group('/cluster', function () use ($main) { 241 | $this->any('/', function () use ($main) { 242 | if (isset($_POST['action'])) { 243 | if (!main::validCSRF()) { 244 | header('Location: ' . main::getUrl() . "/cluster?action&success=false&message=csrfFailed"); 245 | die(); 246 | } 247 | 248 | if ($_POST['action'] == "stopNode" and isset($_POST['node_id'])) { 249 | main::buildDefaultRequest("cluster/" . $_POST['node_id'] . "/command", "POST", array(), json_encode(array("command" => "stop"))); 250 | $action = main::buildDefaultRequest("cluster/" . $_POST['node_id'] . "/command", "POST", array(), json_encode(array("command" => "stop"))); 251 | // two times, because cloudnet require two stop commands 252 | 253 | header('Location: ' . main::getUrl() . "/cluster?action&success=true&message=nodeStop"); 254 | die(); 255 | } 256 | 257 | if ($_POST['action'] == "deleteNode" and isset($_POST['node_id'])) { 258 | main::buildDefaultRequest("cluster/" . $_POST['node_id'], "DELETE", array(), array()); 259 | header('Location: ' . main::getUrl() . "/cluster?action&success=true&message=nodeDelete"); 260 | die(); 261 | } 262 | 263 | if ($_POST['action'] == "createNode" and isset($_POST['name'])) { 264 | $action = main::buildDefaultRequest("cluster", "POST", array(), json_encode(array("properties" => array(), "uniqueId" => $_POST['name'], "listeners" => array((array("host" => $_POST['host'], "port" => $_POST['port'])))))); 265 | header('Location: ' . main::getUrl() . "/cluster?action&success=true&message=nodeCreate"); 266 | die(); 267 | } 268 | 269 | } 270 | 271 | include "../pages/header.php"; 272 | include "../pages/action-modal.php"; 273 | include "../pages/webinterface/cluster/index.php"; 274 | include "../pages/footer.php"; 275 | }); 276 | 277 | $this->any('/?/console', function ($node_id) use ($main) { 278 | $cluster = main::buildDefaultRequest("node/" . $node_id, "GET"); 279 | if (!$cluster['success']) { 280 | header('Location: ' . main::getUrl() . "/cluster?action&success=false&message=notFound"); 281 | die(); 282 | } 283 | 284 | $ticket = main::requestWsTicket("cluster?action&success=false&message=notFound"); 285 | 286 | include "../pages/header.php"; 287 | include "../pages/action-modal.php"; 288 | include "../pages/webinterface/cluster/console.php"; 289 | include "../pages/footer.php"; 290 | }); 291 | }); 292 | 293 | $app->route->group('/modules', function () use ($main) { 294 | $this->any('/', function () use ($main) { 295 | include "../pages/header.php"; 296 | include "../pages/action-modal.php"; 297 | include "../pages/webinterface/modules/index.php"; 298 | include "../pages/footer.php"; 299 | }); 300 | }); 301 | 302 | $app->route->group('/players', function () use ($main) { 303 | $this->any('/', function () use ($main) { 304 | include "../pages/header.php"; 305 | include "../pages/action-modal.php"; 306 | include "../pages/webinterface/players/index.php"; 307 | include "../pages/footer.php"; 308 | }); 309 | }); 310 | 311 | $app->route->group('/players', function () use ($main) { 312 | $this->any('/', function () use ($main) { 313 | include "../pages/header.php"; 314 | include "../pages/action-modal.php"; 315 | include "../pages/webinterface/players/index.php"; 316 | include "../pages/footer.php"; 317 | }); 318 | 319 | $this->any('/?', function ($uuid) use ($main) { 320 | if (isset($_POST["action"])) { 321 | if (!main::validCSRF()) { 322 | header('Location: ' . main::getUrl() . "/players/" . $uuid . "?action&success=false&message=csrfFailed"); 323 | die(); 324 | } 325 | 326 | if ($_POST["action"] == "addGroup") { 327 | main::buildDefaultRequest("players/" . $uuid . "/add", 'PUT', json_encode(array("group" => $_POST["permissionGroup"], "time" => $_POST["time"], "time_number" => $_POST["time_number"]))); 328 | header('Location: ' . main::getUrl() . "/players/" . $uuid . "?action&success=true&message=addGroupToPlayer"); 329 | die(); 330 | } 331 | 332 | if ($_POST["action"] == "deleteGroup") { 333 | main::buildDefaultRequest("players/" . $uuid . "/remove", 'PUT', json_encode(array("group" => $_POST["groupName"]))); 334 | header('Location: ' . main::getUrl() . "/players/" . $uuid . "?action&success=true&message=deleteGroupFromPlayer"); 335 | die(); 336 | } 337 | 338 | if ($_POST["action"] == "addPermission") { 339 | main::buildDefaultRequest("players/" . $uuid . "/add", 'PUT', $_POST["serviceGroup"] == "all" ? 340 | json_encode(array("permission" => $_POST["permission"])) : 341 | json_encode(array("permission" => $_POST["permission"], "serviceGroup" => $_POST["serviceGroup"]))); 342 | header('Location: ' . main::getUrl() . "/players/" . $uuid . "?action&success=true&message=addPermissionFromPlayer"); 343 | die(); 344 | } 345 | 346 | if ($_POST["action"] == "deletePermission") { 347 | main::buildDefaultRequest("players/" . $uuid . "/remove", 'PUT', json_encode(array("permission" => $_POST["permission"]))); 348 | header('Location: ' . main::getUrl() . "/players/" . $uuid . "?action&success=true&message=deletePermissionFromPlayer"); 349 | die(); 350 | } 351 | } 352 | 353 | include "../pages/header.php"; 354 | include "../pages/action-modal.php"; 355 | include "../pages/webinterface/players/show.php"; 356 | include "../pages/footer.php"; 357 | }); 358 | }); 359 | 360 | $app->route->group('/permissions', function () use ($main) { 361 | $this->any('/', function () use ($main) { 362 | include "../pages/header.php"; 363 | include "../pages/action-modal.php"; 364 | include "../pages/webinterface/permissions/index.php"; 365 | include "../pages/footer.php"; 366 | }); 367 | 368 | $this->any('/?', function ($group_name) use ($main) { 369 | if (isset($_POST["action"])) { 370 | if (!main::validCSRF()) { 371 | header('Location: ' . main::getUrl() . "/permissions/" . $group_name . "?action&success=false&message=csrfFailed"); 372 | die(); 373 | } 374 | 375 | if ($_POST["action"] == "groupSettings") { 376 | main::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"]))); 377 | header('Location: ' . main::getUrl() . "/permissions/" . $group_name . "?action&success=true&message=updatePermissionGroup"); 378 | die(); 379 | } 380 | 381 | if ($_POST["action"] == "deletePermission") { 382 | main::buildDefaultRequest("permissions/permission/delete", "POST", json_encode(array("permission" => $_POST["permissionName"], "groupName" => $group_name))); 383 | header('Location: ' . main::getUrl() . "/permissions/" . $group_name . "?action&success=true&message=deletePermission"); 384 | die(); 385 | } 386 | 387 | if ($_POST["action"] == "deleteGroup") { 388 | main::buildDefaultRequest("permissions/group/delete", "POST", json_encode(array("name" => $_POST["groupName"], "groupName" => $group_name))); 389 | header('Location: ' . main::getUrl() . "/permissions/" . $group_name . "?action&success=true&message=deleteGroupFromGroup"); 390 | die(); 391 | } 392 | 393 | if ($_POST["action"] == "addPermission") { 394 | main::buildDefaultRequest("permissions/permission/add", "POST", json_encode(array("permission" => $_POST["name"], "groupName" => $group_name))); 395 | header('Location: ' . main::getUrl() . "/permissions/" . $group_name . "?action&success=true&message=addPermission"); 396 | die(); 397 | } 398 | 399 | } 400 | include "../pages/header.php"; 401 | include "../pages/action-modal.php"; 402 | include "../pages/webinterface/permissions/show.php"; 403 | include "../pages/footer.php"; 404 | }); 405 | }); 406 | 407 | $app->route->group('/profile', function () use ($main) { 408 | $this->any('/', function () use ($main) { 409 | include "../pages/header.php"; 410 | include "../pages/action-modal.php"; 411 | include "../pages/webinterface/profile/index.php"; 412 | include "../pages/footer.php"; 413 | }); 414 | 415 | $this->any('/help', function () use ($main) { 416 | include "../pages/header.php"; 417 | include "../pages/action-modal.php"; 418 | include "../pages/webinterface/profile/help.php"; 419 | include "../pages/footer.php"; 420 | }); 421 | 422 | $this->any('/settings', function () use ($main) { 423 | include "../pages/header.php"; 424 | include "../pages/action-modal.php"; 425 | include "../pages/webinterface/profile/settings.php"; 426 | include "../pages/footer.php"; 427 | }); 428 | }); 429 | 430 | // logout page 431 | $route->any('/logout', function () use ($main) { 432 | $main::buildDefaultRequest("session/logout"); 433 | unset($_SESSION['cn3-wi-access_token']); 434 | header('Location: ' . main::getUrl()); 435 | die(); 436 | }); 437 | } else { 438 | $route->any('/', function () use ($main) { 439 | if (isset($_POST['action'])) { 440 | if (!main::validCSRF()) { 441 | header('Location: ' . main::getUrl() . "/?action&success=false&message=csrfFailed"); 442 | die(); 443 | } 444 | 445 | if ($_POST['action'] == "login" and isset($_POST['username']) and isset($_POST['password'])) { 446 | $action = authorizeController::login($_POST['username'], $_POST['password']); 447 | if ($action == LOGIN_RESULT_SUCCESS) { 448 | header('Location: ' . main::getUrl()); 449 | } else { 450 | header('Location: ' . main::getUrl() . "/?action&success=false&message=loginFailed"); 451 | } 452 | die(); 453 | } 454 | } 455 | 456 | include "../pages/small-header.php"; 457 | include "../pages/action-modal.php"; 458 | include "../pages/webinterface/login.php"; 459 | include "../pages/footer.php"; 460 | }); 461 | } 462 | 463 | $route->any('/*', function () use ($main) { 464 | header('Location: ' . main::getUrl()); 465 | die(); 466 | }); 467 | 468 | $app->route->end(); -------------------------------------------------------------------------------- /src/webinterface/authorizeController.php: -------------------------------------------------------------------------------- 1 | $url, 41 | CURLOPT_RETURNTRANSFER => true, 42 | CURLOPT_ENCODING => '', 43 | CURLOPT_MAXREDIRS => 10, 44 | CURLOPT_TIMEOUT => 0, 45 | CURLOPT_FOLLOWLOCATION => true, 46 | CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, 47 | CURLOPT_CUSTOMREQUEST => 'GET', 48 | CURLOPT_HTTPHEADER => array( 49 | 'Authorization: Basic ' . $token 50 | ), 51 | )); 52 | 53 | $response = curl_exec($curl); 54 | $responseHttpCode = curl_getinfo($curl, CURLINFO_HTTP_CODE); 55 | 56 | curl_close($curl); 57 | if ($response === FALSE || $responseHttpCode !== 200) { 58 | return LOGIN_RESULT_SERVER_DOWN; 59 | } 60 | 61 | $response = json_decode($response, true); 62 | if ($response['success'] == true) { 63 | // session_start(); 64 | $_SESSION['cn3-wi-access_token'] = $token; 65 | $_SESSION['cn3-wi-cookie'] = $response["cookie"]; 66 | $_SESSION['cn3-wi-user'] = $response["userUniqueId"]; 67 | 68 | return LOGIN_RESULT_SUCCESS; 69 | } else { 70 | return LOGIN_RESULT_INVALID_CREDENTIALS; 71 | } 72 | } 73 | 74 | public static function loginToken(string $token): int 75 | { 76 | $url = main::provideUrl("auth"); 77 | 78 | $curl = curl_init($url); 79 | curl_setopt_array($curl, array( 80 | CURLOPT_RETURNTRANSFER => true, 81 | CURLOPT_MAXREDIRS => 1, 82 | CURLOPT_TIMEOUT => 5, 83 | CURLOPT_CUSTOMREQUEST => "GET", 84 | CURLOPT_HTTPHEADER => array( 85 | 'Accept: application/json', 86 | 'Authorization: Basic ' . $token 87 | ), 88 | )); 89 | 90 | $response = curl_exec($curl); 91 | $responseHttpCode = curl_getinfo($curl, CURLINFO_HTTP_CODE); 92 | 93 | curl_close($curl); 94 | 95 | if ($response === FALSE || $responseHttpCode !== 200) { 96 | return LOGIN_RESULT_SERVER_DOWN; 97 | } 98 | 99 | $response = json_decode($response, true); 100 | if ($response['success'] == true) { 101 | // session_start(); 102 | $_SESSION['cn3-wi-access_token'] = $token; 103 | return LOGIN_RESULT_SUCCESS; 104 | } else { 105 | return LOGIN_RESULT_INVALID_CREDENTIALS; 106 | } 107 | } 108 | } 109 | -------------------------------------------------------------------------------- /src/webinterface/fileController.php: -------------------------------------------------------------------------------- 1 | Ein Fehler ist aufgetreten.

    Die Datei "/config/config.php" konnte nicht gefunden werden.

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

    '); 17 | } 18 | 19 | if (!file_exists(self::$path_version)) { 20 | die('

    Ein Fehler ist aufgetreten.

    Die Datei "/config/version.php" konnte nicht gefunden werden

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

    '); 21 | } 22 | 23 | if (!file_exists(self::$path_message)) { 24 | die('

    Ein Fehler ist aufgetreten.

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

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

    '); 25 | } 26 | } 27 | 28 | public static function getConfigurationPath(): string 29 | { 30 | return self::$path_config; 31 | } 32 | 33 | public static function getVersionFilePath(): string 34 | { 35 | return self::$path_version; 36 | } 37 | } -------------------------------------------------------------------------------- /src/webinterface/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 | } -------------------------------------------------------------------------------- /src/webinterface/main.php: -------------------------------------------------------------------------------- 1 | self::provideUrl($url), 81 | CURLOPT_RETURNTRANSFER => true, 82 | CURLOPT_MAXREDIRS => 1, 83 | CURLOPT_TIMEOUT => 5, 84 | CURLOPT_CUSTOMREQUEST => $method, 85 | CURLOPT_POSTFIELDS => $params, 86 | CURLOPT_HTTPHEADER => array( 87 | 'Accept: application/json', 88 | 'Authorization: Basic ' . $token, 89 | 'Cookie: ' . $_SESSION["cn3-wi-cookie"] 90 | ), 91 | )); 92 | 93 | $response = curl_exec($curl); 94 | curl_close($curl); 95 | 96 | if ($response === FALSE) { 97 | return array("success" => "false"); 98 | } 99 | 100 | if ($debug == true) { 101 | return $response; 102 | } else { 103 | return json_decode($response, true); 104 | } 105 | } 106 | 107 | public static function getMessage($key) 108 | { 109 | $file = BASE_PATH . '../../config/messages.json'; 110 | $json = file_get_contents($file); 111 | $message = json_decode($json, true); 112 | if (isset($message[$key])) { 113 | return $message[$key]; 114 | } else { 115 | return $key; 116 | } 117 | } 118 | 119 | #[Pure] public static function getCurrentVersion() 120 | { 121 | return main::getVersionObj()['version']; 122 | } 123 | 124 | public static function getVersion(): array 125 | { 126 | $url = main::getVersionObj()['version_url']; 127 | 128 | $ch = curl_init(); 129 | curl_setopt($ch, CURLOPT_URL, $url); 130 | curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); 131 | $json = curl_exec($ch); 132 | curl_close($ch); 133 | 134 | $response = curl_exec($ch); 135 | if ($response === FALSE) { 136 | return array("success" => false, "response" => "server down"); 137 | } 138 | 139 | return json_decode($json, true); 140 | } 141 | 142 | public static function testIfLatestVersion(): array 143 | { 144 | $version = self::getCurrentVersion(); 145 | $version_latest = self::getVersion(); 146 | 147 | if (!$version_latest['success']) { 148 | return array("success" => false, "response" => array( 149 | "error_code" => 503, 150 | "error_message" => "version-server down" 151 | )); 152 | } 153 | 154 | if ($version != $version_latest['response']['version']) { 155 | return array("success" => false, "response" => array( 156 | "error_code" => 202, 157 | "error_message" => "not latest version", 158 | "error_extra" => array( 159 | "current" => $version, 160 | "latest" => $version_latest['response']['version']) 161 | )); 162 | } else { 163 | return array("success" => true); 164 | } 165 | } 166 | 167 | public static function validCSRF(): bool 168 | { 169 | return isset($_POST['csrf']) ?? false and $_POST['csrf'] == $_SESSION['cn3-wi-csrf']; 170 | } 171 | } --------------------------------------------------------------------------------