@@ -58,7 +58,7 @@ Array.from(document.getElementsByClassName("slider")).forEach((slider) => {
58
58
} ) [ parent . process . platform ] ) , "Custom WebRTC URL" , "Please specify your resource server URL" , parsedEnvironmentVariables . DEFAULT_RESOURCE_SERVER_PROTOCOL + "//" + parsedEnvironmentVariables . DEFAULT_RESOURCE_SERVER_HOSTNAME + ( ( parsedEnvironmentVariables . DEFAULT_RESOURCE_SERVER_PORT ) ? ( ":" + parsedEnvironmentVariables . DEFAULT_RESOURCE_SERVER_PORT ) : "" ) ] ) . stdout . on ( 'data' , ( customResourceServerURL ) => {
59
59
try {
60
60
if ( ! customResourceServerURL . toString ( ) . startsWith ( "RETURN" ) ) return ;
61
- if ( ! [ "http:" , "https:" ] . includes ( new URL ( customResourceServerURL . toString ( ) . substring ( 6 ) ) . protocol ) ) throw alert ( "Invalid resource server URL" ) ;
61
+ if ( ! [ "http:" , "https:" ] . includes ( new URL ( customResourceServerURL . toString ( ) . substring ( 6 , customResourceServerURL . toString ( ) . length - 2 ) ) . protocol ) ) throw alert ( "Invalid resource server URL" ) ;
62
62
childProcess . spawn ( ( {
63
63
win32 : "cscript" ,
64
64
darwin : "osascript" ,
@@ -70,7 +70,7 @@ Array.from(document.getElementsByClassName("slider")).forEach((slider) => {
70
70
} ) [ parent . process . platform ] ) , "Custom WebRTC URL" , "Please specify your socket server URL" , parsedEnvironmentVariables . DEFAULT_SOCKET_SERVER_PROTOCOL + "//" + parsedEnvironmentVariables . DEFAULT_SOCKET_SERVER_HOSTNAME + ( ( parsedEnvironmentVariables . DEFAULT_SOCKET_SERVER_PORT ) ? ( ":" + parsedEnvironmentVariables . DEFAULT_SOCKET_SERVER_PORT ) : "" ) ] ) . stdout . on ( 'data' , ( customSocketServerURL ) => {
71
71
try {
72
72
if ( ! customSocketServerURL . toString ( ) . startsWith ( "RETURN" ) ) return ;
73
- if ( ! [ "http:" , "https:" ] . includes ( new URL ( customSocketServerURL . toString ( ) . substring ( 6 ) ) . protocol ) ) throw alert ( "Invalid socket server URL" ) ;
73
+ if ( ! [ "http:" , "https:" ] . includes ( new URL ( customSocketServerURL . toString ( ) . substring ( 6 , customSocketServerURL . toString ( ) . length - 2 ) ) . protocol ) ) throw alert ( "Invalid socket server URL" ) ;
74
74
childProcess . spawn ( ( {
75
75
win32 : "cscript" ,
76
76
darwin : "osascript" ,
@@ -82,18 +82,18 @@ Array.from(document.getElementsByClassName("slider")).forEach((slider) => {
82
82
} ) [ parent . process . platform ] ) , "Custom WebRTC URL" , "Please specify your peer server URL" , parsedEnvironmentVariables . DEFAULT_PEER_SERVER_PROTOCOL + "//" + parsedEnvironmentVariables . DEFAULT_PEER_SERVER_HOSTNAME + ( ( parsedEnvironmentVariables . DEFAULT_PEER_SERVER_PORT ) ? ( ":" + parsedEnvironmentVariables . DEFAULT_PEER_SERVER_PORT ) : "" ) + parsedEnvironmentVariables . DEFAULT_PEER_SERVER_PATH ] ) . stdout . on ( 'data' , ( customPeerServerURL ) => {
83
83
try {
84
84
if ( ! customPeerServerURL . toString ( ) . startsWith ( "RETURN" ) ) return ;
85
- if ( ! [ "ws:" , "wss:" ] . includes ( new URL ( customPeerServerURL . toString ( ) . substring ( 6 ) ) . protocol ) ) throw alert ( "Invalid peer server URL" ) ;
85
+ if ( ! [ "ws:" , "wss:" ] . includes ( new URL ( customPeerServerURL . toString ( ) . substring ( 6 , customPeerServerURL . toString ( ) . length - 2 ) ) . protocol ) ) throw alert ( "Invalid peer server URL" ) ;
86
86
fs . writeFileSync ( path . join ( parent . process . resourcesPath , "customServer.json" ) , JSON . stringify ( {
87
- resourceProtocol : new URL ( customResourceServerURL . toString ( ) . substring ( 6 ) ) . protocol ,
88
- resourceHostname : new URL ( customResourceServerURL . toString ( ) . substring ( 6 ) ) . hostname ,
89
- resourcePort : new URL ( customResourceServerURL . toString ( ) . substring ( 6 ) ) . port ,
90
- socketProtocol : new URL ( customSocketServerURL . toString ( ) . substring ( 6 ) ) . protocol ,
91
- socketHostname : new URL ( customSocketServerURL . toString ( ) . substring ( 6 ) ) . hostname ,
92
- socketPort : new URL ( customSocketServerURL . toString ( ) . substring ( 6 ) ) . port ,
93
- peerProtocol : new URL ( customPeerServerURL . toString ( ) . substring ( 6 ) ) . protocol ,
94
- peerHostname : new URL ( customPeerServerURL . toString ( ) . substring ( 6 ) ) . hostname ,
95
- peerPort : new URL ( customPeerServerURL . toString ( ) . substring ( 6 ) ) . port ,
96
- peerPath : new URL ( customPeerServerURL . toString ( ) . substring ( 6 ) ) . pathname
87
+ resourceProtocol : new URL ( customResourceServerURL . toString ( ) . substring ( 6 , customResourceServerURL . toString ( ) . length - 2 ) ) . protocol ,
88
+ resourceHostname : new URL ( customResourceServerURL . toString ( ) . substring ( 6 , customResourceServerURL . toString ( ) . length - 2 ) ) . hostname ,
89
+ resourcePort : new URL ( customResourceServerURL . toString ( ) . substring ( 6 , customResourceServerURL . toString ( ) . length - 2 ) ) . port ,
90
+ socketProtocol : new URL ( customSocketServerURL . toString ( ) . substring ( 6 , customSocketServerURL . toString ( ) . length - 2 ) ) . protocol ,
91
+ socketHostname : new URL ( customSocketServerURL . toString ( ) . substring ( 6 , customSocketServerURL . toString ( ) . length - 2 ) ) . hostname ,
92
+ socketPort : new URL ( customSocketServerURL . toString ( ) . substring ( 6 , customSocketServerURL . toString ( ) . length - 2 ) ) . port ,
93
+ peerProtocol : new URL ( customPeerServerURL . toString ( ) . substring ( 6 , customPeerServerURL . toString ( ) . length - 2 ) ) . protocol ,
94
+ peerHostname : new URL ( customPeerServerURL . toString ( ) . substring ( 6 , customPeerServerURL . toString ( ) . length - 2 ) ) . hostname ,
95
+ peerPort : new URL ( customPeerServerURL . toString ( ) . substring ( 6 , customPeerServerURL . toString ( ) . length - 2 ) ) . port ,
96
+ peerPath : new URL ( customPeerServerURL . toString ( ) . substring ( 6 , customPeerServerURL . toString ( ) . length - 2 ) ) . pathname
97
97
} ) , "utf8" ) ;
98
98
localStorage . setItem ( "settings" , JSON . stringify ( {
99
99
...JSON . parse ( localStorage . getItem ( "settings" ) ) || { } ,
0 commit comments