@samitouri / QOSami-HFS / commits / 8ecba7ff

plugins: removed DirEntry.t

Massimo Melina committed Feb 16, 2025 at 14:31 UTC 8ecba7ff4f1123d85ccecad7231678f17d7aa8b7
5 files changed +6 -12
frontend/src/BrowseFiles.ts
+1 -1
@@ -359,7 +359,7 @@ export function getEntryIcon(entry: DirEntry) {
359
360 export const EntryDetails = memo(({ entry, midnight }: { entry: DirEntry, midnight: Date }) => {
361 const { sort_by } = useSnapState()
362 - const time = sort_by === 'creation' ? entry.c : entry.t
362 + const time = sort_by === 'creation' ? entry.c : entry.m
363 const today = time && time > midnight
364 const shortTs = useWindowSize().width < 800
365 const {t} = useI18N()
frontend/src/fileMenu.ts
+1 -1
@@ -76,7 +76,7 @@ export function openFileMenu(entry: DirEntry, ev: MouseEvent, addToMenu: (Falsy
76 { id: 'name', label: t`Name`, value: entry.name },
77 typeof s === 'number' && { id: 'size', label: t`Size`,
78 value: h(Fragment, {}, formatBytes(s), h('small', {}, prefix(' (', s > getHFS().kb && s.toLocaleString(), ')')) ) },
79 - entry.t && { id: 'timestamp', label: t`Timestamp`, value: entry.t.toLocaleString() },
79 + entry.m && { id: 'timestamp', label: t`Timestamp`, value: entry.m.toLocaleString() },
80 entry.c && { id: 'creation', label: t`Creation`, value: entry.c.toLocaleString() },
81 folder && {
82 id: 'folder',
frontend/src/state.ts
+1 -3
@@ -109,7 +109,6 @@ export class DirEntry implements ServerDirEntry {
109 public readonly uri: string
110 public readonly ext: string = ''
111 public readonly isFolder: boolean
112 - public readonly t?: Date
112 public readonly cantOpen?: true | typeof DirEntry.FORBIDDEN
113 public readonly key?: string
114
@@ -125,8 +124,7 @@ export class DirEntry implements ServerDirEntry {
124 this.ext = i ? n.substring(i).toLowerCase() : ''
125 }
126 this.c &&= new Date(this.c)
128 - this.m &&= new Date(this.m)
129 - this.t = this.m || this.c
127 + this.m = this.m ? new Date(this.m) : this.c
128 this.name = n.slice(n.lastIndexOf('/') + 1)
129 const x = this.isFolder && !this.web ? 'L' : 'R' // to open we need list for folders and read for files
130 this.cantOpen = this.p?.match(x) ? true : this.p?.match(x.toLowerCase()) ? DirEntry.FORBIDDEN : undefined
frontend/src/useFetchList.ts
+1 -1
@@ -184,7 +184,7 @@ function sort(list: DirList) {
184 || folders_first && -compareScalar(a.isFolder, b.isFolder)
185 || invert * (bySize ? compareScalar(a.s||0, b.s||0)
186 : byExt ? localCompare(a.ext, b.ext)
187 - : byTime ? compareScalar(a.t, b.t)
187 + : byTime ? compareScalar(a.m, b.m)
188 : byCreation ? compareScalar(a.c, b.c)
189 : 0
190 )
src/api.get_file_list.ts
+2 -6
@@ -96,12 +96,8 @@ export const get_file_list: ApiHandler = async ({ uri='/', offset, limit, c, onl
96 --offset
97 continue
98 }
99 - if (c === 'no') { // allow excluding c for smaller payload
100 - if (!entry.m)
101 - entry.m = entry.c
102 - if (entry.c)
103 - entry.c = undefined
104 - }
99 + if (c === 'no' && entry.c) // allow excluding c for smaller payload
100 + entry.c = undefined
101 yield entry
102 if (limit && !--limit)
103 break