Bläddra i källkod

Allocation limit added

AVMG20 4 år sedan
förälder
incheckning
6a431edd8b

+ 3 - 1
app/Classes/Pterodactyl.php

@@ -2,6 +2,7 @@
 
 namespace App\Classes;
 
+use App\Models\Configuration;
 use App\Models\Egg;
 use App\Models\Nest;
 use App\Models\Node;
@@ -124,7 +125,8 @@ class Pterodactyl
      */
     public static function getAllocations(Node $node)
     {
-        $response = self::client()->get("/application/nodes/{$node->id}/allocations");
+        $per_page = Configuration::getValueByKey('ALLOCATION_LIMIT' , 200);
+        $response = self::client()->get("/application/nodes/{$node->id}/allocations?per_page={$per_page}");
         if ($response->failed()) throw self::getException();
         return $response->json();
     }

+ 0 - 2
app/Http/Controllers/HomeController.php

@@ -2,8 +2,6 @@
 
 namespace App\Http\Controllers;
 
-use App\Models\UsefulLink;
-use Illuminate\Contracts\Support\Renderable;
 use Illuminate\Http\Request;
 use Illuminate\Support\Facades\Auth;
 use Illuminate\Support\Facades\DB;

+ 11 - 0
database/seeders/Seeds/ConfigurationSeeder.php

@@ -109,5 +109,16 @@ class ConfigurationSeeder extends Seeder
             'type'        => 'boolean',
             'description' => 'Prevent users from making multiple accounts using the same IP address'
         ]);
+
+        //per_page on allocations request
+        Configuration::firstOrCreate([
+            'key' => 'ALLOCATION_LIMIT',
+        ], [
+            'value'       => '200',
+            'type'        => 'integer',
+            'description' => 'The maximum amount of allocations to pull per node for automatic deployment, if more allocations are being used than this limit is set to, no new servers can be created!'
+        ]);
+
+
     }
 }