component-shipinlv 1.1.27 → 1.3.1
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/VideoPublish/account-manage/home.js +25 -4
- package/dist/VideoPublish/account-manage/list.d.ts +1 -0
- package/dist/VideoPublish/account-manage/list.js +69 -24
- package/dist/VideoPublish/account-manage/setting/index.js +43 -4
- package/dist/VideoPublish/log/index.js +90 -44
- package/dist/VideoPublish/log/index.less +1 -1
- package/dist/VideoPublish/publish-task-plan/index.js +14 -2
- package/dist/VideoPublish/publish-task-plan/tool-bak.txt +219 -0
- package/dist/VideoPublish/publish-task-plan/tool.d.ts +14 -4
- package/dist/VideoPublish/publish-task-plan/tool.js +302 -83
- package/dist/VideoPublish/video-account/index.js +5 -2
- package/dist/base/folderCreate.d.ts +2 -0
- package/dist/base/folderCreate.js +56 -0
- package/dist/component/folder-select.d.ts +1 -0
- package/dist/component/folder-select.js +46 -12
- package/dist/component/param.d.ts +5 -0
- package/dist/component/param.js +9 -0
- package/dist/component/sse.d.ts +11 -0
- package/dist/component/sse.js +66 -0
- package/dist/component/video-platform/logo.js +4 -2
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/lib/Tool.d.ts +1 -1
- package/dist/lib/Tool.js +3 -2
- package/dist/lib/event.js +2 -2
- package/dist/lib/getApiUrl.d.ts +1 -0
- package/dist/lib/getApiUrl.js +9 -1
- package/dist/lib/openChrome.d.ts +2 -0
- package/dist/lib/openChrome.js +141 -0
- package/dist/lib/request.js +1 -1
- package/dist/lib/user-agent.d.ts +2 -0
- package/dist/lib/user-agent.js +10 -0
- package/dist/lib/video-api/open-chrome.d.ts +2 -0
- package/dist/lib/video-api/open-chrome.js +49 -0
- package/dist/lib/video-api/quit-chrome.d.ts +2 -0
- package/dist/lib/video-api/quit-chrome.js +51 -0
- package/dist/service/local/FileController.d.ts +3 -0
- package/dist/service/local/FileController.js +59 -32
- package/dist/service/video-api/VideoApiOpenChromeController.d.ts +2 -0
- package/dist/service/video-api/VideoApiOpenChromeController.js +50 -0
- package/dist/types/ApiLocal.d.ts +19 -0
- package/dist/types/ApiLocal.js +0 -0
- package/dist/types/ChromeOperate.d.ts +22 -0
- package/dist/types/ChromeOperate.js +0 -0
- package/dist/types/PublishTaskPlan.d.ts +7 -1
- package/dist/types/PublishVideo.d.ts +11 -0
- package/dist/types/PublishVideo.js +0 -0
- package/dist/types/VideoPublishLog.d.ts +4 -1
- package/dist/typings/LocalFile.d.ts +3 -0
- package/dist/typings/VideoPublishAccountManageSetting.d.ts +1 -0
- package/dist/typings/VideoPublishVideoAccount.d.ts +3 -0
- package/dist/window.d.ts +1 -0
- package/package.json +1 -1
@@ -7,6 +7,7 @@ import "./folder-select.less";
|
|
7
7
|
import { Button, Input, Space } from "antd";
|
8
8
|
import { FolderOpenOutlined, FolderOutlined } from "@ant-design/icons";
|
9
9
|
import { folderSelect, folderOpen } from "./..";
|
10
|
+
import folderCreate from "../base/folderCreate";
|
10
11
|
import { jsx as _jsx } from "react/jsx-runtime";
|
11
12
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
12
13
|
var FolderSelect = function FolderSelect(_ref) {
|
@@ -19,6 +20,7 @@ var FolderSelect = function FolderSelect(_ref) {
|
|
19
20
|
_ref$label = _ref.label,
|
20
21
|
label = _ref$label === void 0 ? '' : _ref$label,
|
21
22
|
disabled = _ref.disabled,
|
23
|
+
autoCreateDirName = _ref.autoCreateDirName,
|
22
24
|
_ref$placeholder = _ref.placeholder,
|
23
25
|
placeholder = _ref$placeholder === void 0 ? '请选择文件夹' : _ref$placeholder,
|
24
26
|
_ref$hiddenOpenDir = _ref.hiddenOpenDir,
|
@@ -42,8 +44,8 @@ var FolderSelect = function FolderSelect(_ref) {
|
|
42
44
|
setLoadingOpenDir = _useState6[1];
|
43
45
|
var onSelectDir = /*#__PURE__*/function () {
|
44
46
|
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
45
|
-
var _fileResul$filePaths;
|
46
|
-
var beforeSelectResult, fileResul, filePaths, selectFolderPath;
|
47
|
+
var _fileResul$filePaths, _autoCreateDirName;
|
48
|
+
var beforeSelectResult, fileResul, filePaths, selectFolderPath, isEndNameIndex, targetDir, createResul;
|
47
49
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
48
50
|
while (1) switch (_context.prev = _context.next) {
|
49
51
|
case 0:
|
@@ -69,30 +71,62 @@ var FolderSelect = function FolderSelect(_ref) {
|
|
69
71
|
});
|
70
72
|
case 10:
|
71
73
|
fileResul = _context.sent;
|
72
|
-
setTimeout(function () {
|
73
|
-
setLoadingSelectDir(false);
|
74
|
-
}, 1e3);
|
75
74
|
if (fileResul) {
|
76
75
|
_context.next = 14;
|
77
76
|
break;
|
78
77
|
}
|
78
|
+
setTimeout(function () {
|
79
|
+
setLoadingSelectDir(false);
|
80
|
+
}, 1e3);
|
79
81
|
return _context.abrupt("return");
|
80
82
|
case 14:
|
81
83
|
filePaths = (fileResul === null || fileResul === void 0 ? void 0 : fileResul.filePaths) || [];
|
82
84
|
if (!(filePaths.length <= 0)) {
|
83
|
-
_context.next =
|
85
|
+
_context.next = 18;
|
84
86
|
break;
|
85
87
|
}
|
88
|
+
setTimeout(function () {
|
89
|
+
setLoadingSelectDir(false);
|
90
|
+
}, 1e3);
|
86
91
|
return _context.abrupt("return");
|
87
|
-
case
|
92
|
+
case 18:
|
88
93
|
selectFolderPath = (fileResul === null || fileResul === void 0 || (_fileResul$filePaths = fileResul.filePaths) === null || _fileResul$filePaths === void 0 ? void 0 : _fileResul$filePaths[0]) || '';
|
89
94
|
console.log("selectFolderPath 2:", selectFolderPath);
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
95
|
+
autoCreateDirName = ((_autoCreateDirName = autoCreateDirName) === null || _autoCreateDirName === void 0 ? void 0 : _autoCreateDirName.replace(/^\//, '')) || '';
|
96
|
+
if (!selectFolderPath) {
|
97
|
+
_context.next = 33;
|
98
|
+
break;
|
94
99
|
}
|
95
|
-
|
100
|
+
if (!autoCreateDirName) {
|
101
|
+
_context.next = 30;
|
102
|
+
break;
|
103
|
+
}
|
104
|
+
isEndNameIndex = selectFolderPath.length - autoCreateDirName.length; // 如果 要加的名字,等于 路径后面的;就不加了
|
105
|
+
if (!(selectFolderPath.lastIndexOf(autoCreateDirName) !== isEndNameIndex)) {
|
106
|
+
_context.next = 30;
|
107
|
+
break;
|
108
|
+
}
|
109
|
+
targetDir = selectFolderPath + '/' + autoCreateDirName;
|
110
|
+
_context.next = 28;
|
111
|
+
return folderCreate(targetDir).catch(function (err) {
|
112
|
+
console.log('auto Create DirName err :', err);
|
113
|
+
});
|
114
|
+
case 28:
|
115
|
+
createResul = _context.sent;
|
116
|
+
if (createResul) {
|
117
|
+
selectFolderPath = targetDir;
|
118
|
+
} else {
|
119
|
+
// 接受这个错误,忽略
|
120
|
+
}
|
121
|
+
case 30:
|
122
|
+
Tool.toast('已选择文件夹');
|
123
|
+
onFinish(selectFolderPath);
|
124
|
+
onDir(selectFolderPath);
|
125
|
+
case 33:
|
126
|
+
setTimeout(function () {
|
127
|
+
setLoadingSelectDir(false);
|
128
|
+
}, 1e3);
|
129
|
+
case 34:
|
96
130
|
case "end":
|
97
131
|
return _context.stop();
|
98
132
|
}
|
@@ -0,0 +1,9 @@
|
|
1
|
+
var param = function param() {
|
2
|
+
var query = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
3
|
+
var queryString = [];
|
4
|
+
for (var i in query) {
|
5
|
+
queryString.push("".concat(i, "=").concat(encodeURIComponent(query[i] || '')));
|
6
|
+
}
|
7
|
+
return queryString.join('&');
|
8
|
+
};
|
9
|
+
export default param;
|
@@ -0,0 +1,11 @@
|
|
1
|
+
declare class SSE {
|
2
|
+
apiUrl: string;
|
3
|
+
source: EventSource | null;
|
4
|
+
onMessage: (lastEventId: string, data: string) => void;
|
5
|
+
onOpen: () => void;
|
6
|
+
onClose: () => void;
|
7
|
+
onError: (err: Error) => void;
|
8
|
+
constructor(apiUrl: string, onMessage: (lastEventId: string, data: string) => void, onOpen: () => void, onClose: () => void, onError: (err: Error) => void);
|
9
|
+
onInit(): void;
|
10
|
+
}
|
11
|
+
export default SSE;
|
@@ -0,0 +1,66 @@
|
|
1
|
+
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
|
2
|
+
import _createClass from "@babel/runtime/helpers/esm/createClass";
|
3
|
+
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
4
|
+
var SSE = /*#__PURE__*/function () {
|
5
|
+
function SSE(apiUrl, onMessage, onOpen, onClose, onError) {
|
6
|
+
_classCallCheck(this, SSE);
|
7
|
+
_defineProperty(this, "apiUrl", '');
|
8
|
+
_defineProperty(this, "source", null);
|
9
|
+
_defineProperty(this, "onMessage", function (lastEventId, data) {});
|
10
|
+
_defineProperty(this, "onOpen", function () {});
|
11
|
+
_defineProperty(this, "onClose", function () {});
|
12
|
+
_defineProperty(this, "onError", function (err) {});
|
13
|
+
this.apiUrl = apiUrl;
|
14
|
+
this.onMessage = onMessage;
|
15
|
+
this.onOpen = onOpen;
|
16
|
+
this.onClose = onClose;
|
17
|
+
this.onError = onError;
|
18
|
+
}
|
19
|
+
_createClass(SSE, [{
|
20
|
+
key: "onInit",
|
21
|
+
value: function onInit() {
|
22
|
+
var _this = this;
|
23
|
+
// 创建一个新的EventSource
|
24
|
+
this.source = new EventSource(this.apiUrl);
|
25
|
+
|
26
|
+
// this.source.onmessage = ( event ) => {
|
27
|
+
// console.log('接收到消息:', event );
|
28
|
+
//
|
29
|
+
// }
|
30
|
+
|
31
|
+
// 监听message事件(默认事件名称为message)
|
32
|
+
this.source.addEventListener('message', function (event) {
|
33
|
+
// event.data包含服务器发送的信息
|
34
|
+
// console.log('接收到消息:', event );
|
35
|
+
_this.onMessage(event.lastEventId, event.data);
|
36
|
+
}, false);
|
37
|
+
|
38
|
+
// 监听open事件,当连接建立时触发
|
39
|
+
this.source.addEventListener('open', function (event) {
|
40
|
+
// event.data包含服务器发送的信息
|
41
|
+
console.log(' 消息 open :', event);
|
42
|
+
_this.onOpen();
|
43
|
+
}, false);
|
44
|
+
this.source.addEventListener('error', function (event) {
|
45
|
+
var _event$target, _this$source;
|
46
|
+
// event.data包含服务器发送的信息
|
47
|
+
// @ts-ignore
|
48
|
+
var readyState = (_event$target = event.target) === null || _event$target === void 0 ? void 0 : _event$target.readyState;
|
49
|
+
if (readyState === EventSource.CLOSED) {
|
50
|
+
console.log('连接已关闭');
|
51
|
+
_this.onClose();
|
52
|
+
}
|
53
|
+
if (readyState === EventSource.CONNECTING) {
|
54
|
+
console.log('连接已关闭: EventSource.CONNECTING');
|
55
|
+
// this.onError( new Error('连接时失败'));
|
56
|
+
} else {
|
57
|
+
console.error('发生错误或连接关闭', readyState);
|
58
|
+
_this.onError(new Error('发生错误或连接关闭'));
|
59
|
+
}
|
60
|
+
(_this$source = _this.source) === null || _this$source === void 0 || _this$source.close();
|
61
|
+
}, false);
|
62
|
+
}
|
63
|
+
}]);
|
64
|
+
return SSE;
|
65
|
+
}();
|
66
|
+
export default SSE;
|
@@ -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";
|
package/dist/lib/Tool.d.ts
CHANGED
@@ -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: "
|
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
@@ -122,7 +122,7 @@ var Tool = _objectSpread(_objectSpread({
|
|
122
122
|
}
|
123
123
|
window.__events.forEach(function (item) {
|
124
124
|
// 命中 子集事件
|
125
|
-
if (item.name === name || "".concat(item.name, ".").indexOf(name) === 0) {
|
125
|
+
if (item.name === name || "".concat(item.name, ".").indexOf(name + '.') === 0) {
|
126
126
|
item.fn(data);
|
127
127
|
}
|
128
128
|
});
|
@@ -155,7 +155,7 @@ var Tool = _objectSpread(_objectSpread({
|
|
155
155
|
window.__events.forEach(function (item, index) {
|
156
156
|
var isDel;
|
157
157
|
// 匹配到子集事件
|
158
|
-
if ("".concat(item.name, ".").indexOf(name) > -1) {
|
158
|
+
if ("".concat(item.name, ".").indexOf(name + '.') > -1) {
|
159
159
|
isDel = true;
|
160
160
|
} else if (name === item.name) {
|
161
161
|
// 一级,子集的子集
|
@@ -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
|
package/dist/lib/event.js
CHANGED
@@ -9,7 +9,7 @@ var event = {
|
|
9
9
|
}
|
10
10
|
window.__events.forEach(function (item) {
|
11
11
|
// 命中 子集事件
|
12
|
-
if (item.name === name || "".concat(item.name, ".").indexOf(name) === 0) {
|
12
|
+
if (item.name === name || "".concat(item.name, ".").indexOf(name + '.') === 0) {
|
13
13
|
item.fn(data);
|
14
14
|
}
|
15
15
|
});
|
@@ -42,7 +42,7 @@ var event = {
|
|
42
42
|
window.__events.forEach(function (item, index) {
|
43
43
|
var isDel;
|
44
44
|
// 匹配到子集事件
|
45
|
-
if ("".concat(item.name, ".").indexOf(name) > -1) {
|
45
|
+
if ("".concat(item.name, ".").indexOf(name + '.') > -1) {
|
46
46
|
isDel = true;
|
47
47
|
} else if (name === item.name) {
|
48
48
|
// 一级,子集的子集
|
package/dist/lib/getApiUrl.d.ts
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
export declare const getMainPort: () => number;
|
2
|
+
export declare const getLocalServerPort: () => number;
|
2
3
|
declare const getApiUrl: (apiName?: string, apiEnv?: Global.Env | '') => string;
|
3
4
|
export declare const getApiEnv: (apiEnv?: Global.Env | '') => Global.Env;
|
4
5
|
export declare const getEnv: (env?: Global.Env | '') => Global.Env;
|
package/dist/lib/getApiUrl.js
CHANGED
@@ -10,6 +10,9 @@ var envData = function envData() {
|
|
10
10
|
export var getMainPort = function getMainPort() {
|
11
11
|
return window.__ShipinlvMainPort || 61800;
|
12
12
|
};
|
13
|
+
export var getLocalServerPort = function getLocalServerPort() {
|
14
|
+
return window.__ShipinlvLocalServerPort || 61806;
|
15
|
+
};
|
13
16
|
var getApiUrl = function getApiUrl() {
|
14
17
|
var _domain;
|
15
18
|
var apiName = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
|
@@ -19,11 +22,16 @@ var getApiUrl = function getApiUrl() {
|
|
19
22
|
return apiName;
|
20
23
|
}
|
21
24
|
var mainPort = getMainPort();
|
25
|
+
var localServerPort = getLocalServerPort();
|
22
26
|
|
23
27
|
// 主客户端
|
24
|
-
if (
|
28
|
+
if (/^_main\//i.test(apiName)) {
|
25
29
|
return "http://127.0.0.1:".concat(mainPort, "/").concat(apiName.replace(/^_main\//i, ''));
|
26
30
|
}
|
31
|
+
if (/^_video-api\//i.test(apiName)) {
|
32
|
+
apiName = apiName.toLocaleLowerCase();
|
33
|
+
return "http://127.0.0.1:".concat(localServerPort, "/").concat(apiName.replace(/^_video-api\//i, ''));
|
34
|
+
}
|
27
35
|
|
28
36
|
// 替换第一个 /
|
29
37
|
apiName = apiName.replace(/^\//, '');
|
@@ -0,0 +1,141 @@
|
|
1
|
+
import _regeneratorRuntime from "@babel/runtime/helpers/esm/regeneratorRuntime";
|
2
|
+
import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
|
3
|
+
import AccountManageSettingConfig from "./accountManageSettingConfig";
|
4
|
+
import param from "../component/param";
|
5
|
+
import Tool from "./Tool";
|
6
|
+
import notification from "./notification";
|
7
|
+
import userAgent from "./user-agent";
|
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";
|
12
|
+
|
13
|
+
// @isNew: 只有 新建账户,才要 isNew
|
14
|
+
var openChrome = /*#__PURE__*/function () {
|
15
|
+
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(query, isNew) {
|
16
|
+
var settingConfig, data, cmdResult;
|
17
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
18
|
+
while (1) switch (_context.prev = _context.next) {
|
19
|
+
case 0:
|
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) {
|
42
|
+
// todo 上报
|
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
|
+
});
|
55
|
+
});
|
56
|
+
case 8:
|
57
|
+
cmdResult = _context.sent;
|
58
|
+
console.log("cmd:", query);
|
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:
|
72
|
+
case "end":
|
73
|
+
return _context.stop();
|
74
|
+
}
|
75
|
+
}, _callee);
|
76
|
+
}));
|
77
|
+
return function openChrome(_x, _x2) {
|
78
|
+
return _ref.apply(this, arguments);
|
79
|
+
};
|
80
|
+
}();
|
81
|
+
var getOpenQuery = function getOpenQuery(query, isNew, settingConfig) {
|
82
|
+
var cmdList = [];
|
83
|
+
var url = query.url;
|
84
|
+
var openUrl = url + ((url === null || url === void 0 ? void 0 : url.indexOf('?')) === -1 ? '?' : '&') + param({
|
85
|
+
_shipinlvFrom: 'auto',
|
86
|
+
_action: query.action || '',
|
87
|
+
_platformAccountId: query.platformAccountId,
|
88
|
+
_nickname: query.nickname || '',
|
89
|
+
_chromeProfileName: query.chromeProfileName || ''
|
90
|
+
});
|
91
|
+
var chromeProfileDir = settingConfig.chromeUserDataDir + '/' + query.chromeProfileName;
|
92
|
+
switch (Tool.getOsName()) {
|
93
|
+
case "windows":
|
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" );
|
98
|
+
if (query.chromePath) {
|
99
|
+
cmdList.push("".concat(query.chromePath));
|
100
|
+
} else {
|
101
|
+
cmdList.push("chrome");
|
102
|
+
}
|
103
|
+
if (!query.isOpen) {
|
104
|
+
cmdList.push("--headless=old");
|
105
|
+
|
106
|
+
// --disable-gpu是为了解决一些在无头模式下可能出现的GPU相关的问题
|
107
|
+
cmdList.push("--disable-gpu");
|
108
|
+
}
|
109
|
+
break;
|
110
|
+
case "darwin":
|
111
|
+
cmdList = ["open"];
|
112
|
+
if (isNew) {
|
113
|
+
cmdList.push("-n");
|
114
|
+
}
|
115
|
+
cmdList.push("-a", "".concat(query.chromePath || 'Google Chrome'), "--args");
|
116
|
+
if (!query.isOpen) {
|
117
|
+
cmdList.push("--headless");
|
118
|
+
|
119
|
+
// --disable-gpu是为了解决一些在无头模式下可能出现的GPU相关的问题
|
120
|
+
cmdList.push("--disable-gpu");
|
121
|
+
}
|
122
|
+
break;
|
123
|
+
default:
|
124
|
+
notification.notificationError('不支持的系统', '发布不支持此系统');
|
125
|
+
}
|
126
|
+
|
127
|
+
// 尺寸
|
128
|
+
cmdList.push("--window-size=".concat(window.screen.width, ",").concat(window.screen.height));
|
129
|
+
cmdList.push("--user-data-dir=".concat(chromeProfileDir));
|
130
|
+
cmdList.push("--user-agent=".concat(userAgent()));
|
131
|
+
|
132
|
+
// 不要检查
|
133
|
+
cmdList.push('--no-first-run', '--no-default-browser-check', '--disable-default-apps');
|
134
|
+
cmdList.push("".concat(openUrl));
|
135
|
+
console.log('profileName:', cmdList, chromeProfileDir);
|
136
|
+
return {
|
137
|
+
commandList: cmdList,
|
138
|
+
chromeProfileDir: chromeProfileDir
|
139
|
+
};
|
140
|
+
};
|
141
|
+
export default openChrome;
|
package/dist/lib/request.js
CHANGED
@@ -39,7 +39,7 @@ var requestApi = /*#__PURE__*/function () {
|
|
39
39
|
});
|
40
40
|
case 9:
|
41
41
|
clientIdentity = _context.sent;
|
42
|
-
postUrl += "&clientIdentity=".concat(clientIdentity);
|
42
|
+
postUrl += "&clientIdentity=".concat(clientIdentity || '');
|
43
43
|
|
44
44
|
// 追加环境参数
|
45
45
|
env = getApiEnv(options === null || options === void 0 ? void 0 : options.env);
|
@@ -0,0 +1,10 @@
|
|
1
|
+
import Tool from "./Tool";
|
2
|
+
var chromeVersion = '120.0.6099.56';
|
3
|
+
var darwin = "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/".concat(chromeVersion);
|
4
|
+
var windows = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/".concat(chromeVersion, " Edg/").concat(chromeVersion);
|
5
|
+
var userAgentMore = " Safari/537.36";
|
6
|
+
var userAgent = function userAgent() {
|
7
|
+
var ua = Tool.getOsName() === 'windows' ? windows : darwin;
|
8
|
+
return ua + userAgentMore;
|
9
|
+
};
|
10
|
+
export default userAgent;
|
@@ -0,0 +1,49 @@
|
|
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
|
+
var VideoApiOpenChrome = /*#__PURE__*/function () {
|
5
|
+
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(query) {
|
6
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
7
|
+
while (1) switch (_context2.prev = _context2.next) {
|
8
|
+
case 0:
|
9
|
+
return _context2.abrupt("return", new Promise( /*#__PURE__*/function () {
|
10
|
+
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(resolve, reject) {
|
11
|
+
var openResult;
|
12
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
13
|
+
while (1) switch (_context.prev = _context.next) {
|
14
|
+
case 0:
|
15
|
+
_context.next = 2;
|
16
|
+
return VideoApiOpenChromeController.openChrome(query).catch(function (err) {
|
17
|
+
// if( err?.name === "shipinlv-client-not-run" ){
|
18
|
+
// return reject( err );
|
19
|
+
// }
|
20
|
+
console.log('open In Folder err:', err);
|
21
|
+
err.message = "\u6253\u5F00 \u8C37\u6B4C\u6D4F\u89C8\u5668\u5931\u8D25\uFF1A".concat(err === null || err === void 0 ? void 0 : err.message);
|
22
|
+
reject(err);
|
23
|
+
});
|
24
|
+
case 2:
|
25
|
+
openResult = _context.sent;
|
26
|
+
if (openResult) {
|
27
|
+
resolve(true);
|
28
|
+
}
|
29
|
+
case 4:
|
30
|
+
case "end":
|
31
|
+
return _context.stop();
|
32
|
+
}
|
33
|
+
}, _callee);
|
34
|
+
}));
|
35
|
+
return function (_x2, _x3) {
|
36
|
+
return _ref2.apply(this, arguments);
|
37
|
+
};
|
38
|
+
}()));
|
39
|
+
case 1:
|
40
|
+
case "end":
|
41
|
+
return _context2.stop();
|
42
|
+
}
|
43
|
+
}, _callee2);
|
44
|
+
}));
|
45
|
+
return function VideoApiOpenChrome(_x) {
|
46
|
+
return _ref.apply(this, arguments);
|
47
|
+
};
|
48
|
+
}();
|
49
|
+
export default VideoApiOpenChrome;
|
@@ -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;
|
@@ -10,6 +10,9 @@ export declare function fileSelect(body: {
|
|
10
10
|
export declare function folderSelect(body: {
|
11
11
|
defaultPath: string;
|
12
12
|
}, optionsQuery?: ServicesApi.RequestOptions): Promise<LocalFile.FileSelect>;
|
13
|
+
export declare function folderCreate(body: {
|
14
|
+
folderPath: string;
|
15
|
+
}, optionsQuery?: ServicesApi.RequestOptions): Promise<LocalFile.FileCreate>;
|
13
16
|
export declare function openInFolder(body: {
|
14
17
|
filePath: string;
|
15
18
|
}, optionsQuery?: ServicesApi.RequestOptions): Promise<LocalFile.FileSelect>;
|