easyproctor-hml 0.0.73 → 0.0.74
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/esm/index.js +292 -171
- package/index.js +292 -171
- package/package.json +1 -1
- package/proctoring/proctoring.d.ts +2 -4
- package/proctoring/useProctoring.d.ts +1 -2
- package/unpkg/easyproctor.min.js +34 -24
- package/unpkg/easyproctor.min.js.map +7 -0
package/esm/index.js
CHANGED
|
@@ -20,6 +20,88 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
20
20
|
mod
|
|
21
21
|
));
|
|
22
22
|
|
|
23
|
+
// node_modules/file-saver/dist/FileSaver.min.js
|
|
24
|
+
var require_FileSaver_min = __commonJS({
|
|
25
|
+
"node_modules/file-saver/dist/FileSaver.min.js"(exports, module) {
|
|
26
|
+
(function(a3, b3) {
|
|
27
|
+
if ("function" == typeof define && define.amd)
|
|
28
|
+
define([], b3);
|
|
29
|
+
else if ("undefined" != typeof exports)
|
|
30
|
+
b3();
|
|
31
|
+
else {
|
|
32
|
+
b3(), a3.FileSaver = { exports: {} }.exports;
|
|
33
|
+
}
|
|
34
|
+
})(exports, function() {
|
|
35
|
+
"use strict";
|
|
36
|
+
function b3(a4, b4) {
|
|
37
|
+
return "undefined" == typeof b4 ? b4 = { autoBom: false } : "object" != typeof b4 && (console.warn("Deprecated: Expected third argument to be a object"), b4 = { autoBom: !b4 }), b4.autoBom && /^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(a4.type) ? new Blob(["\uFEFF", a4], { type: a4.type }) : a4;
|
|
38
|
+
}
|
|
39
|
+
function c3(a4, b4, c4) {
|
|
40
|
+
var d4 = new XMLHttpRequest();
|
|
41
|
+
d4.open("GET", a4), d4.responseType = "blob", d4.onload = function() {
|
|
42
|
+
g3(d4.response, b4, c4);
|
|
43
|
+
}, d4.onerror = function() {
|
|
44
|
+
console.error("could not download file");
|
|
45
|
+
}, d4.send();
|
|
46
|
+
}
|
|
47
|
+
function d3(a4) {
|
|
48
|
+
var b4 = new XMLHttpRequest();
|
|
49
|
+
b4.open("HEAD", a4, false);
|
|
50
|
+
try {
|
|
51
|
+
b4.send();
|
|
52
|
+
} catch (a5) {
|
|
53
|
+
}
|
|
54
|
+
return 200 <= b4.status && 299 >= b4.status;
|
|
55
|
+
}
|
|
56
|
+
function e3(a4) {
|
|
57
|
+
try {
|
|
58
|
+
a4.dispatchEvent(new MouseEvent("click"));
|
|
59
|
+
} catch (c4) {
|
|
60
|
+
var b4 = document.createEvent("MouseEvents");
|
|
61
|
+
b4.initMouseEvent("click", true, true, window, 0, 0, 0, 80, 20, false, false, false, false, 0, null), a4.dispatchEvent(b4);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
var f3 = "object" == typeof window && window.window === window ? window : "object" == typeof self && self.self === self ? self : "object" == typeof global && global.global === global ? global : void 0, a3 = f3.navigator && /Macintosh/.test(navigator.userAgent) && /AppleWebKit/.test(navigator.userAgent) && !/Safari/.test(navigator.userAgent), g3 = f3.saveAs || ("object" != typeof window || window !== f3 ? function() {
|
|
65
|
+
} : "download" in HTMLAnchorElement.prototype && !a3 ? function(b4, g4, h3) {
|
|
66
|
+
var i3 = f3.URL || f3.webkitURL, j3 = document.createElement("a");
|
|
67
|
+
g4 = g4 || b4.name || "download", j3.download = g4, j3.rel = "noopener", "string" == typeof b4 ? (j3.href = b4, j3.origin === location.origin ? e3(j3) : d3(j3.href) ? c3(b4, g4, h3) : e3(j3, j3.target = "_blank")) : (j3.href = i3.createObjectURL(b4), setTimeout(function() {
|
|
68
|
+
i3.revokeObjectURL(j3.href);
|
|
69
|
+
}, 4e4), setTimeout(function() {
|
|
70
|
+
e3(j3);
|
|
71
|
+
}, 0));
|
|
72
|
+
} : "msSaveOrOpenBlob" in navigator ? function(f4, g4, h3) {
|
|
73
|
+
if (g4 = g4 || f4.name || "download", "string" != typeof f4)
|
|
74
|
+
navigator.msSaveOrOpenBlob(b3(f4, h3), g4);
|
|
75
|
+
else if (d3(f4))
|
|
76
|
+
c3(f4, g4, h3);
|
|
77
|
+
else {
|
|
78
|
+
var i3 = document.createElement("a");
|
|
79
|
+
i3.href = f4, i3.target = "_blank", setTimeout(function() {
|
|
80
|
+
e3(i3);
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
} : function(b4, d4, e4, g4) {
|
|
84
|
+
if (g4 = g4 || open("", "_blank"), g4 && (g4.document.title = g4.document.body.innerText = "downloading..."), "string" == typeof b4)
|
|
85
|
+
return c3(b4, d4, e4);
|
|
86
|
+
var h3 = "application/octet-stream" === b4.type, i3 = /constructor/i.test(f3.HTMLElement) || f3.safari, j3 = /CriOS\/[\d]+/.test(navigator.userAgent);
|
|
87
|
+
if ((j3 || h3 && i3 || a3) && "undefined" != typeof FileReader) {
|
|
88
|
+
var k3 = new FileReader();
|
|
89
|
+
k3.onloadend = function() {
|
|
90
|
+
var a4 = k3.result;
|
|
91
|
+
a4 = j3 ? a4 : a4.replace(/^data:[^;]*;/, "data:attachment/file;"), g4 ? g4.location.href = a4 : location = a4, g4 = null;
|
|
92
|
+
}, k3.readAsDataURL(b4);
|
|
93
|
+
} else {
|
|
94
|
+
var l3 = f3.URL || f3.webkitURL, m3 = l3.createObjectURL(b4);
|
|
95
|
+
g4 ? g4.location = m3 : location.href = m3, g4 = null, setTimeout(function() {
|
|
96
|
+
l3.revokeObjectURL(m3);
|
|
97
|
+
}, 4e4);
|
|
98
|
+
}
|
|
99
|
+
});
|
|
100
|
+
f3.saveAs = g3.saveAs = g3, "undefined" != typeof module && (module.exports = g3);
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
});
|
|
104
|
+
|
|
23
105
|
// src/plugins/mp3.js
|
|
24
106
|
var require_mp3 = __commonJS({
|
|
25
107
|
"src/plugins/mp3.js"(exports, module) {
|
|
@@ -15052,88 +15134,6 @@ var require_mp3 = __commonJS({
|
|
|
15052
15134
|
}
|
|
15053
15135
|
});
|
|
15054
15136
|
|
|
15055
|
-
// node_modules/file-saver/dist/FileSaver.min.js
|
|
15056
|
-
var require_FileSaver_min = __commonJS({
|
|
15057
|
-
"node_modules/file-saver/dist/FileSaver.min.js"(exports, module) {
|
|
15058
|
-
(function(a3, b3) {
|
|
15059
|
-
if ("function" == typeof define && define.amd)
|
|
15060
|
-
define([], b3);
|
|
15061
|
-
else if ("undefined" != typeof exports)
|
|
15062
|
-
b3();
|
|
15063
|
-
else {
|
|
15064
|
-
b3(), a3.FileSaver = { exports: {} }.exports;
|
|
15065
|
-
}
|
|
15066
|
-
})(exports, function() {
|
|
15067
|
-
"use strict";
|
|
15068
|
-
function b3(a4, b4) {
|
|
15069
|
-
return "undefined" == typeof b4 ? b4 = { autoBom: false } : "object" != typeof b4 && (console.warn("Deprecated: Expected third argument to be a object"), b4 = { autoBom: !b4 }), b4.autoBom && /^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(a4.type) ? new Blob(["\uFEFF", a4], { type: a4.type }) : a4;
|
|
15070
|
-
}
|
|
15071
|
-
function c3(a4, b4, c4) {
|
|
15072
|
-
var d4 = new XMLHttpRequest();
|
|
15073
|
-
d4.open("GET", a4), d4.responseType = "blob", d4.onload = function() {
|
|
15074
|
-
g3(d4.response, b4, c4);
|
|
15075
|
-
}, d4.onerror = function() {
|
|
15076
|
-
console.error("could not download file");
|
|
15077
|
-
}, d4.send();
|
|
15078
|
-
}
|
|
15079
|
-
function d3(a4) {
|
|
15080
|
-
var b4 = new XMLHttpRequest();
|
|
15081
|
-
b4.open("HEAD", a4, false);
|
|
15082
|
-
try {
|
|
15083
|
-
b4.send();
|
|
15084
|
-
} catch (a5) {
|
|
15085
|
-
}
|
|
15086
|
-
return 200 <= b4.status && 299 >= b4.status;
|
|
15087
|
-
}
|
|
15088
|
-
function e3(a4) {
|
|
15089
|
-
try {
|
|
15090
|
-
a4.dispatchEvent(new MouseEvent("click"));
|
|
15091
|
-
} catch (c4) {
|
|
15092
|
-
var b4 = document.createEvent("MouseEvents");
|
|
15093
|
-
b4.initMouseEvent("click", true, true, window, 0, 0, 0, 80, 20, false, false, false, false, 0, null), a4.dispatchEvent(b4);
|
|
15094
|
-
}
|
|
15095
|
-
}
|
|
15096
|
-
var f3 = "object" == typeof window && window.window === window ? window : "object" == typeof self && self.self === self ? self : "object" == typeof global && global.global === global ? global : void 0, a3 = f3.navigator && /Macintosh/.test(navigator.userAgent) && /AppleWebKit/.test(navigator.userAgent) && !/Safari/.test(navigator.userAgent), g3 = f3.saveAs || ("object" != typeof window || window !== f3 ? function() {
|
|
15097
|
-
} : "download" in HTMLAnchorElement.prototype && !a3 ? function(b4, g4, h3) {
|
|
15098
|
-
var i3 = f3.URL || f3.webkitURL, j3 = document.createElement("a");
|
|
15099
|
-
g4 = g4 || b4.name || "download", j3.download = g4, j3.rel = "noopener", "string" == typeof b4 ? (j3.href = b4, j3.origin === location.origin ? e3(j3) : d3(j3.href) ? c3(b4, g4, h3) : e3(j3, j3.target = "_blank")) : (j3.href = i3.createObjectURL(b4), setTimeout(function() {
|
|
15100
|
-
i3.revokeObjectURL(j3.href);
|
|
15101
|
-
}, 4e4), setTimeout(function() {
|
|
15102
|
-
e3(j3);
|
|
15103
|
-
}, 0));
|
|
15104
|
-
} : "msSaveOrOpenBlob" in navigator ? function(f4, g4, h3) {
|
|
15105
|
-
if (g4 = g4 || f4.name || "download", "string" != typeof f4)
|
|
15106
|
-
navigator.msSaveOrOpenBlob(b3(f4, h3), g4);
|
|
15107
|
-
else if (d3(f4))
|
|
15108
|
-
c3(f4, g4, h3);
|
|
15109
|
-
else {
|
|
15110
|
-
var i3 = document.createElement("a");
|
|
15111
|
-
i3.href = f4, i3.target = "_blank", setTimeout(function() {
|
|
15112
|
-
e3(i3);
|
|
15113
|
-
});
|
|
15114
|
-
}
|
|
15115
|
-
} : function(b4, d4, e4, g4) {
|
|
15116
|
-
if (g4 = g4 || open("", "_blank"), g4 && (g4.document.title = g4.document.body.innerText = "downloading..."), "string" == typeof b4)
|
|
15117
|
-
return c3(b4, d4, e4);
|
|
15118
|
-
var h3 = "application/octet-stream" === b4.type, i3 = /constructor/i.test(f3.HTMLElement) || f3.safari, j3 = /CriOS\/[\d]+/.test(navigator.userAgent);
|
|
15119
|
-
if ((j3 || h3 && i3 || a3) && "undefined" != typeof FileReader) {
|
|
15120
|
-
var k3 = new FileReader();
|
|
15121
|
-
k3.onloadend = function() {
|
|
15122
|
-
var a4 = k3.result;
|
|
15123
|
-
a4 = j3 ? a4 : a4.replace(/^data:[^;]*;/, "data:attachment/file;"), g4 ? g4.location.href = a4 : location = a4, g4 = null;
|
|
15124
|
-
}, k3.readAsDataURL(b4);
|
|
15125
|
-
} else {
|
|
15126
|
-
var l3 = f3.URL || f3.webkitURL, m3 = l3.createObjectURL(b4);
|
|
15127
|
-
g4 ? g4.location = m3 : location.href = m3, g4 = null, setTimeout(function() {
|
|
15128
|
-
l3.revokeObjectURL(m3);
|
|
15129
|
-
}, 4e4);
|
|
15130
|
-
}
|
|
15131
|
-
});
|
|
15132
|
-
f3.saveAs = g3.saveAs = g3, "undefined" != typeof module && (module.exports = g3);
|
|
15133
|
-
});
|
|
15134
|
-
}
|
|
15135
|
-
});
|
|
15136
|
-
|
|
15137
15137
|
// src/modules/checkPermissions.ts
|
|
15138
15138
|
async function checkPermissions() {
|
|
15139
15139
|
try {
|
|
@@ -23596,6 +23596,26 @@ var onChangeDevices = class {
|
|
|
23596
23596
|
}
|
|
23597
23597
|
};
|
|
23598
23598
|
|
|
23599
|
+
// src/new-flow/download/downloadService.ts
|
|
23600
|
+
var import_file_saver = __toESM(require_FileSaver_min());
|
|
23601
|
+
var DownloadService = class {
|
|
23602
|
+
constructor(proctoringId) {
|
|
23603
|
+
this.loadingBoolean = true;
|
|
23604
|
+
this.proctoringId = proctoringId;
|
|
23605
|
+
}
|
|
23606
|
+
async upload(data, token) {
|
|
23607
|
+
try {
|
|
23608
|
+
const { file, onProgress } = data;
|
|
23609
|
+
(0, import_file_saver.saveAs)(file);
|
|
23610
|
+
this.loadingBoolean = false;
|
|
23611
|
+
clearInterval(this.loadingInterval);
|
|
23612
|
+
onProgress && onProgress(Math.round(100));
|
|
23613
|
+
} catch (err) {
|
|
23614
|
+
throw new Error(`Error on machine download`);
|
|
23615
|
+
}
|
|
23616
|
+
}
|
|
23617
|
+
};
|
|
23618
|
+
|
|
23599
23619
|
// src/new-flow/proctoring/ProctoringRecorder.ts
|
|
23600
23620
|
var ProctoringRecorder = class {
|
|
23601
23621
|
constructor(session, recorders) {
|
|
@@ -23633,6 +23653,91 @@ var ProctoringRecorder = class {
|
|
|
23633
23653
|
}
|
|
23634
23654
|
};
|
|
23635
23655
|
|
|
23656
|
+
// src/new-flow/proctoring/ProctoringUploader.ts
|
|
23657
|
+
var ProctoringUploader = class {
|
|
23658
|
+
constructor(session, proctoringId, uploadServices) {
|
|
23659
|
+
this.session = session;
|
|
23660
|
+
this.proctoringId = proctoringId;
|
|
23661
|
+
this.uploadServices = uploadServices;
|
|
23662
|
+
}
|
|
23663
|
+
async upload(token, progress) {
|
|
23664
|
+
await this.uploadRecordings(token, progress);
|
|
23665
|
+
}
|
|
23666
|
+
async uploadRecordings(token, onProgress) {
|
|
23667
|
+
await this.uploadAllFiles(token, onProgress);
|
|
23668
|
+
if (!this.session.hasSomethingToUpload) {
|
|
23669
|
+
this.session.setUploaded();
|
|
23670
|
+
}
|
|
23671
|
+
}
|
|
23672
|
+
async uploadAllFiles(token, globalOnProgres) {
|
|
23673
|
+
for (let i3 = 0; i3 < this.session.recordings.length; i3++) {
|
|
23674
|
+
const rec = this.session.recordings[i3];
|
|
23675
|
+
if (rec.upload) {
|
|
23676
|
+
continue;
|
|
23677
|
+
}
|
|
23678
|
+
const onProgress = (percentage) => {
|
|
23679
|
+
const relativePercentage = (i3 * 100 + percentage) / this.session.recordings.length;
|
|
23680
|
+
if (globalOnProgres) {
|
|
23681
|
+
globalOnProgres(relativePercentage);
|
|
23682
|
+
}
|
|
23683
|
+
};
|
|
23684
|
+
const result = await this.uploadFile(rec, token, onProgress).catch(
|
|
23685
|
+
() => void 0
|
|
23686
|
+
);
|
|
23687
|
+
if (result) {
|
|
23688
|
+
if (!rec.upload) {
|
|
23689
|
+
rec.upload = {
|
|
23690
|
+
storage: "upload" /* none */,
|
|
23691
|
+
awsUrl: "",
|
|
23692
|
+
azureUrl: ""
|
|
23693
|
+
};
|
|
23694
|
+
}
|
|
23695
|
+
if (result.uploaded) {
|
|
23696
|
+
rec.upload.storage = result.storage;
|
|
23697
|
+
}
|
|
23698
|
+
if (result.storage === "upload" /* none */) {
|
|
23699
|
+
result.url && (rec.upload.azureUrl = result.url);
|
|
23700
|
+
} else {
|
|
23701
|
+
result.url && (rec.upload.awsUrl = result.url);
|
|
23702
|
+
}
|
|
23703
|
+
}
|
|
23704
|
+
}
|
|
23705
|
+
if (globalOnProgres) {
|
|
23706
|
+
globalOnProgres(100);
|
|
23707
|
+
}
|
|
23708
|
+
}
|
|
23709
|
+
async uploadFile(rec, token, onProgress) {
|
|
23710
|
+
for await (const uploadService of this.uploadServices) {
|
|
23711
|
+
const result = await uploadService.upload(
|
|
23712
|
+
{
|
|
23713
|
+
file: rec.file,
|
|
23714
|
+
onProgress: (progress) => {
|
|
23715
|
+
if (onProgress)
|
|
23716
|
+
onProgress(progress);
|
|
23717
|
+
}
|
|
23718
|
+
},
|
|
23719
|
+
token
|
|
23720
|
+
);
|
|
23721
|
+
if (result) {
|
|
23722
|
+
let fileType = "";
|
|
23723
|
+
if (rec.file.name.search("camera") !== -1) {
|
|
23724
|
+
fileType = "Camera";
|
|
23725
|
+
} else if (rec.file.name.search("screen") !== -1) {
|
|
23726
|
+
fileType = "Screen";
|
|
23727
|
+
} else if (rec.file.name.search("audio") !== -1) {
|
|
23728
|
+
fileType = "Audio";
|
|
23729
|
+
}
|
|
23730
|
+
trackers.registerUploadFile(this.proctoringId, `Upload File
|
|
23731
|
+
Name: ${rec.file.name}
|
|
23732
|
+
Type: ${rec.file.type}
|
|
23733
|
+
Size: ${rec.file.size}`, fileType);
|
|
23734
|
+
return result;
|
|
23735
|
+
}
|
|
23736
|
+
}
|
|
23737
|
+
throw new Error("Could not upload");
|
|
23738
|
+
}
|
|
23739
|
+
};
|
|
23740
|
+
|
|
23636
23741
|
// src/new-flow/recorders/AlertRecorder.ts
|
|
23637
23742
|
var AlertRecorder = class {
|
|
23638
23743
|
constructor(options, optionsProctoring, cameraRecorder) {
|
|
@@ -26439,7 +26544,6 @@ var Auth = class {
|
|
|
26439
26544
|
};
|
|
26440
26545
|
|
|
26441
26546
|
// src/proctoring/proctoring.ts
|
|
26442
|
-
var import_file_saver = __toESM(require_FileSaver_min());
|
|
26443
26547
|
var Proctoring = class {
|
|
26444
26548
|
constructor(context) {
|
|
26445
26549
|
this.context = context;
|
|
@@ -26486,6 +26590,7 @@ var Proctoring = class {
|
|
|
26486
26590
|
type: context.type || "prod",
|
|
26487
26591
|
token: context.token
|
|
26488
26592
|
});
|
|
26593
|
+
this.repository = new IndexDbSessionRepository("EasyProctorDb", "exams2");
|
|
26489
26594
|
this.repositoryDevices = new IndexDbSessionRepository("EasyProctorDbDevices", "devices");
|
|
26490
26595
|
((_a2 = this.context.credentials) == null ? void 0 : _a2.cpf) && (this.auth = new Auth(this.context.credentials.cpf, this.backend));
|
|
26491
26596
|
}
|
|
@@ -26570,7 +26675,6 @@ var Proctoring = class {
|
|
|
26570
26675
|
} else {
|
|
26571
26676
|
recorders.push(audioRecorder);
|
|
26572
26677
|
}
|
|
26573
|
-
console.log("CRIANDO RECORDER");
|
|
26574
26678
|
this.recorder = new ProctoringRecorder(this.proctoringSession, recorders);
|
|
26575
26679
|
return { cameraRecorder, audioRecorder, screenRecorder, alertRecorder, noiseRecorder };
|
|
26576
26680
|
}
|
|
@@ -26599,18 +26703,38 @@ var Proctoring = class {
|
|
|
26599
26703
|
throw PROCTORING_ALREADY_STARTED;
|
|
26600
26704
|
}
|
|
26601
26705
|
this.state = "Starting" /* Starting */;
|
|
26706
|
+
if (await this.repository.hasSessions()) {
|
|
26707
|
+
await this.repository.clear();
|
|
26708
|
+
}
|
|
26709
|
+
this.proctoringSession = new ProctoringSession();
|
|
26602
26710
|
this.allRecorders = this.createRecorders(this.sessionOptions);
|
|
26603
26711
|
await this.recorder.startAll();
|
|
26604
|
-
|
|
26712
|
+
const startResponse = await this.backend.confirmStart(
|
|
26713
|
+
{
|
|
26714
|
+
clientId: this.context.clientId,
|
|
26715
|
+
examId: this.context.examId,
|
|
26716
|
+
token: this.context.token
|
|
26717
|
+
},
|
|
26718
|
+
this.sessionOptions.proctoringType,
|
|
26719
|
+
this.geolocation ? this.geolocation.coords.latitude : void 0,
|
|
26720
|
+
this.geolocation ? this.geolocation.coords.longitude : void 0
|
|
26721
|
+
);
|
|
26722
|
+
this.proctoringId = startResponse.id;
|
|
26605
26723
|
this.allRecorders.cameraRecorder.setProctoringId(this.proctoringId);
|
|
26606
26724
|
this.allRecorders.noiseRecorder.setProctoringId(this.proctoringId);
|
|
26607
26725
|
this.proctoringSession.setProctoringId(this.proctoringId);
|
|
26726
|
+
await this.repository.save(this.proctoringSession);
|
|
26608
26727
|
const _navigator = {};
|
|
26609
26728
|
for (const i3 in navigator)
|
|
26610
26729
|
_navigator[i3] = navigator[i3];
|
|
26611
26730
|
trackers.registerStart(this.proctoringId, true, `Version: ${versionVerify()}
|
|
26612
26731
|
Navigator: ${JSON.stringify(_navigator)}`);
|
|
26732
|
+
startResponse.cameraStream = this.allRecorders.cameraRecorder.cameraStream;
|
|
26733
|
+
if (this.allRecorders.screenRecorder) {
|
|
26734
|
+
startResponse.screenStream = this.allRecorders.screenRecorder.screenStream;
|
|
26735
|
+
}
|
|
26613
26736
|
this.state = "Recording" /* Recording */;
|
|
26737
|
+
return startResponse;
|
|
26614
26738
|
} catch (error) {
|
|
26615
26739
|
await this.cancel();
|
|
26616
26740
|
this.proctoringId && trackers.registerStart(this.proctoringId, false, `Token: ${this.context.token}
|
|
@@ -26635,6 +26759,86 @@ Error: ${error}`);
|
|
|
26635
26759
|
}
|
|
26636
26760
|
await this.recorder.stopAll();
|
|
26637
26761
|
await this.recorder.saveAllOnSession();
|
|
26762
|
+
await this.repository.save(this.proctoringSession);
|
|
26763
|
+
let uploader;
|
|
26764
|
+
let uploaderServices;
|
|
26765
|
+
if (versionVerify() !== "1.0.0.0") {
|
|
26766
|
+
uploader = new ProctoringUploader(this.proctoringSession, this.proctoringId, [
|
|
26767
|
+
new DownloadService(this.proctoringId)
|
|
26768
|
+
]);
|
|
26769
|
+
uploaderServices = "Download";
|
|
26770
|
+
this.serviceType = "Download" /* Download */;
|
|
26771
|
+
} else {
|
|
26772
|
+
uploader = new ProctoringUploader(this.proctoringSession, this.proctoringId, [
|
|
26773
|
+
new UploadService(this.proctoringId, this.backend),
|
|
26774
|
+
new DownloadService(this.proctoringId)
|
|
26775
|
+
]);
|
|
26776
|
+
uploaderServices = "Upload";
|
|
26777
|
+
this.serviceType = "Upload" /* Upload */;
|
|
26778
|
+
}
|
|
26779
|
+
let extensionSuccess = false;
|
|
26780
|
+
if (this.extension.hasExtension) {
|
|
26781
|
+
await this.extension.start().then((response) => {
|
|
26782
|
+
extensionSuccess = response;
|
|
26783
|
+
}).catch((error) => {
|
|
26784
|
+
extensionSuccess = false;
|
|
26785
|
+
});
|
|
26786
|
+
}
|
|
26787
|
+
if (!extensionSuccess || !this.extension.hasExtension) {
|
|
26788
|
+
await uploader.upload(this.context.token, options.onProgress).catch(async (error) => {
|
|
26789
|
+
trackers.registerUpload(
|
|
26790
|
+
this.proctoringSession.id,
|
|
26791
|
+
false,
|
|
26792
|
+
`upload error: ${error}
|
|
26793
|
+
|
|
26794
|
+
Upload Services: ${uploaderServices}`,
|
|
26795
|
+
this.serviceType
|
|
26796
|
+
);
|
|
26797
|
+
if (versionVerify() !== "1.0.0.0") {
|
|
26798
|
+
uploader = new ProctoringUploader(this.proctoringSession, this.proctoringId, [
|
|
26799
|
+
new UploadService(this.proctoringId, this.backend),
|
|
26800
|
+
new DownloadService(this.proctoringId)
|
|
26801
|
+
]);
|
|
26802
|
+
uploaderServices = "Upload";
|
|
26803
|
+
this.serviceType = "Upload" /* Upload */;
|
|
26804
|
+
await uploader.upload(this.context.token, options.onProgress).catch((error2) => {
|
|
26805
|
+
trackers.registerUpload(
|
|
26806
|
+
this.proctoringSession.id,
|
|
26807
|
+
false,
|
|
26808
|
+
`upload backup error: ${error2}
|
|
26809
|
+
|
|
26810
|
+
Upload Services: ${uploaderServices}
|
|
26811
|
+
Upload backup for Safe Browser`,
|
|
26812
|
+
this.serviceType
|
|
26813
|
+
);
|
|
26814
|
+
});
|
|
26815
|
+
}
|
|
26816
|
+
});
|
|
26817
|
+
trackers.registerUpload(
|
|
26818
|
+
this.proctoringSession.id,
|
|
26819
|
+
true,
|
|
26820
|
+
`upload success
|
|
26821
|
+
|
|
26822
|
+
Upload Services: ${uploaderServices}`,
|
|
26823
|
+
this.serviceType
|
|
26824
|
+
);
|
|
26825
|
+
}
|
|
26826
|
+
await this.backend.saveScreenAlerts(this.context, this.proctoringSession).catch((err) => {
|
|
26827
|
+
trackers.registerFinish(
|
|
26828
|
+
this.proctoringSession.id,
|
|
26829
|
+
false,
|
|
26830
|
+
"save-screen error: " + err
|
|
26831
|
+
);
|
|
26832
|
+
});
|
|
26833
|
+
await this.backend.finishAndSendUrls(this.context, this.proctoringSession).then(() => {
|
|
26834
|
+
trackers.registerFinish(this.proctoringSession.id, true, "");
|
|
26835
|
+
}).catch((error) => {
|
|
26836
|
+
trackers.registerFinish(
|
|
26837
|
+
this.proctoringSession.id,
|
|
26838
|
+
false,
|
|
26839
|
+
"finish error: " + error
|
|
26840
|
+
);
|
|
26841
|
+
});
|
|
26638
26842
|
this.state = "Stop" /* Stop */;
|
|
26639
26843
|
} catch (error) {
|
|
26640
26844
|
await this.cancel();
|
|
@@ -26656,89 +26860,6 @@ Error: ` + error);
|
|
|
26656
26860
|
}
|
|
26657
26861
|
}
|
|
26658
26862
|
}
|
|
26659
|
-
async finishDownload() {
|
|
26660
|
-
await this.finish();
|
|
26661
|
-
console.log("teste separado 1");
|
|
26662
|
-
const url = URL.createObjectURL(this.fileTest);
|
|
26663
|
-
console.log("url:" + url);
|
|
26664
|
-
const a3 = document.createElement("a");
|
|
26665
|
-
document.body.appendChild(a3);
|
|
26666
|
-
a3.style.display = "none";
|
|
26667
|
-
a3.href = url;
|
|
26668
|
-
a3.download = this.fileTest.name;
|
|
26669
|
-
a3.click();
|
|
26670
|
-
window.URL.revokeObjectURL(url);
|
|
26671
|
-
console.log("teste separado 2");
|
|
26672
|
-
const file = new File(["foo"], "file2.txt", {
|
|
26673
|
-
type: "text/plain"
|
|
26674
|
-
});
|
|
26675
|
-
const url2 = URL.createObjectURL(file);
|
|
26676
|
-
console.log("url:" + url2);
|
|
26677
|
-
const b3 = document.createElement("a");
|
|
26678
|
-
document.body.appendChild(b3);
|
|
26679
|
-
b3.style.display = "none";
|
|
26680
|
-
b3.href = url2;
|
|
26681
|
-
b3.download = file.name;
|
|
26682
|
-
b3.click();
|
|
26683
|
-
b3.remove();
|
|
26684
|
-
window.URL.revokeObjectURL(url2);
|
|
26685
|
-
import_file_saver.default.saveAs(file, "filesaver.txt");
|
|
26686
|
-
console.log("Length:" + this.proctoringSession.recordings.length);
|
|
26687
|
-
for (let i3 = 0; i3 < this.proctoringSession.recordings.length; i3++) {
|
|
26688
|
-
console.log("baixando " + this.proctoringSession.recordings[i3].device);
|
|
26689
|
-
this.state = "Stop" /* Stop */;
|
|
26690
|
-
const file2 = this.proctoringSession.recordings[i3].file;
|
|
26691
|
-
import_file_saver.default.saveAs(file2, file2.name);
|
|
26692
|
-
console.log("revokeObjectURL " + this.proctoringSession.recordings[i3].device);
|
|
26693
|
-
setTimeout(function() {
|
|
26694
|
-
window.URL.revokeObjectURL(url2);
|
|
26695
|
-
}, 0);
|
|
26696
|
-
}
|
|
26697
|
-
for (let i3 = 0; i3 < this.proctoringSession.recordings.length; i3++) {
|
|
26698
|
-
console.log("baixando " + this.proctoringSession.recordings[i3].device);
|
|
26699
|
-
this.state = "Stop" /* Stop */;
|
|
26700
|
-
const currentFile = this.proctoringSession.recordings[i3].file;
|
|
26701
|
-
const file2 = new File([currentFile], currentFile.name);
|
|
26702
|
-
import_file_saver.default.saveAs(file2, file2.name);
|
|
26703
|
-
console.log("revokeObjectURL " + this.proctoringSession.recordings[i3].device);
|
|
26704
|
-
setTimeout(function() {
|
|
26705
|
-
window.URL.revokeObjectURL(url2);
|
|
26706
|
-
}, 0);
|
|
26707
|
-
}
|
|
26708
|
-
}
|
|
26709
|
-
async download() {
|
|
26710
|
-
const file = new File(["foo"], "file.txt", {
|
|
26711
|
-
type: "text/plain"
|
|
26712
|
-
});
|
|
26713
|
-
this.fileTest = new File(["foo"], "fileTest.txt", {
|
|
26714
|
-
type: "text/plain"
|
|
26715
|
-
});
|
|
26716
|
-
this.proctoringSession = new ProctoringSession();
|
|
26717
|
-
this.proctoringSession.addRecording(
|
|
26718
|
-
{
|
|
26719
|
-
device: `teste txt`,
|
|
26720
|
-
file,
|
|
26721
|
-
origin: "Camera" /* Camera */
|
|
26722
|
-
}
|
|
26723
|
-
);
|
|
26724
|
-
await this.start(
|
|
26725
|
-
{
|
|
26726
|
-
cameraId: "default",
|
|
26727
|
-
microphoneId: "default",
|
|
26728
|
-
allowMultipleMonitors: true,
|
|
26729
|
-
allowOnlyFirstMonitor: false,
|
|
26730
|
-
captureScreen: false,
|
|
26731
|
-
proctoringType: "VIDEO",
|
|
26732
|
-
onBufferSizeError: true,
|
|
26733
|
-
useGeolocation: true,
|
|
26734
|
-
insights: ""
|
|
26735
|
-
},
|
|
26736
|
-
{ width: 1280, height: 720, minWidth: 1280, minHeight: 720 }
|
|
26737
|
-
);
|
|
26738
|
-
setTimeout(() => {
|
|
26739
|
-
this.finishDownload();
|
|
26740
|
-
}, 5e3);
|
|
26741
|
-
}
|
|
26742
26863
|
async verifyBrowser() {
|
|
26743
26864
|
const browserName = await fnBrowserDetect();
|
|
26744
26865
|
if (browserName !== "chrome" && browserName !== "firefox") {
|
|
@@ -26799,6 +26920,7 @@ Error: ` + error);
|
|
|
26799
26920
|
}
|
|
26800
26921
|
await this.recorder.stopAll();
|
|
26801
26922
|
await this.recorder.saveAllOnSession();
|
|
26923
|
+
await this.repository.save(this.proctoringSession);
|
|
26802
26924
|
this.state = "Paused" /* Paused */;
|
|
26803
26925
|
}
|
|
26804
26926
|
async resume() {
|
|
@@ -26810,6 +26932,7 @@ Error: ` + error);
|
|
|
26810
26932
|
await this.verifyMultipleMonitors(this.sessionOptions);
|
|
26811
26933
|
await this.recorder.startAll();
|
|
26812
26934
|
this.proctoringSession.recordings = [];
|
|
26935
|
+
await this.repository.save(this.proctoringSession);
|
|
26813
26936
|
this.state = "Recording" /* Recording */;
|
|
26814
26937
|
return {
|
|
26815
26938
|
cameraStream: this.allRecorders.cameraRecorder.cameraStream,
|
|
@@ -26848,7 +26971,6 @@ function useProctoring(proctoringOptions, enviromentConfig = "prod") {
|
|
|
26848
26971
|
const onRealtimeAlerts = proctoring.onRealtimeAlerts.bind(proctoring);
|
|
26849
26972
|
const checkDevices = checker.checkDevices.bind(checker);
|
|
26850
26973
|
const capturePhoto = photo.takePicture.bind(photo);
|
|
26851
|
-
const download = proctoring.download.bind(proctoring);
|
|
26852
26974
|
return {
|
|
26853
26975
|
login,
|
|
26854
26976
|
start,
|
|
@@ -26865,8 +26987,7 @@ function useProctoring(proctoringOptions, enviromentConfig = "prod") {
|
|
|
26865
26987
|
enumarateDevices,
|
|
26866
26988
|
checkPermissions,
|
|
26867
26989
|
checkIfhasMultipleMonitors,
|
|
26868
|
-
onStopSharingScreen
|
|
26869
|
-
download
|
|
26990
|
+
onStopSharingScreen
|
|
26870
26991
|
};
|
|
26871
26992
|
}
|
|
26872
26993
|
|