ms-types 0.10.13 → 0.10.15
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/package.json +2 -2
- package/types/config.d.ts +0 -6
- package/types/device.d.ts +2 -2
- package/types/global.d.ts +2 -3
- package/types/index.d.ts +7 -0
- package/types/jbclear.d.ts +85 -0
- package/types/jbdevice.d.ts +190 -0
- package/types/jbdylib.d.ts +81 -0
- package/types/jbshell.d.ts +28 -0
- package/types/jbsystem.d.ts +72 -0
- package/types/jbvpn.d.ts +106 -0
- package/types/lua/config.lua +0 -5
- package/types/lua/device.lua +1 -1
- package/types/lua/global.lua +3 -3
- package/types/lua/jbclear.lua +79 -0
- package/types/lua/jbdevice.lua +157 -0
- package/types/lua/jbdylib.lua +52 -0
- package/types/lua/jbshell.lua +20 -0
- package/types/lua/jbsystem.lua +58 -0
- package/types/lua/jbvpn.lua +76 -0
- package/types/lua/pip.lua +13 -4
- package/types/lua/plist.lua +50 -0
- package/types/pip.d.ts +14 -4
- package/types/plist.d.ts +59 -0
- package/types/ui.d.ts +19 -0
- package/types/web.d.ts +25 -0
- package/types/zh//345/205/250/345/261/200/346/250/241/345/235/227.d.ts +2 -2
- package/types/zh//346/202/254/346/265/256/347/252/227/346/250/241/345/235/227.d.ts +20 -4
- package/types/zh//350/247/206/345/233/276/346/250/241/345/235/227.d.ts +19 -0
- package/types/zh//350/256/276/345/244/207/346/250/241/345/235/227.d.ts +2 -2
- package/types/zh//351/205/215/347/275/256/346/250/241/345/235/227.d.ts +0 -6
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ms-types",
|
|
3
|
-
"version": "0.10.
|
|
3
|
+
"version": "0.10.15",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"types": "./types/index.d.ts",
|
|
@@ -24,6 +24,6 @@
|
|
|
24
24
|
"devDependencies": {
|
|
25
25
|
"vitepress": "^1.6.4",
|
|
26
26
|
"vitepress-theme-teek": "^1.6.2",
|
|
27
|
-
"wrangler": "^4.131.
|
|
27
|
+
"wrangler": "^4.131.2"
|
|
28
28
|
}
|
|
29
29
|
}
|
package/types/config.d.ts
CHANGED
|
@@ -30,12 +30,6 @@ declare namespace config {
|
|
|
30
30
|
* @example config.get("key")
|
|
31
31
|
*/
|
|
32
32
|
function get(key: string): any | null;
|
|
33
|
-
/**
|
|
34
|
-
* 获取 KUI 的配置
|
|
35
|
-
* @returns KUI_CONFIG 对应的字典,配置不存在或无法转换时返回空对象
|
|
36
|
-
* @example config.getKuiConfig()
|
|
37
|
-
*/
|
|
38
|
-
function getKuiConfig(): Record<string, any>;
|
|
39
33
|
/**
|
|
40
34
|
* 删除配置
|
|
41
35
|
* @param key 配置key
|
package/types/device.d.ts
CHANGED
package/types/global.d.ts
CHANGED
|
@@ -11,10 +11,9 @@ declare const __debug__: boolean;
|
|
|
11
11
|
*/
|
|
12
12
|
declare const __isRunning__: boolean;
|
|
13
13
|
/**
|
|
14
|
-
*
|
|
14
|
+
* 平台标识。免越狱包为 `"ios"`,越狱包为 `"ios_jb"`。
|
|
15
15
|
*/
|
|
16
|
-
declare const __platform__: "ios" | "
|
|
17
|
-
/**
|
|
16
|
+
declare const __platform__: "ios" | "ios_jb";
|
|
18
17
|
/**
|
|
19
18
|
* 应用版本
|
|
20
19
|
*/
|
package/types/index.d.ts
CHANGED
|
@@ -13,6 +13,12 @@
|
|
|
13
13
|
/// <reference path="http.d.ts" />
|
|
14
14
|
/// <reference path="image.d.ts" />
|
|
15
15
|
/// <reference path="ime.d.ts" />
|
|
16
|
+
/// <reference path="jbdylib.d.ts" />
|
|
17
|
+
/// <reference path="jbshell.d.ts" />
|
|
18
|
+
/// <reference path="jbclear.d.ts" />
|
|
19
|
+
/// <reference path="jbsystem.d.ts" />
|
|
20
|
+
/// <reference path="jbdevice.d.ts" />
|
|
21
|
+
/// <reference path="jbvpn.d.ts" />
|
|
16
22
|
/// <reference path="logger.d.ts" />
|
|
17
23
|
/// <reference path="media.d.ts" />
|
|
18
24
|
/// <reference path="mysql.d.ts" />
|
|
@@ -21,6 +27,7 @@
|
|
|
21
27
|
/// <reference path="opencv.d.ts" />
|
|
22
28
|
/// <reference path="paddleocr.d.ts" />
|
|
23
29
|
/// <reference path="pip.d.ts" />
|
|
30
|
+
/// <reference path="plist.d.ts" />
|
|
24
31
|
/// <reference path="system.d.ts" />
|
|
25
32
|
/// <reference path="thread.d.ts" />
|
|
26
33
|
/// <reference path="tomatoocr.d.ts" />
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 清理模块。仅越狱包提供,免越狱包没有该对象。
|
|
3
|
+
*/
|
|
4
|
+
declare namespace jbclear {
|
|
5
|
+
/**
|
|
6
|
+
* 按关联名清理钥匙串。空串返回 `false`。
|
|
7
|
+
* @param identifier 钥匙串关联名,例如 `"demo.sample.app"`
|
|
8
|
+
* @returns 成功返回 `true`
|
|
9
|
+
* @example jbclear.keychain("demo.sample.app")
|
|
10
|
+
*/
|
|
11
|
+
function keychain(identifier: string): boolean;
|
|
12
|
+
/**
|
|
13
|
+
* 清理第三方应用钥匙串。不清理本 App。
|
|
14
|
+
* @returns 成功返回 `true`
|
|
15
|
+
* @example jbclear.allKeychain()
|
|
16
|
+
*/
|
|
17
|
+
function allKeychain(): boolean;
|
|
18
|
+
/**
|
|
19
|
+
* 清理 Safari Cookies。
|
|
20
|
+
* @returns 成功返回 `true`
|
|
21
|
+
* @example jbclear.cookies()
|
|
22
|
+
*/
|
|
23
|
+
function cookies(): boolean;
|
|
24
|
+
/**
|
|
25
|
+
* 清理系统缓存。默认会重建图标缓存。
|
|
26
|
+
* @param options 传入 `{ noUicache: true }` 时跳过重建图标缓存
|
|
27
|
+
* @returns 成功返回 `true`
|
|
28
|
+
* @example jbclear.caches()
|
|
29
|
+
*/
|
|
30
|
+
function caches(options?: { noUicache?: boolean }): boolean;
|
|
31
|
+
/**
|
|
32
|
+
* 删除本机相册里的本地照片。不影响 iCloud 照片。
|
|
33
|
+
* @returns 成功返回 `true`
|
|
34
|
+
* @example jbclear.photos()
|
|
35
|
+
*/
|
|
36
|
+
function photos(): boolean;
|
|
37
|
+
/**
|
|
38
|
+
* 先结束该应用进程,再清数据容器、App Group、扩展数据和该应用钥匙串,不卸载。空包名或本 App 及其扩展返回 `false`。
|
|
39
|
+
* @param bundleId 应用包标识符,例如 `"demo.sample.app"`
|
|
40
|
+
* @returns 成功返回 `true`
|
|
41
|
+
* @example jbclear.appData("demo.sample.app")
|
|
42
|
+
*/
|
|
43
|
+
function appData(bundleId: string): boolean;
|
|
44
|
+
/**
|
|
45
|
+
* 读取整机广告标识(IDFA)。
|
|
46
|
+
* @returns UUID 字符串;读不到返回 `null`
|
|
47
|
+
* @example const idfa = jbclear.getIdfa()
|
|
48
|
+
*/
|
|
49
|
+
function getIdfa(): string | null;
|
|
50
|
+
/**
|
|
51
|
+
* 重置整机广告标识(IDFA)。之后所有 App 读到的都会变。
|
|
52
|
+
* @returns 重置前的 UUID;失败返回 `null`
|
|
53
|
+
* @example const old = jbclear.resetIdfa()
|
|
54
|
+
*/
|
|
55
|
+
function resetIdfa(): string | null;
|
|
56
|
+
/**
|
|
57
|
+
* 写入整机广告标识(IDFA)。
|
|
58
|
+
* @param value UUID 字符串
|
|
59
|
+
* @returns 写入前的 UUID;失败返回 `null`
|
|
60
|
+
* @example jbclear.setIdfa(old)
|
|
61
|
+
*/
|
|
62
|
+
function setIdfa(value: string): string | null;
|
|
63
|
+
/**
|
|
64
|
+
* 读取指定应用所属开发商的供应商标识(IDFV)。
|
|
65
|
+
* @param bundleId 应用包标识符,例如 `"demo.sample.app"`
|
|
66
|
+
* @returns UUID 字符串;读不到返回 `null`
|
|
67
|
+
* @example const idfv = jbclear.getIdfv("demo.sample.app")
|
|
68
|
+
*/
|
|
69
|
+
function getIdfv(bundleId: string): string | null;
|
|
70
|
+
/**
|
|
71
|
+
* 重置指定应用所属开发商的 IDFV。同一开发商的 App 会一起变。
|
|
72
|
+
* @param bundleId 应用包标识符,例如 `"demo.sample.app"`
|
|
73
|
+
* @returns 重置前的 UUID;失败返回 `null`
|
|
74
|
+
* @example const old = jbclear.resetIdfv("demo.sample.app")
|
|
75
|
+
*/
|
|
76
|
+
function resetIdfv(bundleId: string): string | null;
|
|
77
|
+
/**
|
|
78
|
+
* 写入指定应用所属开发商的 IDFV。
|
|
79
|
+
* @param bundleId 应用包标识符,例如 `"demo.sample.app"`
|
|
80
|
+
* @param value UUID 字符串
|
|
81
|
+
* @returns 写入前的 UUID;失败返回 `null`
|
|
82
|
+
* @example jbclear.setIdfv("demo.sample.app", old)
|
|
83
|
+
*/
|
|
84
|
+
function setIdfv(bundleId: string, value: string): string | null;
|
|
85
|
+
}
|
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 越狱设备模块。仅越狱包提供,免越狱包没有该对象。
|
|
3
|
+
*
|
|
4
|
+
* 可设置自动锁屏分钟数(`0` 为不自动锁屏)并还原,读取序列号和 Wi-Fi 信息 / MAC,
|
|
5
|
+
* 打开或关闭 Wi-Fi / 蓝牙 / 蜂窝数据 / 飞行模式,读取开关,扫描附近或列出已保存无线网,
|
|
6
|
+
* 加入或遗忘无线网,设置和获取音量与背光亮度。
|
|
7
|
+
*/
|
|
8
|
+
declare namespace jbdevice {
|
|
9
|
+
/**
|
|
10
|
+
* 当前已连接无线网信息。
|
|
11
|
+
*/
|
|
12
|
+
interface WifiInfo {
|
|
13
|
+
/** 无线网名称。 */
|
|
14
|
+
ssid: string;
|
|
15
|
+
/** BSSID。 */
|
|
16
|
+
bssid: string;
|
|
17
|
+
/** 已保存密码;开放网络为空串。 */
|
|
18
|
+
password: string;
|
|
19
|
+
/** 加密方式:`WEP` / `WPA` / `EAP` / `NONE`。 */
|
|
20
|
+
encryption: string;
|
|
21
|
+
/** 信道。 */
|
|
22
|
+
channel: number;
|
|
23
|
+
/** 是否隐藏网络。 */
|
|
24
|
+
hidden: boolean;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* 设置自动锁屏分钟数。`0` 表示不自动锁屏。
|
|
28
|
+
* @param minutes 锁屏分钟数;`<= 0` 视为不自动锁屏
|
|
29
|
+
* @returns 成功为 `true`
|
|
30
|
+
* @example jbdevice.setAutoLockMinutes(0)
|
|
31
|
+
*/
|
|
32
|
+
function setAutoLockMinutes(minutes: number): boolean;
|
|
33
|
+
/**
|
|
34
|
+
* 还原自动锁屏分钟数。没有可还原的值则失败。
|
|
35
|
+
* @returns 成功为 `true`
|
|
36
|
+
* @example jbdevice.restoreAutoLock()
|
|
37
|
+
*/
|
|
38
|
+
function restoreAutoLock(): boolean;
|
|
39
|
+
/**
|
|
40
|
+
* 读取当前自动锁屏分钟数。`0` 表示不自动锁屏。
|
|
41
|
+
* @returns 分钟数;读不到返回 `null`
|
|
42
|
+
* @example jbdevice.getAutoLockMinutes()
|
|
43
|
+
*/
|
|
44
|
+
function getAutoLockMinutes(): number | null;
|
|
45
|
+
/**
|
|
46
|
+
* 读取设备序列号。
|
|
47
|
+
* @returns 序列号;读不到返回 `null`
|
|
48
|
+
* @example jbdevice.serialNumber()
|
|
49
|
+
*/
|
|
50
|
+
function serialNumber(): string | null;
|
|
51
|
+
/**
|
|
52
|
+
* 读取本机 Wi-Fi MAC。
|
|
53
|
+
* @returns `aa:bb:cc:dd:ee:ff` 形式;读不到返回 `null`
|
|
54
|
+
* @example jbdevice.wifiMac()
|
|
55
|
+
*/
|
|
56
|
+
function wifiMac(): string | null;
|
|
57
|
+
/**
|
|
58
|
+
* 读取当前已连接无线网信息。没连上返回 `null`。
|
|
59
|
+
* @returns Wi-Fi 信息;没连上返回 `null`
|
|
60
|
+
* @example jbdevice.wifiInfo()
|
|
61
|
+
*/
|
|
62
|
+
function wifiInfo(): WifiInfo | null;
|
|
63
|
+
/**
|
|
64
|
+
* 打开 Wi-Fi。
|
|
65
|
+
* @returns 成功为 `true`
|
|
66
|
+
* @example jbdevice.wifiOn()
|
|
67
|
+
*/
|
|
68
|
+
function wifiOn(): boolean;
|
|
69
|
+
/**
|
|
70
|
+
* 关闭 Wi-Fi。
|
|
71
|
+
* @returns 成功为 `true`
|
|
72
|
+
* @example jbdevice.wifiOff()
|
|
73
|
+
*/
|
|
74
|
+
function wifiOff(): boolean;
|
|
75
|
+
/**
|
|
76
|
+
* 读取 Wi-Fi 是否打开。
|
|
77
|
+
* @returns 当前是否打开;读不到返回 `null`
|
|
78
|
+
* @example jbdevice.isWifiOn()
|
|
79
|
+
*/
|
|
80
|
+
function isWifiOn(): boolean | null;
|
|
81
|
+
/**
|
|
82
|
+
* 打开蓝牙。
|
|
83
|
+
* @returns 成功为 `true`
|
|
84
|
+
* @example jbdevice.bluetoothOn()
|
|
85
|
+
*/
|
|
86
|
+
function bluetoothOn(): boolean;
|
|
87
|
+
/**
|
|
88
|
+
* 关闭蓝牙。
|
|
89
|
+
* @returns 成功为 `true`
|
|
90
|
+
* @example jbdevice.bluetoothOff()
|
|
91
|
+
*/
|
|
92
|
+
function bluetoothOff(): boolean;
|
|
93
|
+
/**
|
|
94
|
+
* 读取蓝牙是否打开。
|
|
95
|
+
* @returns 当前是否打开;读不到返回 `null`
|
|
96
|
+
* @example jbdevice.isBluetoothOn()
|
|
97
|
+
*/
|
|
98
|
+
function isBluetoothOn(): boolean | null;
|
|
99
|
+
/**
|
|
100
|
+
* 打开蜂窝数据。
|
|
101
|
+
* @returns 成功为 `true`
|
|
102
|
+
* @example jbdevice.cellularOn()
|
|
103
|
+
*/
|
|
104
|
+
function cellularOn(): boolean;
|
|
105
|
+
/**
|
|
106
|
+
* 关闭蜂窝数据。
|
|
107
|
+
* @returns 成功为 `true`
|
|
108
|
+
* @example jbdevice.cellularOff()
|
|
109
|
+
*/
|
|
110
|
+
function cellularOff(): boolean;
|
|
111
|
+
/**
|
|
112
|
+
* 读取蜂窝数据是否打开。没有蜂窝能力时失败。
|
|
113
|
+
* @returns 当前是否打开;读不到返回 `null`
|
|
114
|
+
* @example jbdevice.isCellularOn()
|
|
115
|
+
*/
|
|
116
|
+
function isCellularOn(): boolean | null;
|
|
117
|
+
/**
|
|
118
|
+
* 打开飞行模式。
|
|
119
|
+
* @returns 成功为 `true`
|
|
120
|
+
* @example jbdevice.airplaneOn()
|
|
121
|
+
*/
|
|
122
|
+
function airplaneOn(): boolean;
|
|
123
|
+
/**
|
|
124
|
+
* 关闭飞行模式。
|
|
125
|
+
* @returns 成功为 `true`
|
|
126
|
+
* @example jbdevice.airplaneOff()
|
|
127
|
+
*/
|
|
128
|
+
function airplaneOff(): boolean;
|
|
129
|
+
/**
|
|
130
|
+
* 读取飞行模式是否打开。
|
|
131
|
+
* @returns 当前是否打开;读不到返回 `null`
|
|
132
|
+
* @example jbdevice.isAirplaneOn()
|
|
133
|
+
*/
|
|
134
|
+
function isAirplaneOn(): boolean | null;
|
|
135
|
+
/**
|
|
136
|
+
* 加入一个无线网。开放网络密码传空串。有密码时至少 8 位。
|
|
137
|
+
* @param ssid 无线网名称,也可传 BSSID
|
|
138
|
+
* @param password 密码;开放网络传空串
|
|
139
|
+
* @param timeoutMs 等待上限毫秒;省略或 `<= 0` 时用 `15000`,最短 `5000`,最长 `120000`
|
|
140
|
+
* @returns 连上目标网为 `true`
|
|
141
|
+
* @example jbdevice.joinWifi("Office", "password123")
|
|
142
|
+
*/
|
|
143
|
+
function joinWifi(ssid: string, password?: string, timeoutMs?: number): boolean;
|
|
144
|
+
/**
|
|
145
|
+
* 遗忘一个已保存的无线网。可传 SSID 或 BSSID。
|
|
146
|
+
* @param ssid 无线网名称或 BSSID
|
|
147
|
+
* @returns 找到并删掉为 `true`
|
|
148
|
+
* @example jbdevice.forgetWifi("Office")
|
|
149
|
+
*/
|
|
150
|
+
function forgetWifi(ssid: string): boolean;
|
|
151
|
+
/**
|
|
152
|
+
* 列出已保存的无线网。没有已存网络时是空数组。
|
|
153
|
+
* @returns Wi-Fi 信息数组;读失败返回 `null`
|
|
154
|
+
* @example jbdevice.listWifi()
|
|
155
|
+
*/
|
|
156
|
+
function listWifi(): WifiInfo[] | null;
|
|
157
|
+
/**
|
|
158
|
+
* 扫描附近无线网。会先打开 Wi-Fi。
|
|
159
|
+
* @param timeoutMs 等待上限毫秒;省略或 `<= 0` 时用 `15000`,最短 `5000`,最长 `120000`
|
|
160
|
+
* @returns Wi-Fi 信息数组;扫失败返回 `null`。附近没有网时是空数组
|
|
161
|
+
* @example jbdevice.scanWifi()
|
|
162
|
+
*/
|
|
163
|
+
function scanWifi(timeoutMs?: number): WifiInfo[] | null;
|
|
164
|
+
/**
|
|
165
|
+
* 设置系统音量,范围 `0.0-1.0`。
|
|
166
|
+
* @param volume 目标音量
|
|
167
|
+
* @returns 成功为 `true`
|
|
168
|
+
* @example jbdevice.setVolume(0.5)
|
|
169
|
+
*/
|
|
170
|
+
function setVolume(volume: number): boolean;
|
|
171
|
+
/**
|
|
172
|
+
* 读取系统音量,范围 `0.0-1.0`。
|
|
173
|
+
* @returns 当前音量;读不到返回 `null`
|
|
174
|
+
* @example jbdevice.getVolume()
|
|
175
|
+
*/
|
|
176
|
+
function getVolume(): number | null;
|
|
177
|
+
/**
|
|
178
|
+
* 设置背光亮度,范围 `0.0-1.0`。
|
|
179
|
+
* @param brightness 目标亮度
|
|
180
|
+
* @returns 成功为 `true`
|
|
181
|
+
* @example jbdevice.setBrightness(0.5)
|
|
182
|
+
*/
|
|
183
|
+
function setBrightness(brightness: number): boolean;
|
|
184
|
+
/**
|
|
185
|
+
* 读取背光亮度,范围 `0.0-1.0`。
|
|
186
|
+
* @returns 当前亮度;读不到返回 `null`
|
|
187
|
+
* @example jbdevice.getBrightness()
|
|
188
|
+
*/
|
|
189
|
+
function getBrightness(): number | null;
|
|
190
|
+
}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 动态库模块。仅越狱包提供,免越狱包没有该对象。
|
|
3
|
+
*
|
|
4
|
+
* 先 `open` 加载 `res` 里的库并得到库对象,再用 `define` / `defineAll` 绑定 C 函数签名,
|
|
5
|
+
* 之后按符号名直接调用,例如 `lib.mylib_add(1, 2)`。
|
|
6
|
+
*/
|
|
7
|
+
declare namespace jbdylib {
|
|
8
|
+
/**
|
|
9
|
+
* 函数定义:返回类型字符串,或 `[返回类型]`,或 `[返回类型, 参数类型数组]`。
|
|
10
|
+
* @example
|
|
11
|
+
* "void"
|
|
12
|
+
* ["int"]
|
|
13
|
+
* ["int", ["int", "int"]]
|
|
14
|
+
*/
|
|
15
|
+
type FnSpec = string | [string] | [string, string[]];
|
|
16
|
+
/**
|
|
17
|
+
* 已打开的动态库。先定义签名,再调用。
|
|
18
|
+
*/
|
|
19
|
+
interface Lib {
|
|
20
|
+
/**
|
|
21
|
+
* 绑定一个导出函数的返回类型和参数类型。成功后可按符号名直接调用。
|
|
22
|
+
* @param symbol 导出符号名,例如 `"mylib_add"`。不能与 `define` / `call` 等库对象方法重名
|
|
23
|
+
* @param retType 返回类型,如 `"void"` `"int"` `"string"` `"pointer"`
|
|
24
|
+
* @param argTypes 每个参数的类型,无参数时可省略
|
|
25
|
+
* @returns 签名合法且符号存在返回 `true`
|
|
26
|
+
* @example
|
|
27
|
+
* lib.define("mylib_add", "int", ["int", "int"])
|
|
28
|
+
* const sum = lib.mylib_add(1, 2)
|
|
29
|
+
*/
|
|
30
|
+
define(symbol: string, retType: string, argTypes?: string[]): boolean;
|
|
31
|
+
/**
|
|
32
|
+
* 批量绑定导出函数。
|
|
33
|
+
* @param specs 键为符号名,值为函数定义
|
|
34
|
+
* @returns 全部成功返回 `true`;失败项会跳过,其余仍会绑定
|
|
35
|
+
* @example
|
|
36
|
+
* lib.defineAll({
|
|
37
|
+
* mylib_add: ["int", ["int", "int"]],
|
|
38
|
+
* mylib_get_name: ["string"],
|
|
39
|
+
* mylib_touch: "void",
|
|
40
|
+
* })
|
|
41
|
+
*/
|
|
42
|
+
defineAll(specs: Record<string, FnSpec>): boolean;
|
|
43
|
+
/**
|
|
44
|
+
* 按已经 `define` 的签名调用导出函数。
|
|
45
|
+
* @param symbol 已绑定的导出符号名
|
|
46
|
+
* @param args 与定义时参数类型对应的实参
|
|
47
|
+
* @returns 调用成功返回结果;`void` 成功返回 `true`;失败返回 `null`
|
|
48
|
+
* @example
|
|
49
|
+
* const sum = lib.call("mylib_add", 1, 2)
|
|
50
|
+
*/
|
|
51
|
+
call(symbol: string, ...args: any[]): any;
|
|
52
|
+
/**
|
|
53
|
+
* 解析导出符号地址。
|
|
54
|
+
* @param name 导出符号名
|
|
55
|
+
* @returns 成功返回 `"0x..."` 地址字符串,失败返回 `null`
|
|
56
|
+
* @example
|
|
57
|
+
* const addr = lib.symbol("mylib_add")
|
|
58
|
+
*/
|
|
59
|
+
symbol(name: string): string | null;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* 从脚本项目 `res` 目录加载动态库,返回库对象。
|
|
63
|
+
* @param name 相对 `res` 的动态库路径,例如 `"mylib.dylib"` 或 `"libs/mylib.dylib"`
|
|
64
|
+
* @param defs 可选;打开后立刻批量绑定的函数表
|
|
65
|
+
* @returns 加载成功返回库对象,失败返回 `null`
|
|
66
|
+
* @example
|
|
67
|
+
* const lib = jbdylib.open("mylib.dylib", {
|
|
68
|
+
* mylib_add: ["int", ["int", "int"]],
|
|
69
|
+
* })
|
|
70
|
+
* const sum = lib.mylib_add(1, 2)
|
|
71
|
+
*/
|
|
72
|
+
function open(name: string, defs?: Record<string, FnSpec>): Lib | null;
|
|
73
|
+
/**
|
|
74
|
+
* 查询动态库是否已加载进当前脚本进程。
|
|
75
|
+
* @param name 相对 `res` 的动态库路径,须与 `open` 使用的名字一致
|
|
76
|
+
* @returns 已加载返回 `true`,否则 `false`
|
|
77
|
+
* @example
|
|
78
|
+
* const ready = jbdylib.isLoaded("mylib.dylib")
|
|
79
|
+
*/
|
|
80
|
+
function isLoaded(name: string): boolean;
|
|
81
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 终端模块。仅越狱包提供,免越狱包没有该对象。
|
|
3
|
+
*
|
|
4
|
+
* 用 `exec` 执行一条 shell 命令,同步返回退出码和标准输出、标准错误。
|
|
5
|
+
*/
|
|
6
|
+
declare namespace jbshell {
|
|
7
|
+
/**
|
|
8
|
+
* 命令执行结果。字段名固定为英文。
|
|
9
|
+
*/
|
|
10
|
+
interface Result {
|
|
11
|
+
/** 退出码;超时为 `-1`;被信号结束后为 `128 + 信号` */
|
|
12
|
+
code: number;
|
|
13
|
+
/** 标准输出文本 */
|
|
14
|
+
stdout: string;
|
|
15
|
+
/** 标准错误文本 */
|
|
16
|
+
stderr: string;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* 执行一条 shell 命令,等到结束或超时。
|
|
20
|
+
* @param command 交给 `sh -c` 的命令
|
|
21
|
+
* @param timeoutMs 等待上限毫秒;省略或 `<= 0` 时为 30000,最长 3600000
|
|
22
|
+
* @returns 启动成功返回结果;空命令或启动失败返回 `null`。超时仍返回已捕获输出,`code` 为 `-1`
|
|
23
|
+
* @example
|
|
24
|
+
* const r = jbshell.exec("printf hello")
|
|
25
|
+
* logi(r.stdout)
|
|
26
|
+
*/
|
|
27
|
+
function exec(command: string, timeoutMs?: number): Result | null;
|
|
28
|
+
}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 越狱系统模块。仅越狱包提供,免越狱包没有该对象。
|
|
3
|
+
*
|
|
4
|
+
* `respring` 重启 SpringBoard。`reboot` 重启用户空间,不是重启整机。
|
|
5
|
+
* `restartSelf` 重启当前 App 进程。
|
|
6
|
+
* 还可读写「允许 App 请求跟踪」「个性化广告」和定位服务总开关。
|
|
7
|
+
*/
|
|
8
|
+
declare namespace jbsystem {
|
|
9
|
+
/**
|
|
10
|
+
* 重启 SpringBoard(Respring)。
|
|
11
|
+
* 调用后当前 App 和脚本通常会被系统结束。
|
|
12
|
+
* @returns 成功返回 `true`
|
|
13
|
+
* @example jbsystem.respring()
|
|
14
|
+
*/
|
|
15
|
+
function respring(): boolean;
|
|
16
|
+
/**
|
|
17
|
+
* 重启用户空间,不是重启整机。
|
|
18
|
+
* 调用后当前进程会被系统结束。
|
|
19
|
+
* @returns 成功返回 `true`
|
|
20
|
+
* @example jbsystem.reboot()
|
|
21
|
+
*/
|
|
22
|
+
function reboot(): boolean;
|
|
23
|
+
/**
|
|
24
|
+
* 重启当前 App 进程。
|
|
25
|
+
* 调用后当前脚本会结束,App 随后会被重新拉起。
|
|
26
|
+
* @returns 成功返回 `true`
|
|
27
|
+
* @example jbsystem.restartSelf()
|
|
28
|
+
*/
|
|
29
|
+
function restartSelf(): boolean;
|
|
30
|
+
/**
|
|
31
|
+
* 读取「允许 App 请求跟踪」总开关。
|
|
32
|
+
* 对应 `设置 > 隐私与安全性 > 跟踪 > 允许 App 请求跟踪`。
|
|
33
|
+
* @returns 当前是否允许;读失败返回 `null`
|
|
34
|
+
* @example const allow = jbsystem.getUserTracking()
|
|
35
|
+
*/
|
|
36
|
+
function getUserTracking(): boolean | null;
|
|
37
|
+
/**
|
|
38
|
+
* 设置「允许 App 请求跟踪」总开关。
|
|
39
|
+
* @param enabled `true` 允许 App 弹跟踪请求,`false` 不允许
|
|
40
|
+
* @returns 成功返回 `true`
|
|
41
|
+
* @example jbsystem.setUserTracking(false)
|
|
42
|
+
*/
|
|
43
|
+
function setUserTracking(enabled: boolean): boolean;
|
|
44
|
+
/**
|
|
45
|
+
* 读取「个性化广告」开关。
|
|
46
|
+
* 对应 `设置 > 隐私与安全性 > Apple 广告 > 个性化广告`。
|
|
47
|
+
* @returns 当前是否允许;读失败返回 `null`
|
|
48
|
+
* @example const allow = jbsystem.getPersonalizedAdvertising()
|
|
49
|
+
*/
|
|
50
|
+
function getPersonalizedAdvertising(): boolean | null;
|
|
51
|
+
/**
|
|
52
|
+
* 设置「个性化广告」开关。
|
|
53
|
+
* @param enabled `true` 允许个性化广告,`false` 不允许
|
|
54
|
+
* @returns 成功返回 `true`
|
|
55
|
+
* @example jbsystem.setPersonalizedAdvertising(false)
|
|
56
|
+
*/
|
|
57
|
+
function setPersonalizedAdvertising(enabled: boolean): boolean;
|
|
58
|
+
/**
|
|
59
|
+
* 读取定位服务总开关。
|
|
60
|
+
* 对应 `设置 > 隐私与安全性 > 定位服务` 总开关。
|
|
61
|
+
* @returns 当前是否开启;读失败返回 `null`
|
|
62
|
+
* @example const enabled = jbsystem.getLocationServices()
|
|
63
|
+
*/
|
|
64
|
+
function getLocationServices(): boolean | null;
|
|
65
|
+
/**
|
|
66
|
+
* 设置定位服务总开关。
|
|
67
|
+
* @param enabled `true` 开启定位服务,`false` 关闭
|
|
68
|
+
* @returns 成功返回 `true`
|
|
69
|
+
* @example jbsystem.setLocationServices(false)
|
|
70
|
+
*/
|
|
71
|
+
function setLocationServices(enabled: boolean): boolean;
|
|
72
|
+
}
|
package/types/jbvpn.d.ts
ADDED
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 越狱 VPN 模块。仅越狱包提供,免越狱包没有该对象。
|
|
3
|
+
*
|
|
4
|
+
* 管理系统 VPN 配置:创建、列出、读取当前选中、选中、删除、连接、断开,以及读取当前选中配置的状态。
|
|
5
|
+
* 类型支持 `L2TP`、`IPSec`、`IKEv2`。
|
|
6
|
+
*/
|
|
7
|
+
declare namespace jbvpn {
|
|
8
|
+
/**
|
|
9
|
+
* 创建 VPN 时传入的配置。
|
|
10
|
+
*/
|
|
11
|
+
interface VpnConfig {
|
|
12
|
+
/** 显示名。 */
|
|
13
|
+
name: string;
|
|
14
|
+
/** 类型:`L2TP` / `IPSec` / `IKEv2`。 */
|
|
15
|
+
type: string;
|
|
16
|
+
/** 服务器地址。 */
|
|
17
|
+
server: string;
|
|
18
|
+
/** 账号。 */
|
|
19
|
+
account?: string;
|
|
20
|
+
/** 密码。 */
|
|
21
|
+
password?: string;
|
|
22
|
+
/** 共享密钥。L2TP / IPSec 常用。 */
|
|
23
|
+
secret?: string;
|
|
24
|
+
/** 群组名称。 */
|
|
25
|
+
group?: string;
|
|
26
|
+
/** 是否发送所有流量。省略时为 `true`。 */
|
|
27
|
+
sendAllTraffic?: boolean;
|
|
28
|
+
/** 加密级别。省略时为 `1`。 */
|
|
29
|
+
encryptionLevel?: number;
|
|
30
|
+
/** 本端标识。IKEv2 可用。 */
|
|
31
|
+
localId?: string;
|
|
32
|
+
/** 对端标识。IKEv2 可用。 */
|
|
33
|
+
remoteId?: string;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* 系统里的一条 VPN 配置。
|
|
37
|
+
*/
|
|
38
|
+
interface VpnItem {
|
|
39
|
+
/** 显示名。 */
|
|
40
|
+
name: string;
|
|
41
|
+
/** 配置 ID。同名时用这个精确操作。 */
|
|
42
|
+
id: string;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* 当前选中 VPN 的状态。
|
|
46
|
+
*/
|
|
47
|
+
interface VpnStatus {
|
|
48
|
+
/** 状态文字。 */
|
|
49
|
+
text: string;
|
|
50
|
+
/** 是否已经连上。 */
|
|
51
|
+
connected: boolean;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* 创建一条系统 VPN 配置。必填 `name`、`type`、`server`。
|
|
55
|
+
* @param config 配置
|
|
56
|
+
* @returns 成功为 `true`
|
|
57
|
+
* @example jbvpn.create({ name: "Demo", type: "L2TP", server: "vpn.example.com", account: "user", password: "pass", secret: "psk" })
|
|
58
|
+
*/
|
|
59
|
+
function create(config: VpnConfig): boolean;
|
|
60
|
+
/**
|
|
61
|
+
* 列出当前系统 VPN 配置。没有配置时是空数组。
|
|
62
|
+
* @returns 配置列表;读失败返回 `null`
|
|
63
|
+
* @example jbvpn.list()
|
|
64
|
+
*/
|
|
65
|
+
function list(): VpnItem[] | null;
|
|
66
|
+
/**
|
|
67
|
+
* 读取当前选中的 VPN 配置。没有选中配置返回 `null`。
|
|
68
|
+
* @returns `{ name, id }`;没有选中配置返回 `null`
|
|
69
|
+
* @example jbvpn.current()
|
|
70
|
+
*/
|
|
71
|
+
function current(): VpnItem | null;
|
|
72
|
+
/**
|
|
73
|
+
* 选中一条 VPN 配置。可传显示名或 `list` 返回的 `id`。同名时不保证选中哪一条。
|
|
74
|
+
* @param nameOrId 显示名或 VPN ID
|
|
75
|
+
* @returns 找到并选中为 `true`
|
|
76
|
+
* @example jbvpn.select("Demo")
|
|
77
|
+
*/
|
|
78
|
+
function select(nameOrId: string): boolean;
|
|
79
|
+
/**
|
|
80
|
+
* 删除一条 VPN 配置。可传显示名或 `id`。同名时不保证删除哪一条。
|
|
81
|
+
* @param nameOrId 显示名或 VPN ID
|
|
82
|
+
* @returns 找到并删除为 `true`
|
|
83
|
+
* @example jbvpn.remove("Demo")
|
|
84
|
+
*/
|
|
85
|
+
function remove(nameOrId: string): boolean;
|
|
86
|
+
/**
|
|
87
|
+
* 连接 VPN。传入显示名或 `id` 时先选中再连接;省略则连接当前选中的配置。
|
|
88
|
+
* 返回 `true` 只表示已经开始连接,不表示已经连上。用 `status` 看是否连上。
|
|
89
|
+
* @param nameOrId 显示名或 VPN ID
|
|
90
|
+
* @returns 开始连接为 `true`
|
|
91
|
+
* @example jbvpn.connect("Demo")
|
|
92
|
+
*/
|
|
93
|
+
function connect(nameOrId?: string): boolean;
|
|
94
|
+
/**
|
|
95
|
+
* 断开当前 VPN 连接。返回 `true` 只表示已经开始断开,不表示已经断开。
|
|
96
|
+
* @returns 开始断开为 `true`
|
|
97
|
+
* @example jbvpn.disconnect()
|
|
98
|
+
*/
|
|
99
|
+
function disconnect(): boolean;
|
|
100
|
+
/**
|
|
101
|
+
* 读取当前选中 VPN 的状态。没有选中配置返回 `null`。
|
|
102
|
+
* @returns 状态;没有选中配置返回 `null`
|
|
103
|
+
* @example jbvpn.status()
|
|
104
|
+
*/
|
|
105
|
+
function status(): VpnStatus | null;
|
|
106
|
+
}
|
package/types/lua/config.lua
CHANGED
|
@@ -27,11 +27,6 @@ function _Config.set(key, value) return true end
|
|
|
27
27
|
---@example config.get("key")
|
|
28
28
|
function _Config.get(key) return nil end
|
|
29
29
|
|
|
30
|
-
--- 获取 KUI_CONFIG 表;不存在时返回空表
|
|
31
|
-
---@return table<string, any> KUI_CONFIG 对应的字典,配置不存在或无法转换时返回空对象
|
|
32
|
-
---@example config.getKuiConfig()
|
|
33
|
-
function _Config.getKuiConfig() return {} end
|
|
34
|
-
|
|
35
30
|
--- 删除配置
|
|
36
31
|
---@param key string 配置key
|
|
37
32
|
---@return boolean 删除是否成功
|
package/types/lua/device.lua
CHANGED
|
@@ -30,7 +30,7 @@ function _Device.getStorageSpace()
|
|
|
30
30
|
return { total = 0, free = 0, unit = 'GB' }
|
|
31
31
|
end
|
|
32
32
|
|
|
33
|
-
--- 设备 ID
|
|
33
|
+
--- 设备 ID。越狱包返回芯片生成的固定 ID,卸载重装不变;免越狱包返回 IDFV,卸载重装会改变。
|
|
34
34
|
---@return string 设备ID
|
|
35
35
|
---@example device.getDeviceID()
|
|
36
36
|
function _Device.getDeviceID() return '' end
|
package/types/lua/global.lua
CHANGED