hackpro

hackpro

V2EX 第 119931 号会员,加入于 2015-06-01 10:44:41 +08:00
今日活跃度排名 12051
根据 hackpro 的设置,主题列表被隐藏
二手交易 相关的信息,包括已关闭的交易,不会被隐藏
hackpro 最近回复了
@wowh 感谢老哥
我测了手头俩台设备 好像只有 M 系列才有这个问题 intel 10.15 没问题🤣
和官网原始版本( 6.8.9 )最大的不同就是现在完全不需要输入 master 密码解锁
Alfred launch 后直接就解锁了🔓

不知道有其他大佬也是这样的情况吗😄😄
我用 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-browser 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.
我倒是觉得窗口切不切换的无所谓
但是自己写了一款应用把高频使用的软件磁吸在窗口边缘 即点即用
11 天前
回复了 XavierOops 创建的主题 Apple iPod touch 16 到祸啦
确实很香 我的是 18.6.2😄
15 天前
回复了 tmf4ck 创建的主题 macOS 现在 Mac 下有啥免费听歌软件
@HENQIGUAI 网站直接报毒?
27 天前
回复了 Jungeer 创建的主题 Apple 有准确消息 M6 或者 M5 max 啥时候出吗
笔记本 OLED 不得瞎眼 出了正好买 M5😄
@hahaFck #30 老哥具体说说
我有 MAS 版 Version 3.10.23 (11360)
如果官网买这个版本的话 有 OCR 和 Ai 那些功能吗?
44 天前
回复了 shimanooo 创建的主题 iPhone 外版 iPhone 是不是可以频繁 Transfer eSIM?
@PhDMartin 找错人了吧
关于   ·   帮助文档   ·   自助推广系统   ·   博客   ·   API   ·   FAQ   ·   Solana   ·   932 人在线   最高记录 6679   ·     Select Language
创意工作者们的社区
World is powered by solitude
VERSION: 3.9.8.5 · 16ms · UTC 20:31 · PVG 04:31 · LAX 12:31 · JFK 15:31
♥ Do have faith in what you're doing.