@plasosdk/plaso-electron-sdk 1.2.11 → 1.2.13-beta.0

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 CHANGED
@@ -1,226 +1,226 @@
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) _remote = window.require('@electron/remote');
118
- } catch (e) {
119
- console.error(err);
120
- }
121
- return _remote;
122
- }
123
-
124
- const include = function (url) {
125
- url = globalAppInfo.rhost + url;
126
- let ele;
127
- if (/\.css$/.test(url)) {
128
- ele = document.createElement('link');
129
- ele.rel = "stylesheet";
130
- ele.type = "text/css";
131
- ele.href = url;
132
- } else {
133
- ele = document.createElement('script');
134
- ele.src = url;
135
- }
136
-
137
- document.head.appendChild(ele);
138
- }
139
-
140
-
141
- function init(classObj) {
142
- let query;
143
- if (classObj) {
144
- globalAppInfo = Object.assign({}, classObj)
145
- }
146
- globalAppInfo.needFullScreen = false;
147
-
148
- if (globalAppInfo.rhost && globalAppInfo.rhost.substring(globalAppInfo.rhost.length - 1) != '/') {
149
- globalAppInfo.rhost += "/";
150
- }
151
- if (globalAppInfo.dhost && globalAppInfo.dhost.substring(globalAppInfo.dhost.length - 1) != '/') {
152
- globalAppInfo.dhost += "/";
153
- }
154
-
155
- path = globalAppInfo.initjs || "js/all.js";
156
- include(path);
157
- }
158
-
159
- if (typeof require == "function") {
160
- const { ipcRenderer } = window.require('electron');
161
- const { CLASS_WINDOW_MESG_TYPE } = require('./js/macro');
162
-
163
- const queryString = location.href.split('?')[1];
164
- queryString.split('&').forEach((pair) => {
165
- const [key, value] = pair.split('=');
166
- if (key === 'openerId') openerId = Number(value);
167
- });
168
-
169
- ipcRenderer.on(CLASS_WINDOW_MESG_TYPE.INIT_CLASS_OPTIONS, (_, classObj) => {
170
- if (classObj) init(classObj);
171
- });
172
-
173
- if(openerId){
174
- const remote = getElectronRemote();
175
- const webContents = remote.getCurrentWebContents();
176
- ipcRenderer.sendTo(openerId, CLASS_WINDOW_MESG_TYPE.CLASS_READY, {webContentId: webContents.id});
177
- }
178
-
179
- }
180
-
181
- /*
182
- * 加载超时函数,立即执行
183
- * param: timeLength :超时时间
184
- */
185
- (function timeOut(timeLength) {
186
- const timer = setTimeout(
187
- function () {
188
- var loading = document.getElementById('loading');
189
- if (loading) {
190
- loading.style.width = "100%";
191
- loading.style.textAlign = "center";
192
- eval("loading.innerHTML = '加载超时!请点击重新加载<button id=\"btn_reload\" onclick=\"reload()\">重新加载</button>'");
193
- if (typeof require == "function" && globalAppInfo.clientType === 'nw') {
194
- var gui = require('nw.gui');
195
- var win = gui.Window.get();
196
- win.removeAllListeners();
197
- }
198
- }
199
- },
200
- timeLength * 1000
201
- )
202
- })(30);
203
-
204
- function reload() {
205
- if (typeof require == "function" && globalAppInfo.clientType === 'electron') {
206
- var remote = getElectronRemote();
207
- var curWindow = remote.getCurrentWindow();
208
- curWindow.webContents.reloadIgnoringCache()
209
- } else {
210
- location.reload();
211
- }
212
- }
213
- </script>
214
-
215
- <script type="text/javascript">
216
- if (globalAppInfo.background) {
217
- document.body.style.background = globalAppInfo.background;
218
- document.documentElement.style.background = globalAppInfo.background;
219
- }
220
- if (!globalAppInfo.noLoading) {
221
- var loadingDom = document.getElementById("loading");
222
- if (loadingDom) loadingDom.style.display = "";
223
- }
224
- </script>
225
-
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) _remote = window.require('@electron/remote');
118
+ } catch (e) {
119
+ console.error(err);
120
+ }
121
+ return _remote;
122
+ }
123
+
124
+ const include = function (url) {
125
+ url = globalAppInfo.rhost + url;
126
+ let ele;
127
+ if (/\.css$/.test(url)) {
128
+ ele = document.createElement('link');
129
+ ele.rel = "stylesheet";
130
+ ele.type = "text/css";
131
+ ele.href = url;
132
+ } else {
133
+ ele = document.createElement('script');
134
+ ele.src = url;
135
+ }
136
+
137
+ document.head.appendChild(ele);
138
+ }
139
+
140
+
141
+ function init(classObj) {
142
+ let query;
143
+ if (classObj) {
144
+ globalAppInfo = Object.assign({}, classObj)
145
+ }
146
+ globalAppInfo.needFullScreen = false;
147
+
148
+ if (globalAppInfo.rhost && globalAppInfo.rhost.substring(globalAppInfo.rhost.length - 1) != '/') {
149
+ globalAppInfo.rhost += "/";
150
+ }
151
+ if (globalAppInfo.dhost && globalAppInfo.dhost.substring(globalAppInfo.dhost.length - 1) != '/') {
152
+ globalAppInfo.dhost += "/";
153
+ }
154
+
155
+ path = globalAppInfo.initjs || "js/all.js";
156
+ include(path);
157
+ }
158
+
159
+ if (typeof require == "function") {
160
+ const { ipcRenderer } = window.require('electron');
161
+ const { CLASS_WINDOW_MESG_TYPE } = require('./js/macro');
162
+
163
+ const queryString = location.href.split('?')[1];
164
+ queryString.split('&').forEach((pair) => {
165
+ const [key, value] = pair.split('=');
166
+ if (key === 'openerId') openerId = Number(value);
167
+ });
168
+
169
+ ipcRenderer.on(CLASS_WINDOW_MESG_TYPE.INIT_CLASS_OPTIONS, (_, classObj) => {
170
+ if (classObj) init(classObj);
171
+ });
172
+
173
+ if(openerId){
174
+ const remote = getElectronRemote();
175
+ const webContents = remote.getCurrentWebContents();
176
+ ipcRenderer.sendTo(openerId, CLASS_WINDOW_MESG_TYPE.CLASS_READY, {webContentId: webContents.id});
177
+ }
178
+
179
+ }
180
+
181
+ /*
182
+ * 加载超时函数,立即执行
183
+ * param: timeLength :超时时间
184
+ */
185
+ (function timeOut(timeLength) {
186
+ const timer = setTimeout(
187
+ function () {
188
+ var loading = document.getElementById('loading');
189
+ if (loading) {
190
+ loading.style.width = "100%";
191
+ loading.style.textAlign = "center";
192
+ eval("loading.innerHTML = '加载超时!请点击重新加载<button id=\"btn_reload\" onclick=\"reload()\">重新加载</button>'");
193
+ if (typeof require == "function" && globalAppInfo.clientType === 'nw') {
194
+ var gui = require('nw.gui');
195
+ var win = gui.Window.get();
196
+ win.removeAllListeners();
197
+ }
198
+ }
199
+ },
200
+ timeLength * 1000
201
+ )
202
+ })(30);
203
+
204
+ function reload() {
205
+ if (typeof require == "function" && globalAppInfo.clientType === 'electron') {
206
+ var remote = getElectronRemote();
207
+ var curWindow = remote.getCurrentWindow();
208
+ curWindow.webContents.reloadIgnoringCache()
209
+ } else {
210
+ location.reload();
211
+ }
212
+ }
213
+ </script>
214
+
215
+ <script type="text/javascript">
216
+ if (globalAppInfo.background) {
217
+ document.body.style.background = globalAppInfo.background;
218
+ document.documentElement.style.background = globalAppInfo.background;
219
+ }
220
+ if (!globalAppInfo.noLoading) {
221
+ var loadingDom = document.getElementById("loading");
222
+ if (loadingDom) loadingDom.style.display = "";
223
+ }
224
+ </script>
225
+
226
226
  </html>
package/index.js CHANGED
@@ -1,6 +1,6 @@
1
- const { ipcMain } = require('electron');
2
- if (ipcMain) {
3
- module.exports = require('./js/main.js');
4
- } else {
5
- module.exports = require('./js/render.js');
6
- }
1
+ const { ipcMain } = require('electron');
2
+ if (ipcMain) {
3
+ module.exports = require('./js/main.js');
4
+ } else {
5
+ module.exports = require('./js/render.js');
6
+ }
package/js/macro.js CHANGED
@@ -1,81 +1,81 @@
1
- const ERROR_CODE = {
2
- /** 非 electron 环境 */
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
- /** 未知的异常错误 */
11
- COMMOM_ERROR: -99,
12
- };
13
-
14
- const LESSON_TYPE = {
15
- /** 课堂 */
16
- LIVECLASS: 'liveClass',
17
- /** 备课 */
18
- PREPARE_LESSONS: 'prepareLesson',
19
- };
20
-
21
- /** 课堂窗口与外部窗口通讯的消息 */
22
- const CLASS_WINDOW_MESG_TYPE = {
23
- /** 课堂dom渲染成功后告知外部应用窗口,传参用户信息 */
24
- LIVE_WINDOW_READY: 'liveWindowReady',
25
- /** 课堂结束 */
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',
45
- };
46
-
47
- const LEVEL = {
48
- error: 3,
49
- warn: 2,
50
- info: 1,
51
- debug: 0,
52
- };
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
-
74
- module.exports = {
75
- LESSON_TYPE,
76
- ERROR_CODE,
77
- CLASS_WINDOW_MESG_TYPE,
78
- LEVEL,
79
- RENDER_TO_MAIN_MESG_TYPE,
80
- FILE_TYPE,
81
- };
1
+ const ERROR_CODE = {
2
+ /** 非 electron 环境 */
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
+ /** 未知的异常错误 */
11
+ COMMOM_ERROR: -99,
12
+ };
13
+
14
+ const LESSON_TYPE = {
15
+ /** 课堂 */
16
+ LIVECLASS: 'liveClass',
17
+ /** 备课 */
18
+ PREPARE_LESSONS: 'prepareLesson',
19
+ };
20
+
21
+ /** 课堂窗口与外部窗口通讯的消息 */
22
+ const CLASS_WINDOW_MESG_TYPE = {
23
+ /** 课堂dom渲染成功后告知外部应用窗口,传参用户信息 */
24
+ LIVE_WINDOW_READY: 'liveWindowReady',
25
+ /** 课堂结束 */
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',
45
+ };
46
+
47
+ const LEVEL = {
48
+ error: 3,
49
+ warn: 2,
50
+ info: 1,
51
+ debug: 0,
52
+ };
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
+
74
+ module.exports = {
75
+ LESSON_TYPE,
76
+ ERROR_CODE,
77
+ CLASS_WINDOW_MESG_TYPE,
78
+ LEVEL,
79
+ RENDER_TO_MAIN_MESG_TYPE,
80
+ FILE_TYPE,
81
+ };