feat: protocol detection for wss in vertd

This commit is contained in:
not-nullptr 2025-02-15 03:17:38 +00:00
parent b4f5c20793
commit dbf5c2a481
1 changed files with 2 additions and 1 deletions

View File

@ -141,8 +141,9 @@ export class VertdConverter extends Converter {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
const apiUrl = Settings.instance.settings.vertdURL; const apiUrl = Settings.instance.settings.vertdURL;
const protocol = apiUrl.startsWith("https") ? "wss:" : "ws:";
const ws = new WebSocket( const ws = new WebSocket(
`ws://${apiUrl.replace("http://", "").replace("https://", "")}/api/ws`, `${protocol}//${apiUrl.replace("http://", "").replace("https://", "")}/api/ws`,
); );
ws.onopen = () => { ws.onopen = () => {
const speed = Settings.instance.settings.vertdSpeed; const speed = Settings.instance.settings.vertdSpeed;