fcr-ui-scene 3.3.0 → 3.3.1
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/dist/electron/app.js +148 -0
- package/dist/electron/bootstrap-dev.js +51 -0
- package/dist/electron/bootstrap-sdk.js +56 -0
- package/dist/electron/default-options.js +25 -0
- package/dist/electron/env.js +13 -0
- package/dist/electron/index.js +20 -0
- package/dist/electron/injections.js +702 -0
- package/dist/electron/logger.js +66 -0
- package/dist/electron/main.js +67 -0
- package/dist/electron/plugins/meeting-state.js +39 -0
- package/dist/electron/plugins/screenshot.js +49 -0
- package/dist/electron/preload.js +36 -0
- package/dist/electron/tools.js +66 -0
- package/dist/electron/window.js +124 -0
- package/lib/common/room-store.d.ts +55 -0
- package/lib/common/room-store.js +395 -0
- package/lib/creator.js +2 -0
- package/lib/electron/app.js +8 -0
- package/lib/electron/bootstrap-sdk.js +1 -0
- package/lib/electron/injections.d.ts +1 -0
- package/lib/electron/injections.js +4 -1
- package/lib/electron/preload.js +2 -1
- package/lib/modules/Interpreter/add-button/index.css +4 -0
- package/lib/modules/Interpreter/add-button/index.d.ts +11 -0
- package/lib/modules/Interpreter/add-button/index.js +41 -0
- package/lib/modules/Interpreter/config.d.ts +16 -0
- package/lib/modules/Interpreter/config.js +17 -0
- package/lib/modules/Interpreter/constant.d.ts +44 -0
- package/lib/modules/Interpreter/constant.js +60 -0
- package/lib/modules/Interpreter/context.d.ts +2 -0
- package/lib/modules/Interpreter/context.js +9 -0
- package/lib/modules/Interpreter/dialog-content/index.css +33 -0
- package/lib/modules/Interpreter/dialog-content/index.d.ts +8 -0
- package/lib/modules/Interpreter/dialog-content/index.js +34 -0
- package/lib/modules/Interpreter/footer/components/interpreter-btn/index.d.ts +5 -0
- package/lib/modules/Interpreter/footer/components/interpreter-btn/index.js +56 -0
- package/lib/modules/Interpreter/footer/components/set-btn/index.d.ts +5 -0
- package/lib/modules/Interpreter/footer/components/set-btn/index.js +46 -0
- package/lib/modules/Interpreter/footer/components/tooltip-wrapper/index.d.ts +6 -0
- package/lib/modules/Interpreter/footer/components/tooltip-wrapper/index.js +28 -0
- package/lib/modules/Interpreter/footer/index.css +10 -0
- package/lib/modules/Interpreter/footer/index.d.ts +3 -0
- package/lib/modules/Interpreter/footer/index.js +35 -0
- package/lib/modules/Interpreter/index.css +8 -0
- package/lib/modules/Interpreter/index.d.ts +21 -0
- package/lib/modules/Interpreter/index.js +110 -0
- package/lib/modules/Interpreter/interpreter-list/index.css +21 -0
- package/lib/modules/Interpreter/interpreter-list/index.d.ts +3 -0
- package/lib/modules/Interpreter/interpreter-list/index.js +65 -0
- package/lib/modules/Interpreter/interpreter-list/interpreter-item/components/pick-language/index.css +31 -0
- package/lib/modules/Interpreter/interpreter-list/interpreter-item/components/pick-language/index.d.ts +11 -0
- package/lib/modules/Interpreter/interpreter-list/interpreter-item/components/pick-language/index.js +141 -0
- package/lib/modules/Interpreter/interpreter-list/interpreter-item/components/pick-language/useLanguageConfig/images/fcr_ar.png +0 -0
- package/lib/modules/Interpreter/interpreter-list/interpreter-item/components/pick-language/useLanguageConfig/images/fcr_cn.png +0 -0
- package/lib/modules/Interpreter/interpreter-list/interpreter-item/components/pick-language/useLanguageConfig/images/fcr_de.png +0 -0
- package/lib/modules/Interpreter/interpreter-list/interpreter-item/components/pick-language/useLanguageConfig/images/fcr_en.png +0 -0
- package/lib/modules/Interpreter/interpreter-list/interpreter-item/components/pick-language/useLanguageConfig/images/fcr_es.png +0 -0
- package/lib/modules/Interpreter/interpreter-list/interpreter-item/components/pick-language/useLanguageConfig/images/fcr_fr.png +0 -0
- package/lib/modules/Interpreter/interpreter-list/interpreter-item/components/pick-language/useLanguageConfig/images/fcr_hi.png +0 -0
- package/lib/modules/Interpreter/interpreter-list/interpreter-item/components/pick-language/useLanguageConfig/images/fcr_id.png +0 -0
- package/lib/modules/Interpreter/interpreter-list/interpreter-item/components/pick-language/useLanguageConfig/images/fcr_it.png +0 -0
- package/lib/modules/Interpreter/interpreter-list/interpreter-item/components/pick-language/useLanguageConfig/images/fcr_jp.png +0 -0
- package/lib/modules/Interpreter/interpreter-list/interpreter-item/components/pick-language/useLanguageConfig/images/fcr_ko.png +0 -0
- package/lib/modules/Interpreter/interpreter-list/interpreter-item/components/pick-language/useLanguageConfig/images/fcr_ms.png +0 -0
- package/lib/modules/Interpreter/interpreter-list/interpreter-item/components/pick-language/useLanguageConfig/images/fcr_pt.png +0 -0
- package/lib/modules/Interpreter/interpreter-list/interpreter-item/components/pick-language/useLanguageConfig/images/fcr_ru.png +0 -0
- package/lib/modules/Interpreter/interpreter-list/interpreter-item/components/pick-language/useLanguageConfig/images/fcr_th.png +0 -0
- package/lib/modules/Interpreter/interpreter-list/interpreter-item/components/pick-language/useLanguageConfig/images/fcr_tr.png +0 -0
- package/lib/modules/Interpreter/interpreter-list/interpreter-item/components/pick-language/useLanguageConfig/images/fcr_vi.png +0 -0
- package/lib/modules/Interpreter/interpreter-list/interpreter-item/components/pick-language/useLanguageConfig/index.d.ts +11 -0
- package/lib/modules/Interpreter/interpreter-list/interpreter-item/components/pick-language/useLanguageConfig/index.js +119 -0
- package/lib/modules/Interpreter/interpreter-list/interpreter-item/components/pick-user/index.css +41 -0
- package/lib/modules/Interpreter/interpreter-list/interpreter-item/components/pick-user/index.d.ts +12 -0
- package/lib/modules/Interpreter/interpreter-list/interpreter-item/components/pick-user/index.js +118 -0
- package/lib/modules/Interpreter/interpreter-list/interpreter-item/index.css +34 -0
- package/lib/modules/Interpreter/interpreter-list/interpreter-item/index.d.ts +8 -0
- package/lib/modules/Interpreter/interpreter-list/interpreter-item/index.js +65 -0
- package/lib/modules/Interpreter/loading-wrapper/index.css +53 -0
- package/lib/modules/Interpreter/loading-wrapper/index.d.ts +6 -0
- package/lib/modules/Interpreter/loading-wrapper/index.js +28 -0
- package/lib/modules/Interpreter/store.d.ts +82 -0
- package/lib/modules/Interpreter/store.js +1382 -0
- package/lib/modules/Interpreter/view.d.ts +3 -0
- package/lib/modules/Interpreter/view.js +32 -0
- package/lib/modules/action-bar/Interpreter/index.d.ts +6 -0
- package/lib/modules/action-bar/Interpreter/index.js +44 -0
- package/lib/modules/action-bar/apps/appitems.d.ts +2 -0
- package/lib/modules/action-bar/apps/appitems.js +40 -0
- package/lib/modules/action-bar/apps/index.css +6 -0
- package/lib/modules/action-bar/apps/index.d.ts +4 -0
- package/lib/modules/action-bar/apps/index.js +58 -0
- package/lib/modules/action-bar/switch-input-language-room/fcr_translateswitch.png +0 -0
- package/lib/modules/action-bar/switch-input-language-room/index.css +86 -0
- package/lib/modules/action-bar/switch-input-language-room/index.d.ts +17 -0
- package/lib/modules/action-bar/switch-input-language-room/index.js +145 -0
- package/lib/modules/action-bar/switch-output-language-room/drop-menu.d.ts +1 -0
- package/lib/modules/action-bar/switch-output-language-room/drop-menu.js +197 -0
- package/lib/modules/action-bar/switch-output-language-room/guide-tooltip/index.css +18 -0
- package/lib/modules/action-bar/switch-output-language-room/guide-tooltip/index.d.ts +8 -0
- package/lib/modules/action-bar/switch-output-language-room/guide-tooltip/index.js +59 -0
- package/lib/modules/action-bar/switch-output-language-room/index.d.ts +12 -0
- package/lib/modules/action-bar/switch-output-language-room/index.js +238 -0
- package/lib/modules/action-bar/switch-output-language-room/notification-bar/components/interpreter/index.css +54 -0
- package/lib/modules/action-bar/switch-output-language-room/notification-bar/components/interpreter/index.d.ts +8 -0
- package/lib/modules/action-bar/switch-output-language-room/notification-bar/components/interpreter/index.js +94 -0
- package/lib/modules/action-bar/switch-output-language-room/notification-bar/components/virtual-image/index.css +8 -0
- package/lib/modules/action-bar/switch-output-language-room/notification-bar/components/virtual-image/index.d.ts +4 -0
- package/lib/modules/action-bar/switch-output-language-room/notification-bar/components/virtual-image/index.js +31 -0
- package/lib/modules/action-bar/switch-output-language-room/notification-bar/dome.png +0 -0
- package/lib/modules/action-bar/switch-output-language-room/notification-bar/fcr_translateswitch.png +0 -0
- package/lib/modules/action-bar/switch-output-language-room/notification-bar/index.css +71 -0
- package/lib/modules/action-bar/switch-output-language-room/notification-bar/index.d.ts +2 -0
- package/lib/modules/action-bar/switch-output-language-room/notification-bar/index.js +82 -0
- package/lib/modules/dialog/components/Interpreter/electron.d.ts +2 -0
- package/lib/modules/dialog/components/Interpreter/electron.js +72 -0
- package/lib/modules/dialog/components/Interpreter/index.css +30 -0
- package/lib/modules/dialog/components/Interpreter/index.d.ts +4 -0
- package/lib/modules/dialog/components/Interpreter/index.js +61 -0
- package/lib/modules/dialog/components/Interpreter/user-queue/index.css +36 -0
- package/lib/modules/dialog/components/Interpreter/user-queue/index.d.ts +3 -0
- package/lib/modules/dialog/components/Interpreter/user-queue/index.js +47 -0
- package/lib/modules/dialog/components/switch-language-channels/electron.d.ts +2 -0
- package/lib/modules/dialog/components/switch-language-channels/electron.js +72 -0
- package/lib/modules/dialog/components/switch-language-channels/index.css +30 -0
- package/lib/modules/dialog/components/switch-language-channels/index.d.ts +4 -0
- package/lib/modules/dialog/components/switch-language-channels/index.js +63 -0
- package/lib/modules/dialog/components/switch-language-channels/user-queue/index.css +36 -0
- package/lib/modules/dialog/components/switch-language-channels/user-queue/index.d.ts +3 -0
- package/lib/modules/dialog/components/switch-language-channels/user-queue/index.js +47 -0
- package/lib/modules/notification/context.d.ts +2 -0
- package/lib/modules/notification/context.js +9 -0
- package/lib/modules/notification/index.css +58 -0
- package/lib/modules/notification/index.d.ts +15 -0
- package/lib/modules/notification/index.js +51 -0
- package/lib/modules/notification/interpreter-status/index.css +72 -0
- package/lib/modules/notification/interpreter-status/index.d.ts +3 -0
- package/lib/modules/notification/interpreter-status/index.js +59 -0
- package/lib/modules/notification/store.d.ts +16 -0
- package/lib/modules/notification/store.js +127 -0
- package/lib/modules/notification/view.d.ts +10 -0
- package/lib/modules/notification/view.js +116 -0
- package/lib/modules/state-bar/meeting-details.js +4 -3
- package/lib/modules/state-bar/store.d.ts +1 -0
- package/lib/modules/state-bar/store.js +15 -3
- package/lib/modules/state-bar/view.js +6 -4
- package/lib/plugins/browser-runtime-plugin.js +4 -1
- package/lib/runtime.d.ts +1 -0
- package/package.json +5 -5
- package/public/index.html +7 -2
|
@@ -0,0 +1,702 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
require("core-js/modules/es.object.define-property.js");
|
|
4
|
+
require("core-js/modules/es.regexp.exec.js");
|
|
5
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
6
|
+
Object.defineProperty(exports, "__esModule", {
|
|
7
|
+
value: true
|
|
8
|
+
});
|
|
9
|
+
exports.showItemInFolder = exports.setInMeetingState = exports.setFragmentOptions = exports.setFragmentBaseUrl = exports.setAlwaysOnTop = exports.sendEvent = exports.screen = exports.removeEventListener = exports.releaseSubAllWindowRefs = exports.registerListenerReady = exports.quitApp = exports.openRendererWindow = exports.openLinkInDefaultBrowser = exports.openDirectory = exports.open = exports.launch = exports.getVirtualBgResource = exports.getSystemMemorySize = exports.getSystemCpuInfo = exports.getRendererProcessUsage = exports.getNetworkType = exports.getMediaSourceIdList = exports.getLaunchOptions = exports.getBrowserWindowById = exports.getAssetUrl = exports.fileToBase64 = exports.closeRendererWindow = exports.close = exports.captureScreen = exports.browserWindow = exports.addEventListener = void 0;
|
|
10
|
+
require("core-js/modules/es.error.cause.js");
|
|
11
|
+
require("core-js/modules/es.error.to-string.js");
|
|
12
|
+
require("core-js/modules/es.array.concat.js");
|
|
13
|
+
require("core-js/modules/es.array.filter.js");
|
|
14
|
+
require("core-js/modules/es.array.find.js");
|
|
15
|
+
require("core-js/modules/es.array.for-each.js");
|
|
16
|
+
require("core-js/modules/es.array.includes.js");
|
|
17
|
+
require("core-js/modules/es.array.iterator.js");
|
|
18
|
+
require("core-js/modules/es.array.map.js");
|
|
19
|
+
require("core-js/modules/es.array.push.js");
|
|
20
|
+
require("core-js/modules/es.array.reduce.js");
|
|
21
|
+
require("core-js/modules/es.date.now.js");
|
|
22
|
+
require("core-js/modules/es.date.to-json.js");
|
|
23
|
+
require("core-js/modules/es.json.stringify.js");
|
|
24
|
+
require("core-js/modules/es.object.entries.js");
|
|
25
|
+
require("core-js/modules/es.object.keys.js");
|
|
26
|
+
require("core-js/modules/es.object.to-string.js");
|
|
27
|
+
require("core-js/modules/es.promise.js");
|
|
28
|
+
require("core-js/modules/es.promise.all-settled.js");
|
|
29
|
+
require("core-js/modules/es.promise.finally.js");
|
|
30
|
+
require("core-js/modules/es.string.includes.js");
|
|
31
|
+
require("core-js/modules/es.string.iterator.js");
|
|
32
|
+
require("core-js/modules/es.string.starts-with.js");
|
|
33
|
+
require("core-js/modules/es.string.trim.js");
|
|
34
|
+
require("core-js/modules/esnext.async-iterator.filter.js");
|
|
35
|
+
require("core-js/modules/esnext.async-iterator.find.js");
|
|
36
|
+
require("core-js/modules/esnext.async-iterator.for-each.js");
|
|
37
|
+
require("core-js/modules/esnext.async-iterator.map.js");
|
|
38
|
+
require("core-js/modules/esnext.async-iterator.reduce.js");
|
|
39
|
+
require("core-js/modules/esnext.iterator.constructor.js");
|
|
40
|
+
require("core-js/modules/esnext.iterator.filter.js");
|
|
41
|
+
require("core-js/modules/esnext.iterator.find.js");
|
|
42
|
+
require("core-js/modules/esnext.iterator.for-each.js");
|
|
43
|
+
require("core-js/modules/esnext.iterator.map.js");
|
|
44
|
+
require("core-js/modules/esnext.iterator.reduce.js");
|
|
45
|
+
require("core-js/modules/web.dom-collections.for-each.js");
|
|
46
|
+
require("core-js/modules/web.dom-collections.iterator.js");
|
|
47
|
+
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
48
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
49
|
+
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
50
|
+
var _electron = require("electron");
|
|
51
|
+
var _remote = require("@electron/remote");
|
|
52
|
+
var _os = _interopRequireDefault(require("os"));
|
|
53
|
+
var _child_process = require("child_process");
|
|
54
|
+
var _path2 = _interopRequireDefault(require("path"));
|
|
55
|
+
var _fs2 = _interopRequireDefault(require("fs"));
|
|
56
|
+
var _jszip = _interopRequireDefault(require("jszip"));
|
|
57
|
+
var openDirectory = exports.openDirectory = /*#__PURE__*/function () {
|
|
58
|
+
var _ref = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee() {
|
|
59
|
+
var _yield$dialog$showOpe, filePaths;
|
|
60
|
+
return _regenerator["default"].wrap(function _callee$(_context) {
|
|
61
|
+
while (1) switch (_context.prev = _context.next) {
|
|
62
|
+
case 0:
|
|
63
|
+
_context.next = 2;
|
|
64
|
+
return _remote.dialog.showOpenDialog((0, _remote.getCurrentWindow)(), {
|
|
65
|
+
properties: ['openDirectory']
|
|
66
|
+
});
|
|
67
|
+
case 2:
|
|
68
|
+
_yield$dialog$showOpe = _context.sent;
|
|
69
|
+
filePaths = _yield$dialog$showOpe.filePaths;
|
|
70
|
+
return _context.abrupt("return", filePaths[0]);
|
|
71
|
+
case 5:
|
|
72
|
+
case "end":
|
|
73
|
+
return _context.stop();
|
|
74
|
+
}
|
|
75
|
+
}, _callee);
|
|
76
|
+
}));
|
|
77
|
+
return function openDirectory() {
|
|
78
|
+
return _ref.apply(this, arguments);
|
|
79
|
+
};
|
|
80
|
+
}();
|
|
81
|
+
var showItemInFolder = exports.showItemInFolder = function showItemInFolder(path) {
|
|
82
|
+
_remote.shell.showItemInFolder(path);
|
|
83
|
+
};
|
|
84
|
+
var sendEvent = exports.sendEvent = function sendEvent(event) {
|
|
85
|
+
_remote.BrowserWindow.getAllWindows().forEach(function (window) {
|
|
86
|
+
var currentWindow = (0, _remote.getCurrentWindow)();
|
|
87
|
+
if (window.id !== currentWindow.id) {
|
|
88
|
+
window.webContents.send('custom-event', event);
|
|
89
|
+
}
|
|
90
|
+
});
|
|
91
|
+
};
|
|
92
|
+
var addEventListener = exports.addEventListener = function addEventListener(listener) {
|
|
93
|
+
_electron.ipcRenderer.addListener('custom-event', listener);
|
|
94
|
+
};
|
|
95
|
+
var removeEventListener = exports.removeEventListener = function removeEventListener(listener) {
|
|
96
|
+
_electron.ipcRenderer.removeListener('custom-event', listener);
|
|
97
|
+
};
|
|
98
|
+
var setFragmentOptions = exports.setFragmentOptions = function setFragmentOptions(entryPath, windowOptions, webPreferences) {
|
|
99
|
+
_electron.ipcRenderer.send('setFragmentOptions', entryPath, windowOptions, webPreferences);
|
|
100
|
+
};
|
|
101
|
+
var getLaunchOptions = exports.getLaunchOptions = /*#__PURE__*/function () {
|
|
102
|
+
var _ref2 = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee2() {
|
|
103
|
+
return _regenerator["default"].wrap(function _callee2$(_context2) {
|
|
104
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
105
|
+
case 0:
|
|
106
|
+
return _context2.abrupt("return", _electron.ipcRenderer.invoke('get-launch-options'));
|
|
107
|
+
case 1:
|
|
108
|
+
case "end":
|
|
109
|
+
return _context2.stop();
|
|
110
|
+
}
|
|
111
|
+
}, _callee2);
|
|
112
|
+
}));
|
|
113
|
+
return function getLaunchOptions() {
|
|
114
|
+
return _ref2.apply(this, arguments);
|
|
115
|
+
};
|
|
116
|
+
}();
|
|
117
|
+
var openLinkInDefaultBrowser = exports.openLinkInDefaultBrowser = function openLinkInDefaultBrowser(url) {
|
|
118
|
+
_remote.shell.openExternal(url);
|
|
119
|
+
};
|
|
120
|
+
var getBrowserWindowById = exports.getBrowserWindowById = function getBrowserWindowById(id) {
|
|
121
|
+
return _remote.BrowserWindow.getAllWindows().find(function (wind) {
|
|
122
|
+
return wind.id === id;
|
|
123
|
+
});
|
|
124
|
+
};
|
|
125
|
+
var browserWindow = exports.browserWindow = (0, _remote.getCurrentWindow)();
|
|
126
|
+
var screen = exports.screen = _remote.screen;
|
|
127
|
+
var open = exports.open = function open(entryPath, dialogId) {
|
|
128
|
+
_electron.ipcRenderer.send('open', entryPath, dialogId);
|
|
129
|
+
};
|
|
130
|
+
var close = exports.close = function close(entryPath, dialogId) {
|
|
131
|
+
_electron.ipcRenderer.send('close', entryPath, dialogId);
|
|
132
|
+
};
|
|
133
|
+
var setFragmentBaseUrl = exports.setFragmentBaseUrl = function setFragmentBaseUrl(isDev, baseUrl) {
|
|
134
|
+
_electron.ipcRenderer.send('setFragmentBaseUrl', isDev, baseUrl);
|
|
135
|
+
};
|
|
136
|
+
var registerListenerReady = exports.registerListenerReady = function registerListenerReady() {
|
|
137
|
+
_electron.ipcRenderer.send('registerListenerReady');
|
|
138
|
+
};
|
|
139
|
+
var captureScreen = exports.captureScreen = function captureScreen(options) {
|
|
140
|
+
_electron.ipcRenderer.send('short-cut-capture', "short-cut-capture-reply-".concat(Date.now()), options);
|
|
141
|
+
};
|
|
142
|
+
var rendererWindows = {};
|
|
143
|
+
var rendererWindowMutationObservers = {};
|
|
144
|
+
var openRendererWindow = exports.openRendererWindow = /*#__PURE__*/function () {
|
|
145
|
+
var _ref3 = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee3(frameName, renderFn, windowOptions) {
|
|
146
|
+
var rendererWindow, windowConstructorOptionsString, newRendererWindow, windowId, _browserWindow, renderDom, parentWindow, parentHead, parentStyles, parentStyleLinks, stylesLoadedPromises, oldenObserver, observer, parentRoot, parentRootStyles, _windowId, _browserWindow2, _newRendererWindow, _renderDom;
|
|
147
|
+
return _regenerator["default"].wrap(function _callee3$(_context3) {
|
|
148
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
149
|
+
case 0:
|
|
150
|
+
rendererWindow = rendererWindows[frameName];
|
|
151
|
+
if (rendererWindow) {
|
|
152
|
+
_context3.next = 36;
|
|
153
|
+
break;
|
|
154
|
+
}
|
|
155
|
+
windowConstructorOptionsString = Object.entries(windowOptions).reduce(function (acc, _ref4) {
|
|
156
|
+
var _ref5 = (0, _slicedToArray2["default"])(_ref4, 2),
|
|
157
|
+
key = _ref5[0],
|
|
158
|
+
value = _ref5[1];
|
|
159
|
+
if (typeof value === 'string') {
|
|
160
|
+
return "".concat(acc, ",").concat(key, "=").concat(value);
|
|
161
|
+
}
|
|
162
|
+
return "".concat(acc, ",").concat(key, "=").concat(JSON.stringify(value));
|
|
163
|
+
}, '');
|
|
164
|
+
newRendererWindow = window.open('', frameName, windowConstructorOptionsString);
|
|
165
|
+
_context3.next = 6;
|
|
166
|
+
return _electron.ipcRenderer.invoke('getBrowserWindowId', frameName);
|
|
167
|
+
case 6:
|
|
168
|
+
windowId = _context3.sent;
|
|
169
|
+
if (windowId) {
|
|
170
|
+
_context3.next = 10;
|
|
171
|
+
break;
|
|
172
|
+
}
|
|
173
|
+
console.error('windowId not found');
|
|
174
|
+
return _context3.abrupt("return");
|
|
175
|
+
case 10:
|
|
176
|
+
_browserWindow = _remote.BrowserWindow.getAllWindows().find(function (win) {
|
|
177
|
+
return win.id === windowId;
|
|
178
|
+
});
|
|
179
|
+
if (!newRendererWindow) {
|
|
180
|
+
_context3.next = 34;
|
|
181
|
+
break;
|
|
182
|
+
}
|
|
183
|
+
newRendererWindow.document.write('<div id="root"></div>');
|
|
184
|
+
renderDom = newRendererWindow.document.getElementById('root');
|
|
185
|
+
if (renderDom) {
|
|
186
|
+
_context3.next = 16;
|
|
187
|
+
break;
|
|
188
|
+
}
|
|
189
|
+
return _context3.abrupt("return");
|
|
190
|
+
case 16:
|
|
191
|
+
// copy styles from parent window
|
|
192
|
+
parentWindow = window;
|
|
193
|
+
parentHead = parentWindow.document.head;
|
|
194
|
+
parentStyles = parentHead.querySelectorAll('style');
|
|
195
|
+
parentStyleLinks = parentHead.querySelectorAll('link[rel="stylesheet"]');
|
|
196
|
+
stylesLoadedPromises = [];
|
|
197
|
+
parentStyles.forEach(function (style) {
|
|
198
|
+
newRendererWindow === null || newRendererWindow === void 0 || newRendererWindow.document.head.appendChild(style.cloneNode(true));
|
|
199
|
+
});
|
|
200
|
+
parentStyleLinks.forEach(function (style) {
|
|
201
|
+
var linkNode = style.cloneNode(true);
|
|
202
|
+
newRendererWindow === null || newRendererWindow === void 0 || newRendererWindow.document.head.appendChild(linkNode);
|
|
203
|
+
stylesLoadedPromises.push(new Promise(function (resolve, reject) {
|
|
204
|
+
linkNode.addEventListener('load', function () {
|
|
205
|
+
return resolve();
|
|
206
|
+
});
|
|
207
|
+
linkNode.addEventListener('error', function () {
|
|
208
|
+
return reject("failed to load style: ".concat(linkNode.href));
|
|
209
|
+
});
|
|
210
|
+
}));
|
|
211
|
+
});
|
|
212
|
+
oldenObserver = rendererWindowMutationObservers[frameName];
|
|
213
|
+
if (oldenObserver) {
|
|
214
|
+
oldenObserver.disconnect();
|
|
215
|
+
}
|
|
216
|
+
observer = new MutationObserver(function (mutations) {
|
|
217
|
+
mutations.forEach(function (mutation) {
|
|
218
|
+
if (mutation.type === 'childList') {
|
|
219
|
+
mutation.addedNodes.forEach(function (node) {
|
|
220
|
+
if (node.nodeType === Node.ELEMENT_NODE && node.tagName === 'STYLE') {
|
|
221
|
+
newRendererWindow === null || newRendererWindow === void 0 || newRendererWindow.document.head.appendChild(node.cloneNode(true));
|
|
222
|
+
}
|
|
223
|
+
});
|
|
224
|
+
}
|
|
225
|
+
});
|
|
226
|
+
});
|
|
227
|
+
observer.observe(document.head, {
|
|
228
|
+
childList: true
|
|
229
|
+
});
|
|
230
|
+
rendererWindowMutationObservers[frameName] = observer;
|
|
231
|
+
// copy css variables from parent window
|
|
232
|
+
parentRoot = parentWindow.document.documentElement;
|
|
233
|
+
parentRootStyles = parentRoot.style.cssText;
|
|
234
|
+
newRendererWindow.document.documentElement.style.cssText = parentRootStyles;
|
|
235
|
+
rendererWindows[frameName] = newRendererWindow;
|
|
236
|
+
newRendererWindow.onclose = function () {
|
|
237
|
+
delete rendererWindows[frameName];
|
|
238
|
+
};
|
|
239
|
+
Promise.allSettled(stylesLoadedPromises)["finally"](function () {
|
|
240
|
+
renderFn(renderDom, _browserWindow);
|
|
241
|
+
});
|
|
242
|
+
case 34:
|
|
243
|
+
_context3.next = 51;
|
|
244
|
+
break;
|
|
245
|
+
case 36:
|
|
246
|
+
_context3.next = 38;
|
|
247
|
+
return _electron.ipcRenderer.invoke('getBrowserWindowId', frameName);
|
|
248
|
+
case 38:
|
|
249
|
+
_windowId = _context3.sent;
|
|
250
|
+
if (_windowId) {
|
|
251
|
+
_context3.next = 42;
|
|
252
|
+
break;
|
|
253
|
+
}
|
|
254
|
+
console.error('windowId not found');
|
|
255
|
+
return _context3.abrupt("return");
|
|
256
|
+
case 42:
|
|
257
|
+
_browserWindow2 = _remote.BrowserWindow.getAllWindows().find(function (win) {
|
|
258
|
+
return win.id === _windowId;
|
|
259
|
+
});
|
|
260
|
+
_newRendererWindow = rendererWindows[frameName];
|
|
261
|
+
_renderDom = _newRendererWindow.document.getElementById('root');
|
|
262
|
+
if (_renderDom) {
|
|
263
|
+
_context3.next = 47;
|
|
264
|
+
break;
|
|
265
|
+
}
|
|
266
|
+
return _context3.abrupt("return");
|
|
267
|
+
case 47:
|
|
268
|
+
renderFn(_renderDom, _browserWindow2);
|
|
269
|
+
_browserWindow2 === null || _browserWindow2 === void 0 || _browserWindow2.show();
|
|
270
|
+
_browserWindow2 === null || _browserWindow2 === void 0 || _browserWindow2.focus();
|
|
271
|
+
_browserWindow2 === null || _browserWindow2 === void 0 || _browserWindow2.moveTop();
|
|
272
|
+
case 51:
|
|
273
|
+
case "end":
|
|
274
|
+
return _context3.stop();
|
|
275
|
+
}
|
|
276
|
+
}, _callee3);
|
|
277
|
+
}));
|
|
278
|
+
return function openRendererWindow(_x, _x2, _x3) {
|
|
279
|
+
return _ref3.apply(this, arguments);
|
|
280
|
+
};
|
|
281
|
+
}();
|
|
282
|
+
var closeRendererWindow = exports.closeRendererWindow = /*#__PURE__*/function () {
|
|
283
|
+
var _ref6 = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee4(frameName) {
|
|
284
|
+
var windowId, _browserWindow3;
|
|
285
|
+
return _regenerator["default"].wrap(function _callee4$(_context4) {
|
|
286
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
287
|
+
case 0:
|
|
288
|
+
_context4.next = 2;
|
|
289
|
+
return _electron.ipcRenderer.invoke('getBrowserWindowId', frameName);
|
|
290
|
+
case 2:
|
|
291
|
+
windowId = _context4.sent;
|
|
292
|
+
if (windowId) {
|
|
293
|
+
_browserWindow3 = _remote.BrowserWindow.getAllWindows().find(function (win) {
|
|
294
|
+
return win.id === windowId;
|
|
295
|
+
});
|
|
296
|
+
if (_browserWindow3 && !_browserWindow3.isDestroyed()) {
|
|
297
|
+
_browserWindow3.emit('will-close');
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
case 4:
|
|
301
|
+
case "end":
|
|
302
|
+
return _context4.stop();
|
|
303
|
+
}
|
|
304
|
+
}, _callee4);
|
|
305
|
+
}));
|
|
306
|
+
return function closeRendererWindow(_x4) {
|
|
307
|
+
return _ref6.apply(this, arguments);
|
|
308
|
+
};
|
|
309
|
+
}();
|
|
310
|
+
var launch = exports.launch = /*#__PURE__*/function () {
|
|
311
|
+
var _ref7 = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee5(options) {
|
|
312
|
+
var res;
|
|
313
|
+
return _regenerator["default"].wrap(function _callee5$(_context5) {
|
|
314
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
315
|
+
case 0:
|
|
316
|
+
_context5.next = 2;
|
|
317
|
+
return _electron.ipcRenderer.invoke('launch', options);
|
|
318
|
+
case 2:
|
|
319
|
+
res = _context5.sent;
|
|
320
|
+
return _context5.abrupt("return", res);
|
|
321
|
+
case 4:
|
|
322
|
+
case "end":
|
|
323
|
+
return _context5.stop();
|
|
324
|
+
}
|
|
325
|
+
}, _callee5);
|
|
326
|
+
}));
|
|
327
|
+
return function launch(_x5) {
|
|
328
|
+
return _ref7.apply(this, arguments);
|
|
329
|
+
};
|
|
330
|
+
}();
|
|
331
|
+
var setAlwaysOnTop = exports.setAlwaysOnTop = function setAlwaysOnTop() {
|
|
332
|
+
var _app$dock;
|
|
333
|
+
_remote.app.dock && _remote.app.dock.hide();
|
|
334
|
+
var browserWindow = (0, _remote.getCurrentWindow)();
|
|
335
|
+
browserWindow.setVisibleOnAllWorkspaces(true, {
|
|
336
|
+
visibleOnFullScreen: true
|
|
337
|
+
});
|
|
338
|
+
browserWindow.setAlwaysOnTop(true);
|
|
339
|
+
browserWindow.show();
|
|
340
|
+
browserWindow.focus();
|
|
341
|
+
if (!((_app$dock = _remote.app.dock) !== null && _app$dock !== void 0 && _app$dock.isVisible())) {
|
|
342
|
+
_remote.app.dock && _remote.app.dock.show();
|
|
343
|
+
}
|
|
344
|
+
};
|
|
345
|
+
var quitApp = exports.quitApp = function quitApp() {
|
|
346
|
+
_remote.app.quit();
|
|
347
|
+
};
|
|
348
|
+
var getSystemMemorySize = exports.getSystemMemorySize = function getSystemMemorySize() {
|
|
349
|
+
return _os["default"].totalmem();
|
|
350
|
+
};
|
|
351
|
+
var getSystemCpuInfo = exports.getSystemCpuInfo = function getSystemCpuInfo() {
|
|
352
|
+
return _os["default"].cpus();
|
|
353
|
+
};
|
|
354
|
+
var getNetworkType = exports.getNetworkType = function getNetworkType() {
|
|
355
|
+
var resolve = function resolve(res) {};
|
|
356
|
+
var p = new Promise(function (_resolve) {
|
|
357
|
+
resolve = _resolve;
|
|
358
|
+
});
|
|
359
|
+
var platform = _os["default"].platform();
|
|
360
|
+
if (platform === 'darwin') {
|
|
361
|
+
// macos
|
|
362
|
+
(0, _child_process.exec)('networksetup -getairportnetwork en0', function (error, stdout, stderr) {
|
|
363
|
+
if (error || stderr) {
|
|
364
|
+
resolve({
|
|
365
|
+
isWifiConnected: false,
|
|
366
|
+
connection: ''
|
|
367
|
+
});
|
|
368
|
+
return;
|
|
369
|
+
}
|
|
370
|
+
if (stdout.includes('You are not associated with an AirPort network.')) {
|
|
371
|
+
resolve({
|
|
372
|
+
isWifiConnected: false,
|
|
373
|
+
connection: ''
|
|
374
|
+
});
|
|
375
|
+
} else {
|
|
376
|
+
var network = stdout.split(': ')[1].trim();
|
|
377
|
+
resolve({
|
|
378
|
+
isWifiConnected: true,
|
|
379
|
+
connection: network
|
|
380
|
+
});
|
|
381
|
+
}
|
|
382
|
+
});
|
|
383
|
+
} else if (platform === 'win32') {
|
|
384
|
+
// windows
|
|
385
|
+
(0, _child_process.exec)('netsh wlan show interfaces', function (error, stdout, stderr) {
|
|
386
|
+
if (error || stderr) {
|
|
387
|
+
resolve({
|
|
388
|
+
isWifiConnected: false,
|
|
389
|
+
connection: ''
|
|
390
|
+
});
|
|
391
|
+
return;
|
|
392
|
+
}
|
|
393
|
+
var lines = stdout.split('\n');
|
|
394
|
+
lines.forEach(function (line) {
|
|
395
|
+
if (line.includes('State') && line.includes('connected') && line.includes('SSID')) {
|
|
396
|
+
var ssid = line.split(': ')[1].trim();
|
|
397
|
+
resolve({
|
|
398
|
+
isWifiConnected: true,
|
|
399
|
+
connection: ssid
|
|
400
|
+
});
|
|
401
|
+
}
|
|
402
|
+
});
|
|
403
|
+
resolve({
|
|
404
|
+
isWifiConnected: false,
|
|
405
|
+
connection: ''
|
|
406
|
+
});
|
|
407
|
+
});
|
|
408
|
+
} else if (platform === 'linux') {
|
|
409
|
+
// linux
|
|
410
|
+
(0, _child_process.exec)('nmcli -t -f TYPE,STATE,CONNECTION device status', function (error, stdout, stderr) {
|
|
411
|
+
if (error || stderr) {
|
|
412
|
+
resolve({
|
|
413
|
+
isWifiConnected: false,
|
|
414
|
+
connection: ''
|
|
415
|
+
});
|
|
416
|
+
return;
|
|
417
|
+
}
|
|
418
|
+
var devices = stdout.split('\n');
|
|
419
|
+
devices.forEach(function (device) {
|
|
420
|
+
var _device$split = device.split(':'),
|
|
421
|
+
_device$split2 = (0, _slicedToArray2["default"])(_device$split, 3),
|
|
422
|
+
type = _device$split2[0],
|
|
423
|
+
state = _device$split2[1],
|
|
424
|
+
connection = _device$split2[2];
|
|
425
|
+
if (type === 'wifi' && state === 'connected') {
|
|
426
|
+
resolve({
|
|
427
|
+
isWifiConnected: true,
|
|
428
|
+
connection: connection
|
|
429
|
+
});
|
|
430
|
+
}
|
|
431
|
+
});
|
|
432
|
+
resolve({
|
|
433
|
+
isWifiConnected: false,
|
|
434
|
+
connection: ''
|
|
435
|
+
});
|
|
436
|
+
});
|
|
437
|
+
} else {
|
|
438
|
+
resolve({
|
|
439
|
+
isWifiConnected: false,
|
|
440
|
+
connection: ''
|
|
441
|
+
});
|
|
442
|
+
}
|
|
443
|
+
return p;
|
|
444
|
+
};
|
|
445
|
+
var getAssetUrl = exports.getAssetUrl = function getAssetUrl(path) {
|
|
446
|
+
var isDevMode = process.env.DEV === 'true';
|
|
447
|
+
if (isDevMode) {
|
|
448
|
+
return _path2["default"].resolve(process.cwd(), 'public', path);
|
|
449
|
+
}
|
|
450
|
+
return _path2["default"].resolve(_remote.app.getAppPath(), '..', path);
|
|
451
|
+
};
|
|
452
|
+
var getRendererProcessUsage = exports.getRendererProcessUsage = /*#__PURE__*/function () {
|
|
453
|
+
var _ref8 = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee6() {
|
|
454
|
+
return _regenerator["default"].wrap(function _callee6$(_context6) {
|
|
455
|
+
while (1) switch (_context6.prev = _context6.next) {
|
|
456
|
+
case 0:
|
|
457
|
+
return _context6.abrupt("return", {
|
|
458
|
+
memoryUsage: 0,
|
|
459
|
+
cpuUsage: 0,
|
|
460
|
+
totalMemoryUsage: 0,
|
|
461
|
+
totalCpuUsage: 0
|
|
462
|
+
});
|
|
463
|
+
case 1:
|
|
464
|
+
case "end":
|
|
465
|
+
return _context6.stop();
|
|
466
|
+
}
|
|
467
|
+
}, _callee6);
|
|
468
|
+
}));
|
|
469
|
+
return function getRendererProcessUsage() {
|
|
470
|
+
return _ref8.apply(this, arguments);
|
|
471
|
+
};
|
|
472
|
+
}();
|
|
473
|
+
var userDataPath = _remote.app.getPath('userData');
|
|
474
|
+
var cachePath = _path2["default"].resolve(userDataPath, 'cache');
|
|
475
|
+
var imageExtensions = ['.png', '.jpg'];
|
|
476
|
+
var videoExtensions = ['.mp4'];
|
|
477
|
+
var zipExtensions = ['.zip'];
|
|
478
|
+
var getZipCachePath = function getZipCachePath(type) {
|
|
479
|
+
return _path2["default"].resolve(cachePath, "fcr_scene/virtual_bg_".concat(type, "s"));
|
|
480
|
+
};
|
|
481
|
+
var getResourcePath = function getResourcePath(type, md5Url) {
|
|
482
|
+
return _path2["default"].resolve(userDataPath, "fcr_scene/virtual_bg_".concat(type, "s/").concat(md5Url));
|
|
483
|
+
};
|
|
484
|
+
|
|
485
|
+
// 解压 zip 文件并保存
|
|
486
|
+
var unZipAndSaveFile = /*#__PURE__*/function () {
|
|
487
|
+
var _ref9 = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee8(zipFile, outputPath, type) {
|
|
488
|
+
var zipBuffer, zip, fileNames;
|
|
489
|
+
return _regenerator["default"].wrap(function _callee8$(_context8) {
|
|
490
|
+
while (1) switch (_context8.prev = _context8.next) {
|
|
491
|
+
case 0:
|
|
492
|
+
zipBuffer = _fs2["default"].readFileSync(zipFile);
|
|
493
|
+
_context8.next = 3;
|
|
494
|
+
return _jszip["default"].loadAsync(zipBuffer);
|
|
495
|
+
case 3:
|
|
496
|
+
zip = _context8.sent;
|
|
497
|
+
fileNames = [];
|
|
498
|
+
_context8.next = 7;
|
|
499
|
+
return Promise.all(Object.keys(zip.files).filter(function (filename) {
|
|
500
|
+
// 忽略目录、扩展文件或不需要的文件
|
|
501
|
+
var isDirectory = zip.files[filename].dir;
|
|
502
|
+
var isExtensionFile = filename.includes('__MACOSX') || filename.includes('.DS_Store') || filename.startsWith('.') ||
|
|
503
|
+
// 忽略以.开头的文件(隐藏文件)
|
|
504
|
+
filename.includes('Thumbs.db'); // 忽略 Windows 的缩略图数据库文件
|
|
505
|
+
|
|
506
|
+
var isImageOrVideo = type === 'image' ? imageExtensions.includes(_path2["default"].extname(filename)) : videoExtensions.includes(_path2["default"].extname(filename));
|
|
507
|
+
return !isDirectory && !isExtensionFile && isImageOrVideo;
|
|
508
|
+
}).map(/*#__PURE__*/function () {
|
|
509
|
+
var _ref10 = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee7(filenameTmp) {
|
|
510
|
+
var fileData, realFileName, outputFile;
|
|
511
|
+
return _regenerator["default"].wrap(function _callee7$(_context7) {
|
|
512
|
+
while (1) switch (_context7.prev = _context7.next) {
|
|
513
|
+
case 0:
|
|
514
|
+
_context7.next = 2;
|
|
515
|
+
return zip.files[filenameTmp].async('nodebuffer');
|
|
516
|
+
case 2:
|
|
517
|
+
fileData = _context7.sent;
|
|
518
|
+
realFileName = _path2["default"].basename(filenameTmp);
|
|
519
|
+
outputFile = _path2["default"].resolve(outputPath, realFileName);
|
|
520
|
+
_fs2["default"].mkdirSync(_path2["default"].dirname(outputFile), {
|
|
521
|
+
recursive: true
|
|
522
|
+
});
|
|
523
|
+
_fs2["default"].writeFileSync(outputFile, fileData);
|
|
524
|
+
fileNames.push(outputFile);
|
|
525
|
+
case 8:
|
|
526
|
+
case "end":
|
|
527
|
+
return _context7.stop();
|
|
528
|
+
}
|
|
529
|
+
}, _callee7);
|
|
530
|
+
}));
|
|
531
|
+
return function (_x9) {
|
|
532
|
+
return _ref10.apply(this, arguments);
|
|
533
|
+
};
|
|
534
|
+
}()));
|
|
535
|
+
case 7:
|
|
536
|
+
// 删除 zip 文件
|
|
537
|
+
_fs2["default"].unlinkSync(zipFile);
|
|
538
|
+
return _context8.abrupt("return", fileNames);
|
|
539
|
+
case 9:
|
|
540
|
+
case "end":
|
|
541
|
+
return _context8.stop();
|
|
542
|
+
}
|
|
543
|
+
}, _callee8);
|
|
544
|
+
}));
|
|
545
|
+
return function unZipAndSaveFile(_x6, _x7, _x8) {
|
|
546
|
+
return _ref9.apply(this, arguments);
|
|
547
|
+
};
|
|
548
|
+
}();
|
|
549
|
+
|
|
550
|
+
// 检查指定路径下是否有指定的文件
|
|
551
|
+
function getSpecificFiles(directory, extensions, fileName) {
|
|
552
|
+
// 检查目录是否存在
|
|
553
|
+
if (!_fs2["default"].existsSync(directory)) {
|
|
554
|
+
// 如果目录不存在,则创建目录
|
|
555
|
+
_fs2["default"].mkdirSync(directory, {
|
|
556
|
+
recursive: true
|
|
557
|
+
});
|
|
558
|
+
return [];
|
|
559
|
+
}
|
|
560
|
+
try {
|
|
561
|
+
var files = _fs2["default"].readdirSync(directory);
|
|
562
|
+
|
|
563
|
+
// 筛选出符合扩展名的文件
|
|
564
|
+
var filteredFiles = files.filter(function (file) {
|
|
565
|
+
var ext = _path2["default"].extname(file).toLowerCase();
|
|
566
|
+
return extensions.includes(ext);
|
|
567
|
+
});
|
|
568
|
+
|
|
569
|
+
// 如果传入了文件名,则只返回符合条件的文件
|
|
570
|
+
if (fileName) {
|
|
571
|
+
filteredFiles = filteredFiles.filter(function (file) {
|
|
572
|
+
return file === fileName;
|
|
573
|
+
});
|
|
574
|
+
}
|
|
575
|
+
|
|
576
|
+
// 符合条件的文件
|
|
577
|
+
return filteredFiles.length > 0 ? filteredFiles.map(function (file) {
|
|
578
|
+
return _path2["default"].resolve(directory, file);
|
|
579
|
+
}) : [];
|
|
580
|
+
} catch (err) {
|
|
581
|
+
console.error("Error reading directory: ".concat(err === null || err === void 0 ? void 0 : err.message));
|
|
582
|
+
return [];
|
|
583
|
+
}
|
|
584
|
+
}
|
|
585
|
+
function downloadFile(_x10, _x11) {
|
|
586
|
+
return _downloadFile.apply(this, arguments);
|
|
587
|
+
} // 获取资源
|
|
588
|
+
function _downloadFile() {
|
|
589
|
+
_downloadFile = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee10(url, destination) {
|
|
590
|
+
return _regenerator["default"].wrap(function _callee10$(_context10) {
|
|
591
|
+
while (1) switch (_context10.prev = _context10.next) {
|
|
592
|
+
case 0:
|
|
593
|
+
return _context10.abrupt("return", new Promise(function (resolve, reject) {
|
|
594
|
+
var request = _remote.net.request(url);
|
|
595
|
+
request.on('response', function (response) {
|
|
596
|
+
var fileStream = _fs2["default"].createWriteStream(destination);
|
|
597
|
+
fileStream.on('finish', function () {
|
|
598
|
+
resolve();
|
|
599
|
+
});
|
|
600
|
+
response.on('data', function (chunk) {
|
|
601
|
+
fileStream.write(chunk);
|
|
602
|
+
});
|
|
603
|
+
response.on('end', function () {
|
|
604
|
+
fileStream.end();
|
|
605
|
+
});
|
|
606
|
+
response.on('error', function (err) {
|
|
607
|
+
reject(new Error("Download failed: ".concat(err.message)));
|
|
608
|
+
});
|
|
609
|
+
});
|
|
610
|
+
request.on('error', function (err) {
|
|
611
|
+
reject(new Error("Request failed: ".concat(err.message)));
|
|
612
|
+
});
|
|
613
|
+
request.end();
|
|
614
|
+
}));
|
|
615
|
+
case 1:
|
|
616
|
+
case "end":
|
|
617
|
+
return _context10.stop();
|
|
618
|
+
}
|
|
619
|
+
}, _callee10);
|
|
620
|
+
}));
|
|
621
|
+
return _downloadFile.apply(this, arguments);
|
|
622
|
+
}
|
|
623
|
+
var getVirtualBgResource = exports.getVirtualBgResource = /*#__PURE__*/function () {
|
|
624
|
+
var _ref11 = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee9(url, md5Url, type) {
|
|
625
|
+
var resourcePath, extensions, cachedFiles, zipFileName, zipCacheDir, zipFiles, tempZipPath, zipPath;
|
|
626
|
+
return _regenerator["default"].wrap(function _callee9$(_context9) {
|
|
627
|
+
while (1) switch (_context9.prev = _context9.next) {
|
|
628
|
+
case 0:
|
|
629
|
+
resourcePath = getResourcePath(type, md5Url);
|
|
630
|
+
extensions = type === 'image' ? imageExtensions : videoExtensions; // 已有背景文件,直接使用
|
|
631
|
+
cachedFiles = getSpecificFiles(resourcePath, extensions);
|
|
632
|
+
if (!(cachedFiles.length > 0)) {
|
|
633
|
+
_context9.next = 5;
|
|
634
|
+
break;
|
|
635
|
+
}
|
|
636
|
+
return _context9.abrupt("return", cachedFiles);
|
|
637
|
+
case 5:
|
|
638
|
+
// 已有 zip
|
|
639
|
+
zipFileName = "".concat(md5Url, ".zip");
|
|
640
|
+
zipCacheDir = getZipCachePath(type);
|
|
641
|
+
zipFiles = getSpecificFiles(zipCacheDir, zipExtensions, zipFileName); // 没有 zip,需要下载
|
|
642
|
+
if (!(zipFiles.length <= 0)) {
|
|
643
|
+
_context9.next = 15;
|
|
644
|
+
break;
|
|
645
|
+
}
|
|
646
|
+
tempZipPath = _path2["default"].resolve("".concat(zipCacheDir, "/").concat(md5Url, ".temp"));
|
|
647
|
+
zipPath = _path2["default"].resolve("".concat(zipCacheDir, "/").concat(zipFileName));
|
|
648
|
+
_context9.next = 13;
|
|
649
|
+
return downloadFile(url, tempZipPath);
|
|
650
|
+
case 13:
|
|
651
|
+
// temp 文件重命名为 zip
|
|
652
|
+
_fs2["default"].renameSync(tempZipPath, zipPath);
|
|
653
|
+
zipFiles = getSpecificFiles(zipCacheDir, zipExtensions, zipFileName);
|
|
654
|
+
case 15:
|
|
655
|
+
if (!(!zipFiles || zipFiles.length <= 0)) {
|
|
656
|
+
_context9.next = 17;
|
|
657
|
+
break;
|
|
658
|
+
}
|
|
659
|
+
return _context9.abrupt("return", []);
|
|
660
|
+
case 17:
|
|
661
|
+
_context9.next = 19;
|
|
662
|
+
return unZipAndSaveFile(zipFiles[0], resourcePath, type);
|
|
663
|
+
case 19:
|
|
664
|
+
return _context9.abrupt("return", _context9.sent);
|
|
665
|
+
case 20:
|
|
666
|
+
case "end":
|
|
667
|
+
return _context9.stop();
|
|
668
|
+
}
|
|
669
|
+
}, _callee9);
|
|
670
|
+
}));
|
|
671
|
+
return function getVirtualBgResource(_x12, _x13, _x14) {
|
|
672
|
+
return _ref11.apply(this, arguments);
|
|
673
|
+
};
|
|
674
|
+
}();
|
|
675
|
+
|
|
676
|
+
// UI 层拿到 file path 需要转为 base64
|
|
677
|
+
var fileToBase64 = exports.fileToBase64 = function fileToBase64(file, type) {
|
|
678
|
+
var data = _fs2["default"].readFileSync(file, {
|
|
679
|
+
encoding: 'base64'
|
|
680
|
+
});
|
|
681
|
+
if (type === 'video') {
|
|
682
|
+
return "data:video/mp4;base64,".concat(data);
|
|
683
|
+
} else {
|
|
684
|
+
return "data:image/jpeg;base64,".concat(data);
|
|
685
|
+
}
|
|
686
|
+
};
|
|
687
|
+
var releaseSubAllWindowRefs = exports.releaseSubAllWindowRefs = function releaseSubAllWindowRefs() {
|
|
688
|
+
_electron.ipcRenderer.send('closeAllSubWindows');
|
|
689
|
+
rendererWindows = {};
|
|
690
|
+
rendererWindowMutationObservers = {};
|
|
691
|
+
};
|
|
692
|
+
var getMediaSourceIdList = exports.getMediaSourceIdList = function getMediaSourceIdList() {
|
|
693
|
+
return _remote.BrowserWindow.getAllWindows().map(function (window) {
|
|
694
|
+
return {
|
|
695
|
+
title: window.title,
|
|
696
|
+
mediaSourceId: window.getMediaSourceId()
|
|
697
|
+
};
|
|
698
|
+
});
|
|
699
|
+
};
|
|
700
|
+
var setInMeetingState = exports.setInMeetingState = function setInMeetingState(state) {
|
|
701
|
+
_electron.ipcRenderer.send('set-in-meeting-state', state);
|
|
702
|
+
};
|