dagelijksdutchgaming/flock-control

A Pterodactyl Panel addon that allows users to start and stop all their servers at once

1.3.0 2025-03-27 18:37 UTC

This package is not auto-updated.

Last update: 2025-05-22 18:19:29 UTC


README

A Pterodactyl Panel addon that allows users to start and stop all their servers at once.

Features

  • Start/stop all servers owned by the user
  • Support for subusers with proper permissions
  • Rate limiting to prevent server overload
  • Direct Wings daemon integration
  • Easy to use interface
  • Debug-friendly with GET endpoints for testing

Requirements

  • PHP 8.2 or higher
  • Pterodactyl Panel 1.0 or higher
  • Laravel Framework 10.0 or higher

Installation

  1. Add the repository to your composer.json:

    {
     "repositories": [
         {
             "type": "vcs",
             "url": "https://gitlab.com/dagelijksdutchgaming/flockcontrol.git"
         }
     ]
    }
    
  2. Install the package:

    composer require dagelijksdutchgaming/flock-control:^1.1
    
  3. Publish the assets:

    php artisan vendor:publish --provider="FlockControl\Providers\BulkServerControlServiceProvider" --tag="flock-control"
    
  4. Clear the cache:

    php artisan config:clear
    php artisan cache:clear
    php artisan view:clear
    

Configuration

The package can be configured in config/flock-control.php:

return [
    'route_prefix' => 'flock-control',
    'middleware' => ['web', 'auth'],
    'actions' => [
        'max_concurrent' => env('FLOCK_CONTROL_MAX_CONCURRENT', 10),
        'delay_between' => env('FLOCK_CONTROL_ACTION_DELAY', 1),
    ],
];

Usage

Browser Testing

You can test the functionality directly in your browser:

http://your-panel/flock-control/power/start-all
http://your-panel/flock-control/power/stop-all

Both endpoints support both GET and POST requests for flexible testing.

JavaScript Integration

// Start all servers
fetch('/flock-control/power/start-all', {
    method: 'POST',
    headers: {
        'X-CSRF-TOKEN': document.querySelector('meta[name="csrf-token"]').content
    }
});

// Stop all servers
fetch('/flock-control/power/stop-all', {
    method: 'POST',
    headers: {
        'X-CSRF-TOKEN': document.querySelector('meta[name="csrf-token"]').content
    }
});

Response Format

The endpoints return a JSON response with the following structure:

{
    "status": "success|partial",
    "message": "X servers successfully started/stopped, Y servers failed",
    "total_servers": 10,
    "successful_actions": 8,
    "failed_actions": 2,
    "results": [
        {
            "server_id": 1,
            "name": "Server 1",
            "status": "success|error",
            "message": "Server start/stop action successful|Error message",
            "timestamp": "2024-03-27T12:00:00Z"
        }
    ],
    "timestamp": "2024-03-27T12:00:00Z"
}

Security

  • All routes are protected by authentication
  • Rate limiting prevents abuse
  • Proper permission checks for subusers
  • Direct Wings daemon integration for better security

Contributing

  1. Fork the repository
  2. Create your feature branch
  3. Commit your changes
  4. Push to the branch
  5. Create a new Pull Request

License

This package is open-sourced software licensed under the MIT license.

Support

If you discover any security-related issues, please email info@dagelijksdutchgaming.nl instead of using the issue tracker.

For general issues, please use the GitHub issue tracker.

Credits

Changelog

Please see CHANGELOG for more information on what has changed recently.