better code: removed useless code, as mtime is supposed to be always set

Massimo Melina committed Jan 30, 2025 at 15:05 UTC cf48d0562035caeccbc6f8ff9f6e5669d3f30102
4 files changed +4 -4
shared/min-crypto-polyfill.js
+1 -1
@@ -1,7 +1,7 @@
1 export {}
2 // this is the minimum required for lib tssrp6a to work
3 window.crypto ||= {}
4 -crypto.subtle ||= {}
4 +crypto.subtle ||= console.debug("using polyfill for crypto.subtle") || {}
5 crypto.subtle.digest ||= async (algo, buff) => {
6 if (algo !== 'SHA-512')
7 return alert(algo + ' required but not supported')
src/config.ts
+1 -1
@@ -176,7 +176,7 @@ const saveDebounced = debounceAsync(async () => {
176 // keep backup
177 const bak = filePath + '.bak'
178 const aWeekAgo = Date.now() - DAY * 7
179 - if (await stat(bak).then(x => aWeekAgo > (x.mtimeMs || x.birthtimeMs), () => true))
179 + if (await stat(bak).then(x => aWeekAgo > x.mtimeMs, () => true))
180 await copyFile(filePath, bak).catch(() => {}) // ignore errors
181
182 await configFile.save(stringify({ ...state, version: VERSION }))
src/log.ts
+1 -1
@@ -32,7 +32,7 @@ class Logger {
32 return this.stream = undefined
33 try {
34 const stats = await stat(path)
35 - this.last = stats.mtime || stats.birthtime
35 + this.last = stats.mtime
36 }
37 catch {
38 if (await prepareFolder(path) === false)
src/zip.ts
+1 -1
@@ -62,7 +62,7 @@ export async function zipStreamFromFolder(node: VfsNode, ctx: Koa.Context) {
62 return {
63 path: name,
64 size: st.size,
65 - ts: st.mtime || st.birthtime,
65 + ts: st.mtime,
66 mode: st.mode,
67 sourcePath: source,
68 getData: () => createReadStream(source, { start: 0 , end: Math.max(0, st.size-1) })