ezuikit-js 0.5.8-beta.2 → 0.6.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/CHANGELOG.md +16 -0
- package/demos/base-demo/ezuikit.js +133 -20
- package/demos/base-demo/index.html +2 -2
- package/demos/nginx-demo/conf/nginx.conf +0 -2
- package/demos/nginx-demo/html/ezuikit5/ezuikit.js +31 -31
- package/demos/nginx-demo/html/ezuikit5/server.js +1 -1
- package/demos/react-demo/README.md +68 -0
- package/demos/react-demo/config/env.js +101 -0
- package/demos/react-demo/config/getHttpsConfig.js +66 -0
- package/demos/react-demo/config/jest/cssTransform.js +14 -0
- package/demos/react-demo/config/jest/fileTransform.js +40 -0
- package/demos/react-demo/config/modules.js +141 -0
- package/demos/react-demo/config/paths.js +72 -0
- package/demos/react-demo/config/pnpTs.js +35 -0
- package/demos/react-demo/config/webpack.config.js +669 -0
- package/demos/react-demo/config/webpackDevServer.config.js +134 -0
- package/demos/react-demo/package-lock.json +13893 -0
- package/demos/react-demo/package.json +141 -0
- package/demos/react-demo/public/favicon.ico +0 -0
- package/demos/react-demo/public/index.html +43 -0
- package/demos/react-demo/public/logo192.png +0 -0
- package/demos/react-demo/public/logo512.png +0 -0
- package/demos/react-demo/public/manifest.json +25 -0
- package/demos/react-demo/public/robots.txt +3 -0
- package/demos/react-demo/scripts/build.js +211 -0
- package/demos/react-demo/scripts/start.js +166 -0
- package/demos/react-demo/scripts/test.js +53 -0
- package/demos/react-demo/src/App.css +38 -0
- package/demos/react-demo/src/App.js +54 -0
- package/demos/react-demo/src/App.test.js +9 -0
- package/demos/react-demo/src/ezuikit/index.js +1113 -0
- package/demos/react-demo/src/ezuikit/package.json +12 -0
- package/demos/react-demo/src/index.css +13 -0
- package/demos/react-demo/src/index.js +17 -0
- package/demos/react-demo/src/logo.svg +7 -0
- package/demos/react-demo/src/serviceWorker.js +141 -0
- package/demos/react-demo/src/setupTests.js +5 -0
- package/ezuikit.js +16331 -22522
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -23755,7 +23755,7 @@ Janus$1.init = function (options) {
|
|
|
23755
23755
|
} else if (Janus$1.webRTCAdapter.browserDetails.browser === 'chrome' && Janus$1.webRTCAdapter.browserDetails.version < 72) {
|
|
23756
23756
|
// Chrome does, but it's only usable from version 72 on
|
|
23757
23757
|
Janus$1.unifiedPlan = false;
|
|
23758
|
-
} else if (!('currentDirection' in RTCRtpTransceiver.prototype)) {
|
|
23758
|
+
} else if (typeof RTCRtpTransceiver !== 'undefined' && !('currentDirection' in RTCRtpTransceiver.prototype)) {
|
|
23759
23759
|
// Safari supports addTransceiver() but not Unified Plan when
|
|
23760
23760
|
// currentDirection is not defined (see codepen above)
|
|
23761
23761
|
Janus$1.unifiedPlan = false;
|
|
@@ -30795,6 +30795,27 @@ var Monitor = /*#__PURE__*/function () {
|
|
|
30795
30795
|
params.clickEventHandle(event.data);
|
|
30796
30796
|
}
|
|
30797
30797
|
|
|
30798
|
+
break;
|
|
30799
|
+
|
|
30800
|
+
case 'iframeFullScreen':
|
|
30801
|
+
if (id == event.data.id) {
|
|
30802
|
+
var requestFullScreen = function requestFullScreen(element) {
|
|
30803
|
+
var requestMethod = element.requestFullScreen || element.webkitRequestFullScreen || element.mozRequestFullScreen || element.msRequestFullScreen;
|
|
30804
|
+
|
|
30805
|
+
if (requestMethod) {
|
|
30806
|
+
requestMethod.call(element);
|
|
30807
|
+
} else if (typeof window.ActiveXObject !== "undefined") {
|
|
30808
|
+
var wscript = new ActiveXObject("WScript.Shell");
|
|
30809
|
+
|
|
30810
|
+
if (wscript !== null) {
|
|
30811
|
+
wscript.SendKeys("{F11}");
|
|
30812
|
+
}
|
|
30813
|
+
}
|
|
30814
|
+
};
|
|
30815
|
+
|
|
30816
|
+
requestFullScreen(document.getElementById("EZUIKitPlayer-" + event.data.id));
|
|
30817
|
+
}
|
|
30818
|
+
|
|
30798
30819
|
break;
|
|
30799
30820
|
}
|
|
30800
30821
|
}
|
|
@@ -31223,6 +31244,18 @@ var Monitor = /*#__PURE__*/function () {
|
|
|
31223
31244
|
};
|
|
31224
31245
|
|
|
31225
31246
|
EZUIKitPlayer.prototype.changePlayUrl = function (data) {
|
|
31247
|
+
if (data.deviceSerial) {
|
|
31248
|
+
this.opt.deviceSerial = data.deviceSerial;
|
|
31249
|
+
}
|
|
31250
|
+
|
|
31251
|
+
if (data.channelNo) {
|
|
31252
|
+
this.opt.channelNo = data.channelNo;
|
|
31253
|
+
}
|
|
31254
|
+
|
|
31255
|
+
if (data.accessToken) {
|
|
31256
|
+
this.opt.accessToken = data.accessToken;
|
|
31257
|
+
}
|
|
31258
|
+
|
|
31226
31259
|
var id = 'EZUIKitPlayer-' + this.opt.id;
|
|
31227
31260
|
var player = document.getElementById(id).contentWindow;
|
|
31228
31261
|
player.postMessage({
|
|
@@ -31878,6 +31911,12 @@ var matchTemplate = function matchTemplate(templateName, params) {
|
|
|
31878
31911
|
}
|
|
31879
31912
|
};
|
|
31880
31913
|
|
|
31914
|
+
var isVersion2Available = function isVersion2Available() {
|
|
31915
|
+
var isMobile = /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);
|
|
31916
|
+
var isSharedArrayBuffer = window.SharedArrayBuffer;
|
|
31917
|
+
return isSharedArrayBuffer && !isMobile;
|
|
31918
|
+
};
|
|
31919
|
+
|
|
31881
31920
|
var EZUIKitPlayer = /*#__PURE__*/function () {
|
|
31882
31921
|
function EZUIKitPlayer(params) {
|
|
31883
31922
|
var _this = this;
|
|
@@ -31912,11 +31951,13 @@ var EZUIKitPlayer = /*#__PURE__*/function () {
|
|
|
31912
31951
|
this.poster = params.poster;
|
|
31913
31952
|
this.speed = 1;
|
|
31914
31953
|
this.disabledTimeLine = false;
|
|
31954
|
+
this.disabledPTZ = false;
|
|
31955
|
+
this.enableSharedArrayBufferGuide = false;
|
|
31915
31956
|
this.capacity = {};
|
|
31916
31957
|
this.env = {
|
|
31917
31958
|
domain: "https://open.ys7.com"
|
|
31918
31959
|
};
|
|
31919
|
-
this.staticPath = "https://open.ys7.com/assets/ezuikit_v4.0";
|
|
31960
|
+
this.staticPath = isVersion2Available() ? "https://open.ys7.com/assets/ezuikit_v5.0" : "https://open.ys7.com/assets/ezuikit_v4.0";
|
|
31920
31961
|
|
|
31921
31962
|
if (typeof params.staticPath === 'string') {
|
|
31922
31963
|
this.staticPath = params.staticPath;
|
|
@@ -31930,11 +31971,63 @@ var EZUIKitPlayer = /*#__PURE__*/function () {
|
|
|
31930
31971
|
this.disabledTimeLine = params.disabledTimeLine;
|
|
31931
31972
|
}
|
|
31932
31973
|
|
|
31974
|
+
if (typeof params.disabledPTZ !== 'undefined') {
|
|
31975
|
+
this.disabledPTZ = params.disabledPTZ;
|
|
31976
|
+
}
|
|
31977
|
+
|
|
31978
|
+
if (typeof params.enableSharedArrayBufferGuide !== 'undefined') {
|
|
31979
|
+
this.enableSharedArrayBufferGuide = params.enableSharedArrayBufferGuide;
|
|
31980
|
+
}
|
|
31981
|
+
|
|
31933
31982
|
var pluginUrl = "".concat(this.staticPath, "/js/jsPlugin-4.0.2.min.js");
|
|
31934
31983
|
|
|
31935
|
-
if (
|
|
31984
|
+
if (isVersion2Available()) {
|
|
31936
31985
|
console.log("启用多线程解析视频");
|
|
31937
|
-
pluginUrl = "
|
|
31986
|
+
pluginUrl = "".concat(this.staticPath, "/jsPlugin-2.0.0.min.js");
|
|
31987
|
+
} else {
|
|
31988
|
+
// 是否引导用户开启谷歌实验室 Google Labs 特性
|
|
31989
|
+
//enableSharedArrayBufferGuide
|
|
31990
|
+
var isMobile = /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);
|
|
31991
|
+
|
|
31992
|
+
var getChromeVersion = function getChromeVersion() {
|
|
31993
|
+
var arr = navigator.userAgent.split(' ');
|
|
31994
|
+
var chromeVersion = '';
|
|
31995
|
+
|
|
31996
|
+
for (var i = 0; i < arr.length; i++) {
|
|
31997
|
+
if (/chrome/i.test(arr[i])) {
|
|
31998
|
+
chromeVersion = arr[i];
|
|
31999
|
+
}
|
|
32000
|
+
}
|
|
32001
|
+
|
|
32002
|
+
if (chromeVersion) {
|
|
32003
|
+
return Number(chromeVersion.split('/')[1].split('.')[0]);
|
|
32004
|
+
}
|
|
32005
|
+
|
|
32006
|
+
return false;
|
|
32007
|
+
}; // pc端 谷歌浏览器 版本92 ~ 105
|
|
32008
|
+
|
|
32009
|
+
|
|
32010
|
+
if (!isMobile && 91 < getChromeVersion < 106 && this.enableSharedArrayBufferGuide) {
|
|
32011
|
+
console.log("提示用户开启谷歌实验室特性");
|
|
32012
|
+
var wapDomId = "".concat(this.id, "-wrap");
|
|
32013
|
+
var guideDom = document.createElement("div");
|
|
32014
|
+
var guideSpan = document.createElement("span");
|
|
32015
|
+
guideSpan.innerHTML = "您当前浏览器可以开启谷歌实验室多线程特性,获取更好播放体验,避免浏览器卡顿及崩溃,详见";
|
|
32016
|
+
guideDom.appendChild(guideSpan);
|
|
32017
|
+
var guideLink = document.createElement("a");
|
|
32018
|
+
guideLink.href = "https://open.ys7.com/help/384";
|
|
32019
|
+
guideLink.setAttribute("target", "_blank");
|
|
32020
|
+
guideDom.appendChild(guideLink);
|
|
32021
|
+
guideLink.innerHTML = "开启说明"; //guideDom.innerHTML = "您的浏览器当前使用单进程播放视频,可能因内存占用过高导致浏览器卡顿,您可参考·谷歌浏览器开启多线程(链接)·开启谷歌实验室多线程特性,获取更好播放体验";
|
|
32022
|
+
|
|
32023
|
+
guideDom.id = "".concat(this.id, "-guide");
|
|
32024
|
+
guideDom.style = "font-size:12px;color:red;";
|
|
32025
|
+
setTimeout(function () {
|
|
32026
|
+
if (document.getElementById(wapDomId)) {
|
|
32027
|
+
document.getElementById(wapDomId).insertBefore(guideDom, document.getElementById(_this.id));
|
|
32028
|
+
}
|
|
32029
|
+
}, 5000);
|
|
32030
|
+
}
|
|
31938
32031
|
}
|
|
31939
32032
|
|
|
31940
32033
|
addJs(pluginUrl, function () {
|
|
@@ -32046,20 +32139,40 @@ var EZUIKitPlayer = /*#__PURE__*/function () {
|
|
|
32046
32139
|
}
|
|
32047
32140
|
|
|
32048
32141
|
var initDecoder = function initDecoder(resolve, reject) {
|
|
32049
|
-
var jSPlugin
|
|
32050
|
-
|
|
32051
|
-
|
|
32052
|
-
|
|
32053
|
-
|
|
32054
|
-
|
|
32055
|
-
|
|
32056
|
-
|
|
32057
|
-
|
|
32058
|
-
|
|
32059
|
-
|
|
32060
|
-
|
|
32061
|
-
|
|
32062
|
-
|
|
32142
|
+
var jSPlugin;
|
|
32143
|
+
|
|
32144
|
+
if (isVersion2Available()) {
|
|
32145
|
+
jSPlugin = new window.JSPlugin({
|
|
32146
|
+
szId: id,
|
|
32147
|
+
iType: 2,
|
|
32148
|
+
iWidth: width,
|
|
32149
|
+
iHeight: height,
|
|
32150
|
+
iMaxSplit: 1,
|
|
32151
|
+
iCurrentSplit: 1,
|
|
32152
|
+
szBasePath: "",
|
|
32153
|
+
staticPath: params.staticPath,
|
|
32154
|
+
oStyle: {
|
|
32155
|
+
border: "none",
|
|
32156
|
+
background: "#000000"
|
|
32157
|
+
}
|
|
32158
|
+
});
|
|
32159
|
+
} else {
|
|
32160
|
+
jSPlugin = new window.JSPlugin({
|
|
32161
|
+
szId: id,
|
|
32162
|
+
iType: 2,
|
|
32163
|
+
iWidth: width,
|
|
32164
|
+
iHeight: height,
|
|
32165
|
+
iMaxSplit: 1,
|
|
32166
|
+
iCurrentSplit: 1,
|
|
32167
|
+
szBasePath: "",
|
|
32168
|
+
staticPath: params.staticPath,
|
|
32169
|
+
oStyle: {
|
|
32170
|
+
border: "none",
|
|
32171
|
+
background: "#000000"
|
|
32172
|
+
}
|
|
32173
|
+
});
|
|
32174
|
+
}
|
|
32175
|
+
|
|
32063
32176
|
jSPlugin.EventCallback = {
|
|
32064
32177
|
loadEventHandler: function loadEventHandler() {},
|
|
32065
32178
|
zoomEventResponse: function
|
|
@@ -33172,9 +33285,9 @@ var EZUIKitPlayer = /*#__PURE__*/function () {
|
|
|
33172
33285
|
var end = defaultTime.length;
|
|
33173
33286
|
var standardTime = time + defaultTime.substring(start, end);
|
|
33174
33287
|
return standardTime.slice(0, 8) + 'T' + standardTime.slice(8) + 'Z';
|
|
33175
|
-
} else {
|
|
33176
|
-
throw new Error('回放时间格式有误,请确认');
|
|
33177
33288
|
}
|
|
33289
|
+
|
|
33290
|
+
throw new Error('回放时间格式有误,请确认');
|
|
33178
33291
|
}
|
|
33179
33292
|
|
|
33180
33293
|
var seekRT = this.jSPlugin.JS_Seek(0, startTime, endTime);
|
|
@@ -36,8 +36,8 @@
|
|
|
36
36
|
var accessToken = res.data.accessToken;
|
|
37
37
|
playr = new EZUIKit.EZUIKitPlayer({
|
|
38
38
|
id: 'video-container', // 视频容器ID
|
|
39
|
-
accessToken:
|
|
40
|
-
url: 'ezopen://open.ys7.com/
|
|
39
|
+
accessToken: accessToken,
|
|
40
|
+
url: 'ezopen://open.ys7.com/G39444019/1.live',
|
|
41
41
|
template: 'simple', // simple - 极简版;standard-标准版;security - 安防版(预览回放);voice-语音版; theme-可配置主题;
|
|
42
42
|
plugin: ['talk'], // 加载插件,talk-对讲
|
|
43
43
|
width: 600,
|
|
@@ -15834,8 +15834,8 @@ var TimeLine$1 = function TimeLine(jsPlugin) {
|
|
|
15834
15834
|
// 只画一次线
|
|
15835
15835
|
that.drawSolidLine(i * that.canvasWidth / dotNum, 8, i * that.canvasWidth / dotNum, that.canvasHeight / 5 * 0.5 + 8, 1, lineColor);
|
|
15836
15836
|
}
|
|
15837
|
-
/**
|
|
15838
|
-
* 偏移距离超过60,setSeconds会每次累加1到分钟,因此绘图完成后需要复原到当前分钟,再次计算偏移
|
|
15837
|
+
/**
|
|
15838
|
+
* 偏移距离超过60,setSeconds会每次累加1到分钟,因此绘图完成后需要复原到当前分钟,再次计算偏移
|
|
15839
15839
|
*/
|
|
15840
15840
|
|
|
15841
15841
|
|
|
@@ -31531,8 +31531,8 @@ var fragmentYUVShader = ['precision highp float;', 'varying highp vec2 textureCo
|
|
|
31531
31531
|
this.initTextures();
|
|
31532
31532
|
}
|
|
31533
31533
|
}
|
|
31534
|
-
/**
|
|
31535
|
-
* 初始化WebGL上下文
|
|
31534
|
+
/**
|
|
31535
|
+
* 初始化WebGL上下文
|
|
31536
31536
|
*/
|
|
31537
31537
|
|
|
31538
31538
|
RenderManager.prototype.initContextGL = function () {
|
|
@@ -31552,10 +31552,10 @@ var fragmentYUVShader = ['precision highp float;', 'varying highp vec2 textureCo
|
|
|
31552
31552
|
this.contextGL = gl;
|
|
31553
31553
|
console.log("WebGL1.0");
|
|
31554
31554
|
};
|
|
31555
|
-
/**
|
|
31556
|
-
* 初始化着色器程序
|
|
31557
|
-
* @param vertexShaderScript 顶点着色器脚本
|
|
31558
|
-
* @param fragmentShaderScript 片段着色器脚本
|
|
31555
|
+
/**
|
|
31556
|
+
* 初始化着色器程序
|
|
31557
|
+
* @param vertexShaderScript 顶点着色器脚本
|
|
31558
|
+
* @param fragmentShaderScript 片段着色器脚本
|
|
31559
31559
|
*/
|
|
31560
31560
|
|
|
31561
31561
|
|
|
@@ -31591,8 +31591,8 @@ var fragmentYUVShader = ['precision highp float;', 'varying highp vec2 textureCo
|
|
|
31591
31591
|
gl.deleteShader(fragmentShader);
|
|
31592
31592
|
return program;
|
|
31593
31593
|
};
|
|
31594
|
-
/**
|
|
31595
|
-
* 初始化数据缓存
|
|
31594
|
+
/**
|
|
31595
|
+
* 初始化数据缓存
|
|
31596
31596
|
*/
|
|
31597
31597
|
|
|
31598
31598
|
|
|
@@ -31609,8 +31609,8 @@ var fragmentYUVShader = ['precision highp float;', 'varying highp vec2 textureCo
|
|
|
31609
31609
|
this.vertexPosBuffer = vertexPosBuffer;
|
|
31610
31610
|
this.texturePosBuffer = texturePosBuffer;
|
|
31611
31611
|
};
|
|
31612
|
-
/**
|
|
31613
|
-
* 创建纹理
|
|
31612
|
+
/**
|
|
31613
|
+
* 创建纹理
|
|
31614
31614
|
*/
|
|
31615
31615
|
|
|
31616
31616
|
|
|
@@ -31625,8 +31625,8 @@ var fragmentYUVShader = ['precision highp float;', 'varying highp vec2 textureCo
|
|
|
31625
31625
|
gl.bindTexture(gl.TEXTURE_2D, null);
|
|
31626
31626
|
return textureRef;
|
|
31627
31627
|
};
|
|
31628
|
-
/**
|
|
31629
|
-
* 初始化YUV纹理
|
|
31628
|
+
/**
|
|
31629
|
+
* 初始化YUV纹理
|
|
31630
31630
|
*/
|
|
31631
31631
|
|
|
31632
31632
|
|
|
@@ -31648,11 +31648,11 @@ var fragmentYUVShader = ['precision highp float;', 'varying highp vec2 textureCo
|
|
|
31648
31648
|
this.vTextureRef = vTextureRef;
|
|
31649
31649
|
gl.useProgram(null);
|
|
31650
31650
|
};
|
|
31651
|
-
/**
|
|
31652
|
-
* 显示帧数据
|
|
31653
|
-
* @param nWidth 宽度
|
|
31654
|
-
* @param nHeight 高度
|
|
31655
|
-
* @param nHeight 帧数据
|
|
31651
|
+
/**
|
|
31652
|
+
* 显示帧数据
|
|
31653
|
+
* @param nWidth 宽度
|
|
31654
|
+
* @param nHeight 高度
|
|
31655
|
+
* @param nHeight 帧数据
|
|
31656
31656
|
*/
|
|
31657
31657
|
|
|
31658
31658
|
|
|
@@ -31697,11 +31697,11 @@ var fragmentYUVShader = ['precision highp float;', 'varying highp vec2 textureCo
|
|
|
31697
31697
|
gl.disableVertexAttribArray(texturePosRef);
|
|
31698
31698
|
gl.useProgram(null);
|
|
31699
31699
|
};
|
|
31700
|
-
/**
|
|
31701
|
-
* 上传YUV数据到纹理
|
|
31702
|
-
* @param nWidth 宽度
|
|
31703
|
-
* @param nHeight 高度
|
|
31704
|
-
* @param nHeight 帧数据
|
|
31700
|
+
/**
|
|
31701
|
+
* 上传YUV数据到纹理
|
|
31702
|
+
* @param nWidth 宽度
|
|
31703
|
+
* @param nHeight 高度
|
|
31704
|
+
* @param nHeight 帧数据
|
|
31705
31705
|
*/
|
|
31706
31706
|
|
|
31707
31707
|
|
|
@@ -31781,9 +31781,9 @@ var fragmentYUVShader = ['precision highp float;', 'varying highp vec2 textureCo
|
|
|
31781
31781
|
crSonData = null;
|
|
31782
31782
|
}
|
|
31783
31783
|
};
|
|
31784
|
-
/**
|
|
31785
|
-
* 设置显示区域
|
|
31786
|
-
* @param stDisplayRect 显示区域
|
|
31784
|
+
/**
|
|
31785
|
+
* 设置显示区域
|
|
31786
|
+
* @param stDisplayRect 显示区域
|
|
31787
31787
|
*/
|
|
31788
31788
|
|
|
31789
31789
|
|
|
@@ -31808,8 +31808,8 @@ var fragmentYUVShader = ['precision highp float;', 'varying highp vec2 textureCo
|
|
|
31808
31808
|
gl.bufferSubData(gl.ARRAY_BUFFER, 0, texturePosValues);
|
|
31809
31809
|
gl.bindBuffer(gl.ARRAY_BUFFER, null);
|
|
31810
31810
|
};
|
|
31811
|
-
/**
|
|
31812
|
-
* 释放显示资源
|
|
31811
|
+
/**
|
|
31812
|
+
* 释放显示资源
|
|
31813
31813
|
*/
|
|
31814
31814
|
|
|
31815
31815
|
|
|
@@ -31916,7 +31916,7 @@ var EZUIKitPlayer = /*#__PURE__*/function () {
|
|
|
31916
31916
|
this.env = {
|
|
31917
31917
|
domain: "https://open.ys7.com"
|
|
31918
31918
|
};
|
|
31919
|
-
this.staticPath = "https://open.ys7.com/assets/ezuikit_v4.0";
|
|
31919
|
+
this.staticPath = !!window.SharedArrayBuffer ? "https://open.ys7.com/assets/ezuikit_v5.0" : "https://open.ys7.com/assets/ezuikit_v4.0";
|
|
31920
31920
|
|
|
31921
31921
|
if (typeof params.staticPath === 'string') {
|
|
31922
31922
|
this.staticPath = params.staticPath;
|
|
@@ -31934,7 +31934,7 @@ var EZUIKitPlayer = /*#__PURE__*/function () {
|
|
|
31934
31934
|
|
|
31935
31935
|
if (!!window.SharedArrayBuffer) {
|
|
31936
31936
|
console.log("启用多线程解析视频");
|
|
31937
|
-
pluginUrl = "
|
|
31937
|
+
pluginUrl = "".concat(this.staticPath, "/jsPlugin-2.0.0.min.js");
|
|
31938
31938
|
}
|
|
31939
31939
|
|
|
31940
31940
|
addJs(pluginUrl, function () {
|
|
@@ -40,7 +40,7 @@ httpServer.on('request', (req, res) => {
|
|
|
40
40
|
if (ext === 'html' || ext === 'xhtml'|| ext === 'js') {
|
|
41
41
|
//跨域隔离
|
|
42
42
|
res.setHeader('Cross-Origin-Embedder-Policy', 'require-corp')
|
|
43
|
-
|
|
43
|
+
res.setHeader('Cross-Origin-Opener-Policy', 'same-origin')
|
|
44
44
|
res.setHeader('Access-Control-Allow-Origin', 'https://resource.eziot.com')
|
|
45
45
|
//影响报告
|
|
46
46
|
//res.setHeader('Cross-Origin-Embedder-Policy-Report-Only', 'require-corp')
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).
|
|
2
|
+
|
|
3
|
+
## Available Scripts
|
|
4
|
+
|
|
5
|
+
In the project directory, you can run:
|
|
6
|
+
|
|
7
|
+
### `npm start`
|
|
8
|
+
|
|
9
|
+
Runs the app in the development mode.<br />
|
|
10
|
+
Open [http://localhost:3000](http://localhost:3000) to view it in the browser.
|
|
11
|
+
|
|
12
|
+
The page will reload if you make edits.<br />
|
|
13
|
+
You will also see any lint errors in the console.
|
|
14
|
+
|
|
15
|
+
### `npm test`
|
|
16
|
+
|
|
17
|
+
Launches the test runner in the interactive watch mode.<br />
|
|
18
|
+
See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information.
|
|
19
|
+
|
|
20
|
+
### `npm run build`
|
|
21
|
+
|
|
22
|
+
Builds the app for production to the `build` folder.<br />
|
|
23
|
+
It correctly bundles React in production mode and optimizes the build for the best performance.
|
|
24
|
+
|
|
25
|
+
The build is minified and the filenames include the hashes.<br />
|
|
26
|
+
Your app is ready to be deployed!
|
|
27
|
+
|
|
28
|
+
See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information.
|
|
29
|
+
|
|
30
|
+
### `npm run eject`
|
|
31
|
+
|
|
32
|
+
**Note: this is a one-way operation. Once you `eject`, you can’t go back!**
|
|
33
|
+
|
|
34
|
+
If you aren’t satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project.
|
|
35
|
+
|
|
36
|
+
Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you’re on your own.
|
|
37
|
+
|
|
38
|
+
You don’t have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn’t feel obligated to use this feature. However we understand that this tool wouldn’t be useful if you couldn’t customize it when you are ready for it.
|
|
39
|
+
|
|
40
|
+
## Learn More
|
|
41
|
+
|
|
42
|
+
You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started).
|
|
43
|
+
|
|
44
|
+
To learn React, check out the [React documentation](https://reactjs.org/).
|
|
45
|
+
|
|
46
|
+
### Code Splitting
|
|
47
|
+
|
|
48
|
+
This section has moved here: https://facebook.github.io/create-react-app/docs/code-splitting
|
|
49
|
+
|
|
50
|
+
### Analyzing the Bundle Size
|
|
51
|
+
|
|
52
|
+
This section has moved here: https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size
|
|
53
|
+
|
|
54
|
+
### Making a Progressive Web App
|
|
55
|
+
|
|
56
|
+
This section has moved here: https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app
|
|
57
|
+
|
|
58
|
+
### Advanced Configuration
|
|
59
|
+
|
|
60
|
+
This section has moved here: https://facebook.github.io/create-react-app/docs/advanced-configuration
|
|
61
|
+
|
|
62
|
+
### Deployment
|
|
63
|
+
|
|
64
|
+
This section has moved here: https://facebook.github.io/create-react-app/docs/deployment
|
|
65
|
+
|
|
66
|
+
### `npm run build` fails to minify
|
|
67
|
+
|
|
68
|
+
This section has moved here: https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const fs = require('fs');
|
|
4
|
+
const path = require('path');
|
|
5
|
+
const paths = require('./paths');
|
|
6
|
+
|
|
7
|
+
// Make sure that including paths.js after env.js will read .env variables.
|
|
8
|
+
delete require.cache[require.resolve('./paths')];
|
|
9
|
+
|
|
10
|
+
const NODE_ENV = process.env.NODE_ENV;
|
|
11
|
+
if (!NODE_ENV) {
|
|
12
|
+
throw new Error(
|
|
13
|
+
'The NODE_ENV environment variable is required but was not specified.'
|
|
14
|
+
);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
// https://github.com/bkeepers/dotenv#what-other-env-files-can-i-use
|
|
18
|
+
const dotenvFiles = [
|
|
19
|
+
`${paths.dotenv}.${NODE_ENV}.local`,
|
|
20
|
+
`${paths.dotenv}.${NODE_ENV}`,
|
|
21
|
+
// Don't include `.env.local` for `test` environment
|
|
22
|
+
// since normally you expect tests to produce the same
|
|
23
|
+
// results for everyone
|
|
24
|
+
NODE_ENV !== 'test' && `${paths.dotenv}.local`,
|
|
25
|
+
paths.dotenv,
|
|
26
|
+
].filter(Boolean);
|
|
27
|
+
|
|
28
|
+
// Load environment variables from .env* files. Suppress warnings using silent
|
|
29
|
+
// if this file is missing. dotenv will never modify any environment variables
|
|
30
|
+
// that have already been set. Variable expansion is supported in .env files.
|
|
31
|
+
// https://github.com/motdotla/dotenv
|
|
32
|
+
// https://github.com/motdotla/dotenv-expand
|
|
33
|
+
dotenvFiles.forEach(dotenvFile => {
|
|
34
|
+
if (fs.existsSync(dotenvFile)) {
|
|
35
|
+
require('dotenv-expand')(
|
|
36
|
+
require('dotenv').config({
|
|
37
|
+
path: dotenvFile,
|
|
38
|
+
})
|
|
39
|
+
);
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
// We support resolving modules according to `NODE_PATH`.
|
|
44
|
+
// This lets you use absolute paths in imports inside large monorepos:
|
|
45
|
+
// https://github.com/facebook/create-react-app/issues/253.
|
|
46
|
+
// It works similar to `NODE_PATH` in Node itself:
|
|
47
|
+
// https://nodejs.org/api/modules.html#modules_loading_from_the_global_folders
|
|
48
|
+
// Note that unlike in Node, only *relative* paths from `NODE_PATH` are honored.
|
|
49
|
+
// Otherwise, we risk importing Node.js core modules into an app instead of webpack shims.
|
|
50
|
+
// https://github.com/facebook/create-react-app/issues/1023#issuecomment-265344421
|
|
51
|
+
// We also resolve them to make sure all tools using them work consistently.
|
|
52
|
+
const appDirectory = fs.realpathSync(process.cwd());
|
|
53
|
+
process.env.NODE_PATH = (process.env.NODE_PATH || '')
|
|
54
|
+
.split(path.delimiter)
|
|
55
|
+
.filter(folder => folder && !path.isAbsolute(folder))
|
|
56
|
+
.map(folder => path.resolve(appDirectory, folder))
|
|
57
|
+
.join(path.delimiter);
|
|
58
|
+
|
|
59
|
+
// Grab NODE_ENV and REACT_APP_* environment variables and prepare them to be
|
|
60
|
+
// injected into the application via DefinePlugin in webpack configuration.
|
|
61
|
+
const REACT_APP = /^REACT_APP_/i;
|
|
62
|
+
|
|
63
|
+
function getClientEnvironment(publicUrl) {
|
|
64
|
+
const raw = Object.keys(process.env)
|
|
65
|
+
.filter(key => REACT_APP.test(key))
|
|
66
|
+
.reduce(
|
|
67
|
+
(env, key) => {
|
|
68
|
+
env[key] = process.env[key];
|
|
69
|
+
return env;
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
// Useful for determining whether we’re running in production mode.
|
|
73
|
+
// Most importantly, it switches React into the correct mode.
|
|
74
|
+
NODE_ENV: process.env.NODE_ENV || 'development',
|
|
75
|
+
// Useful for resolving the correct path to static assets in `public`.
|
|
76
|
+
// For example, <img src={process.env.PUBLIC_URL + '/img/logo.png'} />.
|
|
77
|
+
// This should only be used as an escape hatch. Normally you would put
|
|
78
|
+
// images into the `src` and `import` them in code to get their paths.
|
|
79
|
+
PUBLIC_URL: publicUrl,
|
|
80
|
+
// We support configuring the sockjs pathname during development.
|
|
81
|
+
// These settings let a developer run multiple simultaneous projects.
|
|
82
|
+
// They are used as the connection `hostname`, `pathname` and `port`
|
|
83
|
+
// in webpackHotDevClient. They are used as the `sockHost`, `sockPath`
|
|
84
|
+
// and `sockPort` options in webpack-dev-server.
|
|
85
|
+
WDS_SOCKET_HOST: process.env.WDS_SOCKET_HOST,
|
|
86
|
+
WDS_SOCKET_PATH: process.env.WDS_SOCKET_PATH,
|
|
87
|
+
WDS_SOCKET_PORT: process.env.WDS_SOCKET_PORT,
|
|
88
|
+
}
|
|
89
|
+
);
|
|
90
|
+
// Stringify all values so we can feed into webpack DefinePlugin
|
|
91
|
+
const stringified = {
|
|
92
|
+
'process.env': Object.keys(raw).reduce((env, key) => {
|
|
93
|
+
env[key] = JSON.stringify(raw[key]);
|
|
94
|
+
return env;
|
|
95
|
+
}, {}),
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
return { raw, stringified };
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
module.exports = getClientEnvironment;
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const fs = require('fs');
|
|
4
|
+
const path = require('path');
|
|
5
|
+
const crypto = require('crypto');
|
|
6
|
+
const chalk = require('react-dev-utils/chalk');
|
|
7
|
+
const paths = require('./paths');
|
|
8
|
+
|
|
9
|
+
// Ensure the certificate and key provided are valid and if not
|
|
10
|
+
// throw an easy to debug error
|
|
11
|
+
function validateKeyAndCerts({ cert, key, keyFile, crtFile }) {
|
|
12
|
+
let encrypted;
|
|
13
|
+
try {
|
|
14
|
+
// publicEncrypt will throw an error with an invalid cert
|
|
15
|
+
encrypted = crypto.publicEncrypt(cert, Buffer.from('test'));
|
|
16
|
+
} catch (err) {
|
|
17
|
+
throw new Error(
|
|
18
|
+
`The certificate "${chalk.yellow(crtFile)}" is invalid.\n${err.message}`
|
|
19
|
+
);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
try {
|
|
23
|
+
// privateDecrypt will throw an error with an invalid key
|
|
24
|
+
crypto.privateDecrypt(key, encrypted);
|
|
25
|
+
} catch (err) {
|
|
26
|
+
throw new Error(
|
|
27
|
+
`The certificate key "${chalk.yellow(keyFile)}" is invalid.\n${
|
|
28
|
+
err.message
|
|
29
|
+
}`
|
|
30
|
+
);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
// Read file and throw an error if it doesn't exist
|
|
35
|
+
function readEnvFile(file, type) {
|
|
36
|
+
if (!fs.existsSync(file)) {
|
|
37
|
+
throw new Error(
|
|
38
|
+
`You specified ${chalk.cyan(
|
|
39
|
+
type
|
|
40
|
+
)} in your env, but the file "${chalk.yellow(file)}" can't be found.`
|
|
41
|
+
);
|
|
42
|
+
}
|
|
43
|
+
return fs.readFileSync(file);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
// Get the https config
|
|
47
|
+
// Return cert files if provided in env, otherwise just true or false
|
|
48
|
+
function getHttpsConfig() {
|
|
49
|
+
const { SSL_CRT_FILE, SSL_KEY_FILE, HTTPS } = process.env;
|
|
50
|
+
const isHttps = HTTPS === 'true';
|
|
51
|
+
|
|
52
|
+
if (isHttps && SSL_CRT_FILE && SSL_KEY_FILE) {
|
|
53
|
+
const crtFile = path.resolve(paths.appPath, SSL_CRT_FILE);
|
|
54
|
+
const keyFile = path.resolve(paths.appPath, SSL_KEY_FILE);
|
|
55
|
+
const config = {
|
|
56
|
+
cert: readEnvFile(crtFile, 'SSL_CRT_FILE'),
|
|
57
|
+
key: readEnvFile(keyFile, 'SSL_KEY_FILE'),
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
validateKeyAndCerts({ ...config, keyFile, crtFile });
|
|
61
|
+
return config;
|
|
62
|
+
}
|
|
63
|
+
return isHttps;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
module.exports = getHttpsConfig;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
// This is a custom Jest transformer turning style imports into empty objects.
|
|
4
|
+
// http://facebook.github.io/jest/docs/en/webpack.html
|
|
5
|
+
|
|
6
|
+
module.exports = {
|
|
7
|
+
process() {
|
|
8
|
+
return 'module.exports = {};';
|
|
9
|
+
},
|
|
10
|
+
getCacheKey() {
|
|
11
|
+
// The output is always the same.
|
|
12
|
+
return 'cssTransform';
|
|
13
|
+
},
|
|
14
|
+
};
|