@plasosdk/plaso-electron-sdk 1.3.14 → 1.3.15-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,276 +1,276 @@
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
- let hasInit = false;
141
- function init(appinfo) {
142
- if (hasInit) {
143
- return;
144
- } else {
145
- hasInit = true;
146
- }
147
-
148
- // from url
149
- var query;
150
- if (window.location.search) {
151
- query = window.location.search.substring(1).split("&");
152
- for (var i = 0, l = query.length; i < l; i++) {
153
- var temp = query[i].split('=');
154
- if (temp.length == 2) {
155
- globalAppInfo[temp[0]] = decodeURIComponent(temp[1]);
156
- } else if (
157
- typeof globalAppInfo[temp[0]] === 'string' &&
158
- globalAppInfo[temp[0]].length > 0 &&
159
- !isNaN(Number(globalAppInfo[temp[0]])) &&
160
- Number(globalAppInfo[temp[0]]) !== undefined &&
161
- !globalAppInfo[temp[0]]?.includes?.('.')
162
- ) {
163
- globalAppInfo[temp[0]] = Number(globalAppInfo[temp[0]]);
164
- }
165
- }
166
- }
167
-
168
- // from ipc
169
- if (appinfo) {
170
- globalAppInfo = Object.assign({}, globalAppInfo, appinfo)
171
- }
172
-
173
- // properties init
174
- if (globalAppInfo.rhost == undefined && location.protocol.indexOf('http') == 0) {
175
- globalAppInfo.rhost = './';
176
- if (!globalAppInfo.dhost) {
177
- if (globalAppInfo.env) {
178
- if (globalAppInfo.env === 'local') {
179
- globalAppInfo.dhost = location.origin;
180
- } else {
181
- globalAppInfo.dhost = `${location.protocol}//${globalAppInfo.env}.plaso.cn/`;
182
- }
183
- } else if (location.origin.indexOf('plaso.cn') > -1) {
184
- globalAppInfo.dhost = location.origin.replace('wwwr', 'www');
185
- globalAppInfo.env = location.host.split('.')[0];
186
- } else if (location.origin.indexOf('127.0.0.1') > -1 || location.origin.indexOf('192.168') > -1) {
187
- globalAppInfo.env = 'dev';
188
- globalAppInfo.dhost = `${location.protocol}//${globalAppInfo.env}.plaso.cn/`;
189
- } else {
190
- globalAppInfo.dhost = `${location.protocol}//www.plaso.cn/`;
191
- }
192
- }
193
- }
194
- if (!globalAppInfo.env) globalAppInfo.env = 'www';
195
- globalAppInfo.markString = globalAppInfo.markString ?? '';
196
- globalAppInfo.needFullScreen = false;
197
- if (globalAppInfo.rhost && globalAppInfo.rhost.substring(globalAppInfo.rhost.length - 1) != '/') {
198
- globalAppInfo.rhost += "/";
199
- }
200
- if (globalAppInfo.dhost && globalAppInfo.dhost.substring(globalAppInfo.dhost.length - 1) != '/') {
201
- globalAppInfo.dhost += "/";
202
- }
203
-
204
- // load all.js
205
- path = globalAppInfo.initjs || "js/all.js";
206
- include(path);
207
- }
208
-
209
- if (typeof require == "function") {
210
- const { ipcRenderer } = window.require('electron');
211
- const { CLASS_WINDOW_MESG_TYPE } = require('./js/macro');
212
-
213
- const queryString = location.href.split('?')[1];
214
- queryString.split('&').forEach((pair) => {
215
- const [key, value] = pair.split('=');
216
- if (key === 'openerId') openerId = Number(value);
217
- });
218
-
219
- ipcRenderer.on(CLASS_WINDOW_MESG_TYPE.INIT_GLOBAL_APPINFO, (_, appinfo) => {
220
- if (appinfo) init(appinfo);
221
- });
222
-
223
- if(openerId){
224
- const remote = getElectronRemote();
225
- const webContents = remote.getCurrentWebContents();
226
- ipcRenderer.sendTo(openerId, CLASS_WINDOW_MESG_TYPE.HTML_READY, {webContentId: webContents.id});
227
- }
228
-
229
- }
230
-
231
- /*
232
- * 加载超时函数,立即执行
233
- * param: timeLength :超时时间
234
- */
235
- (function timeOut(timeLength) {
236
- const timer = setTimeout(
237
- function () {
238
- var loading = document.getElementById('loading');
239
- if (loading) {
240
- loading.style.width = "100%";
241
- loading.style.textAlign = "center";
242
- eval("loading.innerHTML = '加载超时!请点击重新加载<button id=\"btn_reload\" onclick=\"reload()\">重新加载</button>'");
243
- if (typeof require == "function" && globalAppInfo.clientType === 'nw') {
244
- var gui = require('nw.gui');
245
- var win = gui.Window.get();
246
- win.removeAllListeners();
247
- }
248
- }
249
- },
250
- timeLength * 1000
251
- )
252
- })(30);
253
-
254
- function reload() {
255
- if (typeof require == "function" && globalAppInfo.clientType === 'electron') {
256
- var remote = getElectronRemote();
257
- var curWindow = remote.getCurrentWindow();
258
- curWindow.webContents.reloadIgnoringCache()
259
- } else {
260
- location.reload();
261
- }
262
- }
263
- </script>
264
-
265
- <script type="text/javascript">
266
- if (globalAppInfo.background) {
267
- document.body.style.background = globalAppInfo.background;
268
- document.documentElement.style.background = globalAppInfo.background;
269
- }
270
- if (!globalAppInfo.noLoading) {
271
- var loadingDom = document.getElementById("loading");
272
- if (loadingDom) loadingDom.style.display = "";
273
- }
274
- </script>
275
-
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
+ let hasInit = false;
141
+ function init(appinfo) {
142
+ if (hasInit) {
143
+ return;
144
+ } else {
145
+ hasInit = true;
146
+ }
147
+
148
+ // from url
149
+ var query;
150
+ if (window.location.search) {
151
+ query = window.location.search.substring(1).split("&");
152
+ for (var i = 0, l = query.length; i < l; i++) {
153
+ var temp = query[i].split('=');
154
+ if (temp.length == 2) {
155
+ globalAppInfo[temp[0]] = decodeURIComponent(temp[1]);
156
+ } else if (
157
+ typeof globalAppInfo[temp[0]] === 'string' &&
158
+ globalAppInfo[temp[0]].length > 0 &&
159
+ !isNaN(Number(globalAppInfo[temp[0]])) &&
160
+ Number(globalAppInfo[temp[0]]) !== undefined &&
161
+ !globalAppInfo[temp[0]]?.includes?.('.')
162
+ ) {
163
+ globalAppInfo[temp[0]] = Number(globalAppInfo[temp[0]]);
164
+ }
165
+ }
166
+ }
167
+
168
+ // from ipc
169
+ if (appinfo) {
170
+ globalAppInfo = Object.assign({}, globalAppInfo, appinfo)
171
+ }
172
+
173
+ // properties init
174
+ if (globalAppInfo.rhost == undefined && location.protocol.indexOf('http') == 0) {
175
+ globalAppInfo.rhost = './';
176
+ if (!globalAppInfo.dhost) {
177
+ if (globalAppInfo.env) {
178
+ if (globalAppInfo.env === 'local') {
179
+ globalAppInfo.dhost = location.origin;
180
+ } else {
181
+ globalAppInfo.dhost = `${location.protocol}//${globalAppInfo.env}.plaso.cn/`;
182
+ }
183
+ } else if (location.origin.indexOf('plaso.cn') > -1) {
184
+ globalAppInfo.dhost = location.origin.replace('wwwr', 'www');
185
+ globalAppInfo.env = location.host.split('.')[0];
186
+ } else if (location.origin.indexOf('127.0.0.1') > -1 || location.origin.indexOf('192.168') > -1) {
187
+ globalAppInfo.env = 'dev';
188
+ globalAppInfo.dhost = `${location.protocol}//${globalAppInfo.env}.plaso.cn/`;
189
+ } else {
190
+ globalAppInfo.dhost = `${location.protocol}//www.plaso.cn/`;
191
+ }
192
+ }
193
+ }
194
+ if (!globalAppInfo.env) globalAppInfo.env = 'www';
195
+ globalAppInfo.markString = globalAppInfo.markString ?? '';
196
+ globalAppInfo.needFullScreen = false;
197
+ if (globalAppInfo.rhost && globalAppInfo.rhost.substring(globalAppInfo.rhost.length - 1) != '/') {
198
+ globalAppInfo.rhost += "/";
199
+ }
200
+ if (globalAppInfo.dhost && globalAppInfo.dhost.substring(globalAppInfo.dhost.length - 1) != '/') {
201
+ globalAppInfo.dhost += "/";
202
+ }
203
+
204
+ // load all.js
205
+ path = globalAppInfo.initjs || "js/all.js";
206
+ include(path);
207
+ }
208
+
209
+ if (typeof require == "function") {
210
+ const { ipcRenderer } = window.require('electron');
211
+ const { CLASS_WINDOW_MESG_TYPE } = require('./js/macro');
212
+
213
+ const queryString = location.href.split('?')[1];
214
+ queryString.split('&').forEach((pair) => {
215
+ const [key, value] = pair.split('=');
216
+ if (key === 'openerId') openerId = Number(value);
217
+ });
218
+
219
+ ipcRenderer.on(CLASS_WINDOW_MESG_TYPE.INIT_GLOBAL_APPINFO, (_, appinfo) => {
220
+ if (appinfo) init(appinfo);
221
+ });
222
+
223
+ if(openerId){
224
+ const remote = getElectronRemote();
225
+ const webContents = remote.getCurrentWebContents();
226
+ ipcRenderer.sendTo(openerId, CLASS_WINDOW_MESG_TYPE.HTML_READY, {webContentId: webContents.id});
227
+ }
228
+
229
+ }
230
+
231
+ /*
232
+ * 加载超时函数,立即执行
233
+ * param: timeLength :超时时间
234
+ */
235
+ (function timeOut(timeLength) {
236
+ const timer = setTimeout(
237
+ function () {
238
+ var loading = document.getElementById('loading');
239
+ if (loading) {
240
+ loading.style.width = "100%";
241
+ loading.style.textAlign = "center";
242
+ eval("loading.innerHTML = '加载超时!请点击重新加载<button id=\"btn_reload\" onclick=\"reload()\">重新加载</button>'");
243
+ if (typeof require == "function" && globalAppInfo.clientType === 'nw') {
244
+ var gui = require('nw.gui');
245
+ var win = gui.Window.get();
246
+ win.removeAllListeners();
247
+ }
248
+ }
249
+ },
250
+ timeLength * 1000
251
+ )
252
+ })(30);
253
+
254
+ function reload() {
255
+ if (typeof require == "function" && globalAppInfo.clientType === 'electron') {
256
+ var remote = getElectronRemote();
257
+ var curWindow = remote.getCurrentWindow();
258
+ curWindow.webContents.reloadIgnoringCache()
259
+ } else {
260
+ location.reload();
261
+ }
262
+ }
263
+ </script>
264
+
265
+ <script type="text/javascript">
266
+ if (globalAppInfo.background) {
267
+ document.body.style.background = globalAppInfo.background;
268
+ document.documentElement.style.background = globalAppInfo.background;
269
+ }
270
+ if (!globalAppInfo.noLoading) {
271
+ var loadingDom = document.getElementById("loading");
272
+ if (loadingDom) loadingDom.style.display = "";
273
+ }
274
+ </script>
275
+
276
276
  </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
+ }