mirror of
https://github.com/EQEmu/Server.git
synced 2026-01-03 18:53:52 +00:00
129 lines
4.3 KiB
HTML
129 lines
4.3 KiB
HTML
<?
|
|
my $action = $request->get("action", "none");
|
|
my $launcher_name = $request->get("launcher_name", "none");
|
|
if($launcher_name eq "" || $launcher_name eq "none") {
|
|
print "{";
|
|
print "\"status\" : 0, ";
|
|
print "\"message\" : \"Missing launcher name in Remove action\"";
|
|
print "}";
|
|
return;
|
|
}
|
|
|
|
if($action eq "add") {
|
|
my $dynamic_count = $request->get("dynamic_count", "0");
|
|
if($dynamic_count < 0 || $dynamic_count > 254) {
|
|
print "{";
|
|
print "\"status\" : 0, ";
|
|
print "\"message\" : \"Invalid dynamics count in Add action\"";
|
|
print "}";
|
|
return;
|
|
} else {
|
|
$EQW->CreateLauncher($launcher_name, $dynamic_count);
|
|
}
|
|
} elsif($action eq "remove") {
|
|
my $l = $EQW->GetLauncher($launcher_name);
|
|
if(!$l) {
|
|
print "{";
|
|
print "\"status\" : 0, ";
|
|
print "\"message\" : \"Launcher not found during Remove action\"";
|
|
print "}";
|
|
return;
|
|
}
|
|
$l->DeleteLauncher();
|
|
} elsif($action eq "boot") {
|
|
my $zone = $request->get("zone", "none");
|
|
my $port = $request->get("port", "0");
|
|
if($zone eq "none" || $zone eq "") {
|
|
print "{";
|
|
print "\"status\" : 0, ";
|
|
print "\"message\" : \"Missing zone name in Boot action\"";
|
|
print "}";
|
|
return;
|
|
}
|
|
|
|
if($port < 0 || $port > 65535) {
|
|
print "{";
|
|
print "\"status\" : 0, ";
|
|
print "\"message\" : \"Port out of range in Boot action\"";
|
|
print "}";
|
|
return;
|
|
}
|
|
|
|
if(!$config->BootStaticZone($zone, $port)) {
|
|
print "{";
|
|
print "\"status\" : 0, ";
|
|
print "\"message\" : \"Failed to boot '$zone' on launcher $launcher_name with port $port. Invalid zone?\"";
|
|
print "}";
|
|
return;
|
|
}
|
|
} elsif($action eq "change_dynamic_count") {
|
|
my $dynamic_count = $request->get("dynamic_count", "0");
|
|
$config->SetDynamicCount($dynamic_count);
|
|
} elsif($action eq "remove_zone") {
|
|
my $zone = $request->get("zone", "none");
|
|
if($zone eq "none" || $zone eq "") {
|
|
print "{";
|
|
print "\"status\" : 0, ";
|
|
print "\"message\" : \"Invalid zone name in Remove Zone action.\"";
|
|
print "}";
|
|
return;
|
|
} else {
|
|
if(!$config->DeleteStaticZone($zone)) {
|
|
print "{";
|
|
print "\"status\" : 0, ";
|
|
print "\"message\" : \"Failed to remove '$zone' on launcher $launcher_name. Invalid zone?\"";
|
|
print "}";
|
|
return;
|
|
}
|
|
}
|
|
} elsif($action eq "reboot_all") {
|
|
foreach my $z($config->ListZones()) {
|
|
$config->RestartZone($z);
|
|
}
|
|
} elsif($action eq "stop_all") {
|
|
foreach my $z($config->ListZones()) {
|
|
$config->StopZone($z);
|
|
}
|
|
} elsif($action eq "start_all") {
|
|
foreach my $z($config->ListZones()) {
|
|
$config->StartZone($z);
|
|
}
|
|
} elsif($action eq "restart_zone") {
|
|
my $zone = $request->get("zone", "none");
|
|
if($zone eq "none" || $zone eq "") {
|
|
print "{";
|
|
print "\"status\" : 0, ";
|
|
print "\"message\" : \"Invalid zone name in Restart Zone action.\"";
|
|
print "}";
|
|
return;
|
|
} else {
|
|
$config->RestartZone($zone);
|
|
}
|
|
} elsif($action eq "start_zone") {
|
|
my $zone = $request->get("zone", "none");
|
|
if($zone eq "none" || $zone eq "") {
|
|
print "{";
|
|
print "\"status\" : 0, ";
|
|
print "\"message\" : \"Invalid zone name in Start Zone action.\"";
|
|
print "}";
|
|
return;
|
|
} else {
|
|
$config->StartZone($zone);
|
|
}
|
|
} elsif($action eq "stop_zone") {
|
|
my $zone = $request->get("zone", "none");
|
|
if($zone eq "none" || $zone eq "") {
|
|
print "{";
|
|
print "\"status\" : 0, ";
|
|
print "\"message\" : \"Invalid zone name in Stop Zone action.\"";
|
|
print "}";
|
|
return;
|
|
} else {
|
|
$config->StopZone($zone);
|
|
}
|
|
}
|
|
|
|
print "{";
|
|
print "\"status\" : 1";
|
|
print "}";
|
|
?> |