eprolo-cli 1.0.88 → 1.0.90
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/bin/eprolo-cli.js +9 -5
- package/package.json +1 -1
package/bin/eprolo-cli.js
CHANGED
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
const fs = require("fs");
|
|
5
5
|
const os = require("os");
|
|
6
6
|
const path = require("path");
|
|
7
|
-
const https = require("
|
|
8
|
-
|
|
7
|
+
const https = require("https");
|
|
8
|
+
const http = require("http");
|
|
9
9
|
const LOGIN_API = "https://wixtest.eprolo.com/v1/auth/verifyCode.stm";
|
|
10
10
|
const BASE_URL = "https://wixtest.eprolo.com";
|
|
11
11
|
const REFRESH_API = "https://wixtest.eprolo.com/v1/auth/refresh-code";
|
|
@@ -55,7 +55,11 @@ function postJson(url, body, headers = {},method = "POST") {
|
|
|
55
55
|
return new Promise((resolve, reject) => {
|
|
56
56
|
const target = new URL(url);
|
|
57
57
|
const payload = JSON.stringify(body);
|
|
58
|
-
|
|
58
|
+
let reqMethod=https;
|
|
59
|
+
if(String(target.protocol).startsWith("http:")){
|
|
60
|
+
reqMethod=http;
|
|
61
|
+
}
|
|
62
|
+
const req = reqMethod.request({
|
|
59
63
|
hostname: target.hostname,
|
|
60
64
|
port: target.port || 443,
|
|
61
65
|
path: `${target.pathname}${target.search}`,
|
|
@@ -143,8 +147,8 @@ async function login(argv) {
|
|
|
143
147
|
if (res.data.code != 0) {
|
|
144
148
|
console.error(JSON.stringify({
|
|
145
149
|
success: false,
|
|
146
|
-
errorMessage: res.
|
|
147
|
-
statusCode: res.
|
|
150
|
+
errorMessage: res.data.msg || res.data || "登录失败",
|
|
151
|
+
statusCode: res.statusCode,
|
|
148
152
|
response: res.data.msg
|
|
149
153
|
}));
|
|
150
154
|
process.exit(1);
|
package/package.json
CHANGED