还有人坚持用 1Password 6 吗?我把 1password chrome classic 扩展改成 MV3 了 - V2EX
V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
wowh
V2EX    软件

还有人坚持用 1Password 6 吗?我把 1password chrome classic 扩展改成 MV3 了

  •  
  •   wowh 4 天前 610 次点击
    div class="topic_content">

    不知道现在还有多少人还在用 1Password 6

    先感谢下 22 年这个帖子里的大神,当年靠它解决了 Chrome 99 下 Classic 扩展不能用的问题:
    t/856341

    结果最近 Chrome 又开始彻底淘汰 Manifest V2,一开始还能开 flag ,用着用着就得靠命令行参数启动才能加载 MV2 插件,Classic 扩展眼看也要彻底凉了。
    不太想迁移订阅版,就自己动手把 1Password Classic 扩展改成了 Manifest V3,算是又能再坚持一阵。

    代码在这:
    https://github.com/wowh/1password

    我是基于之前老外分享的插件备份改的,介意的话可以自己审查下代码。

    用法很简单:

    • 下载并解压
    • 打开 Chrome 扩展管理页面
    • 开启开发者模式
    • 选择「加载未打包的扩展程序」

    我这边简单用下来是 OK 的。
    如果你用的时候遇到什么 Bug ,可以在扩展的视图里看下 log,贴出来我帮你一起看看。

    14 条回复    2026-01-09 16:43:46 +08:00
    Q980q48Jgj6pRXoO
        1
    Q980q48Jgj6pRXoO  
    PRO
       4 天前 via iPhone
    不错
    nifan
        2
    nifan  
       4 天前
    自己搭建更香 Bitwarden
    wowh
        3
    wowh  
    OP
       4 天前
    @nifan 之前 1p 扩展不能用,用过一段时间的 bitwarden ,一直不习惯他的界面
    steveshi
        4
    steveshi  
       3 天前
    1p 6 如果不是太老了 Intel Only 确实可以继续用下去
    hackpro
        5
    hackpro  
       3 天前
    我用 Gemini 把 https://github.com/wowh/1password
    和之前的代码 https://github.com/scramblr/1password 做了比对

    大家可以参考一下


    While they are both versions of the Stanford Javascript Crypto Library (SJCL) and share about 99% of the same logic, Code 2 contains environment-safety modifications that are missing in Code 1.

    Specifically, Code 2 has been updated to be more "environment-aware" (likely to prevent crashes in Node.js or Server-Side Rendering environments), whereas Code 1 is a more traditional browser-only minification.

    Key Logical Differences
    Here are the specific areas where the logic differs beyond simple formatting:

    1. Environment Safety Checks (window and document)
    In the sjcl.random.startCollectors and stopCollectors functions, Code 2 adds checks to see if window or document are defined before accessing them.

    Code 1:

    Javascript

    if(window.addEventListener){ ... }
    else if(document.attachEvent){ ... }
    Logic: This will throw a ReferenceError in environments like Node.js because window is not defined.

    Code 2:

    Javascript

    if (typeof window !== "undefined" && window.addEventListener) { ... }
    else if (typeof document !== "undefined" && document.attachEvent) { ... }
    Logic: This is safe. It checks the type first, so it won't crash in non-rowser environments.

    2. Error Handling Removal
    In the startCollectors function, Code 1 has a fallback error that Code 2 has removed.

    Code 1:

    Javascript

    else throw new sjcl.exception.bug("can't attach event");
    Code 2: The else block is entirely removed. If it can't find window or document, it simply does nothing rather than throwing an exception.

    3. Stop Collectors Logic
    A similar change exists in stopCollectors:

    Code 1: Directly checks window.removeEventListener.

    Code 2: Checks typeof window !== "undefined" before attempting to access window.removeEventListener.



    While they share the same core cryptographic libraries (SJCL) and general business logic, Code 2 is a significantly modified version of Code 1, specifically updated to be compatible with Chrome Extension Manifest V3 (MV3). Code 1 is written for the older Manifest V2 (MV2) standard.

    Here are the specific logical and functional differences:

    1. Global Scope Reference (window vs. self)
    Since Manifest V3 uses Service Workers (which do not have access to the window object), the global scope references have been changed.

    Code 1: Uses window (e.g., n='undefined'!=typeof window&&window===this?this... and window.OnePassword=r).

    Code 2: Uses self or globalThis (e.g., n = 'undefined' != typeof self && self.self === self ? self... and self.OnePassword= r).

    2. Browser Action API
    Chrome changed the "Browser Action" API to a generic "Action" API in Manifest V3.

    Code 1: Uses chrome.browserAction (e.g., chrome.browserAction.onClicked... and chrome.browserAction.enable()).

    Code 2: Uses chrome.action (e.g., chrome.action.onClicked... and chrome.action.enable()).

    3. Navigation Interception (webRequest vs. tabs)
    This is the most significant logical rewrite. Manifest V3 restricts the use of blocking webRequest.

    Code 1: Uses chrome.webRequest.onBeforeRequest with the ['blocking'] attribute to intercept URLs containing onepasswdfill.

    Code 2: Completely removes the webRequest logic and replaces it with a chrome.tabs.onUpdated listener. It now watches for tab updates to detect those specific URLs instead of intercepting the network request.

    4. Context Menus Implementation
    Code 1: Uses the onclick property directly inside the chrome.contextMenus.create object.

    Code 2: Removes the onclick property from the creation object (as it's forbidden in MV3) and implements a centralized listener using chrome.contextMenus.onClicked.addListener. It also adds a mandatory id to the menu item.

    5. URL API Modernization
    Code 1: Accesses the URL constructor via window.URL || window.webkitURL.

    Code 2: Accesses it via globalThis.URL || URL.
    hackpro
        6
    hackpro  
       3 天前
    和官网原始版本( 6.8.9 )最大的不同就是现在完全不需要输入 master 密码解锁
    Alfred launch 后直接就解锁了

    不知道有其他大佬也是这样的情况吗
    wowh
        7
    wowh  
    OP
       3 天前
    @hackpro 是不是 1password 本身就是解锁状态?我这边测试没这个问题,还是需要解锁才能使用
    hackpro
        8
    hackpro  
       3 天前
    @wowh 感谢老哥
    我测了手头俩台设备 好像只有 M 系列才有这个问题 intel 10.15 没问题
    wowh
        9
    wowh  
    OP
       3 天前 via iPhone
    @hackpro 手头没 m 系列的 mac ,扩展管理检查视图,背景页点进去看下 console 里的 log 是否有异常
    hackpro
        10
    hackpro  
       2 天前
    @wowh 老哥顺便请教下你的 1p mini 浏览器小窗口也是 dark 背景吗
    我记得原版的好像不是这样还是脚本改了什么东西 每次扒拉账号信息看起来好吃力
    wowh
        11
    wowh  
    OP
       2 天前
    @hackpro 我试了下旧版也是这样的,系统如果是深色的就会跟随深色背景 intel mac sequoia 15.7.2 系统
    hackpro
        12
    hackpro  
       1 天前
    @wowh 问题是我系统设置的是 light theme
    1p 主程序打开也是 light 但是 chrome 插件也 dark theme
    wowh
        13
    wowh  
    OP
       1 天前
    @hackpro 是什么系统啊,有点奇怪啊,我看了下这个界面是 1password mini 直接输出的,没法在扩展里面修改
    hackpro
        14
    hackpro  
       1 天前
    @wowh
    * macOS 15.1 light theme, 1p 6.8.9 主程序 light theme, 1p mini extension dark
    * macOS 10.15 light theme, 1p 6.8.9 主程序 light theme, 1p mini extension light

    https://imgur.com/a/zhTyhfe
    关于     帮助文档     自助推广系统     博客     API     FAQ     Solana     2095 人在线   最高记录 6679       Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 24ms UTC 16:12 PVG 00:12 LAX 08:12 JFK 11:12
    Do have faith in what you're doing.
    ubao msn snddm index pchome yahoo rakuten mypaper meadowduck bidyahoo youbao zxmzxm asda bnvcg cvbfg dfscv mmhjk xxddc yybgb zznbn ccubao uaitu acv GXCV ET GDG YH FG BCVB FJFH CBRE CBC GDG ET54 WRWR RWER WREW WRWER RWER SDG EW SF DSFSF fbbs ubao fhd dfg ewr dg df ewwr ewwr et ruyut utut dfg fgd gdfgt etg dfgt dfgd ert4 gd fgg wr 235 wer3 we vsdf sdf gdf ert xcv sdf rwer hfd dfg cvb rwf afb dfh jgh bmn lgh rty gfds cxv xcv xcs vdas fdf fgd cv sdf tert sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf shasha9178 shasha9178 shasha9178 shasha9178 shasha9178 liflif2 liflif2 liflif2 liflif2 liflif2 liblib3 liblib3 liblib3 liblib3 liblib3 zhazha444 zhazha444 zhazha444 zhazha444 zhazha444 dende5 dende denden denden2 denden21 fenfen9 fenf619 fen619 fenfe9 fe619 sdf sdf sdf sdf sdf zhazh90 zhazh0 zhaa50 zha90 zh590 zho zhoz zhozh zhozho zhozho2 lislis lls95 lili95 lils5 liss9 sdf0ty987 sdft876 sdft9876 sdf09876 sd0t9876 sdf0ty98 sdf0976 sdf0ty986 sdf0ty96 sdf0t76 sdf0876 df0ty98 sf0t876 sd0ty76 sdy76 sdf76 sdf0t76 sdf0ty9 sdf0ty98 sdf0ty987 sdf0ty98 sdf6676 sdf876 sd876 sd876 sdf6 sdf6 sdf9876 sdf0t sdf06 sdf0ty9776 sdf0ty9776 sdf0ty76 sdf8876 sdf0t sd6 sdf06 s688876 sd688 sdf86