asdf98 commited on
Commit
59d550a
·
verified ·
1 Parent(s): 58e66b1

fix: rename remaining Muse comments/globals in autofill suppression script

Browse files
src-tauri/resources/scripts/autofill_suppress.js CHANGED
@@ -1,71 +1,53 @@
1
- /**
2
- * Muse Autofill Suppression
3
- *
4
- * Disables native browser autofill (WebView2/WKWebView/WebKitGTK) so that
5
- * the Muse password vault is the only credential source for form fields.
6
- *
7
- * Why: System WebView engines may show their own password save/autofill UIs
8
- * which conflict with our Stronghold-backed vault. We suppress them by:
9
- * 1. Setting autocomplete="off" on all form/input elements
10
- * 2. Using autocomplete="new-password" on password fields (tells browsers not to autofill)
11
- * 3. Adding data-* attributes that third-party password managers check
12
- * 4. Intercepting dynamically created inputs via MutationObserver
13
- *
14
- * Platform notes:
15
- * - Windows WebView2: general_autofill_enabled(false) is also set via Rust builder.
16
- * Password save is already off by default (IsPasswordAutosaveEnabled=false).
17
- * - macOS WKWebView: No public API exists. This JS approach + the Rust
18
- * .general_autofill_enabled(false) builder call (noop on mac but future-proof).
19
- * - Linux WebKitGTK: No built-in password manager UI — this is purely defensive.
20
- */
21
- (function() {
22
- if (window.__museAutofillSuppressed) return;
23
- window.__museAutofillSuppressed = true;
24
-
25
- function suppress(el) {
26
- if (!el || !el.setAttribute) return;
27
- var tag = el.tagName;
28
- if (tag === 'FORM') {
29
- el.setAttribute('autocomplete', 'off');
30
- } else if (tag === 'INPUT') {
31
- var type = (el.type || '').toLowerCase();
32
- if (type === 'password') {
33
- // "new-password" tells browsers: don't autofill existing passwords
34
- el.setAttribute('autocomplete', 'new-password');
35
- } else if (type === 'email' || type === 'text' || type === 'tel') {
36
- el.setAttribute('autocomplete', 'off');
37
- }
38
- // Suppress third-party password managers too
39
- el.setAttribute('data-lpignore', 'true'); // LastPass
40
- el.setAttribute('data-form-type', 'other'); // Dashlane
41
- el.setAttribute('data-1p-ignore', 'true'); // 1Password
42
- }
43
- }
44
-
45
- function suppressAll() {
46
- document.querySelectorAll('form, input').forEach(suppress);
47
- }
48
-
49
- // Initial pass
50
- if (document.readyState === 'loading') {
51
- document.addEventListener('DOMContentLoaded', suppressAll);
52
- } else {
53
- suppressAll();
54
- }
55
-
56
- // Watch for dynamically added forms/inputs (SPAs)
57
- var observer = new MutationObserver(function(mutations) {
58
- for (var i = 0; i < mutations.length; i++) {
59
- var added = mutations[i].addedNodes;
60
- for (var j = 0; j < added.length; j++) {
61
- var node = added[j];
62
- if (node.nodeType !== 1) continue;
63
- suppress(node);
64
- if (node.querySelectorAll) {
65
- node.querySelectorAll('form, input').forEach(suppress);
66
- }
67
- }
68
- }
69
- });
70
- observer.observe(document.documentElement, { childList: true, subtree: true });
71
- })();
 
1
+ /**
2
+ * LumaRef Autofill Suppression
3
+ *
4
+ * Disables native browser autofill (WebView2/WKWebView/WebKitGTK) so that
5
+ * the LumaRef password vault is the only credential source for form fields.
6
+ */
7
+ (function() {
8
+ if (window.__lumarefAutofillSuppressed) return;
9
+ window.__lumarefAutofillSuppressed = true;
10
+
11
+ function suppress(el) {
12
+ if (!el || !el.setAttribute) return;
13
+ var tag = el.tagName;
14
+ if (tag === 'FORM') {
15
+ el.setAttribute('autocomplete', 'off');
16
+ } else if (tag === 'INPUT') {
17
+ var type = (el.type || '').toLowerCase();
18
+ if (type === 'password') {
19
+ el.setAttribute('autocomplete', 'new-password');
20
+ } else if (type === 'email' || type === 'text' || type === 'tel') {
21
+ el.setAttribute('autocomplete', 'off');
22
+ }
23
+ el.setAttribute('data-lpignore', 'true');
24
+ el.setAttribute('data-form-type', 'other');
25
+ el.setAttribute('data-1p-ignore', 'true');
26
+ }
27
+ }
28
+
29
+ function suppressAll() {
30
+ document.querySelectorAll('form, input').forEach(suppress);
31
+ }
32
+
33
+ if (document.readyState === 'loading') {
34
+ document.addEventListener('DOMContentLoaded', suppressAll);
35
+ } else {
36
+ suppressAll();
37
+ }
38
+
39
+ var observer = new MutationObserver(function(mutations) {
40
+ for (var i = 0; i < mutations.length; i++) {
41
+ var added = mutations[i].addedNodes;
42
+ for (var j = 0; j < added.length; j++) {
43
+ var node = added[j];
44
+ if (node.nodeType !== 1) continue;
45
+ suppress(node);
46
+ if (node.querySelectorAll) {
47
+ node.querySelectorAll('form, input').forEach(suppress);
48
+ }
49
+ }
50
+ }
51
+ });
52
+ observer.observe(document.documentElement, { childList: true, subtree: true });
53
+ })();