ms-vite-plugin 1.4.36 → 1.4.38
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/dist/build.js +16 -14
- package/dist/cli.js +2 -2
- package/dist/mcp/runtime-tools.js +2 -2
- package/dist/project.d.ts +1 -1
- package/dist/project.js +2 -2
- package/docs/api/node.md +2 -2
- package/docs/api/pip.md +23 -3
- package/docs/api/thread.md +14 -7
- package/docs/apicn/node.md +2 -2
- package/docs/apicn/pip.md +23 -3
- package/docs/apicn/thread.md +15 -8
- package/docs/apipython/node.md +2 -2
- package/docs/apipython/pip.md +25 -3
- package/docs/httpapi/api.md +45 -19
- package/package.json +1 -1
package/dist/build.js
CHANGED
|
@@ -210,20 +210,22 @@ const buildAll = async (isDev = true, workspacePath) => {
|
|
|
210
210
|
...(isDev
|
|
211
211
|
? []
|
|
212
212
|
: [
|
|
213
|
-
(
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
213
|
+
(obfuscatorConfig.enabled ?? true)
|
|
214
|
+
? (0, vite_plugin_bundle_obfuscator_1.default)({
|
|
215
|
+
autoExcludeNodeModules: true,
|
|
216
|
+
threadPool: true,
|
|
217
|
+
options: {
|
|
218
|
+
...obfuscatorConfig,
|
|
219
|
+
target: "browser",
|
|
220
|
+
debugProtection: false,
|
|
221
|
+
disableConsoleOutput: false,
|
|
222
|
+
domainLock: [],
|
|
223
|
+
selfDefending: false,
|
|
224
|
+
renameGlobals: false,
|
|
225
|
+
renameProperties: false,
|
|
226
|
+
},
|
|
227
|
+
})
|
|
228
|
+
: [],
|
|
227
229
|
]),
|
|
228
230
|
],
|
|
229
231
|
});
|
package/dist/cli.js
CHANGED
|
@@ -536,7 +536,7 @@ async function sourceCommand(options) {
|
|
|
536
536
|
if (!Number.isInteger(timeout) || timeout < 1) {
|
|
537
537
|
throw new Error(`无效 timeout: ${timeoutText}`);
|
|
538
538
|
}
|
|
539
|
-
if (!Number.isInteger(mode) || (mode !== 1 && mode !== 2)) {
|
|
539
|
+
if (!Number.isInteger(mode) || (mode !== 1 && mode !== 2 && mode !== 3)) {
|
|
540
540
|
throw new Error(`无效 mode: ${modeText}`);
|
|
541
541
|
}
|
|
542
542
|
const source = await (0, project_1.getSourceOnDevice)(options, maxDepth, timeout, mode);
|
|
@@ -1102,7 +1102,7 @@ commander_1.program
|
|
|
1102
1102
|
.option("--ws-wait-ms <wsWaitMs>", "WS 等待设备连接时间(毫秒)", "30000")
|
|
1103
1103
|
.option("--max-depth <maxDepth>", "节点最大深度", "50")
|
|
1104
1104
|
.option("--timeout <timeout>", "节点抓取超时秒数", "120")
|
|
1105
|
-
.option("--mode <mode>", "节点抓取模式: 1=模式1, 2=模式2", "1")
|
|
1105
|
+
.option("--mode <mode>", "节点抓取模式: 1=模式1, 2=模式2, 3=模式3", "1")
|
|
1106
1106
|
.option("--output <output>", "节点 XML 输出文件路径(可选)")
|
|
1107
1107
|
.action(sourceCommand);
|
|
1108
1108
|
// 日志命令
|
|
@@ -207,10 +207,10 @@ function registerRuntimeTools(server) {
|
|
|
207
207
|
.number()
|
|
208
208
|
.int()
|
|
209
209
|
.min(1)
|
|
210
|
-
.max(
|
|
210
|
+
.max(3)
|
|
211
211
|
.optional()
|
|
212
212
|
.default(1)
|
|
213
|
-
.describe("节点抓取模式:1
|
|
213
|
+
.describe("节点抓取模式:1、2、3,默认 1"),
|
|
214
214
|
outputPath: z
|
|
215
215
|
.string()
|
|
216
216
|
.min(1)
|
package/dist/project.d.ts
CHANGED
|
@@ -39,7 +39,7 @@ export declare function getScreenshotBase64OnDevice(options: DeviceCliOptions):
|
|
|
39
39
|
* @param options 命令选项(transport 仅支持 http)
|
|
40
40
|
* @param maxDepth 节点最大深度,默认 50
|
|
41
41
|
* @param timeout 获取节点超时秒数,默认 120
|
|
42
|
-
* @param mode
|
|
42
|
+
* @param mode 节点抓取模式,支持 1、2、3,默认 1
|
|
43
43
|
* @returns 返回 XML 字符串
|
|
44
44
|
* @example
|
|
45
45
|
* const xml = await getSourceOnDevice({ ip: "192.168.1.10", port: "9800" }, 50, 120, 1)
|
package/dist/project.js
CHANGED
|
@@ -428,7 +428,7 @@ async function getScreenshotBase64OnDevice(options) {
|
|
|
428
428
|
* @param options 命令选项(transport 仅支持 http)
|
|
429
429
|
* @param maxDepth 节点最大深度,默认 50
|
|
430
430
|
* @param timeout 获取节点超时秒数,默认 120
|
|
431
|
-
* @param mode
|
|
431
|
+
* @param mode 节点抓取模式,支持 1、2、3,默认 1
|
|
432
432
|
* @returns 返回 XML 字符串
|
|
433
433
|
* @example
|
|
434
434
|
* const xml = await getSourceOnDevice({ ip: "192.168.1.10", port: "9800" }, 50, 120, 1)
|
|
@@ -441,7 +441,7 @@ async function getSourceOnDevice(options, maxDepth = 50, timeout = 120, mode = 1
|
|
|
441
441
|
if (!Number.isInteger(timeout) || timeout < 1) {
|
|
442
442
|
throw new Error(`无效 timeout: ${timeout}`);
|
|
443
443
|
}
|
|
444
|
-
if (!Number.isInteger(mode) || (mode !== 1 && mode !== 2)) {
|
|
444
|
+
if (!Number.isInteger(mode) || (mode !== 1 && mode !== 2 && mode !== 3)) {
|
|
445
445
|
throw new Error(`无效 mode: ${mode}`);
|
|
446
446
|
}
|
|
447
447
|
if (transport === "ws") {
|
package/docs/api/node.md
CHANGED
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
```typescript
|
|
21
21
|
function createNodeSelector(params?: {
|
|
22
22
|
maxDepth?: number; // 最大层级深度,默认 50
|
|
23
|
-
mode?: number; // 抓取模式:模式 1、模式 2,默认模式 1
|
|
23
|
+
mode?: number; // 抓取模式:模式 1、模式 2、模式 3,默认模式 1
|
|
24
24
|
}): NodeSelector;
|
|
25
25
|
```
|
|
26
26
|
|
|
@@ -29,7 +29,7 @@ function createNodeSelector(params?: {
|
|
|
29
29
|
| 参数名 | 类型 | 是否必填 | 默认值 | 描述 |
|
|
30
30
|
| ---------- | ------ | -------- | ------ | --------------------------- |
|
|
31
31
|
| `maxDepth` | number | 否 | 50 | 遍历的最大层级深度,默认 50 |
|
|
32
|
-
| `mode` | number | 否 | 1 |
|
|
32
|
+
| `mode` | number | 否 | 1 | 抓取模式。支持模式 1、模式 2、模式 3,默认模式 1 |
|
|
33
33
|
|
|
34
34
|
**返回值:**
|
|
35
35
|
|
package/docs/api/pip.md
CHANGED
|
@@ -4,7 +4,8 @@
|
|
|
4
4
|
|
|
5
5
|
## 功能特性
|
|
6
6
|
|
|
7
|
-
-
|
|
7
|
+
- **显示模式**:支持日志、保活和自定义三种显示模式;首次安装默认保活
|
|
8
|
+
- **关闭控制**:支持主动关闭悬浮窗
|
|
8
9
|
- **状态查询**:判断悬浮窗是否正在显示
|
|
9
10
|
- **尺寸设置**:日志模式和自定义模式支持设置内容宽高,并按模式分别持久化
|
|
10
11
|
- **日志显示**:日志模式支持设置日志文字大小
|
|
@@ -102,6 +103,25 @@ pip.setCustomTextColor("#34c759");
|
|
|
102
103
|
pip.setCustomTextSize(18);
|
|
103
104
|
```
|
|
104
105
|
|
|
106
|
+
### closeWindow - 关闭悬浮窗
|
|
107
|
+
|
|
108
|
+
```typescript
|
|
109
|
+
function closeWindow(): boolean;
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
关闭悬浮窗。
|
|
113
|
+
|
|
114
|
+
**返回值:**
|
|
115
|
+
|
|
116
|
+
| 类型 | 描述 |
|
|
117
|
+
| --------- | ---------------------- |
|
|
118
|
+
| `boolean` | `true` 代表已提交请求 |
|
|
119
|
+
|
|
120
|
+
**示例:**
|
|
121
|
+
|
|
122
|
+
```typescript
|
|
123
|
+
const success = pip.closeWindow();
|
|
124
|
+
```
|
|
105
125
|
|
|
106
126
|
### setContentSize - 设置内容尺寸
|
|
107
127
|
|
|
@@ -109,7 +129,7 @@ pip.setCustomTextSize(18);
|
|
|
109
129
|
function setContentSize(width: number, height: number): boolean;
|
|
110
130
|
```
|
|
111
131
|
|
|
112
|
-
|
|
132
|
+
设置日志模式或自定义模式的悬浮窗内容尺寸。宽度和高度都必须传入有效数字。日志模式和自定义模式会分别保存尺寸;悬浮窗关闭状态和保活模式不会生效。
|
|
113
133
|
|
|
114
134
|
**参数:**
|
|
115
135
|
|
|
@@ -288,7 +308,7 @@ pip.setContentSize(120, 180);
|
|
|
288
308
|
|
|
289
309
|
## 注意事项
|
|
290
310
|
|
|
291
|
-
1. **前台限制**:首次切换到日志、保活或自定义显示模式并启动悬浮窗时,App
|
|
311
|
+
1. **前台限制**:首次切换到日志、保活或自定义显示模式并启动悬浮窗时,App 必须在前台;悬浮窗已启动后可以继续切换显示模式或关闭悬浮窗
|
|
292
312
|
2. **设备兼容性**:仅支持 iOS 15+ 且具备画中画功能的设备
|
|
293
313
|
3. **系统限制**:悬浮窗位置和实际显示尺寸由 iOS 管理
|
|
294
314
|
4. **尺寸持久化**:日志模式和自定义模式分别保存尺寸,互不共用;保活模式不接受脚本尺寸
|
package/docs/api/thread.md
CHANGED
|
@@ -12,7 +12,8 @@
|
|
|
12
12
|
|
|
13
13
|
- **独立的执行环境**: 线程函数在独立的 JavaScript 环境中运行,无法访问主线程或其他作用域中的变量、函数或对象。
|
|
14
14
|
- **闭包限制**: 即使线程函数是闭包形式,它也无法捕获外部变量。传递给 `thread.run` 的函数会被转换并在新的上下文中执行。
|
|
15
|
-
-
|
|
15
|
+
- **启动参数**: 主线程可以向 `thread.run` 传入一个 Object,子线程通过全局变量 `__threadParams__` 读取。
|
|
16
|
+
- **数据通信**: 线程启动后的双向数据通信请使用 `sharedState` 全局对象。
|
|
16
17
|
- **文件名限制**:执行的线程 js 文件名称必须以 `_thread.js` 结尾,例如 `worker_thread.js`。
|
|
17
18
|
|
|
18
19
|
## API 参考
|
|
@@ -24,14 +25,15 @@
|
|
|
24
25
|
启动一个新的线程来执行指定的 JS 文件。
|
|
25
26
|
|
|
26
27
|
```typescript
|
|
27
|
-
function run(threadJsFileName: string): Thread;
|
|
28
|
+
function run(threadJsFileName: string, params?: Record<string, any>): Thread;
|
|
28
29
|
```
|
|
29
30
|
|
|
30
31
|
**参数:**
|
|
31
32
|
|
|
32
|
-
| 参数名 | 类型
|
|
33
|
-
| ------------------ |
|
|
34
|
-
| `threadJsFileName` | `string`
|
|
33
|
+
| 参数名 | 类型 | 描述 |
|
|
34
|
+
| ------------------ | --------------------- | -------------------------------------------------- |
|
|
35
|
+
| `threadJsFileName` | `string` | 线程 js 文件路径 |
|
|
36
|
+
| `params` | `Record<string, any>` | 可选启动参数,只能传 Object;子线程通过 `__threadParams__` 读取 |
|
|
35
37
|
|
|
36
38
|
**返回值:**
|
|
37
39
|
|
|
@@ -42,8 +44,13 @@ function run(threadJsFileName: string): Thread;
|
|
|
42
44
|
**示例:**
|
|
43
45
|
|
|
44
46
|
```javascript
|
|
45
|
-
//
|
|
46
|
-
const t = thread.run("test_thread.js");
|
|
47
|
+
// 主线程传入启动参数
|
|
48
|
+
const t = thread.run("test_thread.js", { taskId: 1, title: "同步任务" });
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
```javascript
|
|
52
|
+
// test_thread.js
|
|
53
|
+
logi(`任务 ${__threadParams__.taskId}: ${__threadParams__.title}`);
|
|
47
54
|
```
|
|
48
55
|
|
|
49
56
|
#### thread.stopAll - 停止所有线程
|
package/docs/apicn/node.md
CHANGED
|
@@ -24,7 +24,7 @@ function $创建节点选择器(params?: {
|
|
|
24
24
|
*/
|
|
25
25
|
maxDepth?: 数字;
|
|
26
26
|
/**
|
|
27
|
-
* 抓取模式:模式 1、模式 2,默认模式 1
|
|
27
|
+
* 抓取模式:模式 1、模式 2、模式 3,默认模式 1
|
|
28
28
|
*/
|
|
29
29
|
mode?: 数字;
|
|
30
30
|
}): $节点选择器;
|
|
@@ -35,7 +35,7 @@ function $创建节点选择器(params?: {
|
|
|
35
35
|
| 参数名 | 类型 | 是否必填 | 默认值 | 描述 |
|
|
36
36
|
| ---------- | ---- | -------- | ------ | --------------------------- |
|
|
37
37
|
| `maxDepth` | 数字 | 否 | 50 | 遍历的最大层级深度,默认 50 |
|
|
38
|
-
| `mode` | 数字 | 否 | 1 |
|
|
38
|
+
| `mode` | 数字 | 否 | 1 | 抓取模式。支持模式 1、模式 2、模式 3,默认模式 1 |
|
|
39
39
|
|
|
40
40
|
**返回值:**
|
|
41
41
|
|
package/docs/apicn/pip.md
CHANGED
|
@@ -4,7 +4,8 @@
|
|
|
4
4
|
|
|
5
5
|
## 功能特性
|
|
6
6
|
|
|
7
|
-
-
|
|
7
|
+
- **显示模式**:支持日志、保活和自定义三种显示模式;首次安装默认保活
|
|
8
|
+
- **关闭控制**:支持主动关闭悬浮窗
|
|
8
9
|
- **状态查询**:判断悬浮窗是否正在显示
|
|
9
10
|
- **尺寸设置**:日志模式和自定义模式支持设置内容宽高,并按模式分别持久化
|
|
10
11
|
- **日志显示**:日志模式支持设置日志文字大小
|
|
@@ -102,6 +103,25 @@ $悬浮窗.设置自定义文字颜色("#34c759");
|
|
|
102
103
|
$悬浮窗.设置自定义文字大小(18);
|
|
103
104
|
```
|
|
104
105
|
|
|
106
|
+
### 关闭悬浮窗
|
|
107
|
+
|
|
108
|
+
```typescript
|
|
109
|
+
function 关闭悬浮窗(): 布尔值;
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
关闭悬浮窗。
|
|
113
|
+
|
|
114
|
+
**返回值:**
|
|
115
|
+
|
|
116
|
+
| 类型 | 描述 |
|
|
117
|
+
| -------- | ---------------------- |
|
|
118
|
+
| `布尔值` | `true` 代表已提交请求 |
|
|
119
|
+
|
|
120
|
+
**示例:**
|
|
121
|
+
|
|
122
|
+
```typescript
|
|
123
|
+
const 是否成功 = $悬浮窗.关闭悬浮窗();
|
|
124
|
+
```
|
|
105
125
|
|
|
106
126
|
### 设置内容尺寸
|
|
107
127
|
|
|
@@ -109,7 +129,7 @@ $悬浮窗.设置自定义文字大小(18);
|
|
|
109
129
|
function 设置内容尺寸(宽度: 数字, 高度: 数字): 布尔值;
|
|
110
130
|
```
|
|
111
131
|
|
|
112
|
-
|
|
132
|
+
设置日志模式或自定义模式的悬浮窗内容尺寸。宽度和高度都必须传入有效数字。日志模式和自定义模式会分别保存尺寸;悬浮窗关闭状态和保活模式不会生效。
|
|
113
133
|
|
|
114
134
|
**参数:**
|
|
115
135
|
|
|
@@ -288,7 +308,7 @@ $悬浮窗.设置内容尺寸(120, 180);
|
|
|
288
308
|
|
|
289
309
|
## 注意事项
|
|
290
310
|
|
|
291
|
-
1. **前台限制**:首次切换到日志、保活或自定义显示模式并启动悬浮窗时,App
|
|
311
|
+
1. **前台限制**:首次切换到日志、保活或自定义显示模式并启动悬浮窗时,App 必须在前台;悬浮窗已启动后可以继续切换显示模式或关闭悬浮窗
|
|
292
312
|
2. **设备兼容性**:仅支持 iOS 15+ 且具备画中画功能的设备
|
|
293
313
|
3. **系统限制**:悬浮窗位置和实际显示尺寸由 iOS 管理
|
|
294
314
|
4. **尺寸持久化**:日志模式和自定义模式分别保存尺寸,互不共用;保活模式不接受脚本尺寸
|
package/docs/apicn/thread.md
CHANGED
|
@@ -12,7 +12,8 @@
|
|
|
12
12
|
|
|
13
13
|
- **独立的执行环境**: 线程函数在独立的 JavaScript 环境中运行,无法访问主线程或其他作用域中的变量、函数或对象。
|
|
14
14
|
- **闭包限制**: 即使线程函数是闭包形式,它也无法捕获外部变量。传递给 `$线程.运行` 的函数会被转换并在新的上下文中执行。
|
|
15
|
-
-
|
|
15
|
+
- **启动参数**: 主线程可以向 `$线程.运行` 传入一个 Object,子线程通过全局变量 `$线程参数` 读取。
|
|
16
|
+
- **数据通信**: 线程启动后的双向数据通信请使用 `$共享状态` 全局对象。
|
|
16
17
|
- **文件名限制**:执行的线程 js 文件名称必须以 `_thread.js` 结尾,例如 `worker_thread.js`。
|
|
17
18
|
|
|
18
19
|
## API 参考
|
|
@@ -21,17 +22,18 @@
|
|
|
21
22
|
|
|
22
23
|
#### $线程.运行 - 异步执行代码
|
|
23
24
|
|
|
24
|
-
|
|
25
|
+
启动一个新的线程来执行指定的 JS 文件。
|
|
25
26
|
|
|
26
27
|
```typescript
|
|
27
|
-
function 运行(
|
|
28
|
+
function 运行(线程js文件名: 字符串, 启动参数?: 字典<任意类型>): 线程;
|
|
28
29
|
```
|
|
29
30
|
|
|
30
31
|
**参数:**
|
|
31
32
|
|
|
32
|
-
| 参数名
|
|
33
|
-
|
|
|
34
|
-
|
|
|
33
|
+
| 参数名 | 类型 | 描述 |
|
|
34
|
+
| ---------------- | ---------------- | ---------------------------------------------- |
|
|
35
|
+
| `线程js文件名` | `字符串` | 线程 js 文件路径 |
|
|
36
|
+
| `启动参数` | `字典<任意类型>` | 可选启动参数,只能传 Object;子线程通过 `$线程参数` 读取 |
|
|
35
37
|
|
|
36
38
|
**返回值:**
|
|
37
39
|
|
|
@@ -42,8 +44,13 @@ function 运行(线程函数: () => 无返回值): 线程;
|
|
|
42
44
|
**示例:**
|
|
43
45
|
|
|
44
46
|
```javascript
|
|
45
|
-
//
|
|
46
|
-
const t = $线程.运行("test_thread.js");
|
|
47
|
+
// 主线程传入启动参数
|
|
48
|
+
const t = $线程.运行("test_thread.js", { 任务编号: 1, 标题: "同步任务" });
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
```javascript
|
|
52
|
+
// test_thread.js
|
|
53
|
+
$打印信息日志(`任务 ${$线程参数.任务编号}: ${$线程参数.标题}`);
|
|
47
54
|
```
|
|
48
55
|
|
|
49
56
|
#### $线程.停止所有 - 停止所有线程
|
package/docs/apipython/node.md
CHANGED
|
@@ -46,7 +46,7 @@ class NodeInfo:
|
|
|
46
46
|
|
|
47
47
|
class NodeSelectorOptions(TypedDict, total=False):
|
|
48
48
|
maxDepth: int # 最大层级深度,默认 50
|
|
49
|
-
mode: int # 抓取模式:模式 1、模式 2,默认模式 1
|
|
49
|
+
mode: int # 抓取模式:模式 1、模式 2、模式 3,默认模式 1
|
|
50
50
|
```
|
|
51
51
|
|
|
52
52
|
## 节点选择器 (NodeSelector)
|
|
@@ -68,7 +68,7 @@ def createNodeSelector(params: Optional[NodeSelectorOptions] = None) -> NodeSele
|
|
|
68
68
|
| 参数名 | 类型 | 是否必填 | 默认值 | 描述 |
|
|
69
69
|
| ---------- | ---- | -------- | ------ | --------------------- |
|
|
70
70
|
| `maxDepth` | int | 否 | 50 | 最大层级深度,默认 50 |
|
|
71
|
-
| `mode` | int | 否 | 1 |
|
|
71
|
+
| `mode` | int | 否 | 1 | 抓取模式。支持模式 1、模式 2、模式 3,默认模式 1 |
|
|
72
72
|
|
|
73
73
|
**返回值:** `NodeSelector`
|
|
74
74
|
|
package/docs/apipython/pip.md
CHANGED
|
@@ -4,7 +4,8 @@
|
|
|
4
4
|
|
|
5
5
|
## 功能特性
|
|
6
6
|
|
|
7
|
-
-
|
|
7
|
+
- **显示模式**:支持日志、保活和自定义三种显示模式;首次安装默认保活
|
|
8
|
+
- **关闭控制**:支持主动关闭悬浮窗
|
|
8
9
|
- **状态查询**:判断悬浮窗是否正在显示
|
|
9
10
|
- **尺寸设置**:日志模式和自定义模式支持设置内容宽高,并按模式分别持久化
|
|
10
11
|
- **日志显示**:日志模式支持设置日志文字大小
|
|
@@ -108,10 +109,31 @@ pip.setCustomTextColor("#34c759")
|
|
|
108
109
|
pip.setCustomTextSize(18)
|
|
109
110
|
```
|
|
110
111
|
|
|
112
|
+
### closeWindow - 关闭悬浮窗
|
|
113
|
+
|
|
114
|
+
关闭悬浮窗。
|
|
115
|
+
|
|
116
|
+
```python
|
|
117
|
+
def closeWindow() -> bool
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
**返回值:**
|
|
121
|
+
|
|
122
|
+
| 类型 | 描述 |
|
|
123
|
+
| ------ | --------------------- |
|
|
124
|
+
| `bool` | `True` 代表已提交请求 |
|
|
125
|
+
|
|
126
|
+
**示例:**
|
|
127
|
+
|
|
128
|
+
```python
|
|
129
|
+
from kuaijs import pip
|
|
130
|
+
|
|
131
|
+
success = pip.closeWindow()
|
|
132
|
+
```
|
|
111
133
|
|
|
112
134
|
### setContentSize - 设置内容尺寸
|
|
113
135
|
|
|
114
|
-
|
|
136
|
+
设置日志模式或自定义模式的悬浮窗内容尺寸。宽度和高度都必须传入有效数字。日志模式和自定义模式会分别保存尺寸;悬浮窗关闭状态和保活模式不会生效。
|
|
115
137
|
|
|
116
138
|
```python
|
|
117
139
|
def setContentSize(width: float, height: float) -> bool
|
|
@@ -308,7 +330,7 @@ pip.setContentSize(120, 180)
|
|
|
308
330
|
|
|
309
331
|
## 注意事项
|
|
310
332
|
|
|
311
|
-
1. **前台限制**:首次切换到日志、保活或自定义显示模式并启动悬浮窗时,App
|
|
333
|
+
1. **前台限制**:首次切换到日志、保活或自定义显示模式并启动悬浮窗时,App 必须在前台;悬浮窗已启动后可以继续切换显示模式或关闭悬浮窗
|
|
312
334
|
2. **设备兼容性**:仅支持 iOS 15+ 且具备画中画功能的设备
|
|
313
335
|
3. **系统限制**:悬浮窗位置和实际显示尺寸由 iOS 管理
|
|
314
336
|
4. **尺寸持久化**:日志模式和自定义模式分别保存尺寸,互不共用;保活模式不接受脚本尺寸
|
package/docs/httpapi/api.md
CHANGED
|
@@ -159,7 +159,7 @@ GET /api/source
|
|
|
159
159
|
| --------- | ----- | ------- | ---- | ------------------ |
|
|
160
160
|
| max_depth | query | integer | 是 | 页面深度,值越小快照成本越低 |
|
|
161
161
|
| timeout | query | integer | 是 | 超时时间(单位秒) |
|
|
162
|
-
| mode | query | integer | 否 |
|
|
162
|
+
| mode | query | integer | 否 | 抓取模式。支持模式 1、模式 2、模式 3,默认模式 1 |
|
|
163
163
|
|
|
164
164
|
> 返回示例
|
|
165
165
|
|
|
@@ -585,13 +585,12 @@ GET /api/setClipboard
|
|
|
585
585
|
|
|
586
586
|
POST /api/login
|
|
587
587
|
|
|
588
|
-
|
|
588
|
+
用户授权模式下,该接口会使用账号密码执行登录。授权卡密模式下,该接口是兼容旧控制端的空操作,会直接返回成功,不读取请求体字段,也不执行账号登录。
|
|
589
589
|
|
|
590
590
|
> Body 请求参数
|
|
591
591
|
|
|
592
592
|
```json
|
|
593
593
|
{
|
|
594
|
-
"serverType": "domestic",
|
|
595
594
|
"username": "string",
|
|
596
595
|
"password": "string"
|
|
597
596
|
}
|
|
@@ -602,17 +601,9 @@ POST /api/login
|
|
|
602
601
|
| 名称 | 位置 | 类型 | 必选 | 中文名 | 说明 |
|
|
603
602
|
| ------------ | ---- | ------ | ---- | ---------- | ---- |
|
|
604
603
|
| body | body | object | 是 | | none |
|
|
605
|
-
| » serverType | body | string | 是 | 服务器类型 | 用户授权模式下使用;授权卡密模式下忽略 |
|
|
606
604
|
| » username | body | string | 是 | 用户名 | 用户授权模式下使用;授权卡密模式下忽略 |
|
|
607
605
|
| » password | body | string | 是 | 密码 | 用户授权模式下使用;授权卡密模式下忽略 |
|
|
608
606
|
|
|
609
|
-
#### 枚举值
|
|
610
|
-
|
|
611
|
-
| 属性 | 值 |
|
|
612
|
-
| ------------ | ------------- |
|
|
613
|
-
| » serverType | domestic |
|
|
614
|
-
| » serverType | international |
|
|
615
|
-
|
|
616
607
|
> 返回示例
|
|
617
608
|
|
|
618
609
|
> 200 Response
|
|
@@ -722,7 +713,6 @@ GET /api/status
|
|
|
722
713
|
"isVolumeControlEnabled": true,
|
|
723
714
|
"agentVersion": "string",
|
|
724
715
|
"appVersion": "string",
|
|
725
|
-
"serverType": "international",
|
|
726
716
|
"isHidConnected": true,
|
|
727
717
|
"isShowUI": true,
|
|
728
718
|
"isLogin": true,
|
|
@@ -783,7 +773,6 @@ GET /api/status
|
|
|
783
773
|
| »» isVolumeControlEnabled | boolean | true | none | 是否开启了音量键启停 | none |
|
|
784
774
|
| »» agentVersion | string | true | none | agent版本号 | none |
|
|
785
775
|
| »» appVersion | string | true | none | app版本号 | none |
|
|
786
|
-
| »» serverType | string | true | none | 授权服务器类型 | none |
|
|
787
776
|
| »» isHidConnected | boolean | true | none | hid设备是否连接 | none |
|
|
788
777
|
| »» isShowUI | boolean | true | none | 实现显示了 UI | none |
|
|
789
778
|
| »» isLogin | boolean | true | none | 是否登录 | none |
|
|
@@ -797,8 +786,6 @@ GET /api/status
|
|
|
797
786
|
| orientation | LANDSCAPE |
|
|
798
787
|
| authMode | user |
|
|
799
788
|
| authMode | card |
|
|
800
|
-
| serverType | international |
|
|
801
|
-
| serverType | domestic |
|
|
802
789
|
|
|
803
790
|
## GET App切到前台
|
|
804
791
|
|
|
@@ -2819,6 +2806,49 @@ GET /api/hid/mouseUp
|
|
|
2819
2806
|
| --------- | ------- | ---- | ---- | -------- | ---- |
|
|
2820
2807
|
| » success | boolean | true | none | 是否成功 | none |
|
|
2821
2808
|
|
|
2809
|
+
## GET 获取 HID 设备信息
|
|
2810
|
+
|
|
2811
|
+
GET /api/hid/deviceInfo
|
|
2812
|
+
|
|
2813
|
+
返回当前 HID 设备连接状态与基础信息。未连接时 `connected` 为 `false`,其余字符串字段为空。`name` 在纯 USB 链路下通常为空;BLE 为外设蓝牙名。
|
|
2814
|
+
|
|
2815
|
+
> 返回示例
|
|
2816
|
+
|
|
2817
|
+
> 200 Response
|
|
2818
|
+
|
|
2819
|
+
```json
|
|
2820
|
+
{
|
|
2821
|
+
"success": true,
|
|
2822
|
+
"data": {
|
|
2823
|
+
"connected": true,
|
|
2824
|
+
"name": "KUAIJS_BLE_HID",
|
|
2825
|
+
"mac": "AA:BB:CC:DD:EE:FF",
|
|
2826
|
+
"model": "esp32s3",
|
|
2827
|
+
"version": "3.0.9"
|
|
2828
|
+
}
|
|
2829
|
+
}
|
|
2830
|
+
```
|
|
2831
|
+
|
|
2832
|
+
### 返回结果
|
|
2833
|
+
|
|
2834
|
+
| 状态码 | 状态码含义 | 说明 | 数据模型 |
|
|
2835
|
+
| ------ | ------------------------------------------------------- | ---- | -------- |
|
|
2836
|
+
| 200 | [OK](https://tools.ietf.org/html/rfc7231#section-6.3.1) | none | Inline |
|
|
2837
|
+
|
|
2838
|
+
### 返回数据结构
|
|
2839
|
+
|
|
2840
|
+
状态码 **200**
|
|
2841
|
+
|
|
2842
|
+
| 名称 | 类型 | 必选 | 约束 | 中文名 | 说明 |
|
|
2843
|
+
| ------------ | ------- | ---- | ---- | -------- | ---- |
|
|
2844
|
+
| » success | boolean | true | none | 是否成功 | none |
|
|
2845
|
+
| » data | object | true | none | 设备信息 | none |
|
|
2846
|
+
| »» connected | boolean | true | none | 连接状态 | USB 或 BLE 任一就绪为 `true` |
|
|
2847
|
+
| »» name | string | true | none | 设备名称 | BLE 外设名;USB 通常为 `""` |
|
|
2848
|
+
| »» mac | string | true | none | 设备 MAC | 未连接或查询失败为 `""` |
|
|
2849
|
+
| »» model | string | true | none | 设备型号 | 如 `esp32s3`;失败为 `""` |
|
|
2850
|
+
| »» version | string | true | none | 设备版本 | 固件版本;失败为 `""` |
|
|
2851
|
+
|
|
2822
2852
|
## POST 保存图像到相册
|
|
2823
2853
|
|
|
2824
2854
|
POST /api/media/saveImageToAlbum
|
|
@@ -3280,7 +3310,6 @@ GET /mirror/image
|
|
|
3280
3310
|
"isVolumeControlEnabled": true,
|
|
3281
3311
|
"agentVersion": "string",
|
|
3282
3312
|
"appVersion": "string",
|
|
3283
|
-
"serverType": "international",
|
|
3284
3313
|
"isHidConnected": true,
|
|
3285
3314
|
"isShowUI": true,
|
|
3286
3315
|
"isLogin": true,
|
|
@@ -3330,7 +3359,6 @@ GET /mirror/image
|
|
|
3330
3359
|
| isVolumeControlEnabled | boolean | true | none | 是否开启了音量键启停 | none |
|
|
3331
3360
|
| agentVersion | string | true | none | agent版本号 | none |
|
|
3332
3361
|
| appVersion | string | true | none | app版本号 | none |
|
|
3333
|
-
| serverType | string | true | none | 授权服务器类型 | none |
|
|
3334
3362
|
| isHidConnected | boolean | true | none | hid设备是否连接 | none |
|
|
3335
3363
|
| isShowUI | boolean | true | none | 实现显示了 UI | none |
|
|
3336
3364
|
| isLogin | boolean | true | none | 是否登录 | none |
|
|
@@ -3344,5 +3372,3 @@ GET /mirror/image
|
|
|
3344
3372
|
| orientation | LANDSCAPE |
|
|
3345
3373
|
| authMode | user |
|
|
3346
3374
|
| authMode | card |
|
|
3347
|
-
| serverType | international |
|
|
3348
|
-
| serverType | domestic |
|