[mirotalksfu] - update dep, API snippets
هذا الالتزام موجود في:
@@ -1,32 +1,39 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
const fetch = require('node-fetch');
|
async function getJoin() {
|
||||||
|
try {
|
||||||
|
// Use dynamic import with await
|
||||||
|
const { default: fetch } = await import('node-fetch');
|
||||||
|
|
||||||
const API_KEY = 'mirotalksfu_default_secret';
|
const API_KEY = 'mirotalksfu_default_secret';
|
||||||
const MIROTALK_URL = 'https://sfu.mirotalk.com/api/v1/join';
|
const MIROTALK_URL = 'https://sfu.mirotalk.com/api/v1/join';
|
||||||
// const MIROTALK_URL = 'http://localhost:3010/api/v1/join';
|
// const MIROTALK_URL = 'http://localhost:3010/api/v1/join';
|
||||||
|
|
||||||
function getResponse() {
|
const response = await fetch(MIROTALK_URL, {
|
||||||
return fetch(MIROTALK_URL, {
|
method: 'POST',
|
||||||
method: 'POST',
|
headers: {
|
||||||
headers: {
|
authorization: API_KEY,
|
||||||
authorization: API_KEY,
|
'Content-Type': 'application/json',
|
||||||
'Content-Type': 'application/json',
|
},
|
||||||
},
|
body: JSON.stringify({
|
||||||
body: JSON.stringify({
|
room: 'test',
|
||||||
room: 'test',
|
password: false,
|
||||||
password: false,
|
name: 'mirotalksfu',
|
||||||
name: 'mirotalksfu',
|
audio: true,
|
||||||
audio: true,
|
video: true,
|
||||||
video: true,
|
screen: true,
|
||||||
screen: true,
|
notify: true,
|
||||||
notify: true,
|
}),
|
||||||
}),
|
});
|
||||||
});
|
const data = await response.json();
|
||||||
|
if (data.error) {
|
||||||
|
console.log('Error:', data.error);
|
||||||
|
} else {
|
||||||
|
console.log('join:', data.join);
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error('Error fetching data:', error);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
getResponse().then(async (res) => {
|
getJoin();
|
||||||
console.log('Status code:', res.status);
|
|
||||||
const data = await res.json();
|
|
||||||
console.log('join:', data.join);
|
|
||||||
});
|
|
||||||
|
|||||||
المرجع في مشكلة جديدة
حظر مستخدم