Initial Release v1.0.0: Full feature set with Docker automation, Nginx/Alpine stack

This commit is contained in:
dyzulk
2026-01-16 11:21:32 +07:00
commit 45623973a8
139 changed files with 24302 additions and 0 deletions

View File

@@ -0,0 +1,47 @@
<?php
namespace App\Controllers;
use App\Core\Controller;
use App\Models\Config;
use App\Libraries\RouterOSAPI;
class SystemController extends Controller
{
// Reboot Router
public function reboot($session)
{
$this->executeCommand($session, '/system/reboot');
}
// Shutdown Router
public function shutdown($session)
{
$this->executeCommand($session, '/system/shutdown');
}
private function executeCommand($session, $command)
{
$configModel = new Config();
$config = $configModel->getSession($session);
if (!$config) {
header('Content-Type: application/json');
echo json_encode(['error' => 'Session not found']);
return;
}
$API = new RouterOSAPI();
if ($API->connect($config['ip_address'], $config['username'], $config['password'])) {
$API->write($command);
// Wait for command to be processed before cutting connection
sleep(2);
$API->disconnect();
header('Content-Type: application/json');
echo json_encode(['success' => true]);
} else {
header('Content-Type: application/json');
echo json_encode(['error' => 'Connection failed']);
}
}
}