Skip to content

Commit d612693

Browse files
authored
Add: show in the server list and server detail if/what GameScript a server uses (#33)
1 parent 8f77094 commit d612693

File tree

4 files changed

+25
-1
lines changed

4 files changed

+25
-1
lines changed

webclient/pages/servers.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
template,
1111
)
1212

13+
GAMESCRIPT_VERSION_NONE = 4294967295 # (int32)-1 as uint32
1314
MAPSETS = {
1415
0: "Temperate",
1516
1: "Arctic",
@@ -165,6 +166,7 @@ def _list_servers(filter):
165166
servers_ipv6=servers_ipv6,
166167
filter=filter,
167168
mapsets=MAPSETS,
169+
GAMESCRIPT_VERSION_NONE=GAMESCRIPT_VERSION_NONE,
168170
)
169171

170172

@@ -199,4 +201,10 @@ def server_entry(server_id):
199201

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

202-
return template("server_entry.html", server=server, expire=expire, mapsets=MAPSETS)
204+
return template(
205+
"server_entry.html",
206+
server=server,
207+
expire=expire,
208+
mapsets=MAPSETS,
209+
GAMESCRIPT_VERSION_NONE=GAMESCRIPT_VERSION_NONE,
210+
)
4.38 KB
Loading

webclient/templates/server_entry.html

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,16 @@ <h1>{% block title %}{{ server["info"]["name"] }} {% endblock %}</h1>
9595
{% endif %}
9696
</td>
9797
</tr>
98+
<tr class="even">
99+
<th>Gamescript:</th>
100+
<td>
101+
{% if server["info"]["gamescript_version"] and server["info"]["gamescript_version"] != GAMESCRIPT_VERSION_NONE %}
102+
{{ server["info"]["gamescript_name"] }} (v{{ server["info"]["gamescript_version"] }})
103+
{% else %}
104+
None
105+
{% endif %}
106+
</td>
107+
</tr>
98108
<tr class="odd">
99109
<th>NewGRFs in use:</th>
100110
<td>

webclient/templates/server_list.html

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ <h1>{% block title %}
2323
<th class="version">Version</th>
2424
<th class="icon-password"></th>
2525
<th class="icon-grf"></th>
26+
<th class="icon-gamescript"></th>
2627
</tr>
2728
</thead>
2829
<tbody>
@@ -65,6 +66,11 @@ <h1>{% block title %}
6566
<img src="/static/img/server-grf.png" alt="GRF" title="NewGRFs Required">
6667
{% endif %}
6768
</td>
69+
<td class="image">
70+
{% if server['info']['gamescript_version'] and server["info"]["gamescript_version"] != GAMESCRIPT_VERSION_NONE %}
71+
<img src="/static/img/server-gamescript.png" alt="GS" title="Uses gamescript">
72+
{% endif %}
73+
</td>
6874
</tr>
6975
{% endfor %}
7076
</tbody>

0 commit comments

Comments
 (0)