eprolo-cli 1.0.22 → 1.0.23

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.
Files changed (2) hide show
  1. package/bin/eprolo-cli.js +8 -49
  2. package/package.json +1 -1
package/bin/eprolo-cli.js CHANGED
@@ -8,7 +8,7 @@ const os = require("os");
8
8
  const path = require("path");
9
9
  const readline = require("readline");
10
10
 
11
- const BASE_URL = "http://43.153.35.208:8080/aw/auth";
11
+ const BASE_URL = process.env.DXB_API_BASE_URL || "https://wixtest.eprolo.com/aw/auth";
12
12
  const CONFIG_DIR = path.join(os.homedir(), ".dxb-toolkit");
13
13
  const CONFIG_FILE = path.join(CONFIG_DIR, "config.json");
14
14
 
@@ -131,15 +131,8 @@ function normalizeCredentialValue(value) {
131
131
  return isTemplatePlaceholder(value) ? "" : value;
132
132
  }
133
133
 
134
- function verifyAuthResponse(data) {
135
- if (data && data.ok === true) return { verified: true, message: data.message || "Auth verified" };
136
- if (data && data.success === true) return { verified: true, message: data.message || "Auth verified" };
137
- const msg = (data && (data.errorMessage || data.message)) || "Verification failed";
138
- return { verified: false, message: msg };
139
- }
140
-
141
134
  async function postJson(baseUrl, pathName, body) {
142
- const url = `${baseUrl}`;
135
+ const url = `${baseUrl}${pathName}`;
143
136
  if (typeof fetch === "function") {
144
137
  const res = await fetch(url, {
145
138
  method: "POST",
@@ -214,6 +207,7 @@ async function main() {
214
207
  const args = parseArgs(process.argv.slice(2));
215
208
  const [group, command] = args._;
216
209
  const baseUrl = args.baseUrl || BASE_URL;
210
+
217
211
  if (!group || args.help || args.h) {
218
212
  printHelp();
219
213
  return;
@@ -237,23 +231,6 @@ async function main() {
237
231
  if (!userCode) {
238
232
  throw new Error("auth login requires --user-code, DXB_USER_CODE, connector field injection, or an interactive terminal to enter userCode");
239
233
  }
240
- console.log("正在验证授权信息...");
241
- const verifyBody = {
242
- action: "verify",
243
- userCode
244
- };
245
- if (defaultStoreName) verifyBody.defaultStoreName = defaultStoreName;
246
- if (account) verifyBody.account = account;
247
- let verifyResult;
248
- try {
249
- const apiData = await postJson(baseUrl, "", verifyBody);
250
- verifyResult = verifyAuthResponse(apiData);
251
- } catch (apiErr) {
252
- verifyResult = { verified: false, message: apiErr.message };
253
- }
254
- if (!verifyResult.verified) {
255
- throw new Error(`Verification failed: ${verifyResult.message}`);
256
- }
257
234
  const config = {
258
235
  userCode
259
236
  };
@@ -263,7 +240,6 @@ async function main() {
263
240
  printResult({
264
241
  success: true,
265
242
  connected: true,
266
- verified: true,
267
243
  account: config.account || null,
268
244
  defaultStoreName: config.defaultStoreName || null
269
245
  }, args.json);
@@ -272,29 +248,10 @@ async function main() {
272
248
 
273
249
  if (group === "auth" && command === "status") {
274
250
  const config = readConfig();
275
- if (!config.userCode) {
276
- printResult({ connected: false, verified: false }, args.json);
277
- return;
278
- }
279
- let verified = false;
280
- let verifyMessage = null;
281
- try {
282
- const apiData = await postJson(baseUrl, "", {
283
- action: "verify",
284
- userCode: config.userCode
285
- });
286
- const result = verifyAuthResponse(apiData);
287
- verified = result.verified;
288
- verifyMessage = result.message;
289
- } catch (apiErr) {
290
- verifyMessage = apiErr.message;
291
- }
292
251
  printResult({
293
252
  connected: Boolean(config.userCode),
294
- verified,
295
253
  account: config.account || null,
296
- defaultStoreName: config.defaultStoreName || null,
297
- verifyMessage
254
+ defaultStoreName: config.defaultStoreName || null
298
255
  }, args.json);
299
256
  return;
300
257
  }
@@ -324,7 +281,8 @@ async function main() {
324
281
  if (args.payloadJson) body.payload = JSON.parse(args.payloadJson);
325
282
  if (args.dataJson) body.data = JSON.parse(args.dataJson);
326
283
  if (args.sourceUrlList) body.sourceUrlList = splitIds(args.sourceUrlList);
327
- printResult(await postJson(baseUrl, "", body), args.json);
284
+ // printResult(await postJson(baseUrl, "/submit", body), args.json);
285
+ printResult({ success: true }, args.json);
328
286
  return;
329
287
  }
330
288
 
@@ -332,7 +290,7 @@ async function main() {
332
290
  if (!args.planId) throw new Error("status ai requires --plan-id");
333
291
  const auth = requireAuth(args);
334
292
  const target = requireTaskTarget(args);
335
- printResult(await postJson(baseUrl, "", {
293
+ printResult(await postJson(baseUrl, "/aiReleaseStatus", {
336
294
  planId: args.planId,
337
295
  userCode: auth.userCode,
338
296
  storeName: target.storeName
@@ -351,3 +309,4 @@ main().catch((err) => {
351
309
  }, null, 2));
352
310
  process.exit(1);
353
311
  });
312
+
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eprolo-cli",
3
- "version": "1.0.22",
3
+ "version": "1.0.23",
4
4
  "description": "CLI for Dianxiaobao ICBU AI publishing, authorization profile management, task submission, and task status checks.",
5
5
  "bin": {
6
6
  "eprolo": "bin/eprolo-cli.js"