mirror of
https://github.com/HeyPuter/puter.git
synced 2026-05-04 00:20:45 +00:00
add redundant readdir to cache the home dir
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user