From c0b03e147b0a4f5a12c2aed8f44790e0a409b4a9 Mon Sep 17 00:00:00 2001 From: jelveh Date: Thu, 18 Sep 2025 21:03:28 -0700 Subject: [PATCH] add redundant readdir to cache the home dir --- src/backend/src/routers/whoami.js | 10 +++------- src/gui/src/UI/UIDesktop.js | 5 +++++ 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/backend/src/routers/whoami.js b/src/backend/src/routers/whoami.js index 9898fc03e..bb14469d5 100644 --- a/src/backend/src/routers/whoami.js +++ b/src/backend/src/routers/whoami.js @@ -56,19 +56,15 @@ const whoami_common = ({ is_user, user }) => { } if(user.last_activity_ts){ - let dateString = user.last_activity_ts; - - // Replace the space with 'T' to make it ISO 8601 compliant - const isoString = dateString.replace(' ', 'T'); // Create a Date object and get the epoch timestamp let epoch; try{ - epoch = new Date(isoString).getTime() / 1000; + epoch = new Date(user.last_activity_ts).getTime(); // round to 1 decimal place - epoch = Math.round(epoch); + epoch = Math.round(epoch/1000); }catch(e){ - console.error('Error parsing last_activity_ts', e); + // console.error('Error parsing last_activity_ts', e); } // add last_activity_ts diff --git a/src/gui/src/UI/UIDesktop.js b/src/gui/src/UI/UIDesktop.js index af9ad631f..0e9174da2 100644 --- a/src/gui/src/UI/UIDesktop.js +++ b/src/gui/src/UI/UIDesktop.js @@ -1056,6 +1056,11 @@ async function UIDesktop(options) { } }) + // perform readdirs for caching purposes + + // home directory + puter.fs.readdir({path: window.home_path, consistency: 'strong'}); + // Show welcome window if user hasn't already seen it and hasn't directly navigated to an app if (!window.url_paths[0]?.toLocaleLowerCase() === 'app' || !window.url_paths[1]) { if (!isMobile.phone && !isMobile.tablet) {