Skip to content
This repository was archived by the owner on Feb 3, 2025. It is now read-only.

Commit d01aa98

Browse files
committed
fix: try other date information from fs for Download Date if birthtime is not present
1 parent 2e31657 commit d01aa98

File tree

2 files changed

+17
-3
lines changed

2 files changed

+17
-3
lines changed

src/components/navbar.tsx

+6-2
Original file line numberDiff line numberDiff line change
@@ -267,8 +267,12 @@ function Activity({ data }: { data: ActivityType }) {
267267
export function KaizokuNavbar() {
268268
const { classes } = useStyles();
269269

270-
const historyQuery = trpc.manga.history.useQuery();
271-
const activityQuery = trpc.manga.activity.useQuery();
270+
const historyQuery = trpc.manga.history.useQuery(undefined, {
271+
refetchInterval: 5 * 1000,
272+
});
273+
const activityQuery = trpc.manga.activity.useQuery(undefined, {
274+
refetchInterval: 5 * 1000,
275+
});
272276
const libraryQuery = trpc.library.query.useQuery();
273277

274278
if (!libraryQuery.data) {

src/server/utils/mangal.ts

+11-1
Original file line numberDiff line numberDiff line change
@@ -318,10 +318,20 @@ const shouldIncludeFile = (chapterFile: string) => {
318318
export const getChapterFromLocal = async (chapterFile: string) => {
319319
try {
320320
const stat = await fs.stat(chapterFile);
321+
let createdAt = new Date();
322+
323+
if (stat.birthtime.getTime() !== 0) {
324+
createdAt = stat.birthtime;
325+
} else if (stat.ctime.getTime() !== 0) {
326+
createdAt = stat.ctime;
327+
} else if (stat.mtime.getTime() !== 0) {
328+
createdAt = stat.mtime;
329+
}
330+
321331
return {
322332
index: getChapterIndexFromFile(chapterFile)!,
323333
size: stat.size,
324-
createdAt: stat.birthtime,
334+
createdAt,
325335
fileName: path.basename(chapterFile),
326336
};
327337
} catch (err) {

0 commit comments

Comments
 (0)