Update packages, fix image errors not being properly thrown

This commit is contained in:
Essem 2022-03-13 14:42:27 -05:00
parent 57cd37d1eb
commit db068cee60
No known key found for this signature in database
GPG key ID: 7D497397CC3A2A8C
4 changed files with 167 additions and 197 deletions

View file

@ -25,7 +25,7 @@ const Rinit = 0x08;
class ImageConnection {
constructor(host, auth, tls = false) {
this.requests = new Map();
if(!host.includes(":")){
if (!host.includes(":")) {
host += ":3762";
}
this.host = host;
@ -42,11 +42,11 @@ class ImageConnection {
this.wsproto = "ws";
}
this.sockurl = `${this.wsproto}://${host}/sock`;
let headers = {};
if(auth){
const headers = {};
if (auth) {
headers.Authentication = auth;
}
this.conn = new WebSocket(this.sockurl, {headers});
this.conn = new WebSocket(this.sockurl, { headers });
let httpproto;
if (tls) {
httpproto = "https";

View file

@ -131,6 +131,7 @@ class ImageWorker extends BaseServiceWorker {
continue;
} else {
if (e === "No available servers" && i >= 2) throw "Request ended prematurely due to a closed connection";
throw e;
}
}
}