easyproctor-hml 2.5.39 → 2.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/errors/errors.d.ts +1 -0
- package/esm/index.js +66 -20
- package/index.js +66 -20
- package/new-flow/backend/SafeBrowserBackendService.d.ts +13 -0
- package/package.json +1 -1
- package/proctoring/options/ProctoringOptions.d.ts +1 -0
- package/proctoring/proctoring.d.ts +1 -0
- package/unpkg/easyproctor.min.js +33 -38
package/errors/errors.d.ts
CHANGED
|
@@ -16,6 +16,7 @@ export declare const TOKEN_MISSING = "token_missing";
|
|
|
16
16
|
export declare const CREDENTIALS_MISSING = "credentials_missing";
|
|
17
17
|
export declare const CAMERA_BLOCKED = "camera_blocked";
|
|
18
18
|
export declare const SPY_SCAN_API_NOT_FOUND = "spy_scan_api_not_found";
|
|
19
|
+
export declare const SAFE_BROWSER_API_NOT_FOUND = "safe_browser_api_not_found";
|
|
19
20
|
export declare const ERROR_ON_MOBILE_APP_NOT_FOUND = "error_on_mobile_app_not_found";
|
|
20
21
|
export declare const EXTERNAL_CAMERA_NOT_STARTED = "external_camera_not_started";
|
|
21
22
|
export declare const EXTERNAL_CAMERA_CHECK_TRANSMISSION = "external_camera_timed_out";
|
package/esm/index.js
CHANGED
|
@@ -12822,8 +12822,8 @@ function recorder(stream, buffer, onBufferSizeError = false, onBufferSizeErrorCa
|
|
|
12822
12822
|
resolvePromise = resolve;
|
|
12823
12823
|
mediaRecorder.onstop = () => {
|
|
12824
12824
|
console.log("recorder onstop");
|
|
12825
|
-
|
|
12826
|
-
console.log("duration no onstop",
|
|
12825
|
+
duration = Date.now() - startTime.getTime() || 0;
|
|
12826
|
+
console.log("duration no onstop", duration);
|
|
12827
12827
|
resolvePromise && resolvePromise();
|
|
12828
12828
|
};
|
|
12829
12829
|
mediaRecorder.stop();
|
|
@@ -13101,6 +13101,7 @@ var BROWSER_NOT_SUPPORTED = "browser_not_supported";
|
|
|
13101
13101
|
var TOKEN_MISSING = "token_missing";
|
|
13102
13102
|
var CREDENTIALS_MISSING = "credentials_missing";
|
|
13103
13103
|
var SPY_SCAN_API_NOT_FOUND = "spy_scan_api_not_found";
|
|
13104
|
+
var SAFE_BROWSER_API_NOT_FOUND = "safe_browser_api_not_found";
|
|
13104
13105
|
var EXTERNAL_CAMERA_NOT_STARTED = "external_camera_not_started";
|
|
13105
13106
|
|
|
13106
13107
|
// src/modules/objectDetection.ts
|
|
@@ -13537,7 +13538,7 @@ Setting: ${JSON.stringify(settings, null, 2)}`
|
|
|
13537
13538
|
this.volumeMeter && this.volumeMeter.stop();
|
|
13538
13539
|
this.intervalNoiseDetection && clearInterval(this.intervalNoiseDetection);
|
|
13539
13540
|
this.recordingStop && await this.recordingStop();
|
|
13540
|
-
this.duration = this.getDuration();
|
|
13541
|
+
this.duration = this.getDuration ? this.getDuration() : 0;
|
|
13541
13542
|
try {
|
|
13542
13543
|
if (this.animationFrameId) {
|
|
13543
13544
|
cancelAnimationFrame(this.animationFrameId);
|
|
@@ -13708,24 +13709,9 @@ Setting: ${JSON.stringify(settings, null, 2)}`
|
|
|
13708
13709
|
type: ((_b = this.recorderOptions) == null ? void 0 : _b.mimeType) || "video/webm"
|
|
13709
13710
|
});
|
|
13710
13711
|
const fixedBlob = await (0, import_fix_webm_duration.default)(rawBlob, this.duration);
|
|
13711
|
-
const file = new File(
|
|
13712
|
-
[rawBlob],
|
|
13713
|
-
`EP_${session.id}_camera_0.webm`,
|
|
13714
|
-
{ type: rawBlob.type }
|
|
13715
|
-
);
|
|
13716
|
-
session.addRecording({
|
|
13717
|
-
device: `Audio
|
|
13718
|
-
Sample Rate: ${settingsAudio.sampleRate}
|
|
13719
|
-
Sample Size: ${settingsAudio.sampleSize}
|
|
13720
|
-
|
|
13721
|
-
Video:
|
|
13722
|
-
${JSON.stringify(this.recorderOptions)}`,
|
|
13723
|
-
file,
|
|
13724
|
-
origin: "Camera" /* Camera */
|
|
13725
|
-
});
|
|
13726
13712
|
const fileWithDuration = new File(
|
|
13727
13713
|
[fixedBlob],
|
|
13728
|
-
`EP_${session.id}
|
|
13714
|
+
`EP_${session.id}_camera_0.webm`,
|
|
13729
13715
|
{ type: rawBlob.type }
|
|
13730
13716
|
);
|
|
13731
13717
|
session.addRecording({
|
|
@@ -18792,6 +18778,49 @@ var Auth = class {
|
|
|
18792
18778
|
}
|
|
18793
18779
|
};
|
|
18794
18780
|
|
|
18781
|
+
// src/new-flow/backend/SafeBrowserBackendService.ts
|
|
18782
|
+
var SafeBrowserBackendService = class {
|
|
18783
|
+
constructor() {
|
|
18784
|
+
this.baseUrl = "http://localhost:7485/Station/api";
|
|
18785
|
+
}
|
|
18786
|
+
async isAlive() {
|
|
18787
|
+
const paramsConfig = await this.makeRequestAxios({
|
|
18788
|
+
path: `/health`,
|
|
18789
|
+
method: "GET",
|
|
18790
|
+
jwt: this.token
|
|
18791
|
+
}).catch((error) => {
|
|
18792
|
+
throw "N\xE3o foi poss\xEDvel realizar a requisi\xE7\xE3o, tente novamente mais tarde";
|
|
18793
|
+
});
|
|
18794
|
+
return paramsConfig.data;
|
|
18795
|
+
}
|
|
18796
|
+
async setProctoringId(proctoringId2) {
|
|
18797
|
+
const paramsConfig = await this.makeRequestAxios({
|
|
18798
|
+
path: `/update-station/` + proctoringId2,
|
|
18799
|
+
method: "POST",
|
|
18800
|
+
jwt: this.token
|
|
18801
|
+
}).catch((error) => {
|
|
18802
|
+
throw "N\xE3o foi poss\xEDvel realizar a requisi\xE7\xE3o, tente novamente mais tarde";
|
|
18803
|
+
});
|
|
18804
|
+
return paramsConfig.data;
|
|
18805
|
+
}
|
|
18806
|
+
async makeRequestAxios(data) {
|
|
18807
|
+
const { path, method, body, jwt } = data;
|
|
18808
|
+
const resp = await axios_default.request({
|
|
18809
|
+
url: this.baseUrl + path,
|
|
18810
|
+
method,
|
|
18811
|
+
headers: {
|
|
18812
|
+
Authorization: `Bearer ${jwt}`,
|
|
18813
|
+
"Access-Control-Allow-Origin": "*"
|
|
18814
|
+
},
|
|
18815
|
+
data: body
|
|
18816
|
+
});
|
|
18817
|
+
if (resp.status >= 400) {
|
|
18818
|
+
throw "N\xE3o foi poss\xEDvel realizar a requisi\xE7\xE3o, tente novamente mais tarde";
|
|
18819
|
+
}
|
|
18820
|
+
return resp;
|
|
18821
|
+
}
|
|
18822
|
+
};
|
|
18823
|
+
|
|
18795
18824
|
// node_modules/@microsoft/signalr/dist/esm/Errors.js
|
|
18796
18825
|
var HttpError = class extends Error {
|
|
18797
18826
|
/** Constructs a new instance of {@link @microsoft/signalr.HttpError}.
|
|
@@ -22678,6 +22707,13 @@ var Proctoring = class {
|
|
|
22678
22707
|
} catch (error) {
|
|
22679
22708
|
throw SPY_SCAN_API_NOT_FOUND;
|
|
22680
22709
|
}
|
|
22710
|
+
try {
|
|
22711
|
+
if (options == null ? void 0 : options.useSafeBrowserAPI) {
|
|
22712
|
+
await this.safeBrowserBackendService.isAlive();
|
|
22713
|
+
}
|
|
22714
|
+
} catch (error) {
|
|
22715
|
+
throw SAFE_BROWSER_API_NOT_FOUND;
|
|
22716
|
+
}
|
|
22681
22717
|
if (this.state != "Stop" /* Stop */) {
|
|
22682
22718
|
throw PROCTORING_ALREADY_STARTED;
|
|
22683
22719
|
}
|
|
@@ -22713,6 +22749,13 @@ var Proctoring = class {
|
|
|
22713
22749
|
this.allRecorders.cameraRecorder.setProctoringId(this.proctoringId);
|
|
22714
22750
|
this.allRecorders.noiseRecorder.setProctoringId(this.proctoringId);
|
|
22715
22751
|
this.proctoringSession.setProctoringId(this.proctoringId);
|
|
22752
|
+
try {
|
|
22753
|
+
if (options == null ? void 0 : options.useSafeBrowserAPI) {
|
|
22754
|
+
await this.safeBrowserBackendService.setProctoringId(this.proctoringId);
|
|
22755
|
+
}
|
|
22756
|
+
} catch (error) {
|
|
22757
|
+
throw SAFE_BROWSER_API_NOT_FOUND;
|
|
22758
|
+
}
|
|
22716
22759
|
try {
|
|
22717
22760
|
console.log("Starting recorders");
|
|
22718
22761
|
await this.recorder.startAll();
|
|
@@ -22934,7 +22977,7 @@ Error: ` + error
|
|
|
22934
22977
|
}
|
|
22935
22978
|
}
|
|
22936
22979
|
async initConfig(useGeolocation) {
|
|
22937
|
-
var _a2;
|
|
22980
|
+
var _a2, _b;
|
|
22938
22981
|
try {
|
|
22939
22982
|
const paramsConfig = await this.backend.getParamsConfig(
|
|
22940
22983
|
this.context
|
|
@@ -22966,6 +23009,9 @@ Error: ` + error
|
|
|
22966
23009
|
onRealtimeAlertsCallback: (response) => this.onRealtimeAlertsCallback(response)
|
|
22967
23010
|
});
|
|
22968
23011
|
}
|
|
23012
|
+
if ((_b = this.sessionOptions) == null ? void 0 : _b.useSafeBrowserAPI) {
|
|
23013
|
+
this.safeBrowserBackendService = new SafeBrowserBackendService();
|
|
23014
|
+
}
|
|
22969
23015
|
} catch (err) {
|
|
22970
23016
|
this.proctoringId && trackers.registerError(this.proctoringId, "Erro no initConfig!");
|
|
22971
23017
|
await this.cancel();
|
package/index.js
CHANGED
|
@@ -30919,8 +30919,8 @@ function recorder(stream4, buffer, onBufferSizeError = false, onBufferSizeErrorC
|
|
|
30919
30919
|
resolvePromise = resolve;
|
|
30920
30920
|
mediaRecorder.onstop = () => {
|
|
30921
30921
|
console.log("recorder onstop");
|
|
30922
|
-
|
|
30923
|
-
console.log("duration no onstop",
|
|
30922
|
+
duration = Date.now() - startTime.getTime() || 0;
|
|
30923
|
+
console.log("duration no onstop", duration);
|
|
30924
30924
|
resolvePromise && resolvePromise();
|
|
30925
30925
|
};
|
|
30926
30926
|
mediaRecorder.stop();
|
|
@@ -31198,6 +31198,7 @@ var BROWSER_NOT_SUPPORTED = "browser_not_supported";
|
|
|
31198
31198
|
var TOKEN_MISSING = "token_missing";
|
|
31199
31199
|
var CREDENTIALS_MISSING = "credentials_missing";
|
|
31200
31200
|
var SPY_SCAN_API_NOT_FOUND = "spy_scan_api_not_found";
|
|
31201
|
+
var SAFE_BROWSER_API_NOT_FOUND = "safe_browser_api_not_found";
|
|
31201
31202
|
var EXTERNAL_CAMERA_NOT_STARTED = "external_camera_not_started";
|
|
31202
31203
|
|
|
31203
31204
|
// src/modules/objectDetection.ts
|
|
@@ -31634,7 +31635,7 @@ Setting: ${JSON.stringify(settings, null, 2)}`
|
|
|
31634
31635
|
this.volumeMeter && this.volumeMeter.stop();
|
|
31635
31636
|
this.intervalNoiseDetection && clearInterval(this.intervalNoiseDetection);
|
|
31636
31637
|
this.recordingStop && await this.recordingStop();
|
|
31637
|
-
this.duration = this.getDuration();
|
|
31638
|
+
this.duration = this.getDuration ? this.getDuration() : 0;
|
|
31638
31639
|
try {
|
|
31639
31640
|
if (this.animationFrameId) {
|
|
31640
31641
|
cancelAnimationFrame(this.animationFrameId);
|
|
@@ -31805,24 +31806,9 @@ Setting: ${JSON.stringify(settings, null, 2)}`
|
|
|
31805
31806
|
type: ((_b = this.recorderOptions) == null ? void 0 : _b.mimeType) || "video/webm"
|
|
31806
31807
|
});
|
|
31807
31808
|
const fixedBlob = await (0, import_fix_webm_duration.default)(rawBlob, this.duration);
|
|
31808
|
-
const file = new File(
|
|
31809
|
-
[rawBlob],
|
|
31810
|
-
`EP_${session.id}_camera_0.webm`,
|
|
31811
|
-
{ type: rawBlob.type }
|
|
31812
|
-
);
|
|
31813
|
-
session.addRecording({
|
|
31814
|
-
device: `Audio
|
|
31815
|
-
Sample Rate: ${settingsAudio.sampleRate}
|
|
31816
|
-
Sample Size: ${settingsAudio.sampleSize}
|
|
31817
|
-
|
|
31818
|
-
Video:
|
|
31819
|
-
${JSON.stringify(this.recorderOptions)}`,
|
|
31820
|
-
file,
|
|
31821
|
-
origin: "Camera" /* Camera */
|
|
31822
|
-
});
|
|
31823
31809
|
const fileWithDuration = new File(
|
|
31824
31810
|
[fixedBlob],
|
|
31825
|
-
`EP_${session.id}
|
|
31811
|
+
`EP_${session.id}_camera_0.webm`,
|
|
31826
31812
|
{ type: rawBlob.type }
|
|
31827
31813
|
);
|
|
31828
31814
|
session.addRecording({
|
|
@@ -36889,6 +36875,49 @@ var Auth = class {
|
|
|
36889
36875
|
}
|
|
36890
36876
|
};
|
|
36891
36877
|
|
|
36878
|
+
// src/new-flow/backend/SafeBrowserBackendService.ts
|
|
36879
|
+
var SafeBrowserBackendService = class {
|
|
36880
|
+
constructor() {
|
|
36881
|
+
this.baseUrl = "http://localhost:7485/Station/api";
|
|
36882
|
+
}
|
|
36883
|
+
async isAlive() {
|
|
36884
|
+
const paramsConfig = await this.makeRequestAxios({
|
|
36885
|
+
path: `/health`,
|
|
36886
|
+
method: "GET",
|
|
36887
|
+
jwt: this.token
|
|
36888
|
+
}).catch((error) => {
|
|
36889
|
+
throw "N\xE3o foi poss\xEDvel realizar a requisi\xE7\xE3o, tente novamente mais tarde";
|
|
36890
|
+
});
|
|
36891
|
+
return paramsConfig.data;
|
|
36892
|
+
}
|
|
36893
|
+
async setProctoringId(proctoringId2) {
|
|
36894
|
+
const paramsConfig = await this.makeRequestAxios({
|
|
36895
|
+
path: `/update-station/` + proctoringId2,
|
|
36896
|
+
method: "POST",
|
|
36897
|
+
jwt: this.token
|
|
36898
|
+
}).catch((error) => {
|
|
36899
|
+
throw "N\xE3o foi poss\xEDvel realizar a requisi\xE7\xE3o, tente novamente mais tarde";
|
|
36900
|
+
});
|
|
36901
|
+
return paramsConfig.data;
|
|
36902
|
+
}
|
|
36903
|
+
async makeRequestAxios(data) {
|
|
36904
|
+
const { path, method, body, jwt } = data;
|
|
36905
|
+
const resp = await axios_default.request({
|
|
36906
|
+
url: this.baseUrl + path,
|
|
36907
|
+
method,
|
|
36908
|
+
headers: {
|
|
36909
|
+
Authorization: `Bearer ${jwt}`,
|
|
36910
|
+
"Access-Control-Allow-Origin": "*"
|
|
36911
|
+
},
|
|
36912
|
+
data: body
|
|
36913
|
+
});
|
|
36914
|
+
if (resp.status >= 400) {
|
|
36915
|
+
throw "N\xE3o foi poss\xEDvel realizar a requisi\xE7\xE3o, tente novamente mais tarde";
|
|
36916
|
+
}
|
|
36917
|
+
return resp;
|
|
36918
|
+
}
|
|
36919
|
+
};
|
|
36920
|
+
|
|
36892
36921
|
// src/proctoring/ExternalCameraChecker.ts
|
|
36893
36922
|
var import_signalr = __toESM(require_cjs());
|
|
36894
36923
|
var import_qrcode = __toESM(require_lib());
|
|
@@ -37927,6 +37956,13 @@ var Proctoring = class {
|
|
|
37927
37956
|
} catch (error) {
|
|
37928
37957
|
throw SPY_SCAN_API_NOT_FOUND;
|
|
37929
37958
|
}
|
|
37959
|
+
try {
|
|
37960
|
+
if (options == null ? void 0 : options.useSafeBrowserAPI) {
|
|
37961
|
+
await this.safeBrowserBackendService.isAlive();
|
|
37962
|
+
}
|
|
37963
|
+
} catch (error) {
|
|
37964
|
+
throw SAFE_BROWSER_API_NOT_FOUND;
|
|
37965
|
+
}
|
|
37930
37966
|
if (this.state != "Stop" /* Stop */) {
|
|
37931
37967
|
throw PROCTORING_ALREADY_STARTED;
|
|
37932
37968
|
}
|
|
@@ -37962,6 +37998,13 @@ var Proctoring = class {
|
|
|
37962
37998
|
this.allRecorders.cameraRecorder.setProctoringId(this.proctoringId);
|
|
37963
37999
|
this.allRecorders.noiseRecorder.setProctoringId(this.proctoringId);
|
|
37964
38000
|
this.proctoringSession.setProctoringId(this.proctoringId);
|
|
38001
|
+
try {
|
|
38002
|
+
if (options == null ? void 0 : options.useSafeBrowserAPI) {
|
|
38003
|
+
await this.safeBrowserBackendService.setProctoringId(this.proctoringId);
|
|
38004
|
+
}
|
|
38005
|
+
} catch (error) {
|
|
38006
|
+
throw SAFE_BROWSER_API_NOT_FOUND;
|
|
38007
|
+
}
|
|
37965
38008
|
try {
|
|
37966
38009
|
console.log("Starting recorders");
|
|
37967
38010
|
await this.recorder.startAll();
|
|
@@ -38183,7 +38226,7 @@ Error: ` + error
|
|
|
38183
38226
|
}
|
|
38184
38227
|
}
|
|
38185
38228
|
async initConfig(useGeolocation) {
|
|
38186
|
-
var _a2;
|
|
38229
|
+
var _a2, _b;
|
|
38187
38230
|
try {
|
|
38188
38231
|
const paramsConfig = await this.backend.getParamsConfig(
|
|
38189
38232
|
this.context
|
|
@@ -38215,6 +38258,9 @@ Error: ` + error
|
|
|
38215
38258
|
onRealtimeAlertsCallback: (response) => this.onRealtimeAlertsCallback(response)
|
|
38216
38259
|
});
|
|
38217
38260
|
}
|
|
38261
|
+
if ((_b = this.sessionOptions) == null ? void 0 : _b.useSafeBrowserAPI) {
|
|
38262
|
+
this.safeBrowserBackendService = new SafeBrowserBackendService();
|
|
38263
|
+
}
|
|
38218
38264
|
} catch (err) {
|
|
38219
38265
|
this.proctoringId && trackers.registerError(this.proctoringId, "Erro no initConfig!");
|
|
38220
38266
|
await this.cancel();
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export declare class SafeBrowserBackendService {
|
|
2
|
+
private readonly baseUrl;
|
|
3
|
+
token: string;
|
|
4
|
+
constructor();
|
|
5
|
+
isAlive(): Promise<boolean>;
|
|
6
|
+
setProctoringId(proctoringId: string): Promise<any>;
|
|
7
|
+
makeRequestAxios<R>(data: {
|
|
8
|
+
path: string;
|
|
9
|
+
method: "GET" | "POST" | "PUT";
|
|
10
|
+
body?: any;
|
|
11
|
+
jwt: string;
|
|
12
|
+
}): Promise<R>;
|
|
13
|
+
}
|
package/package.json
CHANGED