Browse Source

update var name

main
ghost 11 months ago
parent
commit
776e6c6350
  1. 8
      src/Controller/ServerController.php
  2. 2
      templates/default/server/index.html.twig

8
src/Controller/ServerController.php

@ -77,15 +77,15 @@ class ServerController extends AbstractController
$online = []; $online = [];
$players = []; $players = [];
// Format name // Format address
if (false === filter_var($server->getHost(), FILTER_VALIDATE_IP, FILTER_FLAG_IPV6)) if (false === filter_var($server->getHost(), FILTER_VALIDATE_IP, FILTER_FLAG_IPV6))
{ {
$name = "{$server->getHost()}:{$server->getPort()}"; $address = "{$server->getHost()}:{$server->getPort()}";
} }
else else
{ {
$name = "[{$server->getHost()}]:{$server->getPort()}"; $address = "[{$server->getHost()}]:{$server->getPort()}";
} }
// Request server info // Request server info
@ -167,7 +167,7 @@ class ServerController extends AbstractController
'request' => $request, 'request' => $request,
'server' => 'server' =>
[ [
'name' => $name, 'address' => $address,
'crc32server' => $server->getCrc32Server(), 'crc32server' => $server->getCrc32Server(),
'host' => $server->getHost(), 'host' => $server->getHost(),
'port' => $server->getPort(), 'port' => $server->getPort(),

2
templates/default/server/index.html.twig

@ -49,7 +49,7 @@
{% block main_content %} {% block main_content %}
<div class="border-default padding-8-px margin-y-8-px"> <div class="border-default padding-8-px margin-y-8-px">
<h2> <h2>
{{ server.name }} {{ server.address }}
{% if server.status %} {% if server.status %}
<span class="color-success" title="{{ 'Online' | trans }}"> <span class="color-success" title="{{ 'Online' | trans }}">
<svg xmlns="http://www.w3.org/2000/svg" width="10" height="10" fill="currentColor" viewBox="0 0 16 16"> <svg xmlns="http://www.w3.org/2000/svg" width="10" height="10" fill="currentColor" viewBox="0 0 16 16">

Loading…
Cancel
Save