From 06880da7b69517836911dff4bb06f3e608a8a1ca Mon Sep 17 00:00:00 2001 From: AleaJactaEst Date: Tue, 9 Oct 2018 18:03:04 +0200 Subject: [PATCH] update server to use new functionnality openal-manager --- server/common/rootweb/opennelmanager.php | 49 +++-- .../common/rootweb/opennelmanager_admin.php | 170 +++++++++++++++++ .../common/rootweb/opennelmanager_config.php | 158 ++++++++++++++++ .../common/rootweb/opennelmanager_filter.php | 163 +++++++++++++++++ server/common/rootweb/opennelmanager_info.php | 158 ++++++++++++++++ server/common/rootweb/opennelmanager_log.php | 42 +++-- .../common/rootweb/opennelmanager_player.php | 171 ++++++++++++++++++ server/debian/common/khaganat.cfg | 20 ++ 8 files changed, 898 insertions(+), 33 deletions(-) create mode 100644 server/common/rootweb/opennelmanager_admin.php create mode 100644 server/common/rootweb/opennelmanager_config.php create mode 100644 server/common/rootweb/opennelmanager_filter.php create mode 100644 server/common/rootweb/opennelmanager_info.php create mode 100644 server/common/rootweb/opennelmanager_player.php diff --git a/server/common/rootweb/opennelmanager.php b/server/common/rootweb/opennelmanager.php index 206c87f..696db7a 100644 --- a/server/common/rootweb/opennelmanager.php +++ b/server/common/rootweb/opennelmanager.php @@ -67,8 +67,8 @@ table, th, td { xhr.open("POST", url, true); xhr.setRequestHeader("content-type", "application/json"); xhr.onreadystatechange = function () { - console.log(xhr.readyState); - console.log(xhr.status); + console.log(xhr.readyState); + console.log(xhr.status); if (xhr.readyState === 4 && xhr.status === 200) { //var json = JSON.parse(xhr.responseText); console.log(xhr.responseText); @@ -86,8 +86,8 @@ table, th, td { xhr.open("POST", url, true); xhr.setRequestHeader("content-type", "application/json"); xhr.onreadystatechange = function () { - console.log(xhr.readyState); - console.log(xhr.status); + console.log(xhr.readyState); + console.log(xhr.status); if (xhr.readyState === 4 && xhr.status === 200) { //var json = JSON.parse(xhr.responseText); console.log(xhr.responseText); @@ -149,7 +149,7 @@ table, th, td { function get_port($filecfg) { - // $ini_array = parse_ini_file($filecfg); + // $ini_array = parse_ini_file($filecfg); // return "${ini_array['port']}"; $fp = fopen($filecfg, "r"); @@ -163,7 +163,7 @@ function get_port($filecfg) } } fclose($fp); - } + } return "8000"; } @@ -178,7 +178,7 @@ if (file_exists('/home/gameserver/opennelmanager.flag')) { // Initiate curl $ch = curl_init(); curl_setopt($ch, CURLOPT_URL,$url); - curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); + curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); // Execute $result=curl_exec($ch); // Closing @@ -188,23 +188,40 @@ if (file_exists('/home/gameserver/opennelmanager.flag')) { $total=count($data); echo '
Number command:'.$total.'
'; echo ""; - echo ""; + echo ""; ksort($data); foreach ($data as $key => $value) { - if ( $value == 'started' ) { - $fond = "bgcolor=\"SpringGreen \""; - } else { - $fond = "bgcolor=\"Tomato\""; - } - list($type, $command) = explode(':', $key, 2); - echo ""; + list($val1, $val2) = explode(':', $value, 2); + $state=$value['state']; + $number_launch=$value['number_launch']; + $number_launch=$value['number_launch']; + $last_line=$value['last_line']; + $filter=$value['filter']; + $egs=$value['egs']; + $extra=""; + if ( $state == 'started' ) { + $fond = "bgcolor=\"SpringGreen \""; + } else { + $fond = "bgcolor=\"Tomato\""; + } + if ( $filter == 'True' ) { + $extra="$extra filter"; + } + if ( $egs == 'True' ) { + $extra="$extra player"; + $extra="$extra admin"; + } + list($type, $command) = explode(':', $key, 2); + echo ""; + echo "<"; + echo "td align=\"right\">$number_launch"; + echo ""; } echo "
CommandStartStopStateLog
CommandStartStopStateNum. launchLast line logDetail
$command$valuelog
$command$state$last_linelog config info $extra
"; } else { echo "OpenNelManager not used"; } - } else { echo "OpenNelManager not actiavted"; } diff --git a/server/common/rootweb/opennelmanager_admin.php b/server/common/rootweb/opennelmanager_admin.php new file mode 100644 index 0000000..a8ad93a --- /dev/null +++ b/server/common/rootweb/opennelmanager_admin.php @@ -0,0 +1,170 @@ + + + + Test Khanat Config + + + + + + + + +

+ Home + OpenNelManager"; +} else { + echo "opennelmanager not used"; +} +?> + Administration + phpmyadmin + patch +

+
KHANAT SERVER DOCKER (TEST ENVIRONMENT - ADMIN COMMAND)
+
+ +"; + echo "Line"; + foreach ($data as $key => $value) + { + foreach ($value as $key2 => $value2) + { + echo "$key2"; + } + break; + } + echo ""; + foreach ($data as $key => $value) + { + echo "$key"; + foreach ($value as $key2 => $value2) + { + echo "$value2"; + } + } + echo ""; +} else { + echo "OpenNelManager not enabled"; +} +?> +

+
+ Command line : +
+ curl -XGET --header "content-type: application/json" -d '' +
+
+

+ + diff --git a/server/common/rootweb/opennelmanager_config.php b/server/common/rootweb/opennelmanager_config.php new file mode 100644 index 0000000..ec6a2a3 --- /dev/null +++ b/server/common/rootweb/opennelmanager_config.php @@ -0,0 +1,158 @@ + + + + Test Khanat Config + + + + + + + + +

+ Home + OpenNelManager"; +} else { + echo "opennelmanager not used"; +} +?> + Administration + phpmyadmin + patch +

+
KHANAT SERVER DOCKER (TEST ENVIRONMENT - CONFIG)
+
+ +"; + echo "KeyValue"; + ksort($data); + foreach ($data as $key => $value) + { + echo "$key$value"; + } + echo ""; + +} else { + echo "OpenNelManager not enabled"; +} +?> +

+
+ Command line : +
+ curl -XGET --header "content-type: application/json" -d '' +
+
+

+ + diff --git a/server/common/rootweb/opennelmanager_filter.php b/server/common/rootweb/opennelmanager_filter.php new file mode 100644 index 0000000..4241383 --- /dev/null +++ b/server/common/rootweb/opennelmanager_filter.php @@ -0,0 +1,163 @@ + + + + Test Khanat Config + + + + + + + + +

+ Home + OpenNelManager"; +} else { + echo "opennelmanager not used"; +} +?> + Administration + phpmyadmin + patch +

+
KHANAT SERVER DOCKER (TEST ENVIRONMENT - FILTER)
+
+ + $value) + { + echo "

$key
"; + echo ""; + echo ""; + foreach ($value as $key2 => $value2) + { + echo ""; + } + echo "
KeyValue
$key2$value2
"; + echo "

"; + } + +} else { + echo "OpenNelManager not enabled"; +} +?> +

+
+ Command line : +
+ curl -XGET --header "content-type: application/json" -d '' +
+
+

+ + diff --git a/server/common/rootweb/opennelmanager_info.php b/server/common/rootweb/opennelmanager_info.php new file mode 100644 index 0000000..db8766f --- /dev/null +++ b/server/common/rootweb/opennelmanager_info.php @@ -0,0 +1,158 @@ + + + + Test Khanat Config + + + + + + + + +

+ Home + OpenNelManager"; +} else { + echo "opennelmanager not used"; +} +?> + Administration + phpmyadmin + patch +

+
KHANAT SERVER DOCKER (TEST ENVIRONMENT - INFO)
+
+ +"; + echo "KeyValue"; + ksort($data); + foreach ($data as $key => $value) + { + echo "$key$value"; + } + echo ""; + +} else { + echo "OpenNelManager not enabled"; +} +?> +

+
+ Command line : +
+ curl -XGET --header "content-type: application/json" -d '' +
+
+

+ + diff --git a/server/common/rootweb/opennelmanager_log.php b/server/common/rootweb/opennelmanager_log.php index ae63491..4807589 100644 --- a/server/common/rootweb/opennelmanager_log.php +++ b/server/common/rootweb/opennelmanager_log.php @@ -68,8 +68,8 @@ table, th, td { xhr.open("POST", url, true); xhr.setRequestHeader("content-type", "application/json"); xhr.onreadystatechange = function () { - console.log(xhr.readyState); - console.log(xhr.status); + console.log(xhr.readyState); + console.log(xhr.status); if (xhr.readyState === 4 && xhr.status === 200) { //var json = JSON.parse(xhr.responseText); console.log(xhr.responseText); @@ -108,7 +108,7 @@ if (file_exists('/home/gameserver/opennelmanager.flag')) { function get_port($filecfg) { - // $ini_array = parse_ini_file($filecfg); + // $ini_array = parse_ini_file($filecfg); // return "${ini_array['port']}"; $fp = fopen($filecfg, "r"); @@ -122,7 +122,7 @@ function get_port($filecfg) } } fclose($fp); - } + } return "8000"; } @@ -136,17 +136,17 @@ if (file_exists($cfgfile)) { // Initiate curl $ch = curl_init(); curl_setopt($ch, CURLOPT_URL,$url); - curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); + curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); $data = "{\"name\": \"${_GET['command']}\", \"first-line\": 0}"; - $headers = array( - "GET /STDOUT HTTP/1.0", - 'Content-type: application/json', + $headers = array( + "GET /STDOUT HTTP/1.0", + 'Content-type: application/json', 'Content-Length: ' . strlen($data) - ); + ); - curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); - curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "GET"); + curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); + curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "GET"); curl_setopt($ch, CURLOPT_POSTFIELDS, $data); // Execute $result=curl_exec($ch); @@ -202,7 +202,7 @@ if (file_exists($cfgfile)) { } } echo "$key$date$hour$timezone$type$addr$program $line$msg"; - + } echo ""; @@ -210,17 +210,25 @@ if (file_exists($cfgfile)) { echo "OpenNelManager not enabled"; } ?> -
- Send to STDIN: - -
-

Command line :
curl -XGET --header "content-type: application/json" -d ''
+

+

+
+ Send to STDIN: + +
+

+ Command line : +
+ curl -XPOST --header "content-type: application/json" -d '' +
+
+

diff --git a/server/common/rootweb/opennelmanager_player.php b/server/common/rootweb/opennelmanager_player.php new file mode 100644 index 0000000..4f38d04 --- /dev/null +++ b/server/common/rootweb/opennelmanager_player.php @@ -0,0 +1,171 @@ + + + + Test Khanat Config + + + + + + + + +

+ Home + OpenNelManager"; +} else { + echo "opennelmanager not used"; +} +?> + Administration + phpmyadmin + patch +

+
KHANAT SERVER DOCKER (TEST ENVIRONMENT - PLAYER)
+
+ +"; + echo "Player"; + foreach ($data as $key => $value) + { + foreach ($value as $key2 => $value2) + { + echo "$key2"; + } + break; + } + echo ""; + foreach ($data as $key => $value) + { + echo "$key"; + foreach ($value as $key2 => $value2) + { + echo "$value2"; + } + } + echo ""; + +} else { + echo "OpenNelManager not enabled"; +} +?> +

+
+ Command line : +
+ curl -XGET --header "content-type: application/json" -d '' +
+
+

+ + diff --git a/server/debian/common/khaganat.cfg b/server/debian/common/khaganat.cfg index 2a91e22..42aaffa 100644 --- a/server/debian/common/khaganat.cfg +++ b/server/debian/common/khaganat.cfg @@ -87,6 +87,26 @@ command = ryzom_entities_game_service -A/home/gameserver/khanat/server -C/home/g path = /home/gameserver/khanat/server/ # size buffer log for each program launched (number line stdout) logsize = 3000 +# keep some data on array/dict state +activate_filter = yes +# size array/dict state +size_max_filter = 1000 +# search regex to add state (python regex) +# "^((.*)(setActiveCharForPlayer).*(: set active char )[\d]+( for )(?P.*)|(.*)(disconnectPlayer)(.+:.+<.+>){0,1}[\s]+(?P.*)[\s]+(is disconnected))" +# add_filter = "^(.*)(setActiveCharForPlayer).*(: set active char )[\d]+( for )(?P.*)" +# search regex to del state (python regex) +# del_filter = "^(.*)(disconnectPlayer).+[\s]+(?P.*)[\s]+(is disconnected)" +# add_filter = "^(.*)(setActiveCharForPlayer)(.*)(: set active char )[\d]+( for )(?P.*)" +# del_filter = "^(.*)(disconnectPlayer).+[\s]+(?P.*)[\s]+(is disconnected)" +add_filter = "^((.*)(setActiveCharForPlayer).*(: set active char )[\d]+( for )(?P.*)|(.*)(disconnectPlayer)(.+:.+<.+>){0,1}[\s]+(?P.*)[\s]+(is disconnected))" +del_filter = "^((.*)(setActiveCharForPlayer).*(: set active char )[\d]+( for )(?P.*)|(.*)(disconnectPlayer)(.+:.+<.+>){0,1}[\s]+(?P.*)[\s]+(is disconnected))" +# autostart (when start OpenNelManager, launch this program) +autostart = yes +# restart after crash +restart_after_crash = yes +# Delay after each restart (second) +restart_delay = 10 +egs_filter = yes ############################## # gpms : gpm_service