Browse Source

HOTFIX: Icons Upload ,Server overview 500, Installer APP_KEY overwrite

HOTFIX: Icons Upload and Server overview 500
Dennis 3 years ago
parent
commit
5f6ac6ce8f

+ 1 - 0
.gitignore

@@ -22,3 +22,4 @@ storage/invoices.zip
 storage/app/public/logo.png
 storage/app/public/logo.png
 *vscode
 *vscode
  - Kopie.env
  - Kopie.env
+public/install/logs.txt

+ 1 - 1
app/Classes/Pterodactyl.php

@@ -241,7 +241,7 @@ class Pterodactyl
      * @param int $pterodactylId
      * @param int $pterodactylId
      * @return mixed
      * @return mixed
      */
      */
-    public static function getServerAttributes(string $pterodactylId)
+    public static function getServerAttributes(int $pterodactylId)
     {
     {
         try {
         try {
             $response = self::client()->get("/application/servers/{$pterodactylId}?include=egg,node,nest,location");
             $response = self::client()->get("/application/servers/{$pterodactylId}?include=egg,node,nest,location");

+ 19 - 0
app/Classes/Settings/System.php

@@ -42,6 +42,9 @@ class System
                 ->withInput();
                 ->withInput();
         }
         }
 
 
+        // update Icons from request
+        $this->updateIcons($request);
+
 
 
         $values = [
         $values = [
             "SETTINGS::SYSTEM:REGISTER_IP_CHECK" => "register-ip-check",
             "SETTINGS::SYSTEM:REGISTER_IP_CHECK" => "register-ip-check",
@@ -70,4 +73,20 @@ class System
         }
         }
         return redirect(route('admin.settings.index') . '#system')->with('success', __('System settings updated!'));
         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');
+        }
+    }
 }
 }

+ 0 - 43
app/Http/Controllers/Admin/SettingsController.php

@@ -40,47 +40,4 @@ class SettingsController extends Controller
             'tabListItems' => $tabListItems,
             '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();
-    }
 }
 }

+ 5 - 1
bin/test.sh

@@ -71,7 +71,11 @@ if (isset($_POST['feedDB'])) {
     #$logs .= run_console('composer install --no-dev --optimize-autoloader');
     #$logs .= run_console('composer install --no-dev --optimize-autoloader');
     $logs .= run_console('php artisan migrate --seed --force');
     $logs .= run_console('php artisan migrate --seed --force');
     $logs .= run_console('php artisan db:seed --class=ExampleItemsSeeder --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');
     $logs .= run_console('php artisan storage:link');
 
 
     $logsfile = fopen("logs.txt", "w") or die("Unable to open file!");
     $logsfile = fopen("logs.txt", "w") or die("Unable to open file!");

+ 0 - 0
storage/app/.gitignore