Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Panel Installer #951

Merged
merged 26 commits into from
Jul 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
1c30f13
ADD: redis to php extention check of the panel installer
S0ly May 14, 2024
98ce2e3
FIX: trusted proxy depreciated issue
S0ly May 14, 2024
cea4e9e
implementing a mechanism to detect the absence of install.lock and re…
1day2die May 16, 2024
d13365e
Remove unused Middlewares
1day2die May 16, 2024
be6c5d7
fix: pterodactyl settings not getting encrypted during installation
zvikasdongre May 20, 2024
b747b7d
Merge pull request #1 from zvikasdongre/fix/panel-installer
S0ly May 20, 2024
de23e79
Merge branch 'development' into fix/panel-installer
S0ly Jun 9, 2024
392b601
refactor: added warning and deleted useless check in installer first …
S0ly Jun 9, 2024
0735530
Add redis configuration to installer
jameskitt616 Jun 11, 2024
8d0690d
Revert unnecessary changes in index.php
jameskitt616 Jun 11, 2024
fd6f0fd
Revert unnecessary changes in functions.php
jameskitt616 Jun 11, 2024
d89a805
Add docker check for mysql host
jameskitt616 Jun 11, 2024
03af8b3
Verify that redis config is valid and working
jameskitt616 Jun 11, 2024
c508b78
Fix some error handling on installer
jameskitt616 Jun 12, 2024
4ccea68
Add set timezone to install script
jameskitt616 Jun 12, 2024
d4a48a2
Resolve conflicts
jameskitt616 Jun 12, 2024
3136e18
Remove unnecessary variable
jameskitt616 Jun 12, 2024
effc8ac
Remove unnecessary whitespaces
jameskitt616 Jun 12, 2024
bb21c21
feat: Merge pull request #5 from jameskitt616/fix-panel-installer
S0ly Jun 13, 2024
cf198cf
Merge branch 'development' into fix/panel-installer
S0ly Jun 13, 2024
49eeae4
Merge branch 'development' into fix/panel-installer
S0ly Jun 24, 2024
51a2d49
Fix Installer migration failing to run because env encryption key is …
jameskitt616 Jun 29, 2024
96b601e
Update wrong log message
jameskitt616 Jun 29, 2024
b3d3124
Remove dedicated create APP_KEY form and move logic to DB config
jameskitt616 Jul 9, 2024
a67e0ab
Fix wrong next step number
jameskitt616 Jul 9, 2024
9b989a5
Merge pull request #6 from jameskitt616/fix-installer-migration
S0ly Jul 9, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# Ignore dependencies and cache
/.idea
/node_modules
/vendor
/storage/*.key
Expand Down
49 changes: 49 additions & 0 deletions app/Console/Commands/GetSettingCommand.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
<?php

namespace App\Console\Commands;

use Illuminate\Console\Command;

class GetSettingCommand extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'settings:get {class : Settings Class (Example: GeneralSettings)} {key} {--sameline : Outputs the result without newline, useful for implementing in scripts.}';

/**
* The console command description.
*
* @var string
*/
protected $description = 'Gets value of a setting key and decrypts it if needed.';

/**
* Execute the console command.
*
* @return int
*/
public function handle()
{

$class = $this->argument('class');
$key = $this->argument('key');
$sameline = $this->option('sameline');

try {
$settings_class = "App\\Settings\\$class";
$settings = new $settings_class();

$this->output->write($settings->$key, !$sameline);

return Command::SUCCESS;
} catch (\Throwable $th) {
$this->error('Error: ' . $th->getMessage());
return Command::FAILURE;
}

return Command::SUCCESS;
}
}
52 changes: 52 additions & 0 deletions app/Console/Commands/SetSettingCommand.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
<?php

namespace App\Console\Commands;

use Exception;
use Illuminate\Console\Command;

class SetSettingCommand extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'settings:set {class : Settings Class (Example: GeneralSettings)} {key : Unique setting key} {value : Value to set}';

/**
* The console command description.
*
* @var string
*/
protected $description = 'Set value of a setting key.';

/**
* Execute the console command.
*
* @return int
*/
public function handle()
{

$class = $this->argument('class');
$key = $this->argument('key');
$value = $this->argument('value');

try {
$settings_class = "App\\Settings\\$class";
$settings = new $settings_class();

$settings->$key = $value;

$settings->save();

$this->info("Successfully updated '$key'.");
} catch (\Throwable $th) {
$this->error('Error: ' . $th->getMessage());
return Command::FAILURE;
}

return Command::SUCCESS;
}
}
6 changes: 2 additions & 4 deletions app/Http/Kernel.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@

use App\Http\Middleware\ApiAuthToken;
use App\Http\Middleware\CheckSuspended;
use App\Http\Middleware\isAdmin;
use App\Http\Middleware\isMod;
use App\Http\Middleware\InstallerLock;
use App\Http\Middleware\LastSeen;
use Illuminate\Foundation\Http\Kernel as HttpKernel;

Expand Down Expand Up @@ -36,6 +35,7 @@ class Kernel extends HttpKernel
*/
protected $middlewareGroups = [
'web' => [
InstallerLock::class,
\App\Http\Middleware\EncryptCookies::class,
\Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class,
\Illuminate\Session\Middleware\StartSession::class,
Expand Down Expand Up @@ -70,8 +70,6 @@ class Kernel extends HttpKernel
'signed' => \Illuminate\Routing\Middleware\ValidateSignature::class,
'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class,
'verified' => \Illuminate\Auth\Middleware\EnsureEmailIsVerified::class,
'admin' => isAdmin::class,
'moderator' => isMod::class,
'api.token' => ApiAuthToken::class,
'checkSuspended' => CheckSuspended::class,
'role' => \Spatie\Permission\Middlewares\RoleMiddleware::class,
Expand Down
24 changes: 24 additions & 0 deletions app/Http/Middleware/InstallerLock.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?php

namespace App\Http\Middleware;

use Closure;
use Illuminate\Http\Request;

class InstallerLock
{
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure(\Illuminate\Http\Request): (\Illuminate\Http\Response|\Illuminate\Http\RedirectResponse) $next
* @return \Illuminate\Http\Response|\Illuminate\Http\RedirectResponse
*/
public function handle(Request $request, Closure $next)
{
if (!file_exists(base_path()."/install.lock")){
return redirect('/install');
}
return $next($request);
}
}
2 changes: 2 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
"require": {
"php": "^8.1",
"ext-intl": "*",
"ext-mysqli": "*",
"ext-curl": "*",
"biscolab/laravel-recaptcha": "^5.4",
"doctrine/dbal": "^3.5.3",
"guzzlehttp/guzzle": "^7.5",
Expand Down
Loading