From 42dccf95477c00e92eb50e67a4a81e7764b8abe8 Mon Sep 17 00:00:00 2001 From: MrMasrozYTLIVE <61359286+MrMasrozYTLIVE@users.noreply.github.com> Date: Fri, 14 Jun 2024 19:58:40 +0300 Subject: [PATCH] Actually just returning the url if its host is not 'localhost' --- app.js | 2 +- chatBot/includes/Client.js | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/app.js b/app.js index 208c3a0..74a6207 100644 --- a/app.js +++ b/app.js @@ -850,7 +850,7 @@ function writeConfigToFile(filePath) { function updatePortInUrl(url) { if (!url) return url; const urlObject = new URL(url); - if(urlObject.port == 443) return urlObject.toString(); + if(!urlObject.host.startsWith("localhost")) return urlObject.toString(); urlObject.port = servePort; return urlObject.toString(); } diff --git a/chatBot/includes/Client.js b/chatBot/includes/Client.js index b40677e..d44982e 100644 --- a/chatBot/includes/Client.js +++ b/chatBot/includes/Client.js @@ -40,8 +40,9 @@ class Client extends EventEmitter { async fetchAvatar(url) { this.botAvatar = url; - const img = await fetch(url); - this.sendMessage(IconMessage.new(this, img)); + const web = await fetch(url); + const img = await web.body.getReader().read(); + this.sendMessage(IconMessage.new(this, img.value)); } setupSwarm() {