Reworked message format, added support for audio messages, made Message class #10

Merged
snxraven merged 20 commits from MiTask/LinkUp-P2P-Chat:main into main 2024-06-14 14:15:43 -04:00
2 changed files with 4 additions and 3 deletions
Showing only changes of commit 42dccf9547 - Show all commits

2
app.js
View File

@ -850,7 +850,7 @@ function writeConfigToFile(filePath) {
function updatePortInUrl(url) { function updatePortInUrl(url) {
if (!url) return url; if (!url) return url;
const urlObject = new URL(url); const urlObject = new URL(url);
if(urlObject.port == 443) return urlObject.toString(); if(!urlObject.host.startsWith("localhost")) return urlObject.toString();
urlObject.port = servePort; urlObject.port = servePort;
return urlObject.toString(); return urlObject.toString();
} }

View File

@ -40,8 +40,9 @@ class Client extends EventEmitter {
async fetchAvatar(url) { async fetchAvatar(url) {
this.botAvatar = url; this.botAvatar = url;
const img = await fetch(url); const web = await fetch(url);
this.sendMessage(IconMessage.new(this, img)); const img = await web.body.getReader().read();
this.sendMessage(IconMessage.new(this, img.value));
} }
setupSwarm() { setupSwarm() {