mirror of
https://wget.la/https://github.com/Wxw-Gu/WechatExplorer
synced 2026-10-06 13:54:10 +08:00
feat: 支持Mac Intel获取密钥, 提供完整支持
This commit is contained in:
@@ -1118,6 +1118,25 @@ function App(): React.ReactElement {
|
||||
}
|
||||
}
|
||||
|
||||
const handleInstallIntelKeyRuntime = async (): Promise<void> => {
|
||||
if (isFetchingDbKey) return
|
||||
setIsFetchingDbKey(true)
|
||||
setDbKeyStatus('正在准备连接环境,请保持网络连接…')
|
||||
setDbKeyStatusKind('normal')
|
||||
try {
|
||||
const result = await window.api.installIntelMacKeyRuntime()
|
||||
if (!result.success) throw new Error(result.error || '连接环境准备失败')
|
||||
await refreshConnectionEnvironment()
|
||||
setDbKeyStatus('连接环境已准备,请继续按页面步骤获取密钥')
|
||||
setDbKeyStatusKind('success')
|
||||
} catch (error) {
|
||||
setDbKeyStatus(error instanceof Error ? error.message : String(error))
|
||||
setDbKeyStatusKind('error')
|
||||
} finally {
|
||||
setIsFetchingDbKey(false)
|
||||
}
|
||||
}
|
||||
|
||||
const handlePasteAndSaveDbKey = async (): Promise<void> => {
|
||||
setShowMacKeyFaq(false)
|
||||
if (!selectedAccount) {
|
||||
@@ -2266,6 +2285,7 @@ function App(): React.ReactElement {
|
||||
}}
|
||||
onToggleDbKey={() => setShowDbKey((visible) => !visible)}
|
||||
onAutoGetKey={handleAutoGetDbKey}
|
||||
onInstallIntelKeyRuntime={handleInstallIntelKeyRuntime}
|
||||
onRefreshEnvironment={() => void refreshConnectionEnvironment()}
|
||||
onGuideNext={() =>
|
||||
setConnectionGuideStep((current) => (current === 1 ? 2 : current === 2 ? 3 : current))
|
||||
|
||||
@@ -31,6 +31,7 @@ interface DatabaseConnectionPageProps {
|
||||
onSelectDbRoot: () => void
|
||||
onToggleDbKey: () => void
|
||||
onAutoGetKey: () => void
|
||||
onInstallIntelKeyRuntime: () => void
|
||||
onRefreshEnvironment: () => void
|
||||
onGuideNext: () => void
|
||||
onGuideBack: () => void
|
||||
@@ -123,6 +124,7 @@ export function DatabaseConnectionPage({
|
||||
onSelectDbRoot,
|
||||
onToggleDbKey,
|
||||
onAutoGetKey,
|
||||
onInstallIntelKeyRuntime,
|
||||
onRefreshEnvironment,
|
||||
onGuideNext,
|
||||
onGuideBack,
|
||||
@@ -134,6 +136,7 @@ export function DatabaseConnectionPage({
|
||||
onClearKey
|
||||
}: DatabaseConnectionPageProps): React.ReactElement {
|
||||
const isMac = platform === 'darwin'
|
||||
const isIntelMac = isMac && environment?.architecture === 'x64'
|
||||
const defaultPath = isMac
|
||||
? '~/Library/Containers/com.tencent.xinWeChat/Data/Library/Application Support/com.tencent.xinWeChat/'
|
||||
: 'C:\\Users\\...\\WeChat Files\\Msg'
|
||||
@@ -186,14 +189,18 @@ export function DatabaseConnectionPage({
|
||||
<li>
|
||||
<span>2</span>
|
||||
<div>
|
||||
<strong>准备连接组件</strong>
|
||||
<small>页面会按当前系统给出对应步骤</small>
|
||||
<strong>{isIntelMac ? '让微信停在登录页面' : '准备连接组件'}</strong>
|
||||
<small>
|
||||
{isIntelMac
|
||||
? '启动微信,但暂时不要点击登录'
|
||||
: '页面会按当前系统给出对应步骤'}
|
||||
</small>
|
||||
</div>
|
||||
</li>
|
||||
<li>
|
||||
<span>3</span>
|
||||
<div>
|
||||
<strong>登录并验证连接</strong>
|
||||
<strong>{isIntelMac ? '获取密钥并验证连接' : '登录并验证连接'}</strong>
|
||||
<small>验证通过后进入主界面</small>
|
||||
</div>
|
||||
</li>
|
||||
@@ -241,9 +248,13 @@ export function DatabaseConnectionPage({
|
||||
: [
|
||||
'检查本机环境',
|
||||
'让微信停在登录页面',
|
||||
'确认开始准备',
|
||||
`正在完成 ${isMac ? 'macOS' : 'Windows'} 授权`,
|
||||
'获取成功, 现在可以重新登录微信了',
|
||||
isIntelMac ? '确认开始获取密钥' : '确认开始准备',
|
||||
isIntelMac
|
||||
? '正在获取 Intel Mac 密钥'
|
||||
: `正在完成 ${isMac ? 'macOS' : 'Windows'} 授权`,
|
||||
isIntelMac
|
||||
? '获取成功,验证数据库连接'
|
||||
: '获取成功, 现在可以重新登录微信了',
|
||||
'验证数据库连接'
|
||||
][guideStep - 1]}
|
||||
</strong>
|
||||
@@ -253,10 +264,16 @@ export function DatabaseConnectionPage({
|
||||
: status ||
|
||||
[
|
||||
'确认下方检测结果;没有找到目录时可以手动选择。',
|
||||
'请退出当前微信账号,让微信停留在登录页面,然后点击“我已准备好”。',
|
||||
'开始后请按页面提示完成系统授权。',
|
||||
'正在准备连接组件,请不要关闭微信或 TraceMemo。',
|
||||
'请回到微信完成登录,登录成功后再回来验证。',
|
||||
isIntelMac
|
||||
? '请启动微信并停留在未登录界面,暂时不要点击登录,然后点击“我已准备好”。'
|
||||
: '请退出当前微信账号,让微信停留在登录页面,然后点击“我已准备好”。',
|
||||
isIntelMac ? '确认开始获取密钥。' : '开始后请按页面提示完成系统授权。',
|
||||
isIntelMac
|
||||
? '等页面提示可以登录后,立即回到微信点击登录。'
|
||||
: '正在准备连接组件,请不要关闭微信或 TraceMemo。',
|
||||
isIntelMac
|
||||
? '密钥已获取,请继续验证数据库。'
|
||||
: '请回到微信完成登录,登录成功后再回来验证。',
|
||||
'正在验证密钥和本地数据库,请稍候。'
|
||||
][guideStep - 1]}
|
||||
</p>
|
||||
@@ -314,6 +331,28 @@ export function DatabaseConnectionPage({
|
||||
<dt>微信状态</dt>
|
||||
<dd>{environment?.wechatRunning ? '运行中' : '未检测到'}</dd>
|
||||
</div>
|
||||
{isIntelMac && (
|
||||
<>
|
||||
<div>
|
||||
<dt>连接环境</dt>
|
||||
<dd>
|
||||
{environment?.pythonAvailable && environment?.fridaAvailable
|
||||
? '已准备好'
|
||||
: '需要准备'}
|
||||
{(!environment?.pythonAvailable || !environment?.fridaAvailable) && (
|
||||
<Button
|
||||
variant="link"
|
||||
size="sm"
|
||||
onClick={onInstallIntelKeyRuntime}
|
||||
disabled={isFetching}
|
||||
>
|
||||
准备环境
|
||||
</Button>
|
||||
)}
|
||||
</dd>
|
||||
</div>
|
||||
</>
|
||||
)}
|
||||
</dl>
|
||||
{accounts.length > 0 && (
|
||||
<section className="database-account-list" aria-label="选择微信账号">
|
||||
@@ -406,7 +445,7 @@ export function DatabaseConnectionPage({
|
||||
)}
|
||||
{guideStep === 3 && (
|
||||
<Button className="database-login-primary" onClick={onAutoGetKey}>
|
||||
开始准备连接组件
|
||||
{isIntelMac ? '开始获取密钥' : '开始准备连接组件'}
|
||||
</Button>
|
||||
)}
|
||||
{guideStep === 4 && (
|
||||
@@ -450,8 +489,10 @@ export function DatabaseConnectionPage({
|
||||
<p className="database-login-platform-note">
|
||||
{isMac ? (
|
||||
<>
|
||||
macOS 首次获取密钥需要关闭 SIP。{' '}
|
||||
<a href={macKeyFaqUrl} target="_blank" rel="noreferrer">
|
||||
{isIntelMac
|
||||
? 'Intel Mac 首次使用需要先准备连接环境,按页面提示完成即可。'
|
||||
: 'macOS 首次获取密钥需要关闭 SIP。'}{' '}
|
||||
<a href={isIntelMac ? GUIDE_URL : macKeyFaqUrl} target="_blank" rel="noreferrer">
|
||||
查看说明
|
||||
</a>
|
||||
</>
|
||||
|
||||
@@ -17,7 +17,8 @@ export function DatabaseKeyAutoDetect({
|
||||
}): React.ReactElement {
|
||||
const environment = state.environment
|
||||
const platform = environment?.platform || runtimePlatform
|
||||
if (platform !== 'win32') {
|
||||
const isIntelMac = platform === 'darwin' && environment?.architecture === 'x64'
|
||||
if (platform !== 'win32' && !isIntelMac) {
|
||||
return (
|
||||
<section className="settings-card database-key-auto database-key-auto-manual">
|
||||
<div>
|
||||
@@ -31,8 +32,12 @@ export function DatabaseKeyAutoDetect({
|
||||
<section className="settings-card database-key-auto">
|
||||
<div className="database-key-auto-heading">
|
||||
<div>
|
||||
<strong>Windows 自动获取</strong>
|
||||
<p>TraceMemo 可在微信桌面端正在运行时,通过本机内存扫描尝试获取数据库密钥。</p>
|
||||
<strong>{isIntelMac ? 'Intel Mac 自动获取' : 'Windows 自动获取'}</strong>
|
||||
<p>
|
||||
{isIntelMac
|
||||
? '请让微信停在未登录界面,按页面提示操作即可。'
|
||||
: 'TraceMemo 可在微信桌面端正在运行时,通过本机内存扫描尝试获取数据库密钥。'}
|
||||
</p>
|
||||
</div>
|
||||
<Button variant="outline" onClick={onDetect} disabled={disabled}>
|
||||
{state.status === 'auto-detecting' ? '正在获取…' : '自动获取密钥'}
|
||||
@@ -45,9 +50,19 @@ export function DatabaseKeyAutoDetect({
|
||||
<li className={environment?.accountIdentified ? 'ok' : ''}>
|
||||
当前账号:{environment?.accountIdentified ? '已识别' : '尚未识别'}
|
||||
</li>
|
||||
<li className={platform === 'win32' ? 'ok' : ''}>
|
||||
当前平台:{platform === 'win32' ? '支持' : '不支持'}
|
||||
<li className={platform === 'win32' || isIntelMac ? 'ok' : ''}>
|
||||
当前平台:{platform === 'win32' || isIntelMac ? '支持' : '不支持'}
|
||||
</li>
|
||||
{isIntelMac && (
|
||||
<>
|
||||
<li className={environment?.pythonAvailable && environment?.fridaAvailable ? 'ok' : ''}>
|
||||
连接环境:
|
||||
{environment?.pythonAvailable && environment?.fridaAvailable
|
||||
? '已准备好'
|
||||
: '需要准备'}
|
||||
</li>
|
||||
</>
|
||||
)}
|
||||
</ul>
|
||||
{state.status === 'auto-detecting' && (
|
||||
<ol className="database-key-phases">
|
||||
@@ -62,7 +77,11 @@ export function DatabaseKeyAutoDetect({
|
||||
<div className="database-key-auto-error">
|
||||
<strong>暂未找到有效密钥</strong>
|
||||
<span>{state.error}</span>
|
||||
<p>请保持微信正在运行,登录目标账号并打开几个聊天窗口后重试。</p>
|
||||
<p>
|
||||
{isIntelMac
|
||||
? '请让微信回到未登录界面,重新开始后按页面提示操作。'
|
||||
: '请保持微信正在运行,登录目标账号并打开几个聊天窗口后重试。'}
|
||||
</p>
|
||||
<Button
|
||||
variant="link"
|
||||
size="sm"
|
||||
|
||||
Reference in New Issue
Block a user