cloud189-sdk 1.0.4 → 1.0.5
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/CloudClient.d.ts +2 -0
- package/dist/CloudClient.js +7 -7
- package/package.json +1 -1
package/dist/CloudClient.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { CookieJar } from "tough-cookie";
|
|
1
2
|
interface CacheQuery {
|
|
2
3
|
appId: string;
|
|
3
4
|
reqId: string;
|
|
@@ -56,6 +57,7 @@ declare class CloudClient {
|
|
|
56
57
|
username: string;
|
|
57
58
|
password: string;
|
|
58
59
|
cacheQuery: CacheQuery;
|
|
60
|
+
cookieJar: CookieJar;
|
|
59
61
|
constructor(username: string, password: string);
|
|
60
62
|
getEncrypt: () => Promise<any>;
|
|
61
63
|
redirectURL: () => Promise<unknown>;
|
package/dist/CloudClient.js
CHANGED
|
@@ -20,7 +20,6 @@ const node_jsencrypt_1 = __importDefault(require("node-jsencrypt"));
|
|
|
20
20
|
const crypto_1 = __importDefault(require("crypto"));
|
|
21
21
|
const got_1 = __importDefault(require("got"));
|
|
22
22
|
const tough_cookie_1 = require("tough-cookie");
|
|
23
|
-
const cookieJar = new tough_cookie_1.CookieJar();
|
|
24
23
|
const config = {
|
|
25
24
|
clientId: "538135150693412",
|
|
26
25
|
model: "KB2000",
|
|
@@ -133,7 +132,7 @@ class CloudClient {
|
|
|
133
132
|
}
|
|
134
133
|
else {
|
|
135
134
|
return got_1.default
|
|
136
|
-
.get(res.toUrl, { headers, cookieJar })
|
|
135
|
+
.get(res.toUrl, { headers, cookieJar: this.cookieJar })
|
|
137
136
|
.then((r) => resolve(r.statusCode));
|
|
138
137
|
}
|
|
139
138
|
})
|
|
@@ -144,7 +143,7 @@ class CloudClient {
|
|
|
144
143
|
return got_1.default
|
|
145
144
|
.get(task, {
|
|
146
145
|
headers: Object.assign(Object.assign({}, headers), { Host: q.host }),
|
|
147
|
-
cookieJar,
|
|
146
|
+
cookieJar: this.cookieJar,
|
|
148
147
|
})
|
|
149
148
|
.json();
|
|
150
149
|
};
|
|
@@ -154,7 +153,7 @@ class CloudClient {
|
|
|
154
153
|
headers: {
|
|
155
154
|
Accept: "application/json;charset=UTF-8",
|
|
156
155
|
},
|
|
157
|
-
cookieJar,
|
|
156
|
+
cookieJar: this.cookieJar,
|
|
158
157
|
})
|
|
159
158
|
.json();
|
|
160
159
|
};
|
|
@@ -181,7 +180,7 @@ class CloudClient {
|
|
|
181
180
|
};
|
|
182
181
|
this.getUserBriefInfo = () => got_1.default
|
|
183
182
|
.get("https://cloud.189.cn/api/portal/v2/getUserBriefInfo.action", {
|
|
184
|
-
cookieJar,
|
|
183
|
+
cookieJar: this.cookieJar,
|
|
185
184
|
})
|
|
186
185
|
.json();
|
|
187
186
|
this.getAccessTokenBySsKey = (sessionKey) => {
|
|
@@ -200,7 +199,7 @@ class CloudClient {
|
|
|
200
199
|
Timestamp: time,
|
|
201
200
|
Appkey: appkey,
|
|
202
201
|
},
|
|
203
|
-
cookieJar,
|
|
202
|
+
cookieJar: this.cookieJar,
|
|
204
203
|
})
|
|
205
204
|
.json();
|
|
206
205
|
};
|
|
@@ -222,7 +221,7 @@ class CloudClient {
|
|
|
222
221
|
Accesstoken: __classPrivateFieldGet(this, _CloudClient_accessToken, "f"),
|
|
223
222
|
Accept: "application/json;charset=UTF-8",
|
|
224
223
|
},
|
|
225
|
-
cookieJar,
|
|
224
|
+
cookieJar: this.cookieJar,
|
|
226
225
|
})
|
|
227
226
|
.json();
|
|
228
227
|
};
|
|
@@ -233,6 +232,7 @@ class CloudClient {
|
|
|
233
232
|
};
|
|
234
233
|
this.username = username;
|
|
235
234
|
this.password = password;
|
|
235
|
+
this.cookieJar = new tough_cookie_1.CookieJar();
|
|
236
236
|
}
|
|
237
237
|
}
|
|
238
238
|
_CloudClient_accessToken = new WeakMap(), _CloudClient_builLoginForm = new WeakMap(), _CloudClient_sortParameter = new WeakMap(), _CloudClient_getSignature = new WeakMap();
|