From 9e13c8378de24c33af1f8f3984ed68fee42e5e25 Mon Sep 17 00:00:00 2001 From: zhishi <1951671751@qq.com> Date: Sat, 28 Feb 2026 22:15:38 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B5=8B=E8=AF=95=E5=AE=8C=E6=88=901.0.7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/release.yml | 43 +- electron-builder.yml | 32 +- scripts/main.ts | 31 +- scripts/web/index.html | 2556 ++++++++++++++++++------ src/app.ts | 15 +- src/lib/fixDB.ts | 23 +- src/lib/initDB.ts | 76 +- src/types/database.d.ts | 3 +- src/utils/ai/video/owned/volcengine.ts | 10 +- 9 files changed, 2061 insertions(+), 728 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index c6a118e..b45e4b6 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -78,8 +78,41 @@ jobs: dist/*.zip retention-days: 30 + build-linux: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: "24" + cache: "yarn" + + - name: Install dependencies + run: yarn install --frozen-lockfile + + - name: Build application + run: yarn build + + - name: Build Linux installer + run: yarn dist:linux + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Upload artifacts + uses: actions/upload-artifact@v4 + with: + name: linux-builds + path: | + dist/*.AppImage + dist/*.deb + retention-days: 30 + release: - needs: [build-windows, build-macos] + needs: [build-windows, build-macos, build-linux] runs-on: ubuntu-latest if: startsWith(github.ref, 'refs/tags/') @@ -99,6 +132,12 @@ jobs: name: macos-builds path: dist + - name: Download Linux artifacts + uses: actions/download-artifact@v4 + with: + name: linux-builds + path: dist + - name: Create Release uses: softprops/action-gh-release@v2 with: @@ -110,5 +149,7 @@ jobs: dist/*.exe dist/*.zip dist/*.dmg + dist/*.AppImage + dist/*.deb env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/electron-builder.yml b/electron-builder.yml index 0ebf062..ec20581 100644 --- a/electron-builder.yml +++ b/electron-builder.yml @@ -24,8 +24,14 @@ asar: true win: target: - - nsis - - portable + - target: nsis + arch: + - x64 + - arm64 + - target: portable + arch: + - x64 + - arm64 icon: ./scripts/logo.ico artifactName: ${productName}-${version}-${os}-${arch}.${ext} @@ -34,22 +40,34 @@ nsis: allowToChangeInstallationDirectory: true perMachine: true shortcutName: ${productName} - artifactName: ${productName}-Setup-${version}.${ext} + artifactName: ${productName}-Setup-${version}-${arch}.${ext} installerIcon: './scripts/logo.ico' uninstallerIcon: './scripts/logo.ico' mac: target: - - dmg - - zip + - target: dmg + arch: + - x64 + - arm64 + - target: zip + arch: + - x64 + - arm64 icon: ./scripts/logo.icns category: public.app-category.developer-tools artifactName: ${productName}-${version}-${os}-${arch}.${ext} linux: target: - - AppImage - - deb + - target: AppImage + arch: + - x64 + - arm64 + - target: deb + arch: + - x64 + - arm64 icon: ./scripts/logo.png category: Development artifactName: ${productName}-${version}-${os}-${arch}.${ext} diff --git a/scripts/main.ts b/scripts/main.ts index a97fb0e..d39b1c9 100644 --- a/scripts/main.ts +++ b/scripts/main.ts @@ -1,8 +1,12 @@ import { app, BrowserWindow } from "electron"; import path from "path"; import startServe, { closeServe } from "src/app"; +import { number } from "zod"; -function createMainWindow(): void { +// 默认端口配置 +const defaultPort = 60000; + +function createMainWindow(port: any): void { const win = new BrowserWindow({ width: 900, height: 600, @@ -14,14 +18,28 @@ function createMainWindow(): void { const htmlPath = isDev ? path.join(process.cwd(), "scripts", "web", "index.html") : path.join(app.getAppPath(), "scripts", "web", "index.html"); - void win.loadFile(htmlPath); + + // 使用实际端口构建地址 + const baseUrl = `http://localhost:${port}`; + const wsBaseUrl = `ws://localhost:${port}`; + + // 构建带有 query 参数的 URL + const url = new URL(`file://${htmlPath}`); + url.searchParams.set("baseUrl", baseUrl); + url.searchParams.set("wsBaseUrl", wsBaseUrl); + + console.log("%c Line:30 🥓 url", "background:#33a5ff", url.toString()); + + void win.loadURL(url.toString()); } app.whenReady().then(async () => { - createMainWindow(); try { - await startServe(); + const port = await startServe(false); + createMainWindow(60000); } catch (err) { console.error("[服务启动失败]:", err); + // 如果服务启动失败,使用默认端口创建窗口 + createMainWindow(defaultPort); } }); @@ -30,7 +48,10 @@ app.on("window-all-closed", () => { }); app.on("activate", () => { - if (BrowserWindow.getAllWindows().length === 0) createMainWindow(); + if (BrowserWindow.getAllWindows().length === 0) { + // 重新激活时使用默认端口 + createMainWindow(defaultPort); + } }); app.on("before-quit", async (event) => { diff --git a/scripts/web/index.html b/scripts/web/index.html index f3e04d1..9d58ef3 100644 --- a/scripts/web/index.html +++ b/scripts/web/index.html @@ -1,60 +1,1296 @@ - +
- - - + + +