Working server list add
This commit is contained in:
+1
-1
@@ -1,6 +1,6 @@
|
||||
import { useReducer, useRef } from "react";
|
||||
import Enclave from "@/app/app";
|
||||
import ServerList from "./components/view/serverList";
|
||||
import ServerList from "./components/view/ServerList";
|
||||
import { NewProfilePage } from "./components/view/NewProfileView";
|
||||
|
||||
export default function App() {
|
||||
|
||||
+1
-1
@@ -48,7 +48,7 @@ export default class Enclave {
|
||||
this.server.disconnect();
|
||||
}
|
||||
|
||||
this.server = new EnclaveServer(getHostname(hostname), isSecure);
|
||||
this.server = new EnclaveServer(hostname, isSecure);
|
||||
|
||||
const clientSecretKey = this.getClientSecretKey();
|
||||
|
||||
|
||||
@@ -40,13 +40,13 @@ export default function ServerList({
|
||||
return;
|
||||
}
|
||||
|
||||
appRef.current
|
||||
.connectToServer(hostname, isSecure)
|
||||
.then(
|
||||
() =>
|
||||
appRef.current?.serverList &&
|
||||
saveServerList(appRef.current?.serverList),
|
||||
);
|
||||
appRef.current.connectToServer(hostname, isSecure).then(() => {
|
||||
if (!appRef.current) return;
|
||||
|
||||
appRef.current.forceRender();
|
||||
|
||||
saveServerList(appRef.current.serverList);
|
||||
});
|
||||
}}
|
||||
/>
|
||||
</aside>
|
||||
|
||||
@@ -18,13 +18,9 @@ export async function getServerList(): Promise<ServerList> {
|
||||
}
|
||||
|
||||
export function getHTTPUrl(hostname: string, isSecure: boolean, path: string) {
|
||||
return (isSecure ? "https://" : "http://") + getHostname(hostname) + path;
|
||||
return (isSecure ? "https://" : "http://") + hostname + path;
|
||||
}
|
||||
|
||||
export function getWSUrl(hostname: string, isSecure: boolean) {
|
||||
return (isSecure ? "wss://" : "ws://") + getHostname(hostname);
|
||||
}
|
||||
|
||||
export function getHostname(hostname: string) {
|
||||
return hostname.includes(":") ? hostname : hostname + ":3415";
|
||||
return (isSecure ? "wss://" : "ws://") + hostname;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user