Skip to content

Commit

Permalink
use wss if hosted in https
Browse files Browse the repository at this point in the history
  • Loading branch information
3ll3d00d committed Dec 25, 2024
1 parent 5baf0c7 commit 92971aa
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions ui/src/App.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ const Root = ({children}) => {
)
}

const ss = new StateService(`ws://${window.location.host}/ws`);
const wsProtocol = `ws${window.location.protocol === 'https:' ? 's' : ''}`;
const ss = new StateService(`${wsProtocol}://${window.location.host}/ws`);

const App = () => {
const prefersDarkMode = useMediaQuery('(prefers-color-scheme: dark)');
Expand Down Expand Up @@ -82,7 +83,7 @@ const App = () => {
}, [setErr, replaceDevice, setMeta, loadEntries]);

const levelsService = useMemo(() => {
return new LevelsService(setErr, `ws://${window.location.host}/ws`, theme);
return new LevelsService(setErr, `${wsProtocol}://${window.location.host}/ws`, theme);
}, [setErr]);

// load when version changes
Expand Down

0 comments on commit 92971aa

Please sign in to comment.