fix(settings): le toggle autofill survit au changement de port
localStorage meurt avec l'origine a chaque lancement, donc un autofill desactive revenait sur ON. Miroite en pref DPAPI comme unlockMode et rememberedUsername ; la copie DPAPI fait autorite, relue dans enterApp juste avant la poussee des combos vers Delphi. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
@@ -694,6 +694,11 @@ Per-user blob JSON dans `users.settings_json`, exposé via `GET/PUT
|
|||||||
hotkeys autofill, etc. **Device-only** (localStorage seulement) :
|
hotkeys autofill, etc. **Device-only** (localStorage seulement) :
|
||||||
`quickUnlockEnabled` (DPAPI lié au compte Windows), `autofillEnabled`
|
`quickUnlockEnabled` (DPAPI lié au compte Windows), `autofillEnabled`
|
||||||
(toggle hotkey Win32), `rememberedUsername` (auth screen autofill local).
|
(toggle hotkey Win32), `rememberedUsername` (auth screen autofill local).
|
||||||
|
Ces trois-là sont **device-only mais pas localStorage-only** : chacun est
|
||||||
|
miroité en pref DPAPI, sinon le changement de port les ramène à leur défaut
|
||||||
|
à chaque lancement (`autofillEnabled` revenait ainsi sur ON une fois
|
||||||
|
désactivé). Lu dans `enterApp` juste avant `autofillPushHotkeys`, la copie
|
||||||
|
DPAPI faisant autorité.
|
||||||
|
|
||||||
**Piège : tout réglage lu AVANT le login doit être en pref DPAPI.**
|
**Piège : tout réglage lu AVANT le login doit être en pref DPAPI.**
|
||||||
`settings_json` demande une session, et `localStorage` est vidé à chaque
|
`settings_json` demande une session, et `localStorage` est vidé à chaque
|
||||||
|
|||||||
@@ -7013,6 +7013,14 @@ async function enterApp() {
|
|||||||
// Fire-and-forget HIBP scan if the user opted in. Runs in background,
|
// Fire-and-forget HIBP scan if the user opted in. Runs in background,
|
||||||
// re-renders when done to show badges.
|
// re-renders when done to show badges.
|
||||||
if (state.hibpEnabled) hibpCheckAllEntries();
|
if (state.hibpEnabled) hibpCheckAllEntries();
|
||||||
|
// The DPAPI copy governs — localStorage was wiped by the port change.
|
||||||
|
if (Bridge.active) {
|
||||||
|
const savedAutofill = await Bridge.getPref('autofillEnabled');
|
||||||
|
if (savedAutofill === '0' || savedAutofill === '1') {
|
||||||
|
state.autofillEnabled = savedAutofill === '1';
|
||||||
|
localStorage.setItem('autofillEnabled', savedAutofill);
|
||||||
|
}
|
||||||
|
}
|
||||||
// Push the user-configured hotkeys (combos + enabled state) to Delphi.
|
// Push the user-configured hotkeys (combos + enabled state) to Delphi.
|
||||||
// Replaces the historical "always Ctrl+Shift+L on startup" path.
|
// Replaces the historical "always Ctrl+Shift+L on startup" path.
|
||||||
// silent: no success toast on every unlock — a clash still warns.
|
// silent: no success toast on every unlock — a clash still warns.
|
||||||
@@ -8090,6 +8098,9 @@ async function init() {
|
|||||||
$('#settingAutofill').addEventListener('change', e => {
|
$('#settingAutofill').addEventListener('change', e => {
|
||||||
state.autofillEnabled = e.target.checked;
|
state.autofillEnabled = e.target.checked;
|
||||||
localStorage.setItem('autofillEnabled', state.autofillEnabled ? '1' : '0');
|
localStorage.setItem('autofillEnabled', state.autofillEnabled ? '1' : '0');
|
||||||
|
// Mirrored in DPAPI: localStorage dies with the origin at every port
|
||||||
|
// change, so without this the toggle came back ON at each launch.
|
||||||
|
if (Bridge.active) Bridge.setPref('autofillEnabled', state.autofillEnabled ? '1' : '0');
|
||||||
// Push the FULL state (toggle + combos) so Delphi register/unregister
|
// Push the FULL state (toggle + combos) so Delphi register/unregister
|
||||||
// uses the user's current combos, not the defaults.
|
// uses the user's current combos, not the defaults.
|
||||||
autofillPushHotkeys();
|
autofillPushHotkeys();
|
||||||
|
|||||||
Reference in New Issue
Block a user