mirror of
https://github.com/Nezumi-2711/onedrive-vercel-index.git
synced 2026-09-22 13:38:45 +00:00
request all thumbnail on separate route instead
This commit is contained in:
@@ -12,17 +12,8 @@ import { getReadablePath } from '../utils/getReadablePath'
|
||||
import { Checkbox, ChildIcon, Downloading, formatChildName } from './FileListing'
|
||||
|
||||
const GridItem = ({ c, path }: { c: OdFolderChildren; path: string }) => {
|
||||
// We use the generated medium thumbnail for rendering preview images
|
||||
const thumbnailUrl =
|
||||
'folder' in c
|
||||
? // Folders don't have thumbnails
|
||||
null
|
||||
: c.thumbnails && c.thumbnails.length > 0
|
||||
? // Most OneDrive versions, including E5 developer, should have thumbnails returned
|
||||
c.thumbnails[0].medium.url
|
||||
: // According to OneDrive docs, OneDrive for Business and SharePoint does not
|
||||
// (can not retrieve thumbnails via expand). But currently we only see OneDrive 世纪互联 really does not.
|
||||
`/api/thumbnail?path=${path}`
|
||||
// We use the generated medium thumbnail for rendering preview images (excluding folders)
|
||||
const thumbnailUrl = 'folder' in c ? null : `/api/thumbnail?path=${path}&size=medium`
|
||||
|
||||
// Some thumbnails are broken, so we check for onerror event in the image component
|
||||
const [brokenThumbnail, setBrokenThumbnail] = useState(false)
|
||||
|
||||
@@ -21,7 +21,7 @@ const VideoPreview: React.FC<{ file: OdFileObject }> = ({ file }) => {
|
||||
const { t } = useTranslation()
|
||||
|
||||
// OneDrive generates thumbnails for its video files, we pick the thumbnail with the highest resolution
|
||||
const thumbnail = file.thumbnails && file.thumbnails.length > 0 ? file.thumbnails[0].large.url : ''
|
||||
const thumbnail = `/api/thumbnail?path=${asPath}&size=large`
|
||||
|
||||
// We assume subtitle files are beside the video with the same name, only webvtt '.vtt' files are supported
|
||||
const subtitle = `/api?path=${asPath.replace(getExtension(file.name), 'vtt')}&raw=true`
|
||||
|
||||
Reference in New Issue
Block a user