+11
-2
src/App.tsx
+11
-2
src/App.tsx
···
129
129
} else {
130
130
url = new URL("https://" + customRelayHost);
131
131
}
132
-
url.protocol = url.protocol === "https:" ? "wss:" : "ws:";
133
-
132
+
if (url.protocol === 'https:') {
133
+
url.protocol = 'wss:';
134
+
} else if (url.protocol === 'http:') {
135
+
url.protocol = 'ws:';
136
+
}
134
137
return url.origin;
135
138
} catch (err) {
136
139
return "";
···
176
179
const oldURL = getCustomRelayURL();
177
180
setRelays(relays => relays.includes(oldURL) ? relays.filter(u => u !== oldURL) : relays);
178
181
setCustomRelayHost(e.target.value);
182
+
}}
183
+
onKeyDown={e => {
184
+
if (e.key !== 'Enter') return;
185
+
e.preventDefault();
186
+
const url = getCustomRelayURL();
187
+
if (url) showRelay(url, true);
179
188
}}
180
189
/>
181
190
{` `}