From 6bf8d86c1007a3da373781e3dca7ca2f25ce913b Mon Sep 17 00:00:00 2001 From: abearxiong Date: Sat, 7 Feb 2026 13:06:28 +0800 Subject: [PATCH] =?UTF-8?q?=E9=87=8D=E6=9E=84=E9=85=8D=E7=BD=AE=E7=AE=A1?= =?UTF-8?q?=E7=90=86=EF=BC=8C=E6=9B=B4=E6=96=B0=E5=9F=9F=E5=90=8D=E5=A4=84?= =?UTF-8?q?=E7=90=86=E9=80=BB=E8=BE=91=EF=BC=8C=E7=AE=80=E5=8C=96=E9=85=8D?= =?UTF-8?q?=E7=BD=AE=E7=BB=93=E6=9E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/modules/config.ts | 45 +++++++++---------------------------------- src/modules/domain.ts | 4 +++- src/routes/user/me.ts | 2 +- 3 files changed, 13 insertions(+), 38 deletions(-) diff --git a/src/modules/config.ts b/src/modules/config.ts index 0b910d5..73aa920 100644 --- a/src/modules/config.ts +++ b/src/modules/config.ts @@ -1,19 +1,12 @@ import { useConfig } from '@kevisual/use-config'; import { useFileStore } from '@kevisual/use-config'; import { minioResources } from './s3.ts'; +import { proxyDomain } from './domain.ts'; export const config = useConfig() as any; export const port = config.PORT ? Number(config.PORT) : 4005; export const fileStore = useFileStore('pages'); type ConfigType = { - api: { - /** - * API host address - */ - host: string; - path?: string; - port?: number; - }; apiList: { path: string; /** @@ -29,7 +22,11 @@ type ConfigType = { /** * self domain kevisual.xiongxiao.me */ - domain: string; + domain?: string; + /** + * self ip + */ + ip?: string; /** * resources path * https://minio.xiongxiao.me/resources @@ -41,24 +38,8 @@ type ConfigType = { */ allowedOrigin: string[]; }; - stat: { - /** - * 统计网站ID - */ - websiteId: string; - }; - redis?: { - host: string; - port: number; - password?: string; - }; }; export const myConfig: ConfigType = { - api: { - host: config.API_HOST, - path: config.API_PATH, - port: config.PROXY_PORT, - }, apiList: [ // { // path: '/api', @@ -66,20 +47,12 @@ export const myConfig: ConfigType = { // }, { path: '/client', - target: config.API_CLIENT_HOST || 'http://localhost:51015', + target: config.API_CLIENT_HOST || 'http://localhost:51515', }, ], proxy: { - domain: config.PROXY_DOMAIN, + domain: proxyDomain as string, resources: minioResources, allowedOrigin: (config.PROXY_ALLOWED_ORIGINS as string)?.split(',') || [], - }, - redis: { - host: config.REDIS_HOST, - port: config.REDIS_PORT, - password: config.REDIS_PASSWORD, - }, - stat: { - websiteId: config.DATA_WEBSITE_ID, - }, + } }; diff --git a/src/modules/domain.ts b/src/modules/domain.ts index c82171b..41bdcdc 100644 --- a/src/modules/domain.ts +++ b/src/modules/domain.ts @@ -1,5 +1,7 @@ +import { useKey } from "@kevisual/use-config"; + /** * 用来放cookie的域名 */ -export const domain = process.env.DOMAIN || ''; // 请在这里填写你的域名 +export const proxyDomain = useKey('PROXY_DOMAIN') || ''; // 请在这里填写你的域名 diff --git a/src/routes/user/me.ts b/src/routes/user/me.ts index c8a6618..07179c9 100644 --- a/src/routes/user/me.ts +++ b/src/routes/user/me.ts @@ -1,7 +1,7 @@ import { app } from '@/app.ts'; import { Org } from '@/models/org.ts'; import { User } from '@/models/user.ts'; -import { domain } from '@/modules/domain.ts'; +import { proxyDomain as domain } from '@/modules/domain.ts'; /** * 当配置了domain后,创建cookie,当get请求地址的时候,会自动带上cookie * @param token