feat: 控制台 WS 全量检测 · APK 桌面「工作手机」入口
nav_cache 模块单例;index 增加 Hub 链接与 hook 探测;SetupActivity 注册 Launcher。 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -31,11 +31,17 @@
|
||||
android:usesCleartextTraffic="true"
|
||||
tools:targetApi="34">
|
||||
|
||||
<!-- 无桌面图标;打开:adb am start …SetupActivity,或 设置→应用→AI数智员工→打开,或点前台通知 -->
|
||||
<!-- 桌面显示「工作手机」入口;SetupActivity 为 Launcher,MainActivity 仍由服务/通知拉起 -->
|
||||
<activity
|
||||
android:name=".ui.SetupActivity"
|
||||
android:exported="true"
|
||||
android:launchMode="singleTop" />
|
||||
android:label="@string/launcher_name"
|
||||
android:launchMode="singleTop">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
|
||||
<activity
|
||||
android:name=".ui.MainActivity"
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<string name="app_name">AI数智员工</string>
|
||||
<string name="launcher_name">工作手机</string>
|
||||
<string name="app_version_tagline">v5.0.1 · 设备同步服务</string>
|
||||
<string name="accessibility_service_description">AI数智员工服务辅助功能</string>
|
||||
<string name="nav_hub">工作台</string>
|
||||
|
||||
@@ -436,3 +436,7 @@ class OperationLogger:
|
||||
s["avg_ms"] = (
|
||||
s["total_ms"] // s["total"] if s["total"] else 0)
|
||||
return stats
|
||||
|
||||
|
||||
# 模块级单例,供 wechat_adb_engine 等导入
|
||||
nav_cache = WeChatNavCache()
|
||||
|
||||
@@ -181,6 +181,8 @@ body {
|
||||
<div class="status">
|
||||
<span id="sdk-status"><span class="dot dot-red"></span>SDK 检测中</span>
|
||||
<span id="device-count">0 台设备</span>
|
||||
<a href="/static/hub.html" style="color:#7ec8e3;font-size:13px;text-decoration:none;margin-left:12px;">工作台</a>
|
||||
<a href="#" onclick="runWsFullCheck();return false;" style="color:#30d158;font-size:13px;text-decoration:none;margin-left:8px;">WS全量检测</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -656,6 +658,33 @@ async function pollGuardEvents() {
|
||||
} catch(e) {}
|
||||
}
|
||||
|
||||
// WS + Hook 全量检测(控制台一键,对应 scripts/ws_full_test.py)
|
||||
async function runWsFullCheck() {
|
||||
const EXPECT = 'xgfe65eimrrofyws';
|
||||
log('开始 WS 全量检测…', 'info');
|
||||
try {
|
||||
const st = await fetch(`${API}/api/v3/connection/status`, {headers: API_HEADERS}).then(r => r.json());
|
||||
const data = st.data || {};
|
||||
const onWs = (data.online_device_ids || []).includes(EXPECT);
|
||||
const onAdb = (data.adb_serials || []).includes(EXPECT);
|
||||
log(`connection/status: WS=${data.online_ws_count} ADB=${data.adb_count}`, 'info');
|
||||
log(`指定设备 ${EXPECT}: WS=${onWs ? '在线' : '离线'} ADB=${onAdb ? '在线' : '离线'}`, onWs || onAdb ? 'info' : 'error');
|
||||
const probe = await fetch(`${API}/api/v3/hook/probe/${EXPECT}`, {headers: API_HEADERS}).then(r => r.json());
|
||||
log(`hook/probe: supports_hook=${probe.supports_hook} connect=${probe.hook_tests?.connect || '-'}`, probe.supports_hook ? 'info' : 'error');
|
||||
if (onWs || onAdb) {
|
||||
const ex = await fetch(`${API}/api/v3/hook/execute`, {
|
||||
method: 'POST', headers: {...API_HEADERS, 'Content-Type': 'application/json'},
|
||||
body: JSON.stringify({device_id: EXPECT, platform: 'wechat', action: 'get_profile', params: {}, hook_only: true})
|
||||
}).then(r => r.json());
|
||||
log(`hook/execute get_profile: success=${ex.data?.success} channel=${ex.channel_used || ex.data?._channel_used}`, ex.data?.success ? 'info' : 'error');
|
||||
}
|
||||
await loadConnectionStatus();
|
||||
log('WS 全量检测完成', 'info');
|
||||
} catch (e) {
|
||||
log('WS 全量检测失败: ' + e.message, 'error');
|
||||
}
|
||||
}
|
||||
|
||||
// 启动
|
||||
(async () => {
|
||||
await checkHealth();
|
||||
|
||||
Reference in New Issue
Block a user