diff --git a/frontend/react/src/audio/audiomanager.ts b/frontend/react/src/audio/audiomanager.ts index cc86745c..d5b092ed 100644 --- a/frontend/react/src/audio/audiomanager.ts +++ b/frontend/react/src/audio/audiomanager.ts @@ -120,8 +120,7 @@ export class AudioManager { return; } - //this.#socket = new WebSocket(`wss://${wsAddress}/${this.#endpoint}`); - this.#socket = new WebSocket(`wss://refugees.dcsolympus.com/audio`); + this.#socket = new WebSocket(`wss://${wsAddress}/${this.#endpoint}`); if (!this.#socket) this.#socket = new WebSocket(`ws://${wsAddress}:${this.#port}`); if (!this.#socket) { diff --git a/frontend/react/src/ui/modals/adminmodal.tsx b/frontend/react/src/ui/modals/adminmodal.tsx index 969b4e66..d538e6d8 100644 --- a/frontend/react/src/ui/modals/adminmodal.tsx +++ b/frontend/react/src/ui/modals/adminmodal.tsx @@ -74,20 +74,38 @@ export function AdminModal(props: { open: boolean }) { }); }, [adminPassword, configs]); - return ( -
-
+

User admin panel

+
+ +
Groups:
-
+
{configs.groups && - Object.keys(configs.groups).map((group: any) => { + Object.keys(configs.groups).map((group: any, idx: number) => { return (
{group}
@@ -121,7 +139,7 @@ export function AdminModal(props: { open: boolean }) { hover:bg-red-400 `} onClick={() => { - delete configs["users"][group]; + delete configs["groups"][group]; }} > @@ -173,75 +191,96 @@ export function AdminModal(props: { open: boolean }) {
-
+
Users:
-
+
{configs.users && - Object.keys(configs.users).map((user: any) => { + Object.keys(configs.users).map((user: any, idx: number) => { return (
-
{user}
- - - {["Game master", "Blue commander", "Red commander"].map((role: any) => { - return ( -
- { - if (ev.target.checked) { - configs["users"][user].roles.push(role); - } else { - configs["users"][user].roles = configs["users"][user].roles.filter((r: any) => r !== role); - } - setConfigs({ ...configs }); - }} - > - {role} -
- ); - })} -
- - { - var hash = sha256.create(); - configs["users"][user].password = hash.update(ev.currentTarget.value).hex(); - setConfigs({ ...configs }); - }} - className={` - max-w-44 rounded-lg border border-gray-300 bg-gray-50 - p-2.5 text-sm text-gray-900 - dark:border-gray-600 dark:bg-gray-700 dark:text-white - dark:placeholder-gray-400 dark:focus:border-blue-500 - dark:focus:ring-blue-500 - focus:border-blue-500 focus:ring-blue-500 - `} - placeholder="Change password" - required - />
{ - delete configs["users"][user]; - setConfigs({ ...configs }); - }} > - +
{user}
+ + + {["Game master", "Blue commander", "Red commander"].map((role: any) => { + return ( +
+ { + if (ev.target.checked) { + configs["users"][user].roles.push(role); + } else { + configs["users"][user].roles = configs["users"][user].roles.filter((r: any) => r !== role); + } + setConfigs({ ...configs }); + }} + > + {role} +
+ ); + })} +
+
+ +
+ { + var hash = sha256.create(); + configs["users"][user].password = hash.update(ev.currentTarget.value).hex(); + setConfigs({ ...configs }); + }} + className={` + w-full rounded-lg border border-gray-300 bg-gray-50 + p-2.5 text-sm text-gray-900 + dark:border-gray-600 dark:bg-gray-700 dark:text-white + dark:placeholder-gray-400 dark:focus:border-blue-500 + dark:focus:ring-blue-500 + focus:border-blue-500 focus:ring-blue-500 + lg:max-w-92 + `} + placeholder="Change password" + required + /> +
{ + delete configs["users"][user]; + setConfigs({ ...configs }); + }} + > + +
); @@ -291,7 +330,12 @@ export function AdminModal(props: { open: boolean }) {
-
+
Reset all user preferences, use with caution
@@ -318,10 +362,10 @@ export function AdminModal(props: { open: boolean }) { type="button" onClick={() => { uploadNewConfig(); - getApp().setState(OlympusState.IDLE)} - } + getApp().setState(OlympusState.IDLE); + }} className={` - my-auto flex content-center items-center gap-2 rounded-sm + my-auto ml-auto flex content-center items-center gap-2 rounded-sm bg-blue-700 px-5 py-2.5 text-sm font-medium text-white dark:bg-blue-600 dark:hover:bg-blue-700 dark:focus:ring-blue-800 focus:outline-none focus:ring-4 focus:ring-blue-300 diff --git a/frontend/react/src/ui/modals/components/modal.tsx b/frontend/react/src/ui/modals/components/modal.tsx index 2ad7fb53..c1aecb23 100644 --- a/frontend/react/src/ui/modals/components/modal.tsx +++ b/frontend/react/src/ui/modals/components/modal.tsx @@ -27,9 +27,8 @@ export function Modal(props: {
{props.children} {!props.disableClose && ( diff --git a/frontend/react/src/ui/modals/warningmodal.tsx b/frontend/react/src/ui/modals/warningmodal.tsx index fee3b9d8..03c97d98 100644 --- a/frontend/react/src/ui/modals/warningmodal.tsx +++ b/frontend/react/src/ui/modals/warningmodal.tsx @@ -51,7 +51,9 @@ export function WarningModal(props: { open: boolean }) { Your connection to DCS Olympus is not secure. To protect your personal data some advanced DCS Olympus features like the camera plugin or the audio backend have been disabled. - To solve this issue, DCS Olympus should be served using the https protocol. + To solve this issue, DCS Olympus should be served using the https protocol. To do so, we suggest using a dedicated server and a reverse proxy with SSL enabled.
diff --git a/frontend/react/src/ui/panels/optionsmenu.tsx b/frontend/react/src/ui/panels/optionsmenu.tsx index 5c441744..6c26046e 100644 --- a/frontend/react/src/ui/panels/optionsmenu.tsx +++ b/frontend/react/src/ui/panels/optionsmenu.tsx @@ -47,6 +47,7 @@ export function OptionsMenu(props: { open: boolean; onClose: () => void; childre getApp().setState(OlympusState.ADMIN); return response.json(); } else { + getApp().addInfoMessage(`Admin password incorrect!`); throw new Error("Admin password incorrect"); } });