component-shipinlv 1.3.0 → 1.3.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -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,75 @@ 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 sleep from "./sleep";
10
+ import VideoApiQuitChrome from "./video-api/quit-chrome";
11
+ import * as VideoPublishCrawlerTaskController from "../service/api/VideoPublishCrawlerTaskController";
9
12
 
10
13
  // @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;
14
+ var openChrome = /*#__PURE__*/function () {
15
+ var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(query, isNew) {
16
+ var settingConfig, data, cmdResult;
36
17
  return _regeneratorRuntime().wrap(function _callee$(_context) {
37
18
  while (1) switch (_context.prev = _context.next) {
38
19
  case 0:
39
- _context.next = 2;
40
- return VideoApiOpenChrome(query).catch(function (err) {
20
+ settingConfig = AccountManageSettingConfig();
21
+ if (!query.chromePath) {
22
+ query.chromePath = settingConfig.chromePath;
23
+ }
24
+ if (query.chromePath) {
25
+ _context.next = 5;
26
+ break;
27
+ }
28
+ notification.notificationError('没找到 Google 浏览器', '请设置 谷歌浏览器地址,或者重新安装 https://google.cn/chrome/');
29
+ return _context.abrupt("return");
30
+ case 5:
31
+ data = getOpenQuery(query, isNew, settingConfig); //唤起 浏览器;
32
+ // onOpenChromeRun({
33
+ // ...query,
34
+ // ...data,
35
+ // chromeUserDataDir: settingConfig.chromeUserDataDir,
36
+ // chromePath,
37
+ // });
38
+ _context.next = 8;
39
+ return VideoApiOpenChrome({
40
+ commandList: data.commandList
41
+ }).catch(function (err) {
41
42
  // todo 上报
42
43
  console.log('open chrome err:', err);
44
+ VideoPublishCrawlerTaskController.report({
45
+ success: false,
46
+ code: 'open-chrome-fail',
47
+ message: err === null || err === void 0 ? void 0 : err.message,
48
+ taskType: '',
49
+ taskId: query.taskId,
50
+ platform: query.platform,
51
+ platformAccountId: query.platformAccountId
52
+ }, {
53
+ // env,
54
+ });
43
55
  });
44
- case 2:
56
+ case 8:
45
57
  cmdResult = _context.sent;
46
58
  console.log("cmd:", query);
47
- if (cmdResult) {}
48
- case 5:
59
+ if (cmdResult) {
60
+ _context.next = 14;
61
+ break;
62
+ }
63
+ _context.next = 13;
64
+ return sleep(6e3);
65
+ case 13:
66
+ VideoApiQuitChrome({
67
+ platform: query.platform,
68
+ platformVideoAccountId: query.platformAccountId,
69
+ chromeProfileName: query.chromeProfileName
70
+ });
71
+ case 14:
49
72
  case "end":
50
73
  return _context.stop();
51
74
  }
52
75
  }, _callee);
53
76
  }));
54
- return function onOpenChromeRun(_x) {
77
+ return function openChrome(_x, _x2) {
55
78
  return _ref.apply(this, arguments);
56
79
  };
57
80
  }();
@@ -65,9 +88,13 @@ var getOpenQuery = function getOpenQuery(query, isNew, settingConfig) {
65
88
  _nickname: query.nickname || '',
66
89
  _chromeProfileName: query.chromeProfileName || ''
67
90
  });
91
+ var chromeProfileDir = settingConfig.chromeUserDataDir + '/' + query.chromeProfileName;
68
92
  switch (Tool.getOsName()) {
69
93
  case "windows":
70
- cmdList.push("cmd", "/c", "start");
94
+ // 艹,屎一样的 windows cmd
95
+ // powershell -NoProfile -Command "Start-Process -FilePath 'C:\Program Files\Google\Chrome\Application\chrome.exe'"
96
+ // cmdList.push( "cmd", "/c", "start" );
97
+ // cmdList.push( "powershell", "-NoProfile", "-Command", "\"Start-Process", "-FilePath" );
71
98
  if (query.chromePath) {
72
99
  cmdList.push("".concat(query.chromePath));
73
100
  } else {
@@ -99,14 +126,13 @@ var getOpenQuery = function getOpenQuery(query, isNew, settingConfig) {
99
126
 
100
127
  // 尺寸
101
128
  cmdList.push("--window-size=".concat(window.screen.width, ",").concat(window.screen.height));
102
- cmdList.push("--user-agent='".concat(userAgent(), "'"));
129
+ cmdList.push("--user-data-dir=".concat(chromeProfileDir));
130
+ cmdList.push("--user-agent=".concat(userAgent()));
103
131
 
104
132
  // 不要检查
105
133
  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
134
  cmdList.push("".concat(openUrl));
109
- console.log('profileName:', chromeProfileDir);
135
+ console.log('profileName:', cmdList, chromeProfileDir);
110
136
  return {
111
137
  commandList: cmdList,
112
138
  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.1",
4
4
  "description": "",
5
5
  "module": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
File without changes