@honor-claw/yoyo 1.1.2 → 1.1.4-beta.1
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/index.ts +25 -25
- package/package.json +5 -5
- package/src/apis/claw-cloud.ts +124 -124
- package/src/apis/helpers.ts +10 -10
- package/src/apis/honor-auth.ts +158 -158
- package/src/apis/http-client.ts +239 -239
- package/src/apis/index.ts +8 -8
- package/src/apis/types.ts +77 -73
- package/src/cloud-channel/channel.ts +117 -117
- package/src/cloud-channel/client.ts +3 -3
- package/src/cloud-channel/index.ts +4 -4
- package/src/cloud-channel/message-handler.ts +50 -42
- package/src/cloud-channel/session-manager.ts +14 -9
- package/src/cloud-channel/types.ts +115 -115
- package/src/commands/env/impl.ts +58 -58
- package/src/commands/env/index.ts +1 -1
- package/src/commands/index.ts +30 -30
- package/src/commands/login/impl.ts +30 -30
- package/src/commands/login/index.ts +1 -1
- package/src/commands/logout/index.ts +1 -1
- package/src/commands/status/index.ts +194 -194
- package/src/gateway-client/client.ts +90 -90
- package/src/gateway-client/device/auth.ts +57 -57
- package/src/gateway-client/device/builder.ts +105 -105
- package/src/gateway-client/device/helpers.ts +40 -40
- package/src/gateway-client/device/identity.ts +251 -251
- package/src/gateway-client/device/index.ts +40 -40
- package/src/gateway-client/device/types.ts +57 -57
- package/src/gateway-client/index.ts +5 -5
- package/src/gateway-client/protocol-client.ts +49 -34
- package/src/honor-auth/browser.ts +2 -2
- package/src/honor-auth/callback-server.ts +109 -109
- package/src/honor-auth/cloud.ts +57 -57
- package/src/honor-auth/config.ts +43 -43
- package/src/honor-auth/index.ts +3 -3
- package/src/honor-auth/token-manager.ts +90 -90
- package/src/honor-auth/types.ts +50 -50
- package/src/index.ts +10 -10
- package/src/modules/claw-configs/config-manager.ts +409 -409
- package/src/modules/claw-configs/hosts.ts +48 -48
- package/src/modules/claw-configs/index.ts +8 -8
- package/src/modules/claw-configs/provider.ts +394 -394
- package/src/modules/claw-configs/types.ts +34 -34
- package/src/modules/device/device-info.ts +1 -1
- package/src/modules/device/index.ts +3 -3
- package/src/modules/device/providers/base.ts +32 -32
- package/src/modules/device/providers/pad.ts +107 -107
- package/src/modules/device/providers/windows.ts +130 -130
- package/src/modules/device/registry.ts +48 -43
- package/src/modules/login/impl.ts +31 -26
- package/src/modules/login/index.ts +6 -6
- package/src/schemas.ts +23 -23
- package/src/services/connection/impl.ts +339 -339
- package/src/services/connection/status-tracker/events.ts +127 -127
- package/src/services/connection/status-tracker/index.ts +31 -31
- package/src/services/connection/status-tracker/storage.ts +133 -133
- package/src/services/connection/status-tracker/tracker.ts +370 -370
- package/src/services/connection/status-tracker/types.ts +131 -131
- package/src/services/connection/types.ts +20 -20
- package/src/types.ts +64 -64
- package/src/utils/id.ts +8 -8
- package/src/utils/jwt.ts +37 -37
- package/src/utils/logger.ts +20 -20
- package/src/utils/proxy.ts +58 -58
- package/src/utils/version.ts +29 -29
- package/src/utils/ws.ts +21 -21
package/src/utils/version.ts
CHANGED
|
@@ -1,29 +1,29 @@
|
|
|
1
|
-
import { readFileSync } from "fs";
|
|
2
|
-
import { fileURLToPath } from "url";
|
|
3
|
-
import { dirname, join } from "path";
|
|
4
|
-
|
|
5
|
-
let g_isBetaVersion: boolean | null = null;
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* 检查当前版本是否为 beta 版本
|
|
9
|
-
*/
|
|
10
|
-
export function isBetaVersion(): boolean {
|
|
11
|
-
if (g_isBetaVersion !== null) {
|
|
12
|
-
return !!g_isBetaVersion;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
try {
|
|
16
|
-
const __filename = fileURLToPath(import.meta.url);
|
|
17
|
-
const __dirname = dirname(__filename);
|
|
18
|
-
const packagePath = join(__dirname, "../../package.json");
|
|
19
|
-
const pkgContent = readFileSync(packagePath, "utf-8");
|
|
20
|
-
const pkg = JSON.parse(pkgContent);
|
|
21
|
-
const version = pkg.version || "";
|
|
22
|
-
|
|
23
|
-
g_isBetaVersion = version.includes("beta");
|
|
24
|
-
} catch (error) {
|
|
25
|
-
console.error(`Failed to check version: ${error}`);
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
return !!g_isBetaVersion;
|
|
29
|
-
}
|
|
1
|
+
import { readFileSync } from "fs";
|
|
2
|
+
import { fileURLToPath } from "url";
|
|
3
|
+
import { dirname, join } from "path";
|
|
4
|
+
|
|
5
|
+
let g_isBetaVersion: boolean | null = null;
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* 检查当前版本是否为 beta 版本
|
|
9
|
+
*/
|
|
10
|
+
export function isBetaVersion(): boolean {
|
|
11
|
+
if (g_isBetaVersion !== null) {
|
|
12
|
+
return !!g_isBetaVersion;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
try {
|
|
16
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
17
|
+
const __dirname = dirname(__filename);
|
|
18
|
+
const packagePath = join(__dirname, "../../package.json");
|
|
19
|
+
const pkgContent = readFileSync(packagePath, "utf-8");
|
|
20
|
+
const pkg = JSON.parse(pkgContent);
|
|
21
|
+
const version = pkg.version || "";
|
|
22
|
+
|
|
23
|
+
g_isBetaVersion = version.includes("beta");
|
|
24
|
+
} catch (error) {
|
|
25
|
+
console.error(`Failed to check version: ${error}`);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
return !!g_isBetaVersion;
|
|
29
|
+
}
|
package/src/utils/ws.ts
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
import { Buffer } from "node:buffer";
|
|
2
|
-
import type WebSocket from "ws";
|
|
3
|
-
|
|
4
|
-
export function rawDataToString(
|
|
5
|
-
data: WebSocket.RawData,
|
|
6
|
-
encoding: BufferEncoding = "utf8",
|
|
7
|
-
): string {
|
|
8
|
-
if (typeof data === "string") {
|
|
9
|
-
return data;
|
|
10
|
-
}
|
|
11
|
-
if (Buffer.isBuffer(data)) {
|
|
12
|
-
return data.toString(encoding);
|
|
13
|
-
}
|
|
14
|
-
if (Array.isArray(data)) {
|
|
15
|
-
return Buffer.concat(data).toString(encoding);
|
|
16
|
-
}
|
|
17
|
-
if (data instanceof ArrayBuffer) {
|
|
18
|
-
return Buffer.from(data).toString(encoding);
|
|
19
|
-
}
|
|
20
|
-
return Buffer.from(String(data)).toString(encoding);
|
|
21
|
-
}
|
|
1
|
+
import { Buffer } from "node:buffer";
|
|
2
|
+
import type WebSocket from "ws";
|
|
3
|
+
|
|
4
|
+
export function rawDataToString(
|
|
5
|
+
data: WebSocket.RawData,
|
|
6
|
+
encoding: BufferEncoding = "utf8",
|
|
7
|
+
): string {
|
|
8
|
+
if (typeof data === "string") {
|
|
9
|
+
return data;
|
|
10
|
+
}
|
|
11
|
+
if (Buffer.isBuffer(data)) {
|
|
12
|
+
return data.toString(encoding);
|
|
13
|
+
}
|
|
14
|
+
if (Array.isArray(data)) {
|
|
15
|
+
return Buffer.concat(data).toString(encoding);
|
|
16
|
+
}
|
|
17
|
+
if (data instanceof ArrayBuffer) {
|
|
18
|
+
return Buffer.from(data).toString(encoding);
|
|
19
|
+
}
|
|
20
|
+
return Buffer.from(String(data)).toString(encoding);
|
|
21
|
+
}
|