Skip to content

Commit

Permalink
Add: show in the server list and server detail if/what GameScript a s…
Browse files Browse the repository at this point in the history
…erver uses (#33)
  • Loading branch information
TrueBrain authored Jul 17, 2021
1 parent 8f77094 commit d612693
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 1 deletion.
10 changes: 9 additions & 1 deletion webclient/pages/servers.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
template,
)

GAMESCRIPT_VERSION_NONE = 4294967295 # (int32)-1 as uint32
MAPSETS = {
0: "Temperate",
1: "Arctic",
Expand Down Expand Up @@ -165,6 +166,7 @@ def _list_servers(filter):
servers_ipv6=servers_ipv6,
filter=filter,
mapsets=MAPSETS,
GAMESCRIPT_VERSION_NONE=GAMESCRIPT_VERSION_NONE,
)


Expand Down Expand Up @@ -199,4 +201,10 @@ def server_entry(server_id):

expire = datetime.utcfromtimestamp(_server_entry_cache[server_id]["expire"]).strftime("%Y-%m-%d %H:%M:%S") + " UTC"

return template("server_entry.html", server=server, expire=expire, mapsets=MAPSETS)
return template(
"server_entry.html",
server=server,
expire=expire,
mapsets=MAPSETS,
GAMESCRIPT_VERSION_NONE=GAMESCRIPT_VERSION_NONE,
)
Binary file added webclient/static/img/server-gamescript.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 10 additions & 0 deletions webclient/templates/server_entry.html
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,16 @@ <h1>{% block title %}{{ server["info"]["name"] }} {% endblock %}</h1>
{% endif %}
</td>
</tr>
<tr class="even">
<th>Gamescript:</th>
<td>
{% if server["info"]["gamescript_version"] and server["info"]["gamescript_version"] != GAMESCRIPT_VERSION_NONE %}
{{ server["info"]["gamescript_name"] }} (v{{ server["info"]["gamescript_version"] }})
{% else %}
None
{% endif %}
</td>
</tr>
<tr class="odd">
<th>NewGRFs in use:</th>
<td>
Expand Down
6 changes: 6 additions & 0 deletions webclient/templates/server_list.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ <h1>{% block title %}
<th class="version">Version</th>
<th class="icon-password"></th>
<th class="icon-grf"></th>
<th class="icon-gamescript"></th>
</tr>
</thead>
<tbody>
Expand Down Expand Up @@ -65,6 +66,11 @@ <h1>{% block title %}
<img src="/static/img/server-grf.png" alt="GRF" title="NewGRFs Required">
{% endif %}
</td>
<td class="image">
{% if server['info']['gamescript_version'] and server["info"]["gamescript_version"] != GAMESCRIPT_VERSION_NONE %}
<img src="/static/img/server-gamescript.png" alt="GS" title="Uses gamescript">
{% endif %}
</td>
</tr>
{% endfor %}
</tbody>
Expand Down

0 comments on commit d612693

Please sign in to comment.