auth additions

This commit is contained in:
Ryan
2025-03-09 23:40:47 -04:00
committed by GitHub
parent f59ad8077f
commit fc1a1b6b0f
3 changed files with 103 additions and 94 deletions

25
main.js
View File

@@ -15,12 +15,9 @@ import {
displayFilePreview,
renameFile
} from './fileManager.js';
import {
loadFolderTree,
loadFolderList
} from './folderManager.js';
import { loadFolderTree } from './folderManager.js';
import { initUpload } from './upload.js';
import { initAuth } from './auth.js';
import { initAuth, checkAuthentication } from './auth.js';
// Expose functions for inline handlers.
window.sendRequest = sendRequest;
@@ -44,10 +41,16 @@ document.addEventListener("DOMContentLoaded", function () {
showToast(message);
sessionStorage.removeItem("welcomeMessage");
}
window.currentFolder = "root";
window.updateFileActionButtons = updateFileActionButtons;
loadFileList(window.currentFolder);
initFileActions();
initUpload();
loadFolderTree();
checkAuthentication().then(authenticated => {
if (authenticated) {
window.currentFolder = "root";
loadFileList(window.currentFolder);
initFileActions();
initUpload();
loadFolderTree();
} else {
console.warn("User not authenticated. Data loading deferred.");
// Optionally redirect to login
}
});
});