mirror of https://github.com/OpenVidu/openvidu.git
openvidu-node-client: fix OpenVidu Server URL (not force HTTPS)
parent
0e30cea22c
commit
1c3a120e0e
|
@ -37,11 +37,7 @@ export class OpenVidu {
|
|||
/**
|
||||
* @hidden
|
||||
*/
|
||||
public hostname: string;
|
||||
/**
|
||||
* @hidden
|
||||
*/
|
||||
public port: number;
|
||||
public host: string;
|
||||
/**
|
||||
* @hidden
|
||||
*/
|
||||
|
@ -171,7 +167,7 @@ export class OpenVidu {
|
|||
}
|
||||
|
||||
axios.post(
|
||||
'https://' + this.hostname + (!!this.port ? (':' + this.port) : '') + OpenVidu.API_RECORDINGS + OpenVidu.API_RECORDINGS_START,
|
||||
this.host + OpenVidu.API_RECORDINGS + OpenVidu.API_RECORDINGS_START,
|
||||
data,
|
||||
{
|
||||
headers: {
|
||||
|
@ -225,7 +221,7 @@ export class OpenVidu {
|
|||
return new Promise<Recording>((resolve, reject) => {
|
||||
|
||||
axios.post(
|
||||
'https://' + this.hostname + (!!this.port ? (':' + this.port) : '') + OpenVidu.API_RECORDINGS + OpenVidu.API_RECORDINGS_STOP + '/' + recordingId,
|
||||
this.host + OpenVidu.API_RECORDINGS + OpenVidu.API_RECORDINGS_STOP + '/' + recordingId,
|
||||
undefined,
|
||||
{
|
||||
headers: {
|
||||
|
@ -277,7 +273,7 @@ export class OpenVidu {
|
|||
return new Promise<Recording>((resolve, reject) => {
|
||||
|
||||
axios.get(
|
||||
'https://' + this.hostname + (!!this.port ? (':' + this.port) : '') + OpenVidu.API_RECORDINGS + '/' + recordingId,
|
||||
this.host + OpenVidu.API_RECORDINGS + '/' + recordingId,
|
||||
{
|
||||
headers: {
|
||||
'Authorization': this.basicAuth,
|
||||
|
@ -319,7 +315,7 @@ export class OpenVidu {
|
|||
return new Promise<Recording[]>((resolve, reject) => {
|
||||
|
||||
axios.get(
|
||||
'https://' + this.hostname + (!!this.port ? (':' + this.port) : '') + OpenVidu.API_RECORDINGS,
|
||||
this.host + OpenVidu.API_RECORDINGS,
|
||||
{
|
||||
headers: {
|
||||
Authorization: this.basicAuth
|
||||
|
@ -371,7 +367,7 @@ export class OpenVidu {
|
|||
return new Promise<Error>((resolve, reject) => {
|
||||
|
||||
axios.delete(
|
||||
'https://' + this.hostname + (!!this.port ? (':' + this.port) : '') + OpenVidu.API_RECORDINGS + '/' + recordingId,
|
||||
this.host + OpenVidu.API_RECORDINGS + '/' + recordingId,
|
||||
{
|
||||
headers: {
|
||||
'Authorization': this.basicAuth,
|
||||
|
@ -414,7 +410,7 @@ export class OpenVidu {
|
|||
public fetch(): Promise<boolean> {
|
||||
return new Promise<boolean>((resolve, reject) => {
|
||||
axios.get(
|
||||
'https://' + this.hostname + (!!this.port ? (':' + this.port) : '') + OpenVidu.API_SESSIONS,
|
||||
this.host + OpenVidu.API_SESSIONS,
|
||||
{
|
||||
headers: {
|
||||
Authorization: this.basicAuth
|
||||
|
@ -586,7 +582,7 @@ export class OpenVidu {
|
|||
|
||||
return new Promise<{ changes: boolean, sessionChanges: ObjMap<boolean> }>((resolve, reject) => {
|
||||
axios.get(
|
||||
'https://' + this.hostname + (!!this.port ? (':' + this.port) : '') + OpenVidu.API_SESSIONS + '?webRtcStats=true',
|
||||
this.host + OpenVidu.API_SESSIONS + '?webRtcStats=true',
|
||||
{
|
||||
headers: {
|
||||
Authorization: this.basicAuth
|
||||
|
@ -691,11 +687,10 @@ export class OpenVidu {
|
|||
try {
|
||||
url = new URL(this.urlOpenViduServer);
|
||||
} catch (error) {
|
||||
console.error("URL format incorrect", error);
|
||||
return;
|
||||
console.error('URL format incorrect', error);
|
||||
throw new Error('URL format incorrect: ' + error);
|
||||
}
|
||||
this.hostname = url.hostname;
|
||||
this.port = !!url.port ? parseInt(url.port) : undefined;
|
||||
this.host = url.protocol + '//' + url.host;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -108,7 +108,7 @@ export class Session {
|
|||
});
|
||||
|
||||
axios.post(
|
||||
'https://' + this.ov.hostname + (!!this.ov.port ? (':' + this.ov.port) : '') + OpenVidu.API_TOKENS,
|
||||
this.ov.host + OpenVidu.API_TOKENS,
|
||||
data,
|
||||
{
|
||||
headers: {
|
||||
|
@ -152,7 +152,7 @@ export class Session {
|
|||
public close(): Promise<any> {
|
||||
return new Promise<any>((resolve, reject) => {
|
||||
axios.delete(
|
||||
'https://' + this.ov.hostname + (!!this.ov.port ? (':' + this.ov.port) : '') + OpenVidu.API_SESSIONS + '/' + this.sessionId,
|
||||
this.ov.host + OpenVidu.API_SESSIONS + '/' + this.sessionId,
|
||||
{
|
||||
headers: {
|
||||
'Authorization': this.ov.basicAuth,
|
||||
|
@ -202,7 +202,7 @@ export class Session {
|
|||
return new Promise<boolean>((resolve, reject) => {
|
||||
const beforeJSON: string = JSON.stringify(this, this.removeCircularOpenViduReference);
|
||||
axios.get(
|
||||
'https://' + this.ov.hostname + (!!this.ov.port ? (':' + this.ov.port) : '') + OpenVidu.API_SESSIONS + '/' + this.sessionId,
|
||||
this.ov.host + OpenVidu.API_SESSIONS + '/' + this.sessionId,
|
||||
{
|
||||
headers: {
|
||||
'Authorization': this.ov.basicAuth,
|
||||
|
@ -254,7 +254,7 @@ export class Session {
|
|||
return new Promise<any>((resolve, reject) => {
|
||||
const connectionId: string = typeof connection === 'string' ? connection : (<Connection>connection).connectionId;
|
||||
axios.delete(
|
||||
'https://' + this.ov.hostname + (!!this.ov.port ? (':' + this.ov.port) : '') + OpenVidu.API_SESSIONS + '/' + this.sessionId + '/connection/' + connectionId,
|
||||
this.ov.host + OpenVidu.API_SESSIONS + '/' + this.sessionId + '/connection/' + connectionId,
|
||||
{
|
||||
headers: {
|
||||
'Authorization': this.ov.basicAuth,
|
||||
|
@ -333,7 +333,7 @@ export class Session {
|
|||
return new Promise<any>((resolve, reject) => {
|
||||
const streamId: string = typeof publisher === 'string' ? publisher : (<Publisher>publisher).streamId;
|
||||
axios.delete(
|
||||
'https://' + this.ov.hostname + (!!this.ov.port ? (':' + this.ov.port) : '') + OpenVidu.API_SESSIONS + '/' + this.sessionId + '/stream/' + streamId,
|
||||
this.ov.host + OpenVidu.API_SESSIONS + '/' + this.sessionId + '/stream/' + streamId,
|
||||
{
|
||||
headers: {
|
||||
'Authorization': this.ov.basicAuth,
|
||||
|
@ -405,7 +405,7 @@ export class Session {
|
|||
});
|
||||
|
||||
axios.post(
|
||||
'https://' + this.ov.hostname + (!!this.ov.port ? (':' + this.ov.port) : '') + OpenVidu.API_SESSIONS,
|
||||
this.ov.host + OpenVidu.API_SESSIONS,
|
||||
data,
|
||||
{
|
||||
headers: {
|
||||
|
|
Loading…
Reference in New Issue