Skip to content
Snippets Groups Projects
Commit 77bae388 authored by Michael Loipführer's avatar Michael Loipführer
Browse files

fix privileged api

parent 8957328a
No related branches found
No related tags found
No related merge requests found
......@@ -5,7 +5,7 @@ import Login from "./components/Login";
import Haspa from "./components/Haspa";
import Loading from "./components/Loading";
const privilegedIP = "::1";
const privilegedIPs = ["localhost", "10.150.9.13", "::1"];
class App extends React.Component {
state = {
......@@ -58,7 +58,7 @@ class App extends React.Component {
setTimeout(this.refreshToken, message["expires_at"] * 1000 - new Date().getTime() - 10000);
} else if (message["type"] === "client_info") {
const clientIP = message["client_ip"];
if (clientIP === privilegedIP && !this.state.isPrivileged) {
if (privilegedIPs.includes(clientIP) && !this.state.isPrivileged) {
this.setState({isPrivileged: true, wsURL: message["privileged_address"]});
this.ws = new WebSocket(message["privileged_address"]);
this.initWS();
......
......@@ -72,8 +72,8 @@ class WebSocket:
client_info = {
"type": "client_info",
"client_ip": client_ip,
"privileged_address": f'wss://{self.config.get("internal_host")}:{self.config.get("internal_port")}',
"unprivileged_address": f'ws://{self.config.get("external_host")}:{self.config.get("external_port")}'
"privileged_address": f'ws://{self.config.get("internal_host")}:{self.config.get("internal_port")}',
"unprivileged_address": f'wss://{self.config.get("external_host")}:{self.config.get("external_port")}'
}
await websocket.send(json.dumps(client_info))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment