feat: add Bind Host IP and Allowed Hosts / Reverse Proxy Domain settings
This commit is contained in:
@@ -370,6 +370,9 @@ export const api = {
|
||||
getServerConfig: async (portHint?: number): Promise<{
|
||||
online: boolean;
|
||||
enabled: boolean;
|
||||
host?: string;
|
||||
activeHost?: string;
|
||||
allowedHosts?: string;
|
||||
port: number;
|
||||
activePort?: number;
|
||||
webPort?: number;
|
||||
@@ -388,6 +391,9 @@ export const api = {
|
||||
if (res.ok && ct.includes("application/json")) {
|
||||
const data = (await res.json()) as {
|
||||
enabled: boolean;
|
||||
host?: string;
|
||||
activeHost?: string;
|
||||
allowedHosts?: string;
|
||||
port: number;
|
||||
activePort?: number;
|
||||
webPort?: number;
|
||||
@@ -398,6 +404,9 @@ export const api = {
|
||||
return {
|
||||
online: true,
|
||||
enabled: data.enabled,
|
||||
...(data.host ? { host: data.host } : {}),
|
||||
...(data.activeHost ? { activeHost: data.activeHost } : {}),
|
||||
...(data.allowedHosts ? { allowedHosts: data.allowedHosts } : {}),
|
||||
port: data.port,
|
||||
...(data.activePort !== undefined ? { activePort: data.activePort } : {}),
|
||||
...(data.webPort !== undefined ? { webPort: data.webPort } : {}),
|
||||
@@ -413,6 +422,8 @@ export const api = {
|
||||
return {
|
||||
online: false,
|
||||
enabled: true,
|
||||
host: "127.0.0.1",
|
||||
allowedHosts: "localhost, 127.0.0.1",
|
||||
port: portHint ?? 8081,
|
||||
webPort: 5173,
|
||||
startOnBoot: false,
|
||||
@@ -422,6 +433,8 @@ export const api = {
|
||||
updateServerConfig: async (
|
||||
patch: {
|
||||
enabled?: boolean;
|
||||
host?: string;
|
||||
allowedHosts?: string;
|
||||
port?: number;
|
||||
webPort?: number;
|
||||
startOnBoot?: boolean;
|
||||
@@ -431,6 +444,9 @@ export const api = {
|
||||
): Promise<{
|
||||
online: boolean;
|
||||
enabled: boolean;
|
||||
host?: string;
|
||||
activeHost?: string;
|
||||
allowedHosts?: string;
|
||||
port: number;
|
||||
activePort?: number;
|
||||
webPort?: number;
|
||||
@@ -454,6 +470,9 @@ export const api = {
|
||||
if (res.ok && ct.includes("application/json")) {
|
||||
const data = (await res.json()) as {
|
||||
enabled: boolean;
|
||||
host?: string;
|
||||
activeHost?: string;
|
||||
allowedHosts?: string;
|
||||
port: number;
|
||||
activePort?: number;
|
||||
webPort?: number;
|
||||
@@ -464,6 +483,9 @@ export const api = {
|
||||
return {
|
||||
online: true,
|
||||
enabled: data.enabled,
|
||||
...(data.host ? { host: data.host } : {}),
|
||||
...(data.activeHost ? { activeHost: data.activeHost } : {}),
|
||||
...(data.allowedHosts ? { allowedHosts: data.allowedHosts } : {}),
|
||||
port: data.port,
|
||||
...(data.activePort !== undefined ? { activePort: data.activePort } : {}),
|
||||
...(data.webPort !== undefined ? { webPort: data.webPort } : {}),
|
||||
@@ -479,6 +501,8 @@ export const api = {
|
||||
return {
|
||||
online: false,
|
||||
enabled: patch.enabled ?? true,
|
||||
...(patch.host ? { host: patch.host } : {}),
|
||||
...(patch.allowedHosts ? { allowedHosts: patch.allowedHosts } : {}),
|
||||
port: patch.port ?? portHint ?? 8081,
|
||||
...(patch.webPort !== undefined ? { webPort: patch.webPort } : {}),
|
||||
startOnBoot: patch.startOnBoot ?? false,
|
||||
|
||||
Reference in New Issue
Block a user