easyproctor 0.0.74 → 0.0.76
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/README.md +2 -2
- package/esm/index.js +53 -23
- package/index.js +53 -23
- package/package.json +1 -1
- package/unpkg/easyproctor.min.js +19 -17
package/README.md
CHANGED
package/esm/index.js
CHANGED
|
@@ -28561,6 +28561,8 @@ var containerName = "";
|
|
|
28561
28561
|
var sas = "";
|
|
28562
28562
|
var blobServiceClient;
|
|
28563
28563
|
var message = "";
|
|
28564
|
+
var loadingInterval;
|
|
28565
|
+
var loadingBoolean = true;
|
|
28564
28566
|
async function setConfiguration(_account, _cointainerName, _sas) {
|
|
28565
28567
|
account = _account;
|
|
28566
28568
|
containerName = _cointainerName;
|
|
@@ -28648,6 +28650,32 @@ async function uploadBackup(data, config2, proctoringToken) {
|
|
|
28648
28650
|
} catch (err) {
|
|
28649
28651
|
message += "\n\u2022 Error on AWS upload\n ";
|
|
28650
28652
|
message += err;
|
|
28653
|
+
try {
|
|
28654
|
+
download(data);
|
|
28655
|
+
} catch (err2) {
|
|
28656
|
+
throw err2;
|
|
28657
|
+
}
|
|
28658
|
+
throw err;
|
|
28659
|
+
}
|
|
28660
|
+
}
|
|
28661
|
+
function download(data) {
|
|
28662
|
+
try {
|
|
28663
|
+
const { file, onProgress } = data;
|
|
28664
|
+
const url = URL.createObjectURL(file);
|
|
28665
|
+
const a = document.createElement("a");
|
|
28666
|
+
document.body.appendChild(a);
|
|
28667
|
+
a.style.display = "none";
|
|
28668
|
+
a.href = url;
|
|
28669
|
+
a.download = file.name;
|
|
28670
|
+
a.click();
|
|
28671
|
+
window.URL.revokeObjectURL(url);
|
|
28672
|
+
loadingBoolean = false;
|
|
28673
|
+
clearInterval(loadingInterval);
|
|
28674
|
+
onProgress && onProgress(Math.round(100));
|
|
28675
|
+
} catch (err) {
|
|
28676
|
+
message += `
|
|
28677
|
+
\u2022 Error on machine download -> ${data.file.name}
|
|
28678
|
+
`;
|
|
28651
28679
|
throw err;
|
|
28652
28680
|
}
|
|
28653
28681
|
}
|
|
@@ -28774,7 +28802,7 @@ function useProctoring(proctoringOptions, homolConfig = false) {
|
|
|
28774
28802
|
if (!navigator.mediaDevices.getDisplayMedia || !window.indexedDB) {
|
|
28775
28803
|
throw INCOMPATIBLE_NAVIGATOR;
|
|
28776
28804
|
}
|
|
28777
|
-
function
|
|
28805
|
+
function download2(file) {
|
|
28778
28806
|
const url = URL.createObjectURL(file);
|
|
28779
28807
|
const a = document.createElement("a");
|
|
28780
28808
|
document.body.appendChild(a);
|
|
@@ -29213,34 +29241,36 @@ function useProctoring(proctoringOptions, homolConfig = false) {
|
|
|
29213
29241
|
try {
|
|
29214
29242
|
trackers.registerUploadVideo(proctoringId, true, "Starting download");
|
|
29215
29243
|
allFiles.map((c) => {
|
|
29216
|
-
|
|
29244
|
+
download2(c);
|
|
29217
29245
|
});
|
|
29246
|
+
onProgress && onProgress(Math.round(100));
|
|
29218
29247
|
trackers.registerUploadVideo(proctoringId, true, "Finish download");
|
|
29219
29248
|
} catch (error) {
|
|
29220
29249
|
console.log("Enviando tracker de error");
|
|
29221
29250
|
trackers.registerUploadVideo(proctoringId, false, "erro no download " + error);
|
|
29222
29251
|
}
|
|
29223
|
-
}
|
|
29224
|
-
|
|
29225
|
-
|
|
29226
|
-
|
|
29227
|
-
|
|
29228
|
-
|
|
29229
|
-
|
|
29230
|
-
|
|
29231
|
-
|
|
29232
|
-
|
|
29233
|
-
|
|
29234
|
-
|
|
29235
|
-
|
|
29236
|
-
|
|
29237
|
-
|
|
29238
|
-
|
|
29239
|
-
|
|
29240
|
-
|
|
29241
|
-
|
|
29242
|
-
|
|
29243
|
-
|
|
29252
|
+
} else {
|
|
29253
|
+
try {
|
|
29254
|
+
trackers.registerUploadVideo(proctoringId, true, "Starting upload");
|
|
29255
|
+
const timeBefore = performance.now();
|
|
29256
|
+
const uploadPromises = allFiles.map((c, i) => {
|
|
29257
|
+
return upload({
|
|
29258
|
+
file: c,
|
|
29259
|
+
onProgress: (progress) => {
|
|
29260
|
+
uploadProgress[i] = progress;
|
|
29261
|
+
handleOnProgress();
|
|
29262
|
+
}
|
|
29263
|
+
}, proctoringId, config, proctoringOptions.token);
|
|
29264
|
+
});
|
|
29265
|
+
const timeAfter = performance.now();
|
|
29266
|
+
await Promise.all(uploadPromises);
|
|
29267
|
+
const executionTime = timeAfter - timeBefore;
|
|
29268
|
+
onProgress && onProgress(Math.round(100));
|
|
29269
|
+
trackers.registerUploadVideo(proctoringId, true, "Finish upload", executionTime);
|
|
29270
|
+
} catch (error) {
|
|
29271
|
+
console.log("Enviando tracker de error");
|
|
29272
|
+
trackers.registerUploadVideo(proctoringId, false, "" + error);
|
|
29273
|
+
}
|
|
29244
29274
|
}
|
|
29245
29275
|
await clearBuffers("exams");
|
|
29246
29276
|
cameraBuffer = [];
|
package/index.js
CHANGED
|
@@ -40082,6 +40082,8 @@ var containerName = "";
|
|
|
40082
40082
|
var sas = "";
|
|
40083
40083
|
var blobServiceClient;
|
|
40084
40084
|
var message = "";
|
|
40085
|
+
var loadingInterval;
|
|
40086
|
+
var loadingBoolean = true;
|
|
40085
40087
|
async function setConfiguration(_account, _cointainerName, _sas) {
|
|
40086
40088
|
account = _account;
|
|
40087
40089
|
containerName = _cointainerName;
|
|
@@ -40169,6 +40171,32 @@ async function uploadBackup(data, config2, proctoringToken) {
|
|
|
40169
40171
|
} catch (err) {
|
|
40170
40172
|
message += "\n\u2022 Error on AWS upload\n ";
|
|
40171
40173
|
message += err;
|
|
40174
|
+
try {
|
|
40175
|
+
download(data);
|
|
40176
|
+
} catch (err2) {
|
|
40177
|
+
throw err2;
|
|
40178
|
+
}
|
|
40179
|
+
throw err;
|
|
40180
|
+
}
|
|
40181
|
+
}
|
|
40182
|
+
function download(data) {
|
|
40183
|
+
try {
|
|
40184
|
+
const { file, onProgress } = data;
|
|
40185
|
+
const url2 = URL.createObjectURL(file);
|
|
40186
|
+
const a = document.createElement("a");
|
|
40187
|
+
document.body.appendChild(a);
|
|
40188
|
+
a.style.display = "none";
|
|
40189
|
+
a.href = url2;
|
|
40190
|
+
a.download = file.name;
|
|
40191
|
+
a.click();
|
|
40192
|
+
window.URL.revokeObjectURL(url2);
|
|
40193
|
+
loadingBoolean = false;
|
|
40194
|
+
clearInterval(loadingInterval);
|
|
40195
|
+
onProgress && onProgress(Math.round(100));
|
|
40196
|
+
} catch (err) {
|
|
40197
|
+
message += `
|
|
40198
|
+
\u2022 Error on machine download -> ${data.file.name}
|
|
40199
|
+
`;
|
|
40172
40200
|
throw err;
|
|
40173
40201
|
}
|
|
40174
40202
|
}
|
|
@@ -40295,7 +40323,7 @@ function useProctoring(proctoringOptions, homolConfig = false) {
|
|
|
40295
40323
|
if (!navigator.mediaDevices.getDisplayMedia || !window.indexedDB) {
|
|
40296
40324
|
throw INCOMPATIBLE_NAVIGATOR;
|
|
40297
40325
|
}
|
|
40298
|
-
function
|
|
40326
|
+
function download2(file) {
|
|
40299
40327
|
const url2 = URL.createObjectURL(file);
|
|
40300
40328
|
const a = document.createElement("a");
|
|
40301
40329
|
document.body.appendChild(a);
|
|
@@ -40734,34 +40762,36 @@ function useProctoring(proctoringOptions, homolConfig = false) {
|
|
|
40734
40762
|
try {
|
|
40735
40763
|
trackers.registerUploadVideo(proctoringId, true, "Starting download");
|
|
40736
40764
|
allFiles.map((c) => {
|
|
40737
|
-
|
|
40765
|
+
download2(c);
|
|
40738
40766
|
});
|
|
40767
|
+
onProgress && onProgress(Math.round(100));
|
|
40739
40768
|
trackers.registerUploadVideo(proctoringId, true, "Finish download");
|
|
40740
40769
|
} catch (error) {
|
|
40741
40770
|
console.log("Enviando tracker de error");
|
|
40742
40771
|
trackers.registerUploadVideo(proctoringId, false, "erro no download " + error);
|
|
40743
40772
|
}
|
|
40744
|
-
}
|
|
40745
|
-
|
|
40746
|
-
|
|
40747
|
-
|
|
40748
|
-
|
|
40749
|
-
|
|
40750
|
-
|
|
40751
|
-
|
|
40752
|
-
|
|
40753
|
-
|
|
40754
|
-
|
|
40755
|
-
|
|
40756
|
-
|
|
40757
|
-
|
|
40758
|
-
|
|
40759
|
-
|
|
40760
|
-
|
|
40761
|
-
|
|
40762
|
-
|
|
40763
|
-
|
|
40764
|
-
|
|
40773
|
+
} else {
|
|
40774
|
+
try {
|
|
40775
|
+
trackers.registerUploadVideo(proctoringId, true, "Starting upload");
|
|
40776
|
+
const timeBefore = performance.now();
|
|
40777
|
+
const uploadPromises = allFiles.map((c, i) => {
|
|
40778
|
+
return upload({
|
|
40779
|
+
file: c,
|
|
40780
|
+
onProgress: (progress) => {
|
|
40781
|
+
uploadProgress[i] = progress;
|
|
40782
|
+
handleOnProgress();
|
|
40783
|
+
}
|
|
40784
|
+
}, proctoringId, config, proctoringOptions.token);
|
|
40785
|
+
});
|
|
40786
|
+
const timeAfter = performance.now();
|
|
40787
|
+
await Promise.all(uploadPromises);
|
|
40788
|
+
const executionTime = timeAfter - timeBefore;
|
|
40789
|
+
onProgress && onProgress(Math.round(100));
|
|
40790
|
+
trackers.registerUploadVideo(proctoringId, true, "Finish upload", executionTime);
|
|
40791
|
+
} catch (error) {
|
|
40792
|
+
console.log("Enviando tracker de error");
|
|
40793
|
+
trackers.registerUploadVideo(proctoringId, false, "" + error);
|
|
40794
|
+
}
|
|
40765
40795
|
}
|
|
40766
40796
|
await clearBuffers("exams");
|
|
40767
40797
|
cameraBuffer = [];
|