From 6e825f6c8a933cd090af0199c4b66d162ddd6297 Mon Sep 17 00:00:00 2001 From: a12110 Date: Fri, 10 Apr 2026 23:27:33 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0:=20=E5=A2=9E=E5=BC=BAossUrl?= =?UTF-8?q?=E8=BF=94=E5=9B=9E=E5=81=A5=E5=A3=AE=E6=80=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .env | 1 + .gitignore | 1 - src/env.ts | 8 ++++++++ src/types/database.d.ts | 36 +----------------------------------- src/utils/oss.ts | 2 ++ 5 files changed, 12 insertions(+), 36 deletions(-) create mode 100644 .env diff --git a/.env b/.env new file mode 100644 index 0000000..4ea20d2 --- /dev/null +++ b/.env @@ -0,0 +1 @@ +ossURL= \ No newline at end of file diff --git a/.gitignore b/.gitignore index f5aa258..1575956 100644 --- a/.gitignore +++ b/.gitignore @@ -17,7 +17,6 @@ _.log report.[0-9]_.[0-9]_.[0-9]_.[0-9]_.json # dotenv environment variable files -.env .env.development.local .env.test.local .env.production.local diff --git a/src/env.ts b/src/env.ts index db8f322..ca3c960 100644 --- a/src/env.ts +++ b/src/env.ts @@ -1,3 +1,11 @@ +import dotenv from "dotenv"; +import path from "node:path"; + +dotenv.config({ + path: path.resolve(process.cwd(), ".env"), +}); + + // 判断是否为打包后的 Electron 环境 const isElectron = typeof process.versions?.electron !== "undefined"; let isPackaged = false; diff --git a/src/types/database.d.ts b/src/types/database.d.ts index 8adea86..2a9745d 100644 --- a/src/types/database.d.ts +++ b/src/types/database.d.ts @@ -1,37 +1,6 @@ -// @db-hash 6cd709d9bdfe00c4dc87961a8ebba149 +// @db-hash 3296433eb24314b094ac5d3839c049c5 //该文件由脚本自动生成,请勿手动修改 -export interface _o_project_old_20260404 { - 'artStyle'?: string | null; - 'createTime'?: number | null; - 'directorManual'?: string | null; - 'id'?: number | null; - 'imageModel'?: string | null; - 'imageQuality'?: string | null; - 'intro'?: string | null; - 'mode'?: string | null; - 'name'?: string | null; - 'projectType'?: string | null; - 'type'?: string | null; - 'userId'?: number | null; - 'videoModel'?: string | null; - 'videoRatio'?: string | null; -} -export interface _o_prompt_old_20260406 { - 'data'?: string | null; - 'id'?: number; - 'name'?: string | null; - 'type'?: string | null; - 'useData'?: string | null; -} -export interface _o_prompt_old_20260406_1 { - 'data'?: string | null; - 'id'?: number; - 'name'?: string | null; - 'TEXT'?: any | null; - 'type'?: string | null; - 'useData'?: string | null; -} export interface memories { 'content': string; 'createTime': number; @@ -263,9 +232,6 @@ export interface o_videoTrack { } export interface DB { - "_o_project_old_20260404": _o_project_old_20260404; - "_o_prompt_old_20260406": _o_prompt_old_20260406; - "_o_prompt_old_20260406_1": _o_prompt_old_20260406_1; "memories": memories; "o_agentDeploy": o_agentDeploy; "o_agentWorkData": o_agentWorkData; diff --git a/src/utils/oss.ts b/src/utils/oss.ts index bfeb0a2..e019a88 100644 --- a/src/utils/oss.ts +++ b/src/utils/oss.ts @@ -51,6 +51,8 @@ class OSS { const safePath = normalizeUserPath(userRelPath); // URL 始终使用 /,所以这里需要将系统分隔符转回 / let url = `/${prefix}/`; + if (!process.env.ossURL || process.env.ossURL != "") url = process.env.ossURL + `/${prefix}/`; + // if (process.env.NODE_ENV == "dev") url = `http://localhost:10588/${prefix}/`; if (isEletron()) url = `http://localhost:${process.env.PORT}/${prefix}/`; return `${url}${safePath.split(path.sep).join("/")}`; }