Updates, fixes, etc
This commit is contained in:
parent
fafe3f61c0
commit
2274013221
|
@ -51,5 +51,60 @@ class AppServiceProvider extends ServiceProvider
|
|||
|
||||
return $ok;
|
||||
});
|
||||
|
||||
//only run if the installer has been executed
|
||||
if (file_exists(public_path()."/install/install.lock")) {
|
||||
$settings = Settings::all();
|
||||
// Set all configs from database
|
||||
foreach ($settings as $setting) {
|
||||
config([$setting->key => $setting->value]);
|
||||
}
|
||||
|
||||
// Set Mail Config
|
||||
//only update config if mail settings have changed in DB
|
||||
if (
|
||||
config('mail.default') != config('SETTINGS:MAIL:MAILER') ||
|
||||
config('mail.mailers.smtp.host') != config('SETTINGS:MAIL:HOST') ||
|
||||
config('mail.mailers.smtp.port') != config('SETTINGS:MAIL:PORT') ||
|
||||
config('mail.mailers.smtp.username') != config('SETTINGS:MAIL:USERNAME') ||
|
||||
config('mail.mailers.smtp.password') != config('SETTINGS:MAIL:PASSWORD') ||
|
||||
config('mail.mailers.smtp.encryption') != config('SETTINGS:MAIL:ENCRYPTION') ||
|
||||
config('mail.from.address') != config('SETTINGS:MAIL:FROM_ADDRESS') ||
|
||||
config('mail.from.name') != config('SETTINGS:MAIL:FROM_NAME')
|
||||
) {
|
||||
config(['mail.default' => config('SETTINGS::MAIL:MAILER')]);
|
||||
config(['mail.mailers.smtp' => [
|
||||
'transport' => 'smtp',
|
||||
'host' => config('SETTINGS::MAIL:HOST'),
|
||||
'port' => config('SETTINGS::MAIL:PORT'),
|
||||
'encryption' => config('SETTINGS::MAIL:ENCRYPTION'),
|
||||
'username' => config('SETTINGS::MAIL:USERNAME'),
|
||||
'password' => config('SETTINGS::MAIL:PASSWORD'),
|
||||
'timeout' => null,
|
||||
'auth_mode' => null,
|
||||
]]);
|
||||
config(['mail.from' => ['address' => config('SETTINGS::MAIL:FROM_ADDRESS'), 'name' => config('SETTINGS::MAIL:FROM_NAME')]]);
|
||||
|
||||
Artisan::call('queue:restart');
|
||||
}
|
||||
|
||||
|
||||
// Set Recaptcha API Config
|
||||
//only update config if recaptcha settings have changed in DB
|
||||
if (
|
||||
config('recaptcha.api_site_key') != config('SETTINGS::RECAPTCHA:SITE_KEY') ||
|
||||
config('recaptcha.api_secret_key') != config('SETTINGS::RECAPTCHA:SECRET_KEY')
|
||||
) {
|
||||
config(['recaptcha.api_site_key' => config('SETTINGS::RECAPTCHA:SITE_KEY')]);
|
||||
config(['recaptcha.api_secret_key' => config('SETTINGS::RECAPTCHA:SECRET_KEY')]);
|
||||
|
||||
Artisan::call('config:clear');
|
||||
Artisan::call('cache:clear');
|
||||
}
|
||||
|
||||
// Set Discord-API Config
|
||||
config(['services.discord.client_id' => config('SETTINGS::DISCORD:CLIENT_ID')]);
|
||||
config(['services.discord.client_secret' => config('SETTINGS::DISCORD:CLIENT_SECRET')]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -35,14 +35,12 @@ if (isset($_POST['checkDB'])) {
|
|||
|
||||
foreach ($values as $key => $value) {
|
||||
$param = $_POST[$value];
|
||||
if ($key=="DB_PASSWORD"){
|
||||
$param ='"' . $_POST[$value] . '"';
|
||||
}
|
||||
# if ($key == "DB_PASSWORD") {
|
||||
# $param = '"' . $_POST[$value] . '"';
|
||||
# }
|
||||
setEnvironmentValue($key, $param);
|
||||
}
|
||||
|
||||
|
||||
|
||||
header("LOCATION: index.php?step=2.5");
|
||||
|
||||
}
|
||||
|
@ -68,8 +66,11 @@ if (isset($_POST['checkGeneral'])) {
|
|||
|
||||
if (isset($_POST['installComposer'])) {
|
||||
$logs = "";
|
||||
$logs .= run_console(putenv('COMPOSER_HOME=' . dirname(__FILE__, 3) . '/vendor/bin/composer'));
|
||||
$logs .= run_console('composer install --no-dev --optimize-autoloader');
|
||||
|
||||
#$logs .= run_console(putenv('COMPOSER_HOME=' . dirname(__FILE__, 3) . '/vendor/bin/composer'));
|
||||
#$logs .= run_console('composer install --no-dev --optimize-autoloader');
|
||||
$logs .= run_console('php artisan migrate --seed --force');
|
||||
$logs .= run_console('php artisan db:seed --class=ExampleItemsSeeder --force');
|
||||
$logs .= run_console('php artisan key:generate --force');
|
||||
$logs .= run_console('php artisan storage:link');
|
||||
|
||||
|
@ -83,9 +84,11 @@ if (isset($_POST['installComposer'])) {
|
|||
header("LOCATION: index.php?step=2.5&message=There was an error. Please check install/logs.txt !");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
if (isset($_POST['checkSMTP'])) {
|
||||
|
||||
try {
|
||||
$mail = new PHPMailer(true);
|
||||
|
||||
|
@ -114,21 +117,26 @@ if (isset($_POST['checkSMTP'])) {
|
|||
die();
|
||||
}
|
||||
|
||||
$db = new mysqli(getEnvironmentValue("DB_HOST"), getEnvironmentValue("DB_USERNAME"), getEnvironmentValue("DB_PASSWORD"), getEnvironmentValue("DB_DATABASE"), getEnvironmentValue("DB_PORT"));
|
||||
if ($db->connect_error) {
|
||||
header("LOCATION: index.php?step=4&message=Could not connect to the Database");
|
||||
die();
|
||||
}
|
||||
$values = [
|
||||
//SETTINGS::VALUE => REQUEST-VALUE (coming from the html-form)
|
||||
"MAIL_MAILER" => "method",
|
||||
"MAIL_HOST" => "host",
|
||||
"MAIL_PORT" => "port",
|
||||
"MAIL_USERNAME" => "user",
|
||||
"MAIL_PASSWORD" => "pass",
|
||||
"MAIL_ENCRYPTION" => "encryption",
|
||||
"MAIL_FROM_ADDRESS" => "user"
|
||||
"SETTINGS::MAIL:MAILER" => $_POST["method"],
|
||||
"SETTINGS::MAIL:HOST" => $_POST["host"],
|
||||
"SETTINGS::MAIL:PORT" => $_POST["port"],
|
||||
"SETTINGS::MAIL:USERNAME" => $_POST["user"],
|
||||
"SETTINGS::MAIL:PASSWORD" => $_POST["pass"],
|
||||
"SETTINGS::MAIL:ENCRYPTION" => $_POST["encryption"],
|
||||
"SETTINGS::MAIL:FROM_ADDRESS" => $_POST["user"]
|
||||
];
|
||||
|
||||
foreach ($values as $key => $value) {
|
||||
$param = $_POST[$value];
|
||||
setEnvironmentValue($key, $param);
|
||||
$query = "UPDATE `" . getEnvironmentValue("DB_DATABASE") . "`.`settings` SET `value` = '$value' WHERE (`key` = '$key')";
|
||||
$db->query($query);
|
||||
}
|
||||
|
||||
header("LOCATION: index.php?step=5");
|
||||
|
||||
|
||||
|
@ -162,8 +170,10 @@ if (isset($_POST['checkPtero'])) {
|
|||
header("LOCATION: index.php?step=5&message=Couldnt connect to Pterodactyl. Make sure your API key has all read and write permissions!");
|
||||
die();
|
||||
} else {
|
||||
$query1 = "UPDATE `dashboard`.`settings` SET `value` = '$url' WHERE (`key` = 'SETTINGS::SYSTEM:PTERODACTYL:URL')";
|
||||
$query2 = "UPDATE `dashboard`.`settings` SET `value` = '$key' WHERE (`key` = 'SETTINGS::SYSTEM:PTERODACTYL:TOKEN')";
|
||||
|
||||
$query1 = "UPDATE `" . getEnvironmentValue("DB_DATABASE") . "`.`settings` SET `value` = '$url' WHERE (`key` = 'SETTINGS::SYSTEM:PTERODACTYL:URL')";
|
||||
$query2 = "UPDATE `" . getEnvironmentValue("DB_DATABASE") . "`.`settings` SET `value` = '$key' WHERE (`key` = 'SETTINGS::SYSTEM:PTERODACTYL:TOKEN')";
|
||||
|
||||
|
||||
$db = new mysqli(getEnvironmentValue("DB_HOST"), getEnvironmentValue("DB_USERNAME"), getEnvironmentValue("DB_PASSWORD"), getEnvironmentValue("DB_DATABASE"), getEnvironmentValue("DB_PORT"));
|
||||
if ($db->connect_error) {
|
||||
|
@ -194,8 +204,10 @@ if (isset($_POST['createUser'])) {
|
|||
$pteroID = $_POST['pteroID'];
|
||||
$pass = $_POST['pass'];
|
||||
$repass = $_POST['repass'];
|
||||
$key = $db->query("SELECT `value` FROM dashboard.settings WHERE `key` = 'SETTINGS::SYSTEM:PTERODACTYL:TOKEN'")->fetch_assoc();
|
||||
$pterobaseurl = $db->query("SELECT `value` FROM dashboard.settings WHERE `key` = 'SETTINGS::SYSTEM:PTERODACTYL:URL'")->fetch_assoc();
|
||||
|
||||
$key = $db->query("SELECT `value` FROM `" . getEnvironmentValue("DB_DATABASE") . "`.`settings` WHERE `key` = 'SETTINGS::SYSTEM:PTERODACTYL:TOKEN'")->fetch_assoc();
|
||||
$pterobaseurl = $db->query("SELECT `value` FROM `" . getEnvironmentValue("DB_DATABASE") . "`.`settings` WHERE `key` = 'SETTINGS::SYSTEM:PTERODACTYL:URL'")->fetch_assoc();
|
||||
|
||||
|
||||
|
||||
$pteroURL = $pterobaseurl["value"] . "/api/application/users/" . $pteroID;
|
||||
|
@ -250,14 +262,16 @@ if (isset($_POST['createUser'])) {
|
|||
die();
|
||||
}
|
||||
|
||||
$query1 = "INSERT INTO `" . getEnvironmentValue("DB_DATABASE") . "`.`users` (`name`, `role`, `credits`, `server_limit`, `pterodactyl_id`, `email`, `password`, `created_at`) VALUES ('$name', 'admin', '250', '1', '$pteroID', '$mail', '$pass', CURRENT_TIMESTAMP)";
|
||||
|
||||
$query1 = "INSERT INTO `dashboard`.`users` (`name`, `role`, `credits`, `server_limit`, `pterodactyl_id`, `email`, `password`) VALUES ('$name', 'admin', '250', '1', '$pteroID', '$mail', '$pass')";
|
||||
|
||||
|
||||
if ($db->query($query1)) {
|
||||
header("LOCATION: index.php?step=7");
|
||||
} else {
|
||||
|
||||
header("LOCATION: index.php?step=6&message=Something went wrong when communicating with the Database!");
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -95,7 +95,8 @@ function setEnvironmentValue($envKey, $envValue)
|
|||
fclose($fp);
|
||||
}
|
||||
|
||||
function getEnvironmentValue($envKey){
|
||||
function getEnvironmentValue($envKey)
|
||||
{
|
||||
$envFile = dirname(__FILE__, 3) . "/.env";
|
||||
$str = file_get_contents($envFile);
|
||||
|
||||
|
@ -106,11 +107,14 @@ function getEnvironmentValue($envKey){
|
|||
$value = substr($oldLine, strpos($oldLine, "=") + 1);
|
||||
|
||||
|
||||
|
||||
return $value;
|
||||
|
||||
}
|
||||
|
||||
function run_console($command){
|
||||
|
||||
function run_console($command)
|
||||
{
|
||||
$path = dirname(__FILE__, 3);
|
||||
$cmd = "cd '$path' && bash -c 'exec -a ServerCPP $command' 2>&1";
|
||||
return shell_exec($cmd);
|
||||
|
|
|
@ -54,8 +54,10 @@ $cardheader = '
|
|||
|
||||
if (!isset($_GET['step'])) {
|
||||
|
||||
|
||||
if (!file_exists("../../.env")) {
|
||||
echo run_console('cp .env.example .env');
|
||||
|
||||
}
|
||||
echo $cardheader;
|
||||
?>
|
||||
|
@ -72,8 +74,10 @@ if (!isset($_GET['step'])) {
|
|||
foreach (checkExtensions() as $ext) {
|
||||
echo $ext . ", ";
|
||||
}
|
||||
|
||||
print(sizeof(checkExtensions()) == 0 ? "" : "(Proceed anyway)"); ?></p>
|
||||
|
||||
|
||||
<!-- <p class="<?php print(getZipVersion() === "OK" ? "ok" : "notok"); ?>"> Zip
|
||||
version: <?php echo getZipVersion(); ?> </p> -->
|
||||
|
||||
|
@ -169,7 +173,7 @@ echo $cardheader;
|
|||
if (isset($_GET['step']) && $_GET['step'] == 2.5) {
|
||||
echo $cardheader;
|
||||
?>
|
||||
<p class="login-box-msg">Lets install Composer!</p>
|
||||
<p class="login-box-msg">Lets install Composer and generate some security keys!</p>
|
||||
<p> This process might take a while. Please do not refresh or close this page!</p>
|
||||
<?php if (isset($_GET['message'])) {
|
||||
echo "<p class='notok'>" . $_GET['message'] . "</p>";
|
||||
|
@ -191,10 +195,12 @@ echo $cardheader;
|
|||
<?php
|
||||
}
|
||||
|
||||
|
||||
if (isset($_GET['step']) && $_GET['step'] == 3) {
|
||||
echo $cardheader;
|
||||
?>
|
||||
<p class="login-box-msg">Tell us something about your Host</p>
|
||||
|
||||
<?php if (isset($_GET['message'])) {
|
||||
echo "<p class='notok'>" . $_GET['message'] . "</p>";
|
||||
}
|
||||
|
@ -203,6 +209,7 @@ echo $cardheader;
|
|||
<form method="POST" enctype="multipart/form-data" class="mb-3"
|
||||
action="/install/forms.php" name="checkGeneral">
|
||||
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<div class="form-group">
|
||||
|
@ -222,7 +229,6 @@ echo $cardheader;
|
|||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<button class="btn btn-primary" name="checkGeneral">Submit</button>
|
||||
|
@ -239,14 +245,17 @@ echo $cardheader;
|
|||
?>
|
||||
<p class="login-box-msg">Lets get your E-Mails going! </p>
|
||||
<p class="login-box-msg">This might take a few seconds when submitted! </p>
|
||||
|
||||
<?php if (isset($_GET['message'])) {
|
||||
echo "<p class='notok'>" . $_GET['message'] . "</p>";
|
||||
}
|
||||
?>
|
||||
|
||||
<form method="POST" enctype="multipart/form-data" class="mb-3"
|
||||
|
||||
action="/install/forms.php" name="checkSMTP">
|
||||
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<div class="form-group">
|
||||
|
@ -255,6 +264,7 @@ echo $cardheader;
|
|||
<input id="method" name="method"
|
||||
type="text" required
|
||||
value="smtp" class="form-control">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
|
@ -306,6 +316,8 @@ echo $cardheader;
|
|||
</div>
|
||||
|
||||
<button class="btn btn-primary" name="checkSMTP">Submit</button>
|
||||
<a href="?step=5"><button class="btn btn-warning">Skip this step</button></a>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
@ -314,40 +326,14 @@ echo $cardheader;
|
|||
|
||||
<?php
|
||||
}
|
||||
|
||||
if (isset($_GET['step']) && $_GET['step'] == 5) {
|
||||
if (isset($_GET['exec'])) {
|
||||
$resp = "";
|
||||
$resp = run_console('php artisan migrate --seed --force');
|
||||
$resp .= run_console('php artisan db:seed --class=ExampleItemsSeeder --force');
|
||||
$logsfile = fopen("logs.txt", "w") or die("Unable to open file!");
|
||||
fwrite($logsfile, $resp);
|
||||
fclose($logsfile);
|
||||
}
|
||||
|
||||
echo $cardheader;
|
||||
?>
|
||||
|
||||
<p class="login-box-msg">Almost done! </p>
|
||||
<p class="login-box-msg">Lets get some info about your Pterodactyl Installation!</p>
|
||||
<p class="alert alert-warning" role="alert">Before filling these information, make sure to click the button below</p>
|
||||
<?php
|
||||
if (!isset($resp)) { ?>
|
||||
|
||||
<a href="?step=5&exec">
|
||||
<button class="btn btn-success">Run DB-Seeding!</button>
|
||||
|
||||
</a>
|
||||
<?php } else {
|
||||
echo
|
||||
"<div class='alert alert-info'>";
|
||||
if(str_contains($resp,"Database seeding completed successfully.")){
|
||||
echo "All done!";
|
||||
}else{
|
||||
|
||||
"There was an error. Check /install/logs.txt";
|
||||
}
|
||||
echo "</div>";
|
||||
}
|
||||
?>
|
||||
|
||||
|
||||
<?php if (isset($_GET['message'])) {
|
||||
|
@ -356,12 +342,15 @@ echo $cardheader;
|
|||
?>
|
||||
|
||||
<form method="POST" enctype="multipart/form-data" class="mb-3"
|
||||
|
||||
action="/install/forms.php" name="checkPtero">
|
||||
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<div class="form-group">
|
||||
<div class="custom-control mb-3">
|
||||
|
||||
<label for="url">Pterodactyl URL</label>
|
||||
<input id="url" name="url"
|
||||
type="text" required
|
||||
|
@ -381,7 +370,10 @@ echo $cardheader;
|
|||
|
||||
</div>
|
||||
|
||||
<button <?php if(!isset($_GET['exec'])){echo "disabled";} ?> class="btn btn-primary" name="checkPtero">Submit</button>
|
||||
<button <?php if (!isset($_GET['exec'])) {
|
||||
echo "disabled";
|
||||
} ?> class="btn btn-primary" name="checkPtero">Submit
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
|
0
public/install/install.lock
Normal file
0
public/install/install.lock
Normal file
16
public/install/logs.txt
Normal file
16
public/install/logs.txt
Normal file
|
@ -0,0 +1,16 @@
|
|||
Nothing to migrate.
|
||||
Seeding: Database\Seeders\Seeds\SettingsSeeder
|
||||
Seeded: Database\Seeders\Seeds\SettingsSeeder (38.00ms)
|
||||
Database seeding completed successfully.
|
||||
Seeding: Database\Seeders\Seeds\ProductSeeder
|
||||
Seeded: Database\Seeders\Seeds\ProductSeeder (100.42ms)
|
||||
Seeding: Database\Seeders\Seeds\CreditProductSeeder
|
||||
Seeded: Database\Seeders\Seeds\CreditProductSeeder (18.76ms)
|
||||
Seeding: Database\Seeders\Seeds\ApplicationApiSeeder
|
||||
Seeded: Database\Seeders\Seeds\ApplicationApiSeeder (3.40ms)
|
||||
Seeding: Database\Seeders\Seeds\UsefulLinksSeeder
|
||||
Seeded: Database\Seeders\Seeds\UsefulLinksSeeder (7.57ms)
|
||||
Database seeding completed successfully.
|
||||
Application key set successfully.
|
||||
The [/windir/c/Users/leipe/Desktop/dashboard/public/storage] link already exists.
|
||||
The links have been created.
|
|
@ -23,7 +23,6 @@
|
|||
<!-- MAIN CONTENT -->
|
||||
<section class="content">
|
||||
<div class="container-fluid">
|
||||
|
||||
<div class="card">
|
||||
|
||||
<div class="card-header">
|
||||
|
|
Loading…
Reference in a new issue