demo.filerise.net

This commit is contained in:
Ryan
2025-04-04 19:27:01 -04:00
committed by GitHub
parent a2d678ee19
commit 58db1d49ac

54
auth.js
View File

@@ -2,14 +2,14 @@ import { sendRequest } from './networkUtils.js';
import { toggleVisibility, showToast, attachEnterKeyListener, showCustomConfirmModal } from './domUtils.js'; import { toggleVisibility, showToast, attachEnterKeyListener, showCustomConfirmModal } from './domUtils.js';
import { loadFileList, renderFileTable, displayFilePreview, initFileActions } from './fileManager.js'; import { loadFileList, renderFileTable, displayFilePreview, initFileActions } from './fileManager.js';
import { loadFolderTree } from './folderManager.js'; import { loadFolderTree } from './folderManager.js';
import { import {
openTOTPLoginModal, openTOTPLoginModal,
openUserPanel, openUserPanel,
openTOTPModal, openTOTPModal,
closeTOTPModal, closeTOTPModal,
openAdminPanel, openAdminPanel,
closeAdminPanel, closeAdminPanel,
setLastLoginData setLastLoginData
} from './authModals.js'; } from './authModals.js';
// Production OIDC configuration (override via API as needed) // Production OIDC configuration (override via API as needed)
@@ -83,7 +83,7 @@ function updateAuthenticatedUI(data) {
if (typeof data.totp_enabled !== "undefined") { if (typeof data.totp_enabled !== "undefined") {
localStorage.setItem("userTOTPEnabled", data.totp_enabled ? "true" : "false"); localStorage.setItem("userTOTPEnabled", data.totp_enabled ? "true" : "false");
} }
if (data.username) { if (data.username) {
localStorage.setItem("username", data.username); localStorage.setItem("username", data.username);
} }
@@ -126,27 +126,29 @@ function updateAuthenticatedUI(data) {
const adminPanelBtn = document.getElementById("adminPanelBtn"); const adminPanelBtn = document.getElementById("adminPanelBtn");
if (adminPanelBtn) adminPanelBtn.style.display = "none"; if (adminPanelBtn) adminPanelBtn.style.display = "none";
} }
let userPanelBtn = document.getElementById("userPanelBtn"); if (window.location.hostname !== "demo.filerise.net") {
if (!userPanelBtn) { let userPanelBtn = document.getElementById("userPanelBtn");
userPanelBtn = document.createElement("button"); if (!userPanelBtn) {
userPanelBtn.id = "userPanelBtn"; userPanelBtn = document.createElement("button");
userPanelBtn.classList.add("btn", "btn-user"); userPanelBtn.id = "userPanelBtn";
userPanelBtn.innerHTML = '<i class="material-icons" title="User Panel">account_circle</i>'; userPanelBtn.classList.add("btn", "btn-user");
let adminPanelBtn = document.getElementById("adminPanelBtn"); userPanelBtn.innerHTML = '<i class="material-icons" title="User Panel">account_circle</i>';
if (adminPanelBtn) { let adminPanelBtn = document.getElementById("adminPanelBtn");
insertAfter(userPanelBtn, adminPanelBtn); if (adminPanelBtn) {
} else { insertAfter(userPanelBtn, adminPanelBtn);
const firstButton = headerButtons.firstElementChild;
if (firstButton) {
insertAfter(userPanelBtn, firstButton);
} else { } else {
headerButtons.appendChild(userPanelBtn); const firstButton = headerButtons.firstElementChild;
if (firstButton) {
insertAfter(userPanelBtn, firstButton);
} else {
headerButtons.appendChild(userPanelBtn);
}
} }
userPanelBtn.addEventListener("click", openUserPanel);
} else {
userPanelBtn.style.display = "block";
} }
userPanelBtn.addEventListener("click", openUserPanel);
} else {
userPanelBtn.style.display = "block";
} }
updateItemsPerPageSelect(); updateItemsPerPageSelect();