fix: correct mime type for noita log file, opus card status display
This commit is contained in:
parent
9662181d4d
commit
2264401a91
@ -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:
|
||||
|
||||
@ -256,13 +256,13 @@ onMounted(() => {
|
||||
isDragover ? 'border-primary bg-primary/10' : 'border-base-300 hover:border-primary'
|
||||
]">
|
||||
<input type="file" multiple @change="handleFileUpload" class="hidden" id="file-upload"
|
||||
accept="video/*,image/*" />
|
||||
accept="text/plain,text/x-log" />
|
||||
<label for="file-upload" class="cursor-pointer flex flex-col items-center gap-3">
|
||||
<i
|
||||
:class="['mdi text-4xl', isDragover ? 'mdi-cloud-check text-primary' : 'mdi-file-upload text-base-content/50']"></i>
|
||||
<div>
|
||||
<p class="font-semibold">Click to upload or drag and drop</p>
|
||||
<p class="text-sm text-base-content/70">Video or image files (MP4, PNG, etc.)</p>
|
||||
<p class="text-sm text-base-content/70">The log file <code>polylan_mod_log.txt</code></p>
|
||||
</div>
|
||||
</label>
|
||||
</div>
|
||||
@ -353,10 +353,7 @@ onMounted(() => {
|
||||
<i class="mdi mdi-trophy text-yellow-500 mr-2"></i>
|
||||
Global Leaderboard
|
||||
</h3>
|
||||
<button
|
||||
@click="isLeaderboardModalOpen = false"
|
||||
class="btn btn-sm btn-circle btn-ghost"
|
||||
>
|
||||
<button @click="isLeaderboardModalOpen = false" class="btn btn-sm btn-circle btn-ghost">
|
||||
<i class="mdi mdi-close"></i>
|
||||
</button>
|
||||
</div>
|
||||
@ -373,16 +370,10 @@ onMounted(() => {
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr
|
||||
v-for="entry in leaderboard"
|
||||
:key="entry.username"
|
||||
:class="{ 'bg-primary/20': entry.username === userInfo.username }"
|
||||
>
|
||||
<tr v-for="entry in leaderboard" :key="entry.username"
|
||||
:class="{ 'bg-primary/20': entry.username === userInfo.username }">
|
||||
<td class="font-bold">
|
||||
<span
|
||||
v-if="entry.rank === 1"
|
||||
class="badge badge-warning badge-lg"
|
||||
>
|
||||
<span v-if="entry.rank === 1" class="badge badge-warning badge-lg">
|
||||
🏆 #{{ entry.rank }}
|
||||
</span>
|
||||
<span v-else-if="entry.rank === 2" class="badge badge-lg">
|
||||
@ -395,10 +386,7 @@ onMounted(() => {
|
||||
</td>
|
||||
<td class="font-medium">
|
||||
{{ entry.username }}
|
||||
<span
|
||||
v-if="entry.username === userInfo.username"
|
||||
class="badge badge-primary badge-sm ml-2"
|
||||
>
|
||||
<span v-if="entry.username === userInfo.username" class="badge badge-primary badge-sm ml-2">
|
||||
You
|
||||
</span>
|
||||
</td>
|
||||
|
||||
@ -45,6 +45,12 @@ const isLoading = ref(true);
|
||||
const resultsData = ref<ResultsData | null>(null);
|
||||
const selectedTab = ref<"overall" | "byPuzzle">("overall");
|
||||
const expandedPuzzleId = ref<number | null>(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();
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="mb-8">
|
||||
<div class="card bg-base-100 shadow-lg">
|
||||
<div class="card-body">
|
||||
<h2 class="card-title text-2xl mb-6">
|
||||
<i class="mdi mdi-trophy text-yellow-500 mr-2"></i>
|
||||
General Results
|
||||
</h2>
|
||||
<div class="grid grid-cols-1 lg:grid-cols-3 gap-8">
|
||||
<!-- Left Column: Your Ranking -->
|
||||
<div class="lg:col-span-1">
|
||||
<div class="card bg-base-100 shadow-lg sticky top-8">
|
||||
<div class="bg-gradient-to-br from-blue-600 to-blue-400 p-6 text-white rounded-t-2xl">
|
||||
<i class="mdi mdi-trophy text-4xl"></i>
|
||||
<h3 class="text-2xl font-bold mt-2">Your Ranking</h3>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<div class="text-center mb-6">
|
||||
<p class="text-sm text-base-content/70">Player</p>
|
||||
<p class="text-3xl font-bold">{{ userInfo.username }}</p>
|
||||
</div>
|
||||
|
||||
<div v-if="isLoading" class="flex justify-center py-8">
|
||||
<span class="loading loading-spinner loading-lg"></span>
|
||||
<div class="divider"></div>
|
||||
|
||||
<div v-if="isLoading" class="flex justify-center py-8">
|
||||
<span class="loading loading-spinner loading-lg"></span>
|
||||
</div>
|
||||
|
||||
<div v-else class="space-y-4">
|
||||
<div class="text-center">
|
||||
<p class="text-sm text-base-content/70 mb-1">Current Rank</p>
|
||||
<p v-if="userInfo.rank !== null" class="text-4xl font-bold text-primary">
|
||||
#{{ userInfo.rank }}
|
||||
</p>
|
||||
<p v-else class="text-2xl text-base-content/50">No rank yet</p>
|
||||
</div>
|
||||
|
||||
<div class="text-center">
|
||||
<p class="text-sm text-base-content/70 mb-1">Total Points</p>
|
||||
<p class="text-2xl font-bold">{{ userInfo.totalPoints.toLocaleString() }}</p>
|
||||
</div>
|
||||
|
||||
<div class="text-center">
|
||||
<p class="text-sm text-base-content/70 mb-1">Puzzles Solved</p>
|
||||
<p class="text-2xl font-bold">{{ userInfo.puzzlesSolved }}</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Right Column: Results -->
|
||||
<div class="lg:col-span-2">
|
||||
<div class="card bg-base-100 shadow-lg">
|
||||
<div class="card-body">
|
||||
<h2 class="card-title text-2xl mb-6">
|
||||
<i class="mdi mdi-trophy text-yellow-500 mr-2"></i>
|
||||
General Results
|
||||
</h2>
|
||||
|
||||
<div v-if="isLoading" class="flex justify-center py-8">
|
||||
<span class="loading loading-spinner loading-lg"></span>
|
||||
</div>
|
||||
|
||||
<div v-else-if="!resultsData" class="text-center py-8">
|
||||
<p class="text-base-content/70">No results available yet</p>
|
||||
@ -286,6 +364,8 @@ onMounted(() => {
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user