diff --git a/public/install/forms.php b/public/install/forms.php index 5c56ecdd..348aa08c 100644 --- a/public/install/forms.php +++ b/public/install/forms.php @@ -9,6 +9,7 @@ require 'phpmailer/SMTP.php'; include 'functions.php'; +mysqli_report(MYSQLI_REPORT_STRICT | MYSQLI_REPORT_ALL); if (isset($_POST['checkDB'])) { $values = [ @@ -23,12 +24,15 @@ if (isset($_POST['checkDB'])) { wh_log('Trying to connect to the Database', 'debug'); - $db = new mysqli($_POST['databasehost'], $_POST['databaseuser'], $_POST['databaseuserpass'], $_POST['database'], $_POST['databaseport']); - if ($db->connect_error) { - wh_log($db->connect_error, 'error'); - header('LOCATION: index.php?step=2&message=Could not connect to the Database'); + try { + $db = new mysqli($_POST['databasehost'], $_POST['databaseuser'], $_POST['databaseuserpass'], $_POST['database'], $_POST['databaseport']); + } + catch (mysqli_sql_exception $e) { + wh_log($e->getMessage(), 'error'); + header('LOCATION: index.php?step=2&message=' . $e->getMessage()); exit(); } + foreach ($values as $key => $value) { $param = $_POST[$value]; diff --git a/public/install/functions.php b/public/install/functions.php index 5846ad78..a7952046 100644 --- a/public/install/functions.php +++ b/public/install/functions.php @@ -183,7 +183,7 @@ function encryptSettingsValue(mixed $value, $serialize = true): string { $appKey = getenv('APP_KEY'); $appKey = base64_decode(Str::after($appKey, 'base64:')); - $encrypter = new Encrypter($appKey); + $encrypter = new Encrypter($appKey, 'AES-256-CBC'); $encryptedKey = $encrypter->encrypt($value, $serialize); return $encryptedKey; @@ -200,7 +200,7 @@ function decryptSettingsValue(mixed $payload, $unserialize = true) { $appKey = getenv('APP_KEY'); $appKey = base64_decode(Str::after($appKey, 'base64:')); - $encrypter = new Encrypter($appKey); + $encrypter = new Encrypter($appKey, 'AES-256-CBC'); $decryptedKey = $encrypter->decrypt($payload, $unserialize); return $decryptedKey; diff --git a/public/install/index.php b/public/install/index.php index b682a51a..688054b6 100644 --- a/public/install/index.php +++ b/public/install/index.php @@ -4,453 +4,438 @@ include 'functions.php'; if (file_exists('../../install.lock')) { exit("The installation has been completed already. Please delete the File 'install.lock' to re-run"); } + +function cardStart($title, $subtitle = null) +{ + return " +
+

ControlPanel.gg Installation

+
+

$title

" + . (isset($subtitle) ? "

$subtitle

" : ""); +} ?> + Controlpanel.gg installer Script - + + + - - -
- Controlpanel.GG -
-
'; - -if (!isset($_GET['step'])) { - echo $cardheader; ?> - -

HTTPS is required

- -

Write-permissions on .env-file

- -

php - version: (minimum required )

- -

mysql - version: (minimum required )

- -

Missing - php-extentions:

- - - - -

Git - version:

- -

Tar - version:

- - - - - -
-
+ -

Lets start with your Database

- " . $_GET['message'] . '

'; - } ?> -
+ // Getting started + if (!isset($_GET['step']) || $_GET['step'] == 1) { + if (!file_exists('../../.env')) { + echo run_console('cp .env.example .env'); + }; + ?> + -
-
-
-
- - -
-
-
-
- - -
-
-
-
- - -
-
-
-
- - -
-
-
-
- - -
-
+
    -
    -
    - - +
  • HTTPS is required
  • + +
  • Write-permissions on .env-file
  • + +
  • php + version: (minimum required )
  • + +
  • mysql + version: (minimum required )
  • + +
  • Missing + php-extentions:
  • + + + + +
  • Git + version:
  • + +
  • Tar + version:
  • +
+ +
+ + + + + + + + " . $_GET['message'] . '

'; + } ?> + +
+
+
+
+ + +
+
+
+ + +
+
+
+
+ + +
+
+
+
+ + +
+
+
+
+ + +
+
+ +
+
+ + +
+
+
- -
-
-
- - - - - -

Lets feed your Database and generate some security keys!

-

This process might take a while. Please do not refresh or close this page!

- " . $_GET['message'] . '

'; - } ?> - -
- - - -
- - - - - - -

Tell us something about your Host

- - " . $_GET['message'] . '

'; - } ?> - -
- - -
-
-
-
- - -
-
-
-
- - -
-
-
- - -
-
- - - - - - -

Lets get your E-Mails going!

-

This might take a few seconds when submitted!

- - " . $_GET['message'] . '

'; - } ?> - -
- - -
-
-
-
- - - -
-
-
-
- - -
-
- -
-
- - -
-
- -
-
- - -
-
- - -
-
- - -
-
- -
-
- - -
-
- +
+
+ +
- - - -
- - - - - - - + // DB Migration & APP_KEY Generation + if (isset($_GET['step']) && $_GET['step'] == 2.5) { -

Almost done!

-

Lets get some info about your Pterodactyl Installation!

+ echo cardStart($title = "Database Migration and Encryption Key Generation", $subtitle = "Lets feed your Database and generate some security keys!
This process might take a while. Please do not refresh or close this page!"); ?>
+ + + " . $_GET['message'] . '

'; + } ?> - " . $_GET['message'] . '

'; - } ?> - - - - -
-
-
-
- - - -
-
-
-
- - -
-
-
-
- - -
-
+
- - -
- - - - - - - -

Lets create yourself!

-

We're making the first Admin user

- " . $_GET['message'] . '

'; - } ?> - -
- -
-
- - +
+
-
-
-
- - + + + + + " . $_GET['message'] . '

'; + } ?> + +
+
+
+
+ + +
+
+
+
+ + +
+
+ +
+
+ +
+ +
+ +
+
-
-
-
- - + + + Please do not refresh or close this page!"); ?> + +
+ " . $_GET['message'] . '

'; + } ?> + +
+
+
+
+ + + +
+
+
+
+ + +
+
+ +
+
+ + +
+
+ +
+
+ + +
+
+ + +
+
+ + +
+
+ +
+
+ + +
+
+ +
+ + + +
+ +
+ +
+ + + + + +
+
- - - - - - - - - + -

All done!

-

You may navigate to your Dashboard now and log in!

- - - - + echo cardStart($title = "Pterodactyl Configuration", $subtitle = "Lets get some info about your Pterodactyl Installation!"); ?> + +
+ " . $_GET['message'] . '

'; + } ?> + +
+
+
+
+ + + +
+
+
+
+ + + [Found at: ptero.example.com/admin/api]
The key needs all + Read & Write permissions!
+
+
+
+
+ + + [Found at: ptero.example.com/account/api]
Your Account + needs to be an Admin!
+
+
-
- +
+ + + +
+ +
+
+ - + + +
+ + " . $_GET['message'] . '

'; + } ?> + + +
+
+ + + Found in the users-list on your pterodactyl dashboard +
+
+ +
+
+ + + This will be your new pterodactyl password aswell! +
+
+
+
+ + +
+
+ + + + +
+ +
+ +
+ + + + + + + + + + + + - + + \ No newline at end of file diff --git a/public/install/styles.css b/public/install/styles.css new file mode 100644 index 00000000..22f5b596 --- /dev/null +++ b/public/install/styles.css @@ -0,0 +1 @@ +/*! tailwindcss v3.3.1 | MIT License | https://tailwindcss.com*/*,:after,:before{box-sizing:border-box;border:0 solid #e2e8f0}:after,:before{--tw-content:""}html{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4;font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;font-feature-settings:normal;font-variation-settings:normal}body{margin:0;line-height:inherit}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,pre,samp{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:initial}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-family:inherit;font-size:100%;font-weight:inherit;line-height:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}[type=button],[type=reset],[type=submit],button{-webkit-appearance:button;background-color:initial;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:initial}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dd,dl,figure,h1,h2,h3,h4,h5,h6,hr,p,pre{margin:0}fieldset{margin:0}fieldset,legend{padding:0}menu,ol,ul{list-style:none;margin:0;padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{opacity:1;color:#94a3b8}input::placeholder,textarea::placeholder{opacity:1;color:#94a3b8}[role=button],button{cursor:pointer}:disabled{cursor:default}audio,canvas,embed,iframe,img,object,svg,video{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}[hidden]{display:none}*,::backdrop,:after,:before{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:#3b82f680;--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: }.container{width:100%}@media (min-width:640px){.container{max-width:640px}}@media (min-width:768px){.container{max-width:768px}}@media (min-width:1024px){.container{max-width:1024px}}@media (min-width:1280px){.container{max-width:1280px}}@media (min-width:1536px){.container{max-width:1536px}}.static{position:static}.absolute{position:absolute}.relative{position:relative}.m-0{margin:0}.mx-2{margin-left:.5rem;margin-right:.5rem}.my-6{margin-top:1.5rem;margin-bottom:1.5rem}.mb-1{margin-bottom:.25rem}.mb-2{margin-bottom:.5rem}.mb-3{margin-bottom:.75rem}.mt-2{margin-top:.5rem}.mt-4{margin-top:1rem}.box-border{box-sizing:border-box}.block{display:block}.inline{display:inline}.flex{display:flex}.hidden{display:none}.w-1\/3{width:33.333333%}.w-full{width:100%}.min-w-fit{min-width:-moz-fit-content;min-width:fit-content}.list-none{list-style-type:none}.flex-col{flex-direction:column}.items-center{align-items:center}.justify-center{justify-content:center}.justify-around{justify-content:space-around}.gap-4{gap:1rem}.gap-8{gap:2rem}.rounded-2xl{border-radius:1rem}.rounded-md{border-radius:.375rem}.border-2{border-width:2px}.border-4{border-width:4px}.border-\[\#2E373B\]{--tw-border-opacity:1;border-color:rgb(46 55 59/var(--tw-border-opacity))}.border-transparent{border-color:#0000}.bg-\[\#1D2125\]{--tw-bg-opacity:1;background-color:rgb(29 33 37/var(--tw-bg-opacity))}.bg-\[\#242A2E\]{--tw-bg-opacity:1;background-color:rgb(36 42 46/var(--tw-bg-opacity))}.bg-green-500\/90{background-color:#22c55ee6}.bg-sky-500{--tw-bg-opacity:1;background-color:rgb(14 165 233/var(--tw-bg-opacity))}.bg-yellow-500\/90{background-color:#eab308e6}.p-6{padding:1.5rem}.px-2{padding-left:.5rem;padding-right:.5rem}.px-4{padding-left:1rem;padding-right:1rem}.px-8{padding-left:2rem;padding-right:2rem}.py-1{padding-top:.25rem;padding-bottom:.25rem}.py-2{padding-top:.5rem;padding-bottom:.5rem}.pt-3{padding-top:.75rem}.text-center{text-align:center}.text-3xl{font-size:1.875rem;line-height:2.25rem}.text-xl{font-size:1.25rem;line-height:1.75rem}.font-bold{font-weight:700}.text-neutral-400{--tw-text-opacity:1;color:rgb(163 163 163/var(--tw-text-opacity))}.text-white{--tw-text-opacity:1;color:rgb(255 255 255/var(--tw-text-opacity))}.shadow-green-400{--tw-shadow-color:#4ade80;--tw-shadow:var(--tw-shadow-colored)}.shadow-sky-400{--tw-shadow-color:#38bdf8;--tw-shadow:var(--tw-shadow-colored)}.shadow-yellow-400{--tw-shadow-color:#facc15;--tw-shadow:var(--tw-shadow-colored)}.outline-none{outline:2px solid #0000;outline-offset:2px}.\[hostname\:port\]{hostname:port}.hover\:bg-green-600:hover{--tw-bg-opacity:1;background-color:rgb(22 163 74/var(--tw-bg-opacity))}.hover\:bg-sky-600:hover{--tw-bg-opacity:1;background-color:rgb(2 132 199/var(--tw-bg-opacity))}.hover\:bg-yellow-600:hover{--tw-bg-opacity:1;background-color:rgb(202 138 4/var(--tw-bg-opacity))}.focus\:border-sky-500:focus{--tw-border-opacity:1;border-color:rgb(14 165 233/var(--tw-border-opacity))}.focus\:outline:focus{outline-style:solid}.focus\:outline-2:focus{outline-width:2px}.focus\:outline-offset-2:focus{outline-offset:2px}.focus\:outline-green-500:focus{outline-color:#22c55e}.focus\:outline-sky-500:focus{outline-color:#0ea5e9}.focus\:outline-yellow-600:focus{outline-color:#ca8a04}@media (min-width:640px){.sm\:w-auto{width:auto}.sm\:min-w-\[550px\]{min-width:550px}} \ No newline at end of file diff --git a/public/install/tailwind.config.js b/public/install/tailwind.config.js new file mode 100644 index 00000000..5fc499bb --- /dev/null +++ b/public/install/tailwind.config.js @@ -0,0 +1,24 @@ +/** @type {import('tailwindcss').Config} */ +module.exports = { + content: ["./**/*.{html,php}"], + theme: { + extend: { + colors: { + gray: { + '50': "#f8fafc", + '100': "#f1f5f9", + '200': "#e2e8f0", + '300': "#cbd5e1", + '400': "#94a3b8", + '500': "#64748b", + '600': "#475569", + '700': "#334155", + '800': "#1e293b", + '900': "#0f172a", + '950': "#020617", + } + } + }, + }, + plugins: [], +} \ No newline at end of file diff --git a/public/install/tailwind_styles.css b/public/install/tailwind_styles.css new file mode 100644 index 00000000..13de0f34 --- /dev/null +++ b/public/install/tailwind_styles.css @@ -0,0 +1,10 @@ +/* + * You need to have `tailwindcss` packages installed for these commands to work. + * + * Build: `tailwindcss -i tailwind_styles.css -o styles.css -m` + * Dev: `tailwindcss -i tailwind_styles.css -o styles.css --watch` + */ + +@tailwind base; +@tailwind components; +@tailwind utilities; \ No newline at end of file