From 2264401a9194dac156ce4f5c45cbcdf8939ef648 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Gremaud?= Date: Sun, 10 May 2026 03:47:37 +0200 Subject: [PATCH] fix: correct mime type for noita log file, opus card status display --- polylan_submitter/noita/api.py | 6 -- polylan_submitter/src/Noita.vue | 26 ++---- polylan_submitter/src/components/Results.vue | 98 ++++++++++++++++++-- 3 files changed, 96 insertions(+), 34 deletions(-) diff --git a/polylan_submitter/noita/api.py b/polylan_submitter/noita/api.py index a6e0cb9..98ebd1d 100644 --- a/polylan_submitter/noita/api.py +++ b/polylan_submitter/noita/api.py @@ -203,12 +203,6 @@ def submit_log_file(request: HttpRequest, file: UploadedFile = File(...)): allowed_types = [ "text/plain", "text/x-log", - "image/jpeg", - "image/jpg", - "image/png", - "image/gif", - "video/mp4", - "video/webm", ] if file.content_type not in allowed_types: diff --git a/polylan_submitter/src/Noita.vue b/polylan_submitter/src/Noita.vue index 0ebf186..fc4e6af 100644 --- a/polylan_submitter/src/Noita.vue +++ b/polylan_submitter/src/Noita.vue @@ -256,13 +256,13 @@ onMounted(() => { isDragover ? 'border-primary bg-primary/10' : 'border-base-300 hover:border-primary' ]"> + accept="text/plain,text/x-log" /> @@ -353,10 +353,7 @@ onMounted(() => { Global Leaderboard - @@ -373,16 +370,10 @@ onMounted(() => { - + - + 🏆 #{{ entry.rank }} @@ -395,10 +386,7 @@ onMounted(() => { {{ entry.username }} - + You diff --git a/polylan_submitter/src/components/Results.vue b/polylan_submitter/src/components/Results.vue index 8a392ff..6723f92 100644 --- a/polylan_submitter/src/components/Results.vue +++ b/polylan_submitter/src/components/Results.vue @@ -45,6 +45,12 @@ const isLoading = ref(true); const resultsData = ref(null); const selectedTab = ref<"overall" | "byPuzzle">("overall"); const expandedPuzzleId = ref(null); +const userInfo = ref({ + username: "Player", + rank: null as number | null, + totalPoints: 0, + puzzlesSolved: 0, +}); const fetchResults = async () => { isLoading.value = true; @@ -100,23 +106,95 @@ const togglePuzzleExpanded = (puzzleId: number) => { expandedPuzzleId.value = expandedPuzzleId.value === puzzleId ? null : puzzleId; }; +const loadUserData = async () => { + try { + const response = await fetch("/api/user"); + if (response.ok) { + const user = await response.json(); + if (user.is_authenticated) { + userInfo.value.username = user.username; + + await fetchResults(); + + // Calculate user's rank and stats + const ranking = getOverallRanking(); + const userRankIndex = ranking.findIndex((u) => u.username === user.username); + + if (userRankIndex !== -1) { + userInfo.value.rank = userRankIndex + 1; + userInfo.value.totalPoints = ranking[userRankIndex].totalPoints; + userInfo.value.puzzlesSolved = ranking[userRankIndex].puzzlesSolved; + } + } + } + } catch (error) { + console.error("Error loading user data:", error); + await fetchResults(); + } +}; + onMounted(() => { - fetchResults(); + loadUserData(); });