Signed-off-by: Pratyush Desai <pratyush.desai@liberta.casa>
This commit is contained in:
Pratyush Desai 2025-04-16 00:21:07 +05:30
parent 0c44136f1a
commit d8d38e0908
Signed by: pratyush
GPG Key ID: DBA5BB7505946FAD
5 changed files with 41 additions and 20 deletions

View File

@ -3,6 +3,7 @@ certifi==2024.12.14
charset-normalizer==3.4.1
Django==5.1.5
idna==3.10
pillow==11.2.1
podman==5.2.0
requests==2.32.3
sqlparse==0.5.3

View File

@ -4,7 +4,7 @@
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>{% block title %}Game Server Supervisor{% endblock %}</title>
<title>{% block title %}GibCasa{% endblock %}</title>
<style>
* {
margin: 0;
@ -165,12 +165,12 @@
font-size: 14px;
}
.game-box img {
/* .game-box img {
width: 100%;
height: 100%;
object-fit: cover;
border-radius: 5px;
}
} */
</style>
</head>
@ -189,15 +189,15 @@
<a href="{% url 'games' %}">Games</a>
</div>
</div>
</div class="navbar>
<!-- <div class="right">
<div class="search-box">
</div class="navbar">
<!-- <div class="right"> -->
<!-- <div class="search-box">
<input type="text" placeholder="Search...">
</div>
<a href="#">Auth / Settings</a> -->
</div> -->
<!-- <a href="#">Auth / Settings</a> -->
<!-- <div class="profile">Dp</div> -->
</div>
</div>
<!-- </div> -->
</div>
<div class="content">
{% block content %}{% endblock %}
@ -205,7 +205,7 @@
<footer>
<a href="https://ozFrags.net">Other Communities</a>
<a href="https://liberta.casa/rules.html">Terms of Service</a>
<a href="https://liberta.casa/rules.html">Terms of Service WIP</a>
<a href="#">License: AGPLish</a>
<a href="#">Contribute (WIP)</a>
<a href="https://liberta.casa/gamja/#gibcasa">Support</a>

View File

@ -16,16 +16,30 @@
</nav> -->
<div class="game-detail">
<div class="game-image">
<img src="{{ game.image_url }}" alt="{{ game.name }}">
<div class="game-box" style="width: 150px; text-align: center;">
<a href="{% url 'game_detail' game.name %}">
<img src="{{ game.thumbnail.url }}" alt="{{ game.name }}" style="width: 100%; height: auto;">
<p>{{ game.name }}</p>
</a>
</div>
<div class="active-servers">
{% if active_servers %}
{% for server in active_servers %}
<fieldset class="server-box">
<legend>Server: {{ game.name }}</legend>
<div class="server-details">
<p><strong>IP Address:</strong> {{ server.ip_address }}</p>
<p><strong>Port:</strong> {{ server.port }}</p>
<p><strong>Status:</strong> Online</p>
</div>
</fieldset>
{% endfor %}
{% else %}
<p>No active servers found for this game.</p>
{% endif %}
</div>
<div class="game-info">
<p>Pull data from some open API to populate information about the game and render it.</p>
<ul>
<li>🔹 <strong>Active:</strong> Non-full, non-empty servers with connection info, map, and player count</li>
<li>🔹 <strong>All Active:</strong> List of all active servers</li>
<li>🔹 <strong>Stopped:</strong> Available upon request</li>
</ul>
</div>
</div>
{% endblock %}

View File

@ -3,7 +3,7 @@
{% block title %}Games - Game Servers{% endblock %}
{% block content %}
<h2>Public Game Servers</h2>
<h2>Games</h2>
<div class="game-grid" style="display: flex; flex-wrap: wrap; gap: 10px;">
{% for game in games %}

View File

@ -13,4 +13,10 @@ def games(request):
def game_detail(request, game_name):
print(f"Looking for game: {game_name}")
game = get_object_or_404(Game, name=game_name)
return render(request, 'webpanel/game_detail.html', {'game': game})
servers = Server.objects.filter(game=game)
for server in servers:
server.sync_status()
dormant_servers = servers.filter(status='offline')
active_servers = servers.filter(status='online')
return render(request, 'webpanel/game_detail.html', {'game': game,
'active_servers': active_servers, 'dormant_servers': dormant_servers})