feat: add auth and dual-stack tls management

This commit is contained in:
2026-05-07 00:20:44 +08:00
parent cc19ee1936
commit fdec8960c2
24 changed files with 3005 additions and 312 deletions
+9
View File
@@ -8,6 +8,7 @@ import {
linkToFile,
optionalQueryParam
} from './modules/common.js';
import { bindLogoutButton, loadAuthState } from './modules/auth-client.js';
const SOURCE_VIEWS = new Set(['overview', 'browse', 'enhance', 'thumbnails']);
@@ -33,6 +34,8 @@ const webdavHintElement = document.querySelector('#webdavHint');
const deleteSourceButton = document.querySelector('#deleteSourceButton');
const sourceThumbnailSummaryElement = document.querySelector('#sourceThumbnailSummary');
const clearSourceThumbnailsButton = document.querySelector('#clearSourceThumbnailsButton');
const authStatusElement = document.querySelector('#authStatus');
const logoutButton = document.querySelector('#logoutButton');
const viewPanels = [...document.querySelectorAll('[data-view-panel]')];
const viewLinks = [...document.querySelectorAll('[data-view-link]')];
@@ -554,6 +557,12 @@ window.addEventListener('hashchange', () => {
});
async function bootstrap() {
const authentication = await loadAuthState();
authStatusElement.textContent = authentication.authenticated
? `已登录:${authentication.username}`
: '未登录';
bindLogoutButton(logoutButton, authStatusElement);
if (!state.sourceId) {
renderMissingRouteContext();
return;