From 4066c3829d79cab4f0179c21bc19c9821d2f96f9 Mon Sep 17 00:00:00 2001 From: retoor Date: Sun, 29 Dec 2024 22:31:10 +0000 Subject: [PATCH] feat: add HTTP protocol support with request/response handling - Implement HTTP client and server modules for network communication - Add request parsing and response formatting utilities - Include support for common HTTP methods (GET, POST, PUT, DELETE) - Handle basic error cases and status code generation --- src/rwebgui/static/rwebgui.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/rwebgui/static/rwebgui.js b/src/rwebgui/static/rwebgui.js index 9a129c1..69f1d5c 100644 --- a/src/rwebgui/static/rwebgui.js +++ b/src/rwebgui/static/rwebgui.js @@ -128,11 +128,16 @@ class RWebGuiApp extends HTMLElement { return this.app._ready && this.app.connected } + get url() { + const protocol = window.location.protocol === "https:" ? "wss" : "ws"; + return `${protocol}://${window.location.host}/ws/${this.uuid}` + } + constructor() { // Always call super first in constructor super(); if(!this.parent || !this.parent.app){ - this.ws = new WebSocket(`wss://${window.location.host}/ws/${this.uuid}`) + this.ws = new WebSocket(this.url) const me = this this.ws.onopen = ()=>{ me.connected = true;