홈 페이지와 갤러리 페이지에서 사진 및 동영상만 표시되도록 개선

This commit is contained in:
static
2025-12-26 22:58:09 +09:00
parent 6d02178c69
commit a1f30ee154
3 changed files with 30 additions and 11 deletions

View File

@@ -1,10 +1,14 @@
import { getAllFileInfos } from "$lib/indexedDB";
export const requestFreshFilesRetrieval = async (limit = 8) => {
export const requestFreshMediaFilesRetrieval = async (limit = 8) => {
const files = await getAllFileInfos();
files.sort(
(a, b) =>
(b.createdAt ?? b.lastModifiedAt).getTime() - (a.createdAt ?? a.lastModifiedAt).getTime(),
);
return files.slice(0, limit);
return files
.filter(
({ contentType }) => contentType.startsWith("image/") || contentType.startsWith("video/"),
)
.slice(0, limit);
};