diff --git a/polylan_submitter/.gitignore b/polylan_submitter/.gitignore index 0178178..5269a2a 100644 --- a/polylan_submitter/.gitignore +++ b/polylan_submitter/.gitignore @@ -15,7 +15,7 @@ dist-ssr # Vite build output (generated locally via `pnpm build`, served by whitenoise) static_source/vite/assets static_source/vite/manifest.json -static_source/vite/vite.svg +static_source/vite/icon.png tsconfig.tsbuildinfo # vue-tsc emits a compiled copy of vite.config.ts here (tsconfig.node.json, diff --git a/polylan_submitter/market/views.py b/polylan_submitter/market/views.py index 5744326..9c9b58e 100644 --- a/polylan_submitter/market/views.py +++ b/polylan_submitter/market/views.py @@ -8,4 +8,4 @@ from events.models import Event @login_required def market_home(request: HttpRequest, event_path: str): get_object_or_404(Event, path=event_path) - return render(request, "app.html", {"bootstrap": {}}) + return render(request, "app.html") diff --git a/polylan_submitter/polylan_submitter/api.py b/polylan_submitter/polylan_submitter/api.py index dfc13de..9ff1725 100644 --- a/polylan_submitter/polylan_submitter/api.py +++ b/polylan_submitter/polylan_submitter/api.py @@ -1,4 +1,4 @@ -from ninja import NinjaAPI +from ninja import NinjaAPI, Schema from django.conf import settings from django.core.cache import cache from django.http import HttpRequest @@ -62,6 +62,17 @@ def health_check(request): return {"status": "healthy", "service": "polylan-submitter-api"} +class ConfigOut(Schema): + market_enabled: bool + + +# Site-wide config the SPA needs but that isn't tied to any one event +# (e.g. whether to render the market card at all on the home page). +@api.get("/config", response=ConfigOut) +def get_config(request): + return {"market_enabled": settings.MARKET_ENABLED} + + # Cache management endpoint @api.post("/cache/clear") def clear_cache(request: HttpRequest, event_path: str | None = None): diff --git a/polylan_submitter/polylan_submitter/urls.py b/polylan_submitter/polylan_submitter/urls.py index 3ee8be4..b6c56c9 100644 --- a/polylan_submitter/polylan_submitter/urls.py +++ b/polylan_submitter/polylan_submitter/urls.py @@ -44,44 +44,21 @@ def home(request: HttpRequest): @login_required def event_home(request: HttpRequest, event_path: str): get_object_or_404(Event, path=event_path) - - return render( - request, - "app.html", - { - "bootstrap": { - "marketEnabled": settings.MARKET_ENABLED, - }, - }, - ) + return render(request, "app.html") @login_required @require_game_enabled(OPUS_MAGNUM_APP_ID) def opus_magnum_home(request: HttpRequest, event_path: str): - from opus_magnum.models import SteamCollection - - event = get_object_or_404(Event, path=event_path) - collection = SteamCollection.objects.filter(is_active=True, event=event).last() - - return render( - request, - "app.html", - { - "bootstrap": { - "collectionTitle": collection.title if collection else "", - "collectionUrl": collection.url if collection else "", - "collectionDescription": collection.description if collection else "", - }, - }, - ) + get_object_or_404(Event, path=event_path) + return render(request, "app.html") @login_required @require_game_enabled(NOITA_APP_ID) def noita_home(request: HttpRequest, event_path: str): get_object_or_404(Event, path=event_path) - return render(request, "app.html", {"bootstrap": {}}) + return render(request, "app.html") urlpatterns = [ diff --git a/polylan_submitter/public/favicon.ico b/polylan_submitter/public/favicon.ico new file mode 100644 index 0000000..22052ab Binary files /dev/null and b/polylan_submitter/public/favicon.ico differ diff --git a/polylan_submitter/public/vite.svg b/polylan_submitter/public/vite.svg deleted file mode 100644 index e7b8dfb..0000000 --- a/polylan_submitter/public/vite.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/polylan_submitter/src/Home.vue b/polylan_submitter/src/Home.vue index 58d52ef..9841bf8 100644 --- a/polylan_submitter/src/Home.vue +++ b/polylan_submitter/src/Home.vue @@ -1,25 +1,25 @@