@plasosdk/plaso-electron-sdk 1.0.6 → 1.0.32
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/index.html +229 -0
- package/js/code.js +49 -2
- package/js/common.js +32 -21
- package/js/main.js +8 -8
- package/js/render.js +316 -131
- package/lib/PlasoALD/PlasoALD.driver/Contents/Info.plist +60 -0
- package/lib/PlasoALD/PlasoALD.driver/Contents/MacOS/PlasoALD +0 -0
- package/lib/PlasoALD/PlasoALD.driver/Contents/Resources/en.lproj/Localizable.strings +0 -0
- package/lib/PlasoALD/PlasoALD.driver/Contents/_CodeSignature/CodeResources +139 -0
- package/lib/PlasoALD/PlasoALD.scpt +1 -0
- package/lib/image//345/244/207/350/257/2761.png +0 -0
- package/package.json +6 -9
- package/readme.md +623 -21
- package/scripts/downloadPrebuild.js +60 -27
- package/scripts/logger.js +2 -2
package/index.html
ADDED
|
@@ -0,0 +1,229 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
|
|
4
|
+
<head>
|
|
5
|
+
<meta charset="UTF-8">
|
|
6
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
7
|
+
|
|
8
|
+
<style>
|
|
9
|
+
* {
|
|
10
|
+
font-family: "Microsoft YaHei", sans-serif;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
body {
|
|
14
|
+
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
#btn_reload {
|
|
18
|
+
width: 120px;
|
|
19
|
+
height: 40px;
|
|
20
|
+
background: #02c8f2;
|
|
21
|
+
border-radius: 4px;
|
|
22
|
+
border: none;
|
|
23
|
+
margin: 10px auto;
|
|
24
|
+
font-size: 20px;
|
|
25
|
+
display: block;
|
|
26
|
+
color: #fff;
|
|
27
|
+
cursor: pointer;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.contain {
|
|
31
|
+
position: absolute;
|
|
32
|
+
width: 80px;
|
|
33
|
+
height: 80px;
|
|
34
|
+
left: 50%;
|
|
35
|
+
top: 50%;
|
|
36
|
+
transform: translate(-50%, -50%);
|
|
37
|
+
font-size: 20px;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.animate {
|
|
41
|
+
position: absolute;
|
|
42
|
+
width: 100%;
|
|
43
|
+
height: 100%;
|
|
44
|
+
left: 0;
|
|
45
|
+
top: -25%;
|
|
46
|
+
border-radius: 10%;
|
|
47
|
+
z-index: 1;
|
|
48
|
+
transform: translateZ(0);
|
|
49
|
+
background: #8EEFC7;
|
|
50
|
+
animation: animate .6s -.1s linear infinite;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.shadow {
|
|
54
|
+
position: absolute;
|
|
55
|
+
left: 0;
|
|
56
|
+
width: 100%;
|
|
57
|
+
bottom: -9%;
|
|
58
|
+
height: 10%;
|
|
59
|
+
background: #DFE6EC;
|
|
60
|
+
border-radius: 50%;
|
|
61
|
+
-webkit-animation: shadow .6s -.1s linear infinite;
|
|
62
|
+
-moz-animation: shadow .6s -.1s linear infinite;
|
|
63
|
+
-o-animation: shadow .6s -.1s linear infinite;
|
|
64
|
+
animation: shadow .6s -.1s linear infinite;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
@keyframes animate {
|
|
68
|
+
17% {
|
|
69
|
+
border-bottom-right-radius: 10%;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
25% {
|
|
73
|
+
transform: translateY(25%) rotate(22.5deg);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
50% {
|
|
77
|
+
border-bottom-right-radius: 100%;
|
|
78
|
+
transform: translateY(50%) scale(1, .9) rotate(45deg);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
75% {
|
|
82
|
+
transform: translateY(25%) rotate(67.5deg);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
100% {
|
|
86
|
+
transform: translateY(0) rotate(90deg);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
@keyframes shadow {
|
|
91
|
+
50% {
|
|
92
|
+
transform: scale(1.25, 1);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
</style>
|
|
96
|
+
|
|
97
|
+
<title></title>
|
|
98
|
+
</head>
|
|
99
|
+
|
|
100
|
+
<body>
|
|
101
|
+
<div id="react_body">
|
|
102
|
+
<div class="contain" id="loading" style="display:none">
|
|
103
|
+
<div class="animate"></div>
|
|
104
|
+
<div class="shadow"></div>
|
|
105
|
+
</div>
|
|
106
|
+
</div>
|
|
107
|
+
</body>
|
|
108
|
+
|
|
109
|
+
<script type="text/javascript">
|
|
110
|
+
//配置文件,主要是 thrift 接口地址和一些标识字符串
|
|
111
|
+
var globalAppInfo = {};
|
|
112
|
+
|
|
113
|
+
function getElectronRemote() {
|
|
114
|
+
let _remote;
|
|
115
|
+
try {
|
|
116
|
+
_remote = window.require('electron').remote;
|
|
117
|
+
if (!_remote) {
|
|
118
|
+
_remote = window.require('@electron/remote');
|
|
119
|
+
}
|
|
120
|
+
} catch (e) {
|
|
121
|
+
console.error(e);
|
|
122
|
+
throw new Error('illegal call, non electron environment');
|
|
123
|
+
}
|
|
124
|
+
return _remote;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
const include = function (url) {
|
|
128
|
+
url = globalAppInfo.rhost + url;
|
|
129
|
+
let ele;
|
|
130
|
+
if (/\.css$/.test(url)) {
|
|
131
|
+
ele = document.createElement('link');
|
|
132
|
+
ele.rel = "stylesheet";
|
|
133
|
+
ele.type = "text/css";
|
|
134
|
+
ele.href = url;
|
|
135
|
+
} else {
|
|
136
|
+
ele = document.createElement('script');
|
|
137
|
+
ele.src = url;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
document.head.appendChild(ele);
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
|
|
144
|
+
function init(classObj) {
|
|
145
|
+
let query;
|
|
146
|
+
if (classObj) {
|
|
147
|
+
globalAppInfo = Object.assign({}, classObj)
|
|
148
|
+
}
|
|
149
|
+
globalAppInfo.needFullScreen = false;
|
|
150
|
+
|
|
151
|
+
if (globalAppInfo.rhost && globalAppInfo.rhost.substring(globalAppInfo.rhost.length - 1) != '/') {
|
|
152
|
+
globalAppInfo.rhost += "/";
|
|
153
|
+
}
|
|
154
|
+
if (globalAppInfo.dhost && globalAppInfo.dhost.substring(globalAppInfo.dhost.length - 1) != '/') {
|
|
155
|
+
globalAppInfo.dhost += "/";
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
path = globalAppInfo.initjs || "js/all.js";
|
|
159
|
+
include(path);
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
if (typeof require == "function") {
|
|
163
|
+
const { ipcRenderer } = window.require('electron');
|
|
164
|
+
const { CLASS_WINDOW_MESG_TYPE } = require('./js/code');
|
|
165
|
+
|
|
166
|
+
const queryString = location.href.split('?')[1];
|
|
167
|
+
queryString.split('&').forEach((pair) => {
|
|
168
|
+
const [key, value] = pair.split('=');
|
|
169
|
+
if (key === 'openerId') openerId = Number(value);
|
|
170
|
+
});
|
|
171
|
+
|
|
172
|
+
ipcRenderer.on(CLASS_WINDOW_MESG_TYPE.INIT_CLASS_OPTIONS, (_, classObj) => {
|
|
173
|
+
if (classObj) init(classObj);
|
|
174
|
+
});
|
|
175
|
+
|
|
176
|
+
if(openerId){
|
|
177
|
+
const remote = getElectronRemote();
|
|
178
|
+
const webContents = remote.getCurrentWebContents();
|
|
179
|
+
ipcRenderer.sendTo(openerId, CLASS_WINDOW_MESG_TYPE.CLASS_READY, {webContentId: webContents.id});
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
/*
|
|
185
|
+
* 加载超时函数,立即执行
|
|
186
|
+
* param: timeLength :超时时间
|
|
187
|
+
*/
|
|
188
|
+
(function timeOut(timeLength) {
|
|
189
|
+
const timer = setTimeout(
|
|
190
|
+
function () {
|
|
191
|
+
var loading = document.getElementById('loading');
|
|
192
|
+
if (loading) {
|
|
193
|
+
loading.style.width = "100%";
|
|
194
|
+
loading.style.textAlign = "center";
|
|
195
|
+
eval("loading.innerHTML = '加载超时!请点击重新加载<button id=\"btn_reload\" onclick=\"reload()\">重新加载</button>'");
|
|
196
|
+
if (typeof require == "function" && globalAppInfo.clientType === 'nw') {
|
|
197
|
+
var gui = require('nw.gui');
|
|
198
|
+
var win = gui.Window.get();
|
|
199
|
+
win.removeAllListeners();
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
},
|
|
203
|
+
timeLength * 1000
|
|
204
|
+
)
|
|
205
|
+
})(30);
|
|
206
|
+
|
|
207
|
+
function reload() {
|
|
208
|
+
if (typeof require == "function" && globalAppInfo.clientType === 'electron') {
|
|
209
|
+
var remote = getElectronRemote();
|
|
210
|
+
var curWindow = remote.getCurrentWindow();
|
|
211
|
+
curWindow.webContents.reloadIgnoringCache()
|
|
212
|
+
} else {
|
|
213
|
+
location.reload();
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
</script>
|
|
217
|
+
|
|
218
|
+
<script type="text/javascript">
|
|
219
|
+
if (globalAppInfo.background) {
|
|
220
|
+
document.body.style.background = globalAppInfo.background;
|
|
221
|
+
document.documentElement.style.background = globalAppInfo.background;
|
|
222
|
+
}
|
|
223
|
+
if (!globalAppInfo.noLoading) {
|
|
224
|
+
var loadingDom = document.getElementById("loading");
|
|
225
|
+
if (loadingDom) loadingDom.style.display = "";
|
|
226
|
+
}
|
|
227
|
+
</script>
|
|
228
|
+
|
|
229
|
+
</html>
|
package/js/code.js
CHANGED
|
@@ -1,6 +1,13 @@
|
|
|
1
1
|
const ERROR_CODE = {
|
|
2
2
|
/** 非 electron 环境 */
|
|
3
3
|
NO_ELECTRON_ENVIRONMENT: -1,
|
|
4
|
+
/** 获取remote 失败 */
|
|
5
|
+
GET_REMOTE_FAIL: -2,
|
|
6
|
+
/** 获取 屏幕信息 失败 */
|
|
7
|
+
GET_DISPLAY_INFO_FAIL: -3,
|
|
8
|
+
/** 课堂窗口同时仅能存在一个 */
|
|
9
|
+
CLASS_WINODW_GREATER_THAN_ONE: -4,
|
|
10
|
+
/** 未知的异常错误 */
|
|
4
11
|
COMMOM_ERROR: -99,
|
|
5
12
|
};
|
|
6
13
|
|
|
@@ -15,8 +22,26 @@ const LESSON_TYPE = {
|
|
|
15
22
|
const CLASS_WINDOW_MESG_TYPE = {
|
|
16
23
|
/** 课堂dom渲染成功后告知外部应用窗口,传参用户信息 */
|
|
17
24
|
LIVE_WINDOW_READY: 'liveWindowReady',
|
|
18
|
-
/**
|
|
25
|
+
/** 课堂结束 */
|
|
19
26
|
ON_CLASS_FINISHED: 'onClassFinished',
|
|
27
|
+
/** 初始化进课堂参数 */
|
|
28
|
+
INIT_CLASS_OPTIONS: 'init_class_options',
|
|
29
|
+
/** 课堂窗口 html ready */
|
|
30
|
+
CLASS_READY: 'class_ready',
|
|
31
|
+
/** 保存白板文件 */
|
|
32
|
+
SAVE_BOARD: 'save_board',
|
|
33
|
+
/** 响应保存白板文件 */
|
|
34
|
+
RESP_SAVE_BOARD: 'resp_save_board',
|
|
35
|
+
/** 插入白板文件 */
|
|
36
|
+
INSERT_BOARD: 'insert_board',
|
|
37
|
+
/** 打开资料中心 */
|
|
38
|
+
OPEN_RESOURCE_CENTER: 'open_resource_center',
|
|
39
|
+
/** 插入文件 */
|
|
40
|
+
INSERT_OBJECT: 'insertObject',
|
|
41
|
+
/** 通知外部调用getExtFileName */
|
|
42
|
+
GET_EXT_FILE_NAME: 'getExtFileName',
|
|
43
|
+
/** 响应getExtFileName */
|
|
44
|
+
RESP_GET_EXT_FILE_NAME: 'respGetExtFileName',
|
|
20
45
|
};
|
|
21
46
|
|
|
22
47
|
const LEVEL = {
|
|
@@ -26,9 +51,31 @@ const LEVEL = {
|
|
|
26
51
|
debug: 0,
|
|
27
52
|
};
|
|
28
53
|
|
|
54
|
+
/** 渲染进程——》主进程通讯的消息 */
|
|
55
|
+
const RENDER_TO_MAIN_MESG_TYPE = {
|
|
56
|
+
/** 初始化dump生成位置 */
|
|
57
|
+
PLASO_INIT_LOG_PATH: 'plaso-init-log-path',
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
/** 插入的文件类型 */
|
|
61
|
+
const FILE_TYPE = {
|
|
62
|
+
IMAGE: 2,
|
|
63
|
+
PDF: 3,
|
|
64
|
+
WORD: 4,
|
|
65
|
+
EXCEL: 5,
|
|
66
|
+
AUDIO: 6,
|
|
67
|
+
VIDEO: 7,
|
|
68
|
+
DOC: 14,
|
|
69
|
+
XLS: 15,
|
|
70
|
+
NPPT: 17,
|
|
71
|
+
PREPARE_LESSONS: 22,
|
|
72
|
+
};
|
|
73
|
+
|
|
29
74
|
module.exports = {
|
|
30
75
|
LESSON_TYPE,
|
|
31
76
|
ERROR_CODE,
|
|
32
77
|
CLASS_WINDOW_MESG_TYPE,
|
|
33
|
-
LEVEL
|
|
78
|
+
LEVEL,
|
|
79
|
+
RENDER_TO_MAIN_MESG_TYPE,
|
|
80
|
+
FILE_TYPE,
|
|
34
81
|
};
|
package/js/common.js
CHANGED
|
@@ -17,20 +17,19 @@ function getElectronRemote() {
|
|
|
17
17
|
let _remote;
|
|
18
18
|
try {
|
|
19
19
|
_remote = window.require('electron').remote;
|
|
20
|
-
|
|
21
|
-
try {
|
|
20
|
+
if (!_remote) {
|
|
22
21
|
_remote = window.require('@electron/remote');
|
|
23
|
-
} catch (err) {
|
|
24
|
-
console.error(err);
|
|
25
|
-
throw new Error('illegal call, non electron environment');
|
|
26
22
|
}
|
|
23
|
+
} catch (e) {
|
|
24
|
+
console.error(e);
|
|
25
|
+
throw new Error('illegal call, non electron environment');
|
|
27
26
|
}
|
|
28
27
|
return _remote;
|
|
29
28
|
}
|
|
30
29
|
|
|
31
30
|
function parseUrlParams(url) {
|
|
32
31
|
const params = {};
|
|
33
|
-
const queryString = url.split('?')[1];
|
|
32
|
+
const queryString = url.indexOf('?') > -1 ? url.split('?')[1] : url;
|
|
34
33
|
|
|
35
34
|
if (!queryString) return params;
|
|
36
35
|
|
|
@@ -39,6 +38,14 @@ function parseUrlParams(url) {
|
|
|
39
38
|
let decodedValue = decodeURIComponent(value || '');
|
|
40
39
|
if (decodedValue === 'true' || decodedValue === 'false') {
|
|
41
40
|
decodedValue = decodedValue === 'true';
|
|
41
|
+
} else if (
|
|
42
|
+
typeof decodedValue === 'string' &&
|
|
43
|
+
decodedValue.length > 0 &&
|
|
44
|
+
!isNaN(Number(decodedValue)) &&
|
|
45
|
+
Number(decodedValue) !== undefined &&
|
|
46
|
+
!decodedValue?.includes?.('.')
|
|
47
|
+
) {
|
|
48
|
+
decodedValue = Number(decodedValue);
|
|
42
49
|
}
|
|
43
50
|
params[key] = decodedValue;
|
|
44
51
|
});
|
|
@@ -47,7 +54,7 @@ function parseUrlParams(url) {
|
|
|
47
54
|
}
|
|
48
55
|
|
|
49
56
|
function getEnvironment(url) {
|
|
50
|
-
|
|
57
|
+
let host = (url ?? location.host)
|
|
51
58
|
.replace('wwwr', 'www')
|
|
52
59
|
.replace('devai', 'dev')
|
|
53
60
|
.replace('testai', 'test')
|
|
@@ -56,38 +63,42 @@ function getEnvironment(url) {
|
|
|
56
63
|
.replace('ai-cdn', 'www')
|
|
57
64
|
.replace('ai.', 'www.')
|
|
58
65
|
.toLocaleUpperCase();
|
|
66
|
+
const httpIndex = host.indexOf('://');
|
|
67
|
+
if (httpIndex > -1) {
|
|
68
|
+
host = host.substring(httpIndex + 3);
|
|
69
|
+
}
|
|
59
70
|
const index = host.indexOf('.');
|
|
60
71
|
let environment = '';
|
|
61
72
|
//先根据url判断环境。这里single页面访问会用到
|
|
62
|
-
if (/^192\.|localhost/.test(host)) {
|
|
73
|
+
if (/^192\.|^127\.|localhost/.test(host)) {
|
|
63
74
|
environment = 'local';
|
|
64
75
|
} else {
|
|
65
76
|
environment = host.substring(0, index);
|
|
66
77
|
}
|
|
67
|
-
return environment;
|
|
78
|
+
return environment?.toLowerCase();
|
|
68
79
|
}
|
|
69
80
|
|
|
70
81
|
/**
|
|
71
82
|
* 获取当前BrowserWindow实例
|
|
72
83
|
*/
|
|
73
84
|
function getCurrentWindow() {
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
85
|
+
const remote = getElectronRemote();
|
|
86
|
+
if (remote) {
|
|
87
|
+
return remote.getCurrentWindow();
|
|
88
|
+
}
|
|
78
89
|
}
|
|
79
90
|
|
|
80
91
|
/**
|
|
81
92
|
* 获取窗口所属的屏幕(当应用跨屏幕时,应该属于占用面积超过一半的那块屏幕)
|
|
82
93
|
*/
|
|
83
94
|
function getDisplayMatching() {
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
95
|
+
const remote = getElectronRemote();
|
|
96
|
+
const currentWindow = getCurrentWindow();
|
|
97
|
+
if (remote && currentWindow) {
|
|
98
|
+
const { screen } = remote;
|
|
99
|
+
const currentWindowBounds = currentWindow.getBounds();
|
|
100
|
+
return screen.getDisplayMatching(currentWindowBounds);
|
|
101
|
+
}
|
|
91
102
|
}
|
|
92
103
|
|
|
93
104
|
module.exports = {
|
|
@@ -95,5 +106,5 @@ module.exports = {
|
|
|
95
106
|
getElectronRemote,
|
|
96
107
|
parseUrlParams,
|
|
97
108
|
getEnvironment,
|
|
98
|
-
getDisplayMatching
|
|
109
|
+
getDisplayMatching,
|
|
99
110
|
};
|
package/js/main.js
CHANGED
|
@@ -5,18 +5,18 @@ if (isElectron) {
|
|
|
5
5
|
require('@plasosdk/screenshot');
|
|
6
6
|
require('@plasosdk/rtmpplayer');
|
|
7
7
|
|
|
8
|
-
const {
|
|
9
|
-
|
|
10
|
-
const { app } = require('electron');
|
|
8
|
+
const { RENDER_TO_MAIN_MESG_TYPE } = require('./code');
|
|
9
|
+
|
|
10
|
+
const { app, ipcMain, crashReporter } = require('electron');
|
|
11
11
|
|
|
12
|
-
if (electronVersion && versionComp(electronVersion, '14.0.0') >= 0) {
|
|
13
|
-
const electronStore = require('@electron/remote/main');
|
|
14
|
-
const isInitialized = electronStore.isInitialized();
|
|
15
|
-
if (!isInitialized) electronStore.initialize();
|
|
16
|
-
}
|
|
17
12
|
// 首次添加此开关是为了解决一些GPU导致的渲染问题的,比如进课堂白屏,历史课堂播放进度条不动。
|
|
18
13
|
// 支持虚拟声卡需要添加此开关
|
|
19
14
|
app.commandLine.appendSwitch('--no-sandbox');
|
|
15
|
+
|
|
16
|
+
ipcMain.on(RENDER_TO_MAIN_MESG_TYPE.PLASO_INIT_LOG_PATH, function(e, logFilePath) {
|
|
17
|
+
app.setPath('crashDumps', logFilePath);
|
|
18
|
+
crashReporter.start({ submitURL: '', uploadToServer: false });
|
|
19
|
+
});
|
|
20
20
|
} catch (e) {
|
|
21
21
|
console.error(e);
|
|
22
22
|
}
|