only replace http if at the start of the url
This commit is contained in:
Julien Bouquillon 2020-05-04 01:22:18 +02:00 committed by GitHub
parent 985cfa2b4d
commit 284a028e1c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

2
gun.js
View File

@ -2404,7 +2404,7 @@
mesh.wire = opt.wire = open;
function open(peer){ try{
if(!peer || !peer.url){ return wire && wire(peer) }
var url = peer.url.replace('http', 'ws');
var url = peer.url.replace(/^http/, 'ws');
var wire = peer.wire = new opt.WebSocket(url);
wire.onclose = function(){
opt.mesh.bye(peer);