@honor-claw/yoyo 1.1.4-beta.8 → 1.1.4-beta.9
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
CHANGED
package/src/honor-auth/cloud.ts
CHANGED
|
@@ -14,7 +14,7 @@ export async function performLogout(): Promise<void> {
|
|
|
14
14
|
const configManager = getConfigManager();
|
|
15
15
|
const userConfig = configManager.getUserConfig();
|
|
16
16
|
|
|
17
|
-
if (!userConfig
|
|
17
|
+
if (!userConfig?.token) {
|
|
18
18
|
console.log("⚠️ Not logged in");
|
|
19
19
|
return;
|
|
20
20
|
}
|
|
@@ -26,7 +26,7 @@ export async function saveToken(
|
|
|
26
26
|
|
|
27
27
|
// 如果没有 jwtToken 但有 userId,通过 exchangeToken 获取
|
|
28
28
|
if (!jwtToken && params.userId) {
|
|
29
|
-
const deviceInfo = await getDeviceInfo();
|
|
29
|
+
const deviceInfo = params.deviceInfo || (await getDeviceInfo());
|
|
30
30
|
const client = createClawCloudClient();
|
|
31
31
|
const tokenInfo = await client.exchangeToken(deviceInfo, { userId: params.userId });
|
|
32
32
|
jwtToken = tokenInfo.jwtToken;
|
package/src/honor-auth/types.ts
CHANGED
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
* 荣耀OAuth2认证相关类型定义
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
|
+
import { DeviceInfo } from "../types.js";
|
|
6
|
+
|
|
5
7
|
/**
|
|
6
8
|
* 荣耀认证配置
|
|
7
9
|
*/
|
|
@@ -29,4 +31,5 @@ export interface HonorAuthConfig {
|
|
|
29
31
|
export interface SaveTokenParams {
|
|
30
32
|
userId?: string;
|
|
31
33
|
jwtToken?: string;
|
|
34
|
+
deviceInfo?: DeviceInfo;
|
|
32
35
|
}
|