一碗鹌鹑蛋 LV31

一碗鹌鹑蛋 特权

📍 正阳县 🌱 空间等级 31 ✨ 49 条说说 👍 10 次获赞
登录后解锁 发表说说·装扮空间·点赞互动

蚂蚁 的空间

这里收纳了同一主题下的说说。

返回主页
蚂蚁

分享一个脚本
// ==UserScript==
// @name Bitwarden AutoFill (Via)
// @namespace local.bw
// @version 1.0
// @description 自动填充 Bitwarden 密码
// @match *://*/*
// @grant none
// @run-at document-idle
// ==/UserScript==

(function () {
'use strict';
const PROXY = 'http://192.168.1.100:8765'; // 改成你的代理地址

function getDomain() {
return location.hostname.replace(/^www\./, '');
}

function findLoginForm() {
const pwd = document.querySelector('input[type="password"]');
if (!pwd) return null;
// 向上找 form,找不到就取最近的 username 输入框
let user = null;
const form = pwd.closest('form');
const scope = form || document;
user = scope.querySelector(
'input[type="text"], input[type="email"], input[name*="user" i], input[name*="email" i], input[autocomplete="username"]'
);
return { user, pwd };
}

async function fill() {
const form = findLoginForm();
if (!form) return;

// 避免重复填充
if (form.pwd.dataset.bwFilled) return;
form.pwd.dataset.bwFilled = '1';

try {
const res = await fetch(`${PROXY}/search?domain=${encodeURIComponent(getDomain())}`);
const items = await res.json();
if (!items || !items.length) return;

const item = items[0]; // 取第一个匹配项
if (form.user && item.username) {
form.user.value = item.username;
form.user.dispatchEvent(new Event('input', { bubbles: true }));
}
form.pwd.value = item.password;
form.pwd.dispatchEvent(new Event('input', { bubbles: true }));
form.pwd.dispatchEvent(new Event('change', { bubbles: true }));

// 可选:自动提交
// form.pwd.closest('form')?.submit();
} catch (e) {
console.warn('[BW] 填充失败', e);
}
}

// 页面加载 + 动态表单监听
fill();
new MutationObserver(fill).observe(document.body, { childList: true, subtree: true });
})();

蚂蚁

遇见一辆摩旅,把手左右两边、后备箱上还有车身上面挂的都是大包小包。我操,严严实实就露个脸,我操,真牛逼

  1. 1
  2. 2
  3. …
  4. 10