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:
@@ -7013,6 +7013,14 @@ async function enterApp() {
|
||||
// Fire-and-forget HIBP scan if the user opted in. Runs in background,
|
||||
// re-renders when done to show badges.
|
||||
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.
|
||||
// Replaces the historical "always Ctrl+Shift+L on startup" path.
|
||||
// silent: no success toast on every unlock — a clash still warns.
|
||||
@@ -8090,6 +8098,9 @@ async function init() {
|
||||
$('#settingAutofill').addEventListener('change', e => {
|
||||
state.autofillEnabled = e.target.checked;
|
||||
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
|
||||
// uses the user's current combos, not the defaults.
|
||||
autofillPushHotkeys();
|
||||
|
||||
Reference in New Issue
Block a user