mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-05 22:30:21 +00:00
UI: inline storage lookup and simplify settings password param check
This commit is contained in:
@@ -127,7 +127,6 @@ export function applySettingsFromUrl(host: SettingsHost) {
|
||||
const queryToken = params.get("token");
|
||||
const hashToken = hashParams.get("token");
|
||||
const hasTokenParam = hashToken != null || queryToken != null;
|
||||
const passwordRaw = params.get("password") ?? hashParams.get("password");
|
||||
const token = normalizeOptionalString(hashToken ?? queryToken);
|
||||
const session = normalizeOptionalString(params.get("session") ?? hashParams.get("session"));
|
||||
const shouldResetSessionForToken = Boolean(token && !session && !gatewayUrlChanged);
|
||||
@@ -163,7 +162,7 @@ export function applySettingsFromUrl(host: SettingsHost) {
|
||||
});
|
||||
}
|
||||
|
||||
if (passwordRaw != null) {
|
||||
if (params.has("password") || hashParams.has("password")) {
|
||||
// Never hydrate password from URL params; strip only.
|
||||
params.delete("password");
|
||||
hashParams.delete("password");
|
||||
|
||||
@@ -44,12 +44,8 @@ const LEGACY_USAGE_DATE_PARAMS_INVALID_RE = /invalid sessions\.usage params/i;
|
||||
|
||||
let legacyUsageDateParamsCache: Set<string> | null = null;
|
||||
|
||||
function getLocalStorage(): Storage | null {
|
||||
return getSafeLocalStorage();
|
||||
}
|
||||
|
||||
function loadLegacyUsageDateParamsCache(): Set<string> {
|
||||
const storage = getLocalStorage();
|
||||
const storage = getSafeLocalStorage();
|
||||
if (!storage) {
|
||||
return new Set<string>();
|
||||
}
|
||||
@@ -74,7 +70,7 @@ function loadLegacyUsageDateParamsCache(): Set<string> {
|
||||
}
|
||||
|
||||
function persistLegacyUsageDateParamsCache(cache: Set<string>) {
|
||||
const storage = getLocalStorage();
|
||||
const storage = getSafeLocalStorage();
|
||||
if (!storage) {
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user