diff --git a/src/app/components/DirectorySlideshow.tsx b/src/app/components/DirectorySlideshow.tsx index 5ba7e92..c09e49b 100644 --- a/src/app/components/DirectorySlideshow.tsx +++ b/src/app/components/DirectorySlideshow.tsx @@ -1,6 +1,6 @@ import { useCallback, useEffect, useRef, useState } from 'react'; import { ChevronLeft, ChevronRight, Pause, Play } from 'lucide-react'; -import { listDirectory, getWebDAVBaseUrl, type EntryInfo } from '../webdav'; +import { listDirectory, stat, splitPath, getWebDAVBaseUrl, type EntryInfo } from '../webdav'; import { IMAGE_EXTS } from './MediaEntry'; // Module-level cache: persists for the lifetime of the page session. @@ -60,7 +60,8 @@ export default function DirectorySlideshow({ path }: Props) { // Fetch directory listing and preload all images eagerly. useEffect(() => { if (!path) { setImages([]); return; } - listDirectory(path) + stat(path) + .then(info => listDirectory(info?.type === 'file' ? splitPath(path).parent : path)) .then(entries => { const imgs = entries.filter(e => { if (e.type !== 'file') return false; diff --git a/src/app/components/StatusPage.tsx b/src/app/components/StatusPage.tsx index eb54a41..01252e6 100644 --- a/src/app/components/StatusPage.tsx +++ b/src/app/components/StatusPage.tsx @@ -41,8 +41,8 @@ export default function StatusPage({ config, setConfig, onOpenFileManager }: Sta }; const activeDevice = findActiveDevice(); - const activeDir = activeDevice - ? (activeDevice.base_url || splitPath(activeDevice.url || '/').parent) + const activeDir = activeDevice + ? (activeDevice.base_url || activeDevice.url || null) : null; const mediaSetFiles: MediaSetEntry[] | null =