Skip to content

Commit

Permalink
Merge pull request #185 from zediious/0.5.2.1
Browse files Browse the repository at this point in the history
Changes for 0.5.2.1
  • Loading branch information
zediious authored Jun 12, 2024
2 parents 2c2b931 + 0f2955c commit c496f2c
Show file tree
Hide file tree
Showing 19 changed files with 220 additions and 186 deletions.
3 changes: 2 additions & 1 deletion raptorWeb/donations/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,9 +114,10 @@ def get_context_data(self, **kwargs: Any) -> dict[str, Any]:
context['donation_price_form'] = DonationPriceForm({'chosen_price': bought_package.price})
context['discord_username_form'] = DonationDiscordUsernameForm()
context['donation_details_form'] = SubmittedDonationForm()
context['donation_currency'] = site_info.donation_currency.upper()

if site_info.paypal_enabled and site_info.stripe_enabled:
context['donation_gateway_form'] = DonationGatewayForm()
context['donation_gateway_form'] = DonationGatewayForm({'payment_gateway': 'stripe'})
context['single_gateway'] = False

else:
Expand Down
3 changes: 2 additions & 1 deletion raptorWeb/gameservers/context_processor.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,15 @@


def server_settings_to_context(request: HttpResponse) -> dict:
site_info: SiteInformation.objects = SiteInformation.objects.get_or_create(pk=1)[0]
site_info: SiteInformation = SiteInformation.objects.get_or_create(pk=1)[0]
current_servers = Server.objects.filter(archived=False)

return {"server_query_enabled": site_info.enable_server_query,
"server_online_message": site_info.server_online_message,
"server_offline_message": site_info.server_offline_message,
"server_maintenance_message": site_info.server_maintenance_message,
"server_pagination_count": site_info.server_pagination_count,
'query_delay_seconds': (site_info.query_delay * 60) + 5,
"total_server_count": current_servers.count(),
"current_enabled_servers": current_servers}

5 changes: 3 additions & 2 deletions raptorWeb/gameservers/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,9 @@ def _update_announcement_count(server: Server) -> None:
if do_query == True:
try:
serverJSON: QueryResponse = JavaServer(
server.server_address,
server.server_port
host=server.server_address,
port=server.server_port,
timeout=0.5
).query()

server.player_count = serverJSON.players.online
Expand Down
8 changes: 4 additions & 4 deletions raptorWeb/gameservers/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@
path('html/server_button_poll/', views.Server_Buttons.as_view(template_name='gameservers/server_list.html'), name="server_buttons_poll"),
path('html/server_button_poll_loading/', views.Server_Buttons.as_view(template_name='gameservers/server_list_loading.html'), name="server_buttons_poll_loading"),
path('html/server_modal_poll/', views.Server_List_Base.as_view(template_name='gameservers/server_list_modals.html'), name="server_modals_poll"),
path('html/server_rules_poll/', views.Server_List_Base.as_view(template_name='gameservers/server_list_rules.html'), name="server_rules_poll"),
path('html/server_banned_items_poll/', views.Server_List_Base.as_view(template_name='gameservers/server_list_banneditems.html'), name="server_banned_items_poll"),
path('html/server_voting_poll/', views.Server_List_Base.as_view(template_name='gameservers/server_list_voting.html'), name="server_voting_poll"),
path('html/server_announcements_poll/', views.Server_List_Base.as_view(template_name='gameservers/server_list_announcements.html'), name="server_announcements_poll"),
path('html/server_rules_poll/', views.Server_List_Base.as_view(template_name='gameservers/server_list_rules_NOWAIT.html'), name="server_rules_poll"),
path('html/server_banned_items_poll/', views.Server_List_Base.as_view(template_name='gameservers/server_list_banneditems_NOWAIT.html'), name="server_banned_items_poll"),
path('html/server_voting_poll/', views.Server_List_Base.as_view(template_name='gameservers/server_list_voting_NOWAIT.html'), name="server_voting_poll"),
path('html/server_announcements_poll/', views.Server_List_Base.as_view(template_name='gameservers/server_list_announcements_NOWAIT.html'), name="server_announcements_poll"),
# Individual server info endpoints
path('html/server/server_description', views.Server_Description.as_view(), name="server_description"),
path('html/server/maintenance/update/<int:pk>', views.SetMaintenanceMode.as_view(), name="update_maintenance"),
Expand Down
2 changes: 1 addition & 1 deletion raptorWeb/gameservers/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class Server_List_Base(ListView):
model: Server = Server

def get_queryset(self) -> ServerManager:
if 'loading' not in self.template_name:
if 'loading' not in self.template_name and '_NOWAIT' not in self.template_name:
return Server.objects.get_servers()

return Server.objects.get_servers(wait=False)
Expand Down
2 changes: 1 addition & 1 deletion raptorWeb/static/css/raptormc.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion raptorWeb/static/css/raptormc.scss
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ a:hover .picture_transition {
animation-name: fadeInOpacity;
animation-iteration-count: 1;
animation-timing-function: ease-in;
animation-duration: 0.6s;
animation-duration: 0.4s;
}

.fade-in-main {
Expand Down
12 changes: 6 additions & 6 deletions raptorWeb/templates/donations/checkout.html
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
{% if buying_package.variable_price %}
{% else %}
<p class='fs-1'>
${{buying_package.price}}
{{buying_package.price}} {{donation_currency|upper}}
</p>
{% endif %}
</div>
Expand All @@ -34,11 +34,6 @@
{{buying_package.package_description|safe}}
</div>
<hr>
{% if not single_gateway %}
<div class="d-flex flex-column">
{% bootstrap_field donation_gateway_form.payment_gateway %}
</div>
{% endif %}
{% if buying_package.servers.count > 0 %}
{% if request.user.discord_user_info %}
<p class="text-center text-white fs-3">
Expand Down Expand Up @@ -69,6 +64,11 @@
{% if buying_package.variable_price %}
{% bootstrap_field donation_price_form.chosen_price %}
{% endif %}
{% if not single_gateway %}
<div class="d-flex flex-column">
{% bootstrap_field donation_gateway_form.payment_gateway %}
</div>
{% endif %}
<button class="btn btn-success" type='submit'>
Checkout
</button>
Expand Down
11 changes: 8 additions & 3 deletions raptorWeb/templates/donations/donationpackage_list.html
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,13 @@
alt="Package Picture">
{% endif %}
</div>
<div class="col-10 w-100 mt-3 text-center">
<strong>{{package.name}}</strong>
<div class="col-10 w-100 mt-3 text-center">
<div class='badge bg-dark' style="text-decoration: none !important;">
{{package.price}} {{donation_currency|upper}}
</div>
<div>
<strong class="fs-5 text-center">{{package.name}}</strong>
</div>
</div>
</div>
</a>
Expand All @@ -107,7 +112,7 @@
{% if package.variable_price %}
{% else %}
<p class='fs-3'>
${{package.price}}
{{package.price}} {{donation_currency|upper}}
</p>
{% endif %}
</div>
Expand Down
58 changes: 25 additions & 33 deletions raptorWeb/templates/gameservers/player_list.html
Original file line number Diff line number Diff line change
@@ -1,43 +1,35 @@
{% load static %}

{% if server_query_enabled %}
<div class="modal fade" id="playerNames" tabindex="-1" aria-labelledby="Online Player Names" aria-hidden="true">
<div class="modal-dialog modal-sm">
<div class="modal-content bg-dark text-white">
<button class="btn-close btn-close-white p-3 mb-0 fs-6" data-bs-dismiss="modal" aria-label="Close"></button>
<div class="modal-body pt-0">

{% for server in server_list reversed %}
{% if forloop.counter0 != 0 %}
<hr>
{% endif %}
<h5 class="fs-4 text-center text-decoration-underline mb-3">{{ server.modpack_name}}</h5>
<span class="fs-6 d-block text-center">
{% for player in object_list %}
{% if player.server == server %}
{{ player.name }},
{% endif %}
{% endfor %}
</span>
{% endfor %}
<div id='player_count_modal' hx-swap-oob="innerHTML: #player_count_modal">
<div class="modal-dialog modal-sm">
<div class="modal-content bg-dark text-white">
<button class="btn-close btn-close-white p-3 mb-0 fs-6" data-bs-dismiss="modal" aria-label="Close"></button>
<div class="modal-body pt-0">
<div id='current_player_list'>
{% for server in server_list reversed %}
{% if forloop.counter0 != 0 %}
<hr>
{% endif %}
<h5 class="fs-4 text-center text-decoration-underline mb-3">{{ server.modpack_name}}</h5>
<span class="fs-6 d-block text-center">
{% for player in object_list %}
{% if player.server == server %}
{{ player.name }}{% if forloop.counter0 != 0 %},{% endif %}
{% endif %}
{% endfor %}
</span>
{% endfor %}
</div>

</div>
</div>
</div>
</div>
</div>

<button id="totalPlayers" class="mt-auto btn btn-lg btn-dark mb-3 d-block mb-auto"
data-bs-toggle="modal"
data-bs-target="#playerNames"
>
<div class="fs-4 text-white opacity-75 p-3 pt-0 pb-0" >
Currently Playing:
<span id="total_count" class="fs-1">
{{ stat_object.total_player_count }}
</span>
</div>
<div class="fs-6 text-white opacity-75 p-3 pt-0 pb-0">
Click to view players!
</div>
</button>
<span id="total_count" hx-swap-oob="innerHTML: #total_count">
{{ stat_object.total_player_count }}
</span>

{% endif %}
Loading

0 comments on commit c496f2c

Please sign in to comment.