dsh-mobile-plugin 0.5.33 → 0.5.35
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +17 -2
- package/dsh-mobile-credentials/lib/credentials.js +49 -2
- package/extensions/README.md +25 -21
- package/host.js +16 -1
- package/lib/git/pr.js +375 -0
- package/lib/git/read.js +1 -0
- package/lib/host-capabilities.cjs +67 -0
- package/lib/http/routing.js +25 -0
- package/lib/impl.js +34 -26
- package/lib/mirror/history-blob.cjs +184 -0
- package/lib/mirror/pusher.cjs +276 -1
- package/lib/mobile/approval-facts.js +439 -0
- package/lib/mobile/approval-memory.js +199 -0
- package/lib/mobile/approvals.js +596 -30
- package/lib/mobile/auto-review-log.js +160 -0
- package/lib/mobile/auto-review.js +172 -0
- package/lib/mobile/credential-upgrade.js +14 -0
- package/lib/mobile/device-permissions.js +86 -0
- package/lib/mobile/directory-browse.js +23 -8
- package/lib/mobile/events.js +9 -1
- package/lib/mobile/extension-catalog.js +106 -44
- package/lib/mobile/extension-data.js +6 -0
- package/lib/mobile/file-ops.js +89 -76
- package/lib/mobile/git.js +108 -2
- package/lib/mobile/live-steps.js +107 -4
- package/lib/mobile/mail.js +621 -0
- package/lib/mobile/monitor.js +6 -0
- package/lib/mobile/notification-prefs.js +205 -0
- package/lib/mobile/pairing.js +15 -2
- package/lib/mobile/permissions.js +433 -0
- package/lib/mobile/project-write-queue.js +115 -0
- package/lib/mobile/project-writes.js +61 -0
- package/lib/mobile/push-notify.js +293 -13
- package/lib/mobile/questions.js +20 -3
- package/lib/mobile/recent-failures.js +48 -0
- package/lib/mobile/relay-control.js +5 -0
- package/lib/mobile/session-cache.js +50 -0
- package/lib/mobile/session-last-turn.js +24 -22
- package/lib/mobile/session-new.js +205 -0
- package/lib/mobile/session-send.js +0 -1
- package/lib/mobile/sessions.js +12 -84
- package/lib/mobile/skill-write.js +549 -0
- package/lib/mobile/stats-collect.cjs +33 -3
- package/lib/mobile/stats-ledger.cjs +39 -2
- package/lib/mobile/stream.js +24 -3
- package/lib/mobile/supervisor-broadcast.js +58 -11
- package/lib/mobile/supervisor-tools.js +1 -1
- package/lib/mobile/third-party-extensions.js +158 -0
- package/lib/mobile/uploads.js +30 -14
- package/lib/mobile/worktree-isolation.js +479 -0
- package/lib/mobile/worktree-lifecycle.js +79 -0
- package/lib/p2p/wiring.cjs +41 -16
- package/lib/panel/index.html +15 -15
- package/lib/read-receipt.cjs +89 -5
- package/lib/relay/core.js +25 -1
- package/lib/relay/lan-proxy.js +6 -1
- package/lib/relay/preview.js +21 -1
- package/lib/relay/protocol.js +1 -0
- package/lib/relay/status.js +6 -0
- package/lib/relay/tunnel-forwarder.cjs +178 -0
- package/lib/routes/control-plane.js +35 -1
- package/lib/routes/mobile-api.js +105 -52
- package/lib/shared/via-header.js +15 -2
- package/lib/sidecar-facade-worker.cjs +15 -2
- package/lib/sidecar-facade.cjs +5 -0
- package/lib/tailcat/host-process.cjs +1 -1
- package/lib/tailcat/ingress.cjs +2 -2
- package/lib/tailcat/wiring.cjs +34 -13
- package/package.json +11 -3
- package/assets/pets/README.md +0 -9
- package/assets/pets/deepy-whale/attention.gif +0 -0
- package/assets/pets/deepy-whale/done.gif +0 -0
- package/assets/pets/deepy-whale/error.gif +0 -0
- package/assets/pets/deepy-whale/idle.gif +0 -0
- package/assets/pets/deepy-whale/pack.json +0 -54
- package/assets/pets/deepy-whale/sleeping.gif +0 -0
- package/assets/pets/deepy-whale/working-3.gif +0 -0
- package/assets/pets/deepy-whale/working.gif +0 -0
- package/knowledge/apps/alipay.md +0 -30
- package/knowledge/apps/android-settings.md +0 -30
- package/knowledge/apps/baijiahao.md +0 -30
- package/knowledge/apps/bilibili.md +0 -31
- package/knowledge/apps/boss-zhipin.md +0 -32
- package/knowledge/apps/dedao.md +0 -33
- package/knowledge/apps/douyin.md +0 -32
- package/knowledge/apps/feishu.md +0 -35
- package/knowledge/apps/gmail.md +0 -33
- package/knowledge/apps/jike.md +0 -31
- package/knowledge/apps/kuaishou.md +0 -34
- package/knowledge/apps/linkedin.md +0 -33
- package/knowledge/apps/qqmail.md +0 -30
- package/knowledge/apps/taobao.md +0 -33
- package/knowledge/apps/telegram.md +0 -27
- package/knowledge/apps/toutiao.md +0 -32
- package/knowledge/apps/uber-eats.md +0 -26
- package/knowledge/apps/uber.md +0 -27
- package/knowledge/apps/wechat.md +0 -33
- package/knowledge/apps/weibo.md +0 -31
- package/knowledge/apps/whatsapp.md +0 -27
- package/knowledge/apps/x.md +0 -32
- package/knowledge/apps/xiaohongshu.md +0 -30
- package/knowledge/apps/zhihu.md +0 -31
- package/knowledge/sites/bilibili.com/SITE.md +0 -50
- package/knowledge/sites/bilibili.com/references/view-fields.md +0 -17
- package/knowledge/sites/github.com/SITE.md +0 -51
- package/knowledge/sites/github.com/references/repo-fields.md +0 -13
- package/knowledge/sites/x.com/SITE.md +0 -47
- package/knowledge/sites/xiaohongshu.com/SITE.md +0 -48
- package/knowledge/sites/xiaohongshu.com/references/note-fields.md +0 -18
- package/knowledge/sites/youtube.com/SITE.md +0 -49
- package/knowledge/sites/youtube.com/references/innertube-fields.md +0 -14
- package/knowledge/sites/zhihu.com/SITE.md +0 -47
- package/knowledge/sites/zhihu.com/references/api-fields.md +0 -21
- package/lib/mobile/pet-tools.js +0 -261
- package/lib/mobile/pets.js +0 -755
- package/lib/mobile/phone/access.js +0 -85
- package/lib/mobile/phone/binding.js +0 -247
- package/lib/mobile/phone/confirm.js +0 -189
- package/lib/mobile/phone/evidence.js +0 -228
- package/lib/mobile/phone/gate.js +0 -290
- package/lib/mobile/phone/grounding.js +0 -314
- package/lib/mobile/phone/guard.js +0 -465
- package/lib/mobile/phone/index.js +0 -83
- package/lib/mobile/phone/irreversible.js +0 -226
- package/lib/mobile/phone/knowledge-tools.js +0 -665
- package/lib/mobile/phone/learn.js +0 -329
- package/lib/mobile/phone/pacing.js +0 -173
- package/lib/mobile/phone/redact.js +0 -237
- package/lib/mobile/phone/risk.js +0 -95
- package/lib/mobile/phone/route-hint.js +0 -164
- package/lib/mobile/phone/routes-memory.js +0 -133
- package/lib/mobile/phone/routes.js +0 -279
- package/lib/mobile/phone/service.js +0 -500
- package/lib/mobile/phone/site-commands.js +0 -271
- package/lib/mobile/phone/step-summary.js +0 -201
- package/lib/mobile/phone/stop-summary.js +0 -235
- package/lib/mobile/phone/tool-groups.js +0 -125
- package/lib/mobile/phone/tools.js +0 -2282
- package/lib/mobile/phone/untrusted.js +0 -65
- package/lib/mobile/phone-knowledge.js +0 -317
- package/lib/mobile/wechat-tools.js +0 -257
- package/lib/mobile/wechat.js +0 -514
|
@@ -1,279 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* 「让 AI 操作手机」的三条普通状态路由(动作字节流在 `phone/service.js` 的升级口上)。
|
|
5
|
-
*
|
|
6
|
-
* - `GET /api/mobile/v1/phone/status`:这台电脑上「操作手机」这一侧的状态 —— 服务在不在、
|
|
7
|
-
* 哪几台手机连着、这条会话绑的是哪台。App 的配对向导与设置页读它。
|
|
8
|
-
* - `GET /api/mobile/v1/phone/devices`:此刻认识哪几台手机。模型改绑、用户看「另一台」时
|
|
9
|
-
* 都读这份清单。
|
|
10
|
-
* - `POST /api/mobile/v1/phone/unbind`:解除。带 `sessionId` 只清这条会话的绑定;不带就断开
|
|
11
|
-
* 所有连接并清掉所有指向它们的绑定。
|
|
12
|
-
*
|
|
13
|
-
* 三条都只读状态或做收尾,**没有一条能往手机上发动作**:发动作只有 `phone/tools.js` 那条路,
|
|
14
|
-
* 且只由模型在会话里触发。这个分界是刻意的 —— 路由服务的是「正在看设置页的人」,工具服务的
|
|
15
|
-
* 是「正在替用户干活的模型」。
|
|
16
|
-
*
|
|
17
|
-
* 装配方式:路由表(`routes/mobile-api.js`)只认「路径 → handler」,所以这里给的是
|
|
18
|
-
* `createPhoneRoutes(deps)` 造出来的一组 handler,`deps` 由装配层从 `phone/index.js` 转来。
|
|
19
|
-
*/
|
|
20
|
-
|
|
21
|
-
const { sendJson, readJsonBody } = require('../../shared/http-util');
|
|
22
|
-
const binding = require('./binding.js');
|
|
23
|
-
const pacing = require('./pacing.js');
|
|
24
|
-
const routeHint = require('./route-hint.js');
|
|
25
|
-
const knowledge = require('../phone-knowledge.js');
|
|
26
|
-
const access = require('./access.js');
|
|
27
|
-
|
|
28
|
-
/** 设备标题:机型优先,没有机型才用 deviceId 的短尾巴。与凭据面板同一口径。 */
|
|
29
|
-
function deviceLabel(row) {
|
|
30
|
-
const model = row && typeof row.model === 'string' ? row.model.trim() : '';
|
|
31
|
-
if (model) return row.suffix ? `${model} · ${row.suffix}` : model;
|
|
32
|
-
const id = row && typeof row.deviceId === 'string' ? row.deviceId : '';
|
|
33
|
-
return id ? `手机 ${id.slice(0, 8)}` : '一台没认出身份的手机';
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
/**
|
|
37
|
-
* 这台电脑认识哪几台手机、哪几台此刻连着。
|
|
38
|
-
*
|
|
39
|
-
* 名字从凭据库拿(那里才是「这台电脑认识哪些手机」的真值),拿不到就退回 id 的短尾巴;
|
|
40
|
-
* 已经连上来但凭据库里没有的(老记录、刚重置过的库)也照样报出来 —— 否则模型看不见一台
|
|
41
|
-
* 明明能用的手机。
|
|
42
|
-
*/
|
|
43
|
-
function listDevices(deps) {
|
|
44
|
-
const known = [];
|
|
45
|
-
try {
|
|
46
|
-
if (deps.credentials && deps.instanceId) {
|
|
47
|
-
for (const row of deps.credentials.listDevices(deps.instanceId)) known.push(row);
|
|
48
|
-
}
|
|
49
|
-
} catch {
|
|
50
|
-
// 凭据库读不出来不影响「谁在线」这件事:退化成只报 id。
|
|
51
|
-
}
|
|
52
|
-
const service = deps.getService ? deps.getService() : null;
|
|
53
|
-
const online = new Map();
|
|
54
|
-
if (service && service.devices) for (const [deviceId, link] of service.devices) online.set(deviceId, link);
|
|
55
|
-
|
|
56
|
-
const rows = new Map();
|
|
57
|
-
for (const row of known) {
|
|
58
|
-
const live = online.get(row.deviceId);
|
|
59
|
-
rows.set(row.deviceId, {
|
|
60
|
-
deviceId: row.deviceId,
|
|
61
|
-
name: deviceLabel(row),
|
|
62
|
-
model: row.model || '',
|
|
63
|
-
platform: row.platform || '',
|
|
64
|
-
osVersion: row.osVersion || '',
|
|
65
|
-
appVersion: row.appVersion || '',
|
|
66
|
-
online: Boolean(live),
|
|
67
|
-
// 能力清单只对「此刻连着」的那台有意义:设置页据此说「这台手机支持什么」。
|
|
68
|
-
// 没连上时报空表,界面那边按「还没连上」处理,不拿上一次的旧清单冒充。
|
|
69
|
-
capabilities: live && Array.isArray(live.capabilities) ? live.capabilities : [],
|
|
70
|
-
lastSeenAt: row.lastSeenAt || 0,
|
|
71
|
-
});
|
|
72
|
-
if (live) online.delete(row.deviceId);
|
|
73
|
-
}
|
|
74
|
-
for (const [deviceId, link] of online) {
|
|
75
|
-
const device = link.device || {};
|
|
76
|
-
rows.set(deviceId, {
|
|
77
|
-
deviceId,
|
|
78
|
-
name: deviceLabel({ deviceId, model: device.model }),
|
|
79
|
-
model: device.model || '',
|
|
80
|
-
platform: device.platform || '',
|
|
81
|
-
osVersion: device.osVersion || '',
|
|
82
|
-
appVersion: device.appVersion || '',
|
|
83
|
-
online: true,
|
|
84
|
-
capabilities: Array.isArray(link.capabilities) ? link.capabilities : [],
|
|
85
|
-
lastSeenAt: Date.now(),
|
|
86
|
-
});
|
|
87
|
-
}
|
|
88
|
-
return [...rows.values()].sort((a, b) => (Number(b.online) - Number(a.online)) || (b.lastSeenAt - a.lastSeenAt));
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
function describeDevice(deps, deviceId) {
|
|
92
|
-
const row = listDevices(deps).find((item) => item.deviceId === deviceId);
|
|
93
|
-
return row ? row.name : deviceId;
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
/** GET /phone/status?sessionId=… */
|
|
97
|
-
async function handlePhoneStatus(deps, _ctx, req, res) {
|
|
98
|
-
const url = new URL(req.url || '/', 'http://x');
|
|
99
|
-
const sessionId = (url.searchParams.get('sessionId') || '').trim();
|
|
100
|
-
const service = deps.getService ? deps.getService() : null;
|
|
101
|
-
const devices = listDevices(deps);
|
|
102
|
-
const payload = {
|
|
103
|
-
ok: true,
|
|
104
|
-
running: Boolean(service),
|
|
105
|
-
online: devices.filter((row) => row.online).map((row) => row.deviceId),
|
|
106
|
-
devices,
|
|
107
|
-
};
|
|
108
|
-
if (sessionId) {
|
|
109
|
-
const bound = binding.boundDeviceOf(sessionId);
|
|
110
|
-
payload.binding = {
|
|
111
|
-
deviceId: bound || '',
|
|
112
|
-
name: bound ? describeDevice(deps, bound) : '',
|
|
113
|
-
lastSender: binding.lastSenderOf(sessionId) || '',
|
|
114
|
-
};
|
|
115
|
-
}
|
|
116
|
-
// 顶层再带一份「这台手机能做什么」:设置页问的是「我现在操作的是哪台、它能做什么」,
|
|
117
|
-
// 那条会话绑了就看绑的那台,没绑就看唯第一台在线的。都没有就是空表。
|
|
118
|
-
const focus = (payload.binding && payload.binding.deviceId)
|
|
119
|
-
? devices.find((row) => row.deviceId === payload.binding.deviceId)
|
|
120
|
-
: devices.find((row) => row.online);
|
|
121
|
-
payload.capabilities = focus && Array.isArray(focus.capabilities) ? focus.capabilities : [];
|
|
122
|
-
sendJson(res, 200, payload);
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
/** GET /phone/devices */
|
|
126
|
-
async function handlePhoneDevices(deps, _ctx, _req, res) {
|
|
127
|
-
sendJson(res, 200, { ok: true, devices: listDevices(deps) });
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
/**
|
|
131
|
-
* POST /phone/unbind —— `{ sessionId?, deviceId? }`
|
|
132
|
-
*
|
|
133
|
-
* 不带参数是「这台电脑上操作手机这件事整个解除」:断开所有连接、清掉所有指向它们的绑定。
|
|
134
|
-
* 带 `sessionId` 只清这一条会话的绑定(用户只是想让这条对话别再用那台手机)。
|
|
135
|
-
*
|
|
136
|
-
* 卸掉手机上那枚 adb 钥匙这一步只能由手机侧自己做(壳在手机上,宿主碰不到它),所以回包里
|
|
137
|
-
* 如实写 `localReset: 'requested'`,界面据此提示「回手机上确认一下」。
|
|
138
|
-
*/
|
|
139
|
-
async function handlePhoneUnbind(deps, _ctx, req, res) {
|
|
140
|
-
const body = await readJsonBody(req);
|
|
141
|
-
const sessionId = body && typeof body.sessionId === 'string' ? body.sessionId.trim() : '';
|
|
142
|
-
const deviceId = body && typeof body.deviceId === 'string' ? body.deviceId.trim() : '';
|
|
143
|
-
if (sessionId) {
|
|
144
|
-
return sendJson(res, 200, {
|
|
145
|
-
ok: true,
|
|
146
|
-
clearedSession: binding.clearBinding(sessionId),
|
|
147
|
-
disconnected: [],
|
|
148
|
-
localReset: '',
|
|
149
|
-
});
|
|
150
|
-
}
|
|
151
|
-
const service = deps.getService ? deps.getService() : null;
|
|
152
|
-
const targets = deviceId ? [deviceId] : listDevices(deps).map((row) => row.deviceId);
|
|
153
|
-
for (const id of targets) service?.kick?.(id);
|
|
154
|
-
const cleared = targets.reduce((sum, id) => sum + binding.clearBindingForDevice(id), 0);
|
|
155
|
-
sendJson(res, 200, { ok: true, clearedSession: false, clearedBindings: cleared, disconnected: targets, localReset: 'requested' });
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
/**
|
|
159
|
-
* GET /phone/knowledge?package=… —— 知识库里有哪些 App、有哪些网站,各自包名 / 域名,以及按就
|
|
160
|
-
* 包名查询时的命中情况。
|
|
161
|
-
*
|
|
162
|
-
* 只读:把 `knowledge/apps/*.md` 与 `knowledge/sites/*.md` 的目录清单摊平给设置页看,不碰手机、
|
|
163
|
-
* 不发任何动作。`package` 是可选的前台包名;给了就标出哪一条 App 命中(`hit`),并回填 `matched`。
|
|
164
|
-
*/
|
|
165
|
-
async function handlePhoneKnowledge(deps, _ctx, req, res) {
|
|
166
|
-
const url = new URL(req.url || '/', 'http://x');
|
|
167
|
-
const pkg = (url.searchParams.get('package') || '').trim();
|
|
168
|
-
const matched = pkg ? knowledge.matchApp(pkg) : null;
|
|
169
|
-
const apps = knowledge.listApps().map((app) => ({
|
|
170
|
-
name: app.name,
|
|
171
|
-
display: app.display,
|
|
172
|
-
packages: app.packages,
|
|
173
|
-
aliases: app.aliases,
|
|
174
|
-
open: app.open,
|
|
175
|
-
hit: Boolean(matched && matched.name === app.name),
|
|
176
|
-
}));
|
|
177
|
-
const sites = knowledge.listSites().map((site) => ({
|
|
178
|
-
name: site.name,
|
|
179
|
-
display: site.display,
|
|
180
|
-
description: site.description,
|
|
181
|
-
sites: site.domains,
|
|
182
|
-
aliases: site.aliases,
|
|
183
|
-
}));
|
|
184
|
-
sendJson(res, 200, { ok: true, apps, sites, matched: matched ? matched.name : '' });
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
/**
|
|
188
|
-
* GET /phone/routes?package=… —— 某个 App 以前成功过的路线(最多 5 条,只给步骤摘要)。
|
|
189
|
-
*
|
|
190
|
-
* 只读:从成功路线账本里读回,不碰手机、不发任何动作。**这些只是参考,不会自动执行** ——
|
|
191
|
-
* 模型看过之后仍要按当前屏重新判断。
|
|
192
|
-
*/
|
|
193
|
-
async function handlePhoneRoutes(_deps, _ctx, req, res) {
|
|
194
|
-
const url = new URL(req.url || '/', 'http://x');
|
|
195
|
-
const pkg = (url.searchParams.get('package') || '').trim();
|
|
196
|
-
const routes = pkg ? routeHint.hintFor(pkg) : [];
|
|
197
|
-
sendJson(res, 200, { ok: true, packageName: pkg, count: routes.length, routes });
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
/**
|
|
201
|
-
* GET / POST /phone/pacing —— 读或改「操作节奏」那一档。
|
|
202
|
-
*
|
|
203
|
-
* 和上面几条一样只碰设置,不往手机上发动作:节奏改了下一轮动作才生效,正在跑的那一批
|
|
204
|
-
* 不跟着变(动作中途改停留会让边界很奇怪,重开一轮才干净)。
|
|
205
|
-
*/
|
|
206
|
-
async function handlePhonePacing(_deps, _ctx, req, res) {
|
|
207
|
-
if (req.method === 'GET' || !req.method) {
|
|
208
|
-
const mode = pacing.get();
|
|
209
|
-
return sendJson(res, 200, { ok: true, mode, pace: pacing.paceFor(mode) });
|
|
210
|
-
}
|
|
211
|
-
const body = await readJsonBody(req);
|
|
212
|
-
const wanted = body && typeof body.mode === 'string' ? body.mode.trim().toLowerCase() : '';
|
|
213
|
-
if (!wanted) return sendJson(res, 400, { ok: false, error: 'missing-mode' });
|
|
214
|
-
try {
|
|
215
|
-
const mode = pacing.set(wanted);
|
|
216
|
-
sendJson(res, 200, { ok: true, mode, pace: pacing.paceFor(mode) });
|
|
217
|
-
} catch {
|
|
218
|
-
// 不认识的档名:如实回 400 并把可选值带上,别让设置页自己维护一份枚举。
|
|
219
|
-
sendJson(res, 400, { ok: false, error: 'unknown-mode', modes: pacing.MODES });
|
|
220
|
-
}
|
|
221
|
-
}
|
|
222
|
-
|
|
223
|
-
/**
|
|
224
|
-
* 逐 App 访问控制:GET 读全部开关行,POST 改一个 App 的一行。
|
|
225
|
-
*
|
|
226
|
-
* 只是本地开关,不往手机上发动作;名单落 `$DSH_HOME/storages/mobile-plugin/phone-app-access.json`,
|
|
227
|
-
* 原生 `AppAccess.kt` 执行前按同一份名单判。包名形状在这里先校验,挡住把路径/命令塞进来。
|
|
228
|
-
*/
|
|
229
|
-
async function handlePhoneAppAccess(_deps, _ctx, req, res) {
|
|
230
|
-
if (req.method === 'GET' || !req.method) {
|
|
231
|
-
return sendJson(res, 200, { ok: true, apps: access.rows() });
|
|
232
|
-
}
|
|
233
|
-
const body = await readJsonBody(req);
|
|
234
|
-
const packageName = body && typeof body.packageName === 'string' ? body.packageName : '';
|
|
235
|
-
const patch = {
|
|
236
|
-
blocked: typeof body.blocked === 'boolean' ? body.blocked : undefined,
|
|
237
|
-
shareAllowed: typeof body.shareAllowed === 'boolean' ? body.shareAllowed : undefined,
|
|
238
|
-
};
|
|
239
|
-
if (patch.blocked === undefined && patch.shareAllowed === undefined) {
|
|
240
|
-
return sendJson(res, 400, { ok: false, error: 'missing-flags' });
|
|
241
|
-
}
|
|
242
|
-
const result = access.update(packageName, patch);
|
|
243
|
-
if (!result.ok) return sendJson(res, 400, { ok: false, error: result.error });
|
|
244
|
-
sendJson(res, 200, { ok: true, apps: access.rows() });
|
|
245
|
-
}
|
|
246
|
-
|
|
247
|
-
/**
|
|
248
|
-
* 造出路由表要的那组 handler。
|
|
249
|
-
*
|
|
250
|
-
* @param {object} deps
|
|
251
|
-
* @param {() => object|null} deps.getService 取值器(服务随插件重载整体替换)
|
|
252
|
-
* @param {object} [deps.credentials] 凭据库
|
|
253
|
-
* @param {string} [deps.instanceId]
|
|
254
|
-
*/
|
|
255
|
-
function createPhoneRoutes(deps) {
|
|
256
|
-
return {
|
|
257
|
-
status: (ctx, req, res) => handlePhoneStatus(deps, ctx, req, res),
|
|
258
|
-
devices: (ctx, req, res) => handlePhoneDevices(deps, ctx, req, res),
|
|
259
|
-
unbind: (ctx, req, res) => handlePhoneUnbind(deps, ctx, req, res),
|
|
260
|
-
knowledge: (ctx, req, res) => handlePhoneKnowledge(deps, ctx, req, res),
|
|
261
|
-
routes: (ctx, req, res) => handlePhoneRoutes(deps, ctx, req, res),
|
|
262
|
-
pacing: (ctx, req, res) => handlePhonePacing(deps, ctx, req, res),
|
|
263
|
-
appAccess: (ctx, req, res) => handlePhoneAppAccess(deps, ctx, req, res),
|
|
264
|
-
};
|
|
265
|
-
}
|
|
266
|
-
|
|
267
|
-
module.exports = {
|
|
268
|
-
createPhoneRoutes,
|
|
269
|
-
handlePhoneStatus,
|
|
270
|
-
handlePhoneDevices,
|
|
271
|
-
handlePhoneUnbind,
|
|
272
|
-
handlePhoneKnowledge,
|
|
273
|
-
handlePhoneRoutes,
|
|
274
|
-
handlePhonePacing,
|
|
275
|
-
handlePhoneAppAccess,
|
|
276
|
-
listDevices,
|
|
277
|
-
describeDevice,
|
|
278
|
-
deviceLabel,
|
|
279
|
-
};
|