ui: Add Websocket prefix settings (#449)

This commit is contained in:
yzx_28 authored and GitHub committed 2022-10-24 02:45:27 +08:00
1 parent 39e3d057fa
commit 0c587d1786
11 files changed
+14 -10

No files matched your search

+1
View File
@@ -197,6 +197,7 @@ SystemSetting(
Setting('setting_server', 'server.url', '/', 'text', 'server.url', 'Server BaseURL'),
Setting('setting_server', 'server.upload', '256m', 'text', 'server.upload', 'Max upload file size'),
Setting('setting_server', 'server.cdn', '/', 'text', 'server.cdn', 'CDN Prefix'),
Setting('setting_server', 'server.ws', '/', 'text', 'server.ws', 'WebSocket Prefix'),
Setting('setting_server', 'server.port', 8888, 'number', 'server.port', 'Server Port'),
Setting('setting_server', 'server.xff', null, 'text', 'server.xff', 'IP Header'),
Setting('setting_server', 'server.xhost', null, 'text', 'server.xhost', 'Hostname Header'),
@@ -7,10 +7,12 @@ import type { HydroRequest, HydroResponse } from '../server';
export interface UiContextBase {
cdn_prefix: string;
url_prefix: string;
ws_prefix: string;
}
export const UiContextBase: UiContextBase = {
cdn_prefix: '/',
url_prefix: '/',
ws_prefix: '/',
};
export default async (ctx, next) => {
@@ -62,6 +64,7 @@ export default async (ctx, next) => {
};
const UiContext: any = cloneDeep(UiContextBase);
if (!process.env.DEV) UiContext.cdn_prefix = system.get('server.cdn');
if (!process.env.DEV) UiContext.ws_prefix = system.get('server.ws');
UiContext.domainId = domainId;
UiContext.domain = domainInfo;
ctx.HydroContext = {