Skip to content

Commit

Permalink
HOTFIX: Icons Upload ,Server overview 500, Installer APP_KEY overwrite
Browse files Browse the repository at this point in the history
HOTFIX: Icons Upload and Server overview 500
  • Loading branch information
1day2die authored Feb 7, 2022
2 parents 4bab861 + d3f7e19 commit 5f6ac6c
Show file tree
Hide file tree
Showing 17 changed files with 26 additions and 45 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,4 @@ storage/invoices.zip
storage/app/public/logo.png
*vscode
- Kopie.env
public/install/logs.txt
2 changes: 1 addition & 1 deletion app/Classes/Pterodactyl.php
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ public function getUser(int $pterodactylId)
* @param int $pterodactylId
* @return mixed
*/
public static function getServerAttributes(string $pterodactylId)
public static function getServerAttributes(int $pterodactylId)
{
try {
$response = self::client()->get("/application/servers/{$pterodactylId}?include=egg,node,nest,location");
Expand Down
19 changes: 19 additions & 0 deletions app/Classes/Settings/System.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ public function updateSettings(Request $request)
->withInput();
}

// update Icons from request
$this->updateIcons($request);


$values = [
"SETTINGS::SYSTEM:REGISTER_IP_CHECK" => "register-ip-check",
Expand Down Expand Up @@ -70,4 +73,20 @@ public function updateSettings(Request $request)
}
return redirect(route('admin.settings.index') . '#system')->with('success', __('System settings updated!'));
}

private function updateIcons(Request $request)
{
$request->validate([
'icon' => 'nullable|max:10000|mimes:jpg,png,jpeg',
'favicon' => 'nullable|max:10000|mimes:ico',
]);

if ($request->hasFile('icon')) {
$request->file('icon')->storeAs('public', 'icon.png');
}

if ($request->hasFile('favicon')) {
$request->file('favicon')->storeAs('public', 'favicon.ico');
}
}
}
43 changes: 0 additions & 43 deletions app/Http/Controllers/Admin/SettingsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,47 +40,4 @@ public function index()
'tabListItems' => $tabListItems,
]);
}


public function updatevalue(Request $request)
{
$setting = Settings::findOrFail($request->input('key'));

$request->validate([
'key' => 'required|string|max:191',
'value' => 'required|string|max:191',
]);

$setting->update($request->all());

return redirect()->route('admin.settings.index')->with('success', __('configuration has been updated!'));
}

/**
* Remove the specified resource from storage.
*
* @param Settings $setting
* @return Response
*/
public function destroy(Settings $setting)
{
//
}

public function datatable()
{
$query = Settings::where('key', 'like', '%SYSTEM%')
->orWhere('key', 'like', '%USER%')
->orWhere('key', 'like', '%SERVER%');

return datatables($query)
->addColumn('actions', function (Settings $setting) {
return '<button data-content="' . __("Edit") . '" data-toggle="popover" data-trigger="hover" data-placement="top" onclick="configuration.parse(\'' . $setting->key . '\',\'' . $setting->value . '\',\'' . $setting->type . '\')" data-content="Edit" data-trigger="hover" data-toggle="tooltip" class="btn btn-sm btn-info mr-1"><i class="fas fa-pen"></i></button> ';
})
->editColumn('created_at', function (Settings $setting) {
return $setting->created_at ? $setting->created_at->diffForHumans() : '';
})
->rawColumns(['actions'])
->make();
}
}
Empty file modified bin/test.sh
100755 → 100644
Empty file.
Empty file modified bootstrap/cache/.gitignore
100755 → 100644
Empty file.
Empty file modified config/trustedproxy.php
100755 → 100644
Empty file.
6 changes: 5 additions & 1 deletion public/install/forms.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,11 @@
#$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');
if (strpos(getEnvironmentValue("APP_KEY"), 'base64') === false) {
$logs .= run_console('php artisan key:generate --force');
}else{
$logs .= "Key already exists. Skipping\n";
}
$logs .= run_console('php artisan storage:link');

$logsfile = fopen("logs.txt", "w") or die("Unable to open file!");
Expand Down
Empty file modified storage/app/.gitignore
100755 → 100644
Empty file.
Empty file modified storage/app/public/.gitignore
100755 → 100644
Empty file.
Empty file modified storage/framework/.gitignore
100755 → 100644
Empty file.
Empty file modified storage/framework/cache/.gitignore
100755 → 100644
Empty file.
Empty file modified storage/framework/cache/data/.gitignore
100755 → 100644
Empty file.
Empty file modified storage/framework/sessions/.gitignore
100755 → 100644
Empty file.
Empty file modified storage/framework/testing/.gitignore
100755 → 100644
Empty file.
Empty file modified storage/framework/views/.gitignore
100755 → 100644
Empty file.
Empty file modified storage/logs/.gitignore
100755 → 100644
Empty file.

0 comments on commit 5f6ac6c

Please sign in to comment.