component-shipinlv 1.3.0 → 1.3.2

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.
@@ -106,6 +106,7 @@ var VideoPublishAccountManageHomePage = function VideoPublishAccountManageHomePa
106
106
  platformAccountId: accountDetail.accountId,
107
107
  nickname: accountDetail.nickname,
108
108
  chromeProfileName: accountDetail.chromeProfileName,
109
+ taskId: 0,
109
110
  url: url,
110
111
  proxyInfo: accountDetail.proxyInfo,
111
112
  isOpen: true
@@ -206,6 +206,7 @@ var HomePageAccountList = function HomePageAccountList(_ref) {
206
206
  platform: platform,
207
207
  platformAccountId: '',
208
208
  nickname: '',
209
+ taskId: 0,
209
210
  chromePath: settingConfig.chromePath,
210
211
  chromeProfileName: chromeProfileName,
211
212
  url: 'https://creator.douyin.com/',
@@ -488,6 +488,7 @@ var PublishTaskPlanClass = /*#__PURE__*/function () {
488
488
  platform: query.platform || 'douyin',
489
489
  platformAccountId: query.platformVideoAccountId,
490
490
  nickname: query.nickname,
491
+ taskId: query.taskInfo.taskId,
491
492
  url: 'https://creator.douyin.com/creator-micro/home',
492
493
  chromePath: settingConfig.chromePath,
493
494
  chromeProfileName: query.chromeProfileName,
@@ -15,7 +15,8 @@ export var VideoPlatformList = [{
15
15
  name: 'Tiktok',
16
16
  videoWebSiteUrl: 'https://www.tiktok.com/',
17
17
  // auth login
18
- allowMainDomainList: ['tiktok.com']
18
+ allowMainDomainList: ['tiktok.com'],
19
+ disabled: true
19
20
  },
20
21
  // {
21
22
  // platform: 'buyin',
@@ -29,7 +30,8 @@ export var VideoPlatformList = [{
29
30
  platform: 'kuaishou',
30
31
  name: '快手',
31
32
  videoWebSiteUrl: 'https://www.kuaishou.com/',
32
- allowMainDomainList: ['kuaishou.com']
33
+ allowMainDomainList: ['kuaishou.com'],
34
+ disabled: true
33
35
  }
34
36
  // {
35
37
  // platform: 'bilibili',
package/dist/index.d.ts CHANGED
@@ -8,6 +8,7 @@ export { default as Product } from './Product';
8
8
  export { default as JoinClient } from './join-client';
9
9
  export { default as renewalVip } from './renewal-vip';
10
10
  export { default as ClientUpdate } from './Client/ClientUpdate';
11
+ export { default as openChrome } from './lib/openChrome';
11
12
  export { default as DealerUrlDict } from './base/DealerUrlDict';
12
13
  export { default as VideoPlatform, VideoPlatformList, VideoPlatformDict } from './component/video-platform/logo';
13
14
  export { default as VipList } from './VipList';
package/dist/index.js CHANGED
@@ -10,6 +10,7 @@ export { default as Product } from "./Product";
10
10
  export { default as JoinClient } from "./join-client";
11
11
  export { default as renewalVip } from "./renewal-vip";
12
12
  export { default as ClientUpdate } from "./Client/ClientUpdate";
13
+ export { default as openChrome } from "./lib/openChrome";
13
14
  export { default as DealerUrlDict } from "./base/DealerUrlDict";
14
15
  export { default as VideoPlatform, VideoPlatformList, VideoPlatformDict } from "./component/video-platform/logo";
15
16
  export { default as VipList } from "./VipList";
@@ -161,7 +161,7 @@ declare const Tool: {
161
161
  OsPathSeparator(): string;
162
162
  getTitleByPath(path: string): string;
163
163
  h5Pay(query: Pay.H5PayQuery): void;
164
- notification(type: "success" | "info" | "error" | "warning", message: string, description?: import("react").ReactNode, options?: NotificationOptions): void;
164
+ notification(type: "success" | "info" | "warning" | "error", message: string, description?: import("react").ReactNode, options?: NotificationOptions): void;
165
165
  notificationSuccess(message: string, description?: import("react").ReactNode, options?: NotificationOptions): void;
166
166
  notificationError(message: string, description?: import("react").ReactNode, options?: NotificationOptions): void;
167
167
  notificationWarning(message: string, description?: import("react").ReactNode, options?: NotificationOptions): void;
package/dist/lib/Tool.js CHANGED
@@ -1100,6 +1100,7 @@ var Tool = _objectSpread(_objectSpread({
1100
1100
  return Date.now() - Tool.getTimeOffset();
1101
1101
  },
1102
1102
  getOsName: function getOsName() {
1103
+ return 'windows';
1103
1104
  var userAgent = navigator.userAgent || window.opera;
1104
1105
 
1105
1106
  // Windows
@@ -1,2 +1,2 @@
1
- declare const openChrome: (query: OpenChrome.PropsQuery, isNew: boolean) => void;
1
+ declare const openChrome: (query: ChromeOperate.PropsQuery, isNew: boolean) => Promise<void>;
2
2
  export default openChrome;
@@ -6,52 +6,69 @@ import Tool from "./Tool";
6
6
  import notification from "./notification";
7
7
  import userAgent from "./user-agent";
8
8
  import VideoApiOpenChrome from "./video-api/open-chrome";
9
+ import * as VideoPublishCrawlerTaskController from "../service/api/VideoPublishCrawlerTaskController";
9
10
 
10
11
  // @isNew: 只有 新建账户,才要 isNew
11
- var openChrome = function openChrome(query, isNew) {
12
- var settingConfig = AccountManageSettingConfig();
13
- if (!query.chromePath) {
14
- query.chromePath = settingConfig.chromePath;
15
- }
16
- if (!query.chromePath) {
17
- notification.notificationError('没找到 Google 浏览器', '请设置 谷歌浏览器地址,或者重新安装 https://google.cn/chrome/');
18
- return;
19
- }
20
- var data = getOpenQuery(query, isNew, settingConfig);
21
-
22
- //唤起 浏览器;
23
- // onOpenChromeRun({
24
- // ...query,
25
- // ...data,
26
- // chromeUserDataDir: settingConfig.chromeUserDataDir,
27
- // chromePath,
28
- // });
29
- onOpenChromeRun({
30
- commandList: data.commandList
31
- });
32
- };
33
- var onOpenChromeRun = /*#__PURE__*/function () {
34
- var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(query) {
35
- var cmdResult;
12
+ var openChrome = /*#__PURE__*/function () {
13
+ var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(query, isNew) {
14
+ var settingConfig, data, cmdResult;
36
15
  return _regeneratorRuntime().wrap(function _callee$(_context) {
37
16
  while (1) switch (_context.prev = _context.next) {
38
17
  case 0:
39
- _context.next = 2;
40
- return VideoApiOpenChrome(query).catch(function (err) {
18
+ settingConfig = AccountManageSettingConfig();
19
+ if (!query.chromePath) {
20
+ query.chromePath = settingConfig.chromePath;
21
+ }
22
+ if (query.chromePath) {
23
+ _context.next = 5;
24
+ break;
25
+ }
26
+ notification.notificationError('没找到 Google 浏览器', '请设置 谷歌浏览器地址,或者重新安装 https://google.cn/chrome/');
27
+ return _context.abrupt("return");
28
+ case 5:
29
+ data = getOpenQuery(query, isNew, settingConfig); //唤起 浏览器;
30
+ // onOpenChromeRun({
31
+ // ...query,
32
+ // ...data,
33
+ // chromeUserDataDir: settingConfig.chromeUserDataDir,
34
+ // chromePath,
35
+ // });
36
+ _context.next = 8;
37
+ return VideoApiOpenChrome({
38
+ commandList: data.commandList
39
+ }).catch(function (err) {
41
40
  // todo 上报
42
41
  console.log('open chrome err:', err);
42
+ VideoPublishCrawlerTaskController.report({
43
+ success: false,
44
+ code: 'open-chrome-fail',
45
+ message: err === null || err === void 0 ? void 0 : err.message,
46
+ taskType: '',
47
+ taskId: query.taskId,
48
+ platform: query.platform,
49
+ platformAccountId: query.platformAccountId
50
+ }, {
51
+ // env,
52
+ });
43
53
  });
44
- case 2:
54
+ case 8:
45
55
  cmdResult = _context.sent;
46
56
  console.log("cmd:", query);
47
- if (cmdResult) {}
48
- case 5:
57
+ if (!cmdResult) {
58
+ // await sleep( 6e3 );
59
+ // VideoApiQuitChrome({
60
+ // platform: query.platform,
61
+ // platformVideoAccountId: query.platformAccountId,
62
+ // chromeProfileName: query.chromeProfileName,
63
+ // });
64
+ }
65
+ case 11:
49
66
  case "end":
50
67
  return _context.stop();
51
68
  }
52
69
  }, _callee);
53
70
  }));
54
- return function onOpenChromeRun(_x) {
71
+ return function openChrome(_x, _x2) {
55
72
  return _ref.apply(this, arguments);
56
73
  };
57
74
  }();
@@ -65,9 +82,13 @@ var getOpenQuery = function getOpenQuery(query, isNew, settingConfig) {
65
82
  _nickname: query.nickname || '',
66
83
  _chromeProfileName: query.chromeProfileName || ''
67
84
  });
85
+ var chromeProfileDir = settingConfig.chromeUserDataDir + '/' + query.chromeProfileName;
68
86
  switch (Tool.getOsName()) {
69
87
  case "windows":
70
- cmdList.push("cmd", "/c", "start");
88
+ // 艹,屎一样的 windows cmd
89
+ // powershell -NoProfile -Command "Start-Process -FilePath 'C:\Program Files\Google\Chrome\Application\chrome.exe'"
90
+ // cmdList.push( "cmd", "/c", "start" );
91
+ // cmdList.push( "powershell", "-NoProfile", "-Command", "\"Start-Process", "-FilePath" );
71
92
  if (query.chromePath) {
72
93
  cmdList.push("".concat(query.chromePath));
73
94
  } else {
@@ -99,14 +120,13 @@ var getOpenQuery = function getOpenQuery(query, isNew, settingConfig) {
99
120
 
100
121
  // 尺寸
101
122
  cmdList.push("--window-size=".concat(window.screen.width, ",").concat(window.screen.height));
102
- cmdList.push("--user-agent='".concat(userAgent(), "'"));
123
+ cmdList.push("--user-data-dir=".concat(chromeProfileDir));
124
+ cmdList.push("--user-agent=".concat(userAgent()));
103
125
 
104
126
  // 不要检查
105
127
  cmdList.push('--no-first-run', '--no-default-browser-check', '--disable-default-apps');
106
- var chromeProfileDir = settingConfig.chromeUserDataDir + '/' + query.chromeProfileName;
107
- cmdList.push("--user-data-dir=".concat(chromeProfileDir));
108
128
  cmdList.push("".concat(openUrl));
109
- console.log('profileName:', chromeProfileDir);
129
+ console.log('profileName:', cmdList, chromeProfileDir);
110
130
  return {
111
131
  commandList: cmdList,
112
132
  chromeProfileDir: chromeProfileDir
@@ -1,2 +1,2 @@
1
- declare const VideoApiOpenChrome: (query: OpenChrome.OnOpenChromeRun) => Promise<boolean>;
1
+ declare const VideoApiOpenChrome: (query: ChromeOperate.OpenChrome) => Promise<boolean>;
2
2
  export default VideoApiOpenChrome;
@@ -0,0 +1,2 @@
1
+ declare const VideoApiQuitChrome: (query: ChromeOperate.QuitChromeQuery) => Promise<boolean>;
2
+ export default VideoApiQuitChrome;
@@ -0,0 +1,51 @@
1
+ import _regeneratorRuntime from "@babel/runtime/helpers/esm/regeneratorRuntime";
2
+ import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
3
+ import * as VideoApiOpenChromeController from "../../service/video-api/VideoApiOpenChromeController";
4
+ import notification from "../notification";
5
+ var VideoApiQuitChrome = /*#__PURE__*/function () {
6
+ var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(query) {
7
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
8
+ while (1) switch (_context2.prev = _context2.next) {
9
+ case 0:
10
+ return _context2.abrupt("return", new Promise( /*#__PURE__*/function () {
11
+ var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(resolve, reject) {
12
+ var openResult;
13
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
14
+ while (1) switch (_context.prev = _context.next) {
15
+ case 0:
16
+ _context.next = 2;
17
+ return VideoApiOpenChromeController.quitChrome(query).catch(function (err) {
18
+ // if( err?.name === "shipinlv-client-not-run" ){
19
+ // return reject( err );
20
+ // }
21
+ console.log('open In Folder err:', err);
22
+ err.message = "\u5173\u95ED \u8C37\u6B4C\u6D4F\u89C8\u5668\u5931\u8D25\uFF1A".concat(err === null || err === void 0 ? void 0 : err.message);
23
+ notification.notificationError('关闭 谷歌浏览器 失败', '请手动关闭');
24
+ reject(err);
25
+ });
26
+ case 2:
27
+ openResult = _context.sent;
28
+ if (openResult) {
29
+ resolve(true);
30
+ }
31
+ case 4:
32
+ case "end":
33
+ return _context.stop();
34
+ }
35
+ }, _callee);
36
+ }));
37
+ return function (_x2, _x3) {
38
+ return _ref2.apply(this, arguments);
39
+ };
40
+ }()));
41
+ case 1:
42
+ case "end":
43
+ return _context2.stop();
44
+ }
45
+ }, _callee2);
46
+ }));
47
+ return function VideoApiQuitChrome(_x) {
48
+ return _ref.apply(this, arguments);
49
+ };
50
+ }();
51
+ export default VideoApiQuitChrome;
@@ -1 +1,2 @@
1
- export declare function openChrome(body: OpenChrome.OnOpenChromeRun, options?: ServicesApi.RequestOptions): Promise<boolean>;
1
+ export declare function openChrome(body: ChromeOperate.OpenChrome, options?: ServicesApi.RequestOptions): Promise<boolean>;
2
+ export declare function quitChrome(body: ChromeOperate.QuitChromeQuery, options?: ServicesApi.RequestOptions): Promise<boolean>;
@@ -24,4 +24,27 @@ function _openChrome() {
24
24
  }, _callee);
25
25
  }));
26
26
  return _openChrome.apply(this, arguments);
27
+ }
28
+ export function quitChrome(_x3, _x4) {
29
+ return _quitChrome.apply(this, arguments);
30
+ }
31
+ function _quitChrome() {
32
+ _quitChrome = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(body, options) {
33
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
34
+ while (1) switch (_context2.prev = _context2.next) {
35
+ case 0:
36
+ return _context2.abrupt("return", request("_video-api/chrome/quit", _objectSpread({
37
+ method: 'POST',
38
+ headers: {
39
+ 'Content-Type': 'application/json'
40
+ },
41
+ data: body
42
+ }, options || {})));
43
+ case 1:
44
+ case "end":
45
+ return _context2.stop();
46
+ }
47
+ }, _callee2);
48
+ }));
49
+ return _quitChrome.apply(this, arguments);
27
50
  }
@@ -1,4 +1,4 @@
1
- declare namespace OpenChrome {
1
+ declare namespace ChromeOperate {
2
2
  interface PropsQuery {
3
3
  action: 'view' | 'publish' | 'add-account';
4
4
  platform: Global.VideoPlatformKind;
@@ -6,11 +6,17 @@ declare namespace OpenChrome {
6
6
  nickname: string;
7
7
  chromePath?: string;
8
8
  chromeProfileName: string;
9
+ taskId: number;
9
10
  url?: string;
10
11
  proxyInfo?: Global.ProxyInfo;
11
12
  isOpen: boolean;
12
13
  }
13
- interface OnOpenChromeRun {
14
+ interface OpenChrome {
14
15
  commandList: string[];
15
16
  }
17
+ interface QuitChromeQuery {
18
+ platform: Global.VideoPlatformKind;
19
+ platformVideoAccountId: string;
20
+ chromeProfileName: string;
21
+ }
16
22
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "component-shipinlv",
3
- "version": "1.3.0",
3
+ "version": "1.3.2",
4
4
  "description": "",
5
5
  "module": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
File without changes