v0.2.8
RustBox CI / rustbox (push) Canceled after 0s

This commit is contained in:
Mateusz Gruszczyński committed 2026-11-01 20:40:40 +01:00
1 parent cfc74d9db6
commit dacdf9c27d
76 files changed
+5209 -741

No files matched your search

+36 -9
View File
@@ -481,17 +481,40 @@ function applyFeatureAvailability() {
async function loadAuthPolicy() {
try {
state.authPolicy = await request("/auth/policy", { method: "GET" });
const policy = await request("/auth/policy", { method: "GET" });
state.authPolicy = { ...state.authPolicy, ...policy };
} catch (_) {
state.authPolicy = { rememberMeEnabled: true, rememberMeDays: 30, sessionTimeoutHours: 24, pgpEnabled: true, sieveEnabled: true, diagnosticsEnabled: true, aboutEnabled: true };
state.authPolicy = { ...state.authPolicy, rememberMeEnabled: true };
}
const enabled = state.authPolicy.rememberMeEnabled !== false;
["#login-remember-row", "#add-account-remember-row"].forEach((selector) => $(selector)?.classList.toggle("hidden", !enabled));
["#login-remember", "#add-account-remember"].forEach((selector) => {
const input = $(selector);
if (!input) return;
input.disabled = !enabled;
if (!enabled) input.checked = false;
});
["#login-remember-label", "#add-account-remember-label"].forEach((selector) => {
const label = $(selector);
if (label) label.textContent = "Keep me signed in";
});
}
async function loadSessionPolicy() {
try {
const policy = await request("/auth/session-policy", { method: "GET" });
state.authPolicy = { ...state.authPolicy, ...policy };
} catch (_) {
state.authPolicy = {
...state.authPolicy,
pgpEnabled: false,
sieveEnabled: false,
diagnosticsEnabled: false,
aboutEnabled: false,
};
}
setOpenPgpAvailability(state.authPolicy.pgpEnabled !== false);
applyFeatureAvailability();
const enabled = state.authPolicy.rememberMeEnabled !== false;
["#login-remember-row", "#add-account-remember-row"].forEach((selector) => $(selector)?.classList.toggle("hidden", !enabled));
["#login-remember", "#add-account-remember"].forEach((selector) => { const input = $(selector); if (input && !enabled) { input.checked = false; input.disabled = true; } });
const days = Number(state.authPolicy.rememberMeDays || 30);
["#login-remember-label", "#add-account-remember-label"].forEach((selector) => { const label = $(selector); if (label) label.textContent = `Keep me signed in (${days} days)`; });
}
async function loadAccounts() {
@@ -607,9 +630,11 @@ async function reloadActiveAccount() {
state.selectedMessages.clear();
state.selectionMode = false;
closeReader();
await loadSessionPolicy();
await loadPreferences();
await loadMailPreferences();
await loadOpenPgp();
if (state.authPolicy.pgpEnabled !== false) await loadOpenPgp();
else setOpenPgpAvailability(false);
await loadIdentities();
await loadFolders(true);
await loadSpecialFolders();
@@ -684,9 +709,11 @@ async function login(event) {
state.accountId = data.account.id;
localStorage.setItem("rustbox.activeAccount", state.accountId);
await loadAccounts();
await loadSessionPolicy();
await loadPreferences();
await loadMailPreferences();
await loadOpenPgp();
if (state.authPolicy.pgpEnabled !== false) await loadOpenPgp();
else setOpenPgpAvailability(false);
await loadIdentities();
await loadFolders(true);
await loadSpecialFolders();