[mirotalksfu] - add timestamp to stats, fix api doc

هذا الالتزام موجود في:
Miroslav Pejic
2024-12-21 11:23:21 +01:00
الأصل 3e2708c21b
التزام 0f451901c4
7 ملفات معدلة مع 27 إضافات و24 حذوفات

عرض الملف

@@ -128,10 +128,16 @@ definitions:
StatsResponse:
type: object
properties:
meetings:
type: array
items:
$ref: '#/definitions/Stats'
success:
type: boolean
timestamp:
type: string
format: date-time
example: "2024-12-21T12:00:00Z"
totalRooms:
type: integer
totalPeers:
type: integer
MeetingsResponse:
type: object
properties:
@@ -218,15 +224,6 @@ definitions:
browser:
type: string
Stats:
type: object
properties:
success:
type: boolean
totalRooms:
type: integer
totalUser:
type: integer
Meeting:
type: object
properties:

عرض الملف

@@ -55,7 +55,7 @@ dev dependencies: {
* @license For commercial or closed source, contact us at license.mirotalk@gmail.com or purchase directly via CodeCanyon
* @license CodeCanyon: https://codecanyon.net/item/mirotalk-sfu-webrtc-realtime-video-conferences/40769970
* @author Miroslav Pejic - miroslav.pejic.85@gmail.com
* @version 1.6.54
* @version 1.6.55
*
*/
@@ -945,10 +945,11 @@ function startServer() {
return res.status(403).json({ error: 'Unauthorized!' });
}
const { totalRooms, totalUsers } = api.getStats(roomList);
const { timestamp, totalRooms, totalUsers } = api.getStats(roomList);
res.json({
success: true,
timestamp,
totalRooms,
totalUsers,
});
@@ -957,6 +958,7 @@ function startServer() {
log.debug('MiroTalk get stats - Authorized', {
header: req.headers,
body: req.body,
timestamp,
totalRooms,
totalUsers,
});

عرض الملف

@@ -21,10 +21,10 @@ module.exports = class ServerApi {
return true;
}
getStats(roomList) {
getStats(roomList, timestamp = new Date().toISOString()) {
const totalUsers = Array.from(roomList.values()).reduce((total, room) => total + room.peers.size, 0);
const totalRooms = roomList.size;
return { totalRooms, totalUsers };
return { timestamp, totalRooms, totalUsers };
}
getMeetings(roomList) {

عرض الملف

@@ -1,6 +1,6 @@
{
"name": "mirotalksfu",
"version": "1.6.54",
"version": "1.6.55",
"description": "WebRTC SFU browser-based video calls",
"main": "Server.js",
"scripts": {

عرض الملف

@@ -11,7 +11,7 @@ if (location.href.substr(0, 5) !== 'https') location.href = 'https' + location.h
* @license For commercial or closed source, contact us at license.mirotalk@gmail.com or purchase directly via CodeCanyon
* @license CodeCanyon: https://codecanyon.net/item/mirotalk-sfu-webrtc-realtime-video-conferences/40769970
* @author Miroslav Pejic - miroslav.pejic.85@gmail.com
* @version 1.6.54
* @version 1.6.55
*
*/
@@ -4619,7 +4619,7 @@ function showAbout() {
imageUrl: image.about,
customClass: { image: 'img-about' },
position: 'center',
title: 'WebRTC SFU v1.6.54',
title: 'WebRTC SFU v1.6.55',
html: `
<br />
<div id="about">

عرض الملف

@@ -9,7 +9,7 @@
* @license For commercial or closed source, contact us at license.mirotalk@gmail.com or purchase directly via CodeCanyon
* @license CodeCanyon: https://codecanyon.net/item/mirotalk-sfu-webrtc-realtime-video-conferences/40769970
* @author Miroslav Pejic - miroslav.pejic.85@gmail.com
* @version 1.6.54
* @version 1.6.55
*
*/

عرض الملف

@@ -16,6 +16,7 @@ describe('test-ServerAPI', () => {
const host = 'example.com';
const authorization = 'secret-key';
const apiKeySecret = 'secret-key';
const timestamp = new Date().toISOString();
beforeEach(() => {
// Mocking config values
@@ -58,9 +59,10 @@ describe('test-ServerAPI', () => {
],
]);
const result = serverApi.getStats(roomList);
const result = serverApi.getStats(roomList, timestamp);
result.should.deepEqual({
timestamp: timestamp,
totalRooms: 2,
totalUsers: 3,
});
@@ -72,9 +74,10 @@ describe('test-ServerAPI', () => {
['room2', { peers: new Map() }],
]);
const result = serverApi.getStats(roomList);
const result = serverApi.getStats(roomList, timestamp);
result.should.deepEqual({
timestamp: timestamp,
totalRooms: 2,
totalUsers: 0,
});
@@ -83,9 +86,10 @@ describe('test-ServerAPI', () => {
it('should return 0 rooms when roomList is empty', () => {
const roomList = new Map();
const result = serverApi.getStats(roomList);
const result = serverApi.getStats(roomList, timestamp);
result.should.deepEqual({
timestamp: timestamp,
totalRooms: 0,
totalUsers: 0,
});