Youtube indirmeleri ile ilgili UI/UX güncellemeleri yapıldı

This commit is contained in:
2025-11-30 20:16:20 +03:00
parent decf503297
commit 4ab37005cf
3 changed files with 50 additions and 9 deletions

View File

@@ -78,6 +78,10 @@
: originalSegments; : originalSegments;
const isDirectory = Boolean(file.isDirectory); const isDirectory = Boolean(file.isDirectory);
const baseDisplayName =
file.displayName ||
displaySegments[displaySegments.length - 1] ||
file.name;
return { return {
...file, ...file,
isDirectory, isDirectory,
@@ -85,7 +89,7 @@
originalSegments, originalSegments,
displaySegments, displaySegments,
displayPath: displaySegments.join("/"), displayPath: displaySegments.join("/"),
displayName: displaySegments[displaySegments.length - 1] || file.name, displayName: baseDisplayName,
displayParentPath: displaySegments.slice(0, -1).join("/"), displayParentPath: displaySegments.slice(0, -1).join("/"),
}; };
} }
@@ -123,7 +127,7 @@
if (file.isDirectory) { if (file.isDirectory) {
const displayPath = segments.join("/"); const displayPath = segments.join("/");
const parentDisplayPath = segments.slice(0, -1).join("/"); const parentDisplayPath = segments.slice(0, -1).join("/");
const displayName = segments[segments.length - 1] || displayPath; const displayName = file.displayName || segments[segments.length - 1] || displayPath;
ensureDirectoryEntry(displayPath, displayName, parentDisplayPath, fullOriginalPath); ensureDirectoryEntry(displayPath, displayName, parentDisplayPath, fullOriginalPath);
} }

View File

@@ -534,6 +534,10 @@
class="thumb" class="thumb"
on:load={(e) => e.target.classList.add("loaded")} on:load={(e) => e.target.classList.add("loaded")}
/> />
{:else if t.type === "youtube" && (!t.progress || t.progress <= 0)}
<div class="thumb placeholder loading">
<div class="spinner"></div>
</div>
{:else} {:else}
<div class="thumb placeholder"> <div class="thumb placeholder">
<i class="fa-regular fa-image"></i> <i class="fa-regular fa-image"></i>
@@ -545,6 +549,9 @@
<div class="torrent-title"> <div class="torrent-title">
<div class="torrent-name">{t.name}</div> <div class="torrent-name">{t.name}</div>
{#if t.type === "youtube"} {#if t.type === "youtube"}
<div class="torrent-subtitle">
Source: YouTube
</div>
<div class="torrent-subtitle"> <div class="torrent-subtitle">
Added: {formatDate(t.added)} Added: {formatDate(t.added)}
</div> </div>
@@ -572,15 +579,12 @@
</div> </div>
</div> </div>
<div class="torrent-hash"> {#if t.type !== "youtube"}
{#if t.type === "youtube"} <div class="torrent-hash">
Source: YouTube | Added:
{t.added ? formatDate(t.added) : "Unknown"}
{:else}
Hash: {t.infoHash} | Tracker: {t.tracker ?? "Unknown"} | Added: Hash: {t.infoHash} | Tracker: {t.tracker ?? "Unknown"} | Added:
{t.added ? formatDate(t.added) : "Unknown"} {t.added ? formatDate(t.added) : "Unknown"}
{/if} </div>
</div> {/if}
{#if t.files && t.files.length} {#if t.files && t.files.length}
<div class="torrent-files"> <div class="torrent-files">
@@ -815,6 +819,30 @@
color: #666; color: #666;
} }
.placeholder.loading {
display: flex;
align-items: center;
justify-content: center;
}
.spinner {
width: 32px;
height: 32px;
border: 3px solid rgba(255, 255, 255, 0.2);
border-top-color: #fdce45;
border-radius: 50%;
animation: spin 0.8s linear infinite;
}
@keyframes spin {
from {
transform: rotate(0deg);
}
to {
transform: rotate(360deg);
}
}
.toggle-btn { .toggle-btn {
background: transparent; background: transparent;
border: none; border: none;

View File

@@ -4910,9 +4910,16 @@ app.get("/api/files", requireAuth, (req, res) => {
const tracker = dirInfo.tracker ?? null; const tracker = dirInfo.tracker ?? null;
const torrentName = dirInfo.name ?? null; const torrentName = dirInfo.name ?? null;
const infoHash = dirInfo.infoHash ?? null; const infoHash = dirInfo.infoHash ?? null;
const baseName = safeRel.split(/[\\/]/).pop();
const isRoot = !relWithinRoot;
const displayName =
isRoot && tracker === "youtube" && torrentName
? torrentName
: baseName;
result.push({ result.push({
name: safeRel, name: safeRel,
displayName,
size: 0, size: 0,
type: "inode/directory", type: "inode/directory",
isDirectory: true, isDirectory: true,
@@ -4984,9 +4991,11 @@ app.get("/api/files", requireAuth, (req, res) => {
: null; : null;
const isPrimaryVideo = const isPrimaryVideo =
!!info.primaryVideoPath && info.primaryVideoPath === relWithinRoot; !!info.primaryVideoPath && info.primaryVideoPath === relWithinRoot;
const displayName = entry.name;
result.push({ result.push({
name: safeRel, name: safeRel,
displayName,
size, size,
type, type,
url, url,