Prevents adding ws relay when over https
This commit is contained in:
parent
e95f1fe369
commit
2580fd33e5
@ -31,6 +31,14 @@ const RelaySettingsPage = () => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const handleNewRelayChange = (event: React.ChangeEvent<HTMLInputElement>) => {
|
||||||
|
const inputValue = event.target.value;
|
||||||
|
const protocol = window.location.protocol;
|
||||||
|
if ((protocol === "https:" && inputValue.startsWith("wss://")) || protocol === "http:") {
|
||||||
|
setNewRelay(inputValue);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
function addRelay() {
|
function addRelay() {
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
@ -43,7 +51,7 @@ const RelaySettingsPage = () => {
|
|||||||
className="f-grow"
|
className="f-grow"
|
||||||
placeholder="wss://my-relay.com"
|
placeholder="wss://my-relay.com"
|
||||||
value={newRelay}
|
value={newRelay}
|
||||||
onChange={e => setNewRelay(e.target.value)}
|
onChange={handleNewRelayChange}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<button className="secondary mb10" onClick={() => addNewRelay()}>
|
<button className="secondary mb10" onClick={() => addNewRelay()}>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user