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" /> Click to upload or drag and drop - Video or image files (MP4, PNG, etc.) + The log file polylan_mod_log.txt @@ -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(); }); - - - - - General Results - + + + + + + + Your Ranking + + + + Player + {{ userInfo.username }} + - - + + + + + + + + + Current Rank + + #{{ userInfo.rank }} + + No rank yet + + + + Total Points + {{ userInfo.totalPoints.toLocaleString() }} + + + + Puzzles Solved + {{ userInfo.puzzlesSolved }} + + + + + + + + + + + + General Results + + + + + No results available yet @@ -286,6 +364,8 @@ onMounted(() => { + +
Click to upload or drag and drop
Video or image files (MP4, PNG, etc.)
The log file polylan_mod_log.txt
polylan_mod_log.txt
Player
{{ userInfo.username }}
Current Rank
+ #{{ userInfo.rank }} +
No rank yet
Total Points
{{ userInfo.totalPoints.toLocaleString() }}
Puzzles Solved
{{ userInfo.puzzlesSolved }}
No results available yet