测试完成1.0.7
This commit is contained in:
parent
1dd328262c
commit
9e13c8378d
43
.github/workflows/release.yml
vendored
43
.github/workflows/release.yml
vendored
@ -78,8 +78,41 @@ jobs:
|
|||||||
dist/*.zip
|
dist/*.zip
|
||||||
retention-days: 30
|
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:
|
release:
|
||||||
needs: [build-windows, build-macos]
|
needs: [build-windows, build-macos, build-linux]
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
if: startsWith(github.ref, 'refs/tags/')
|
if: startsWith(github.ref, 'refs/tags/')
|
||||||
|
|
||||||
@ -99,6 +132,12 @@ jobs:
|
|||||||
name: macos-builds
|
name: macos-builds
|
||||||
path: dist
|
path: dist
|
||||||
|
|
||||||
|
- name: Download Linux artifacts
|
||||||
|
uses: actions/download-artifact@v4
|
||||||
|
with:
|
||||||
|
name: linux-builds
|
||||||
|
path: dist
|
||||||
|
|
||||||
- name: Create Release
|
- name: Create Release
|
||||||
uses: softprops/action-gh-release@v2
|
uses: softprops/action-gh-release@v2
|
||||||
with:
|
with:
|
||||||
@ -110,5 +149,7 @@ jobs:
|
|||||||
dist/*.exe
|
dist/*.exe
|
||||||
dist/*.zip
|
dist/*.zip
|
||||||
dist/*.dmg
|
dist/*.dmg
|
||||||
|
dist/*.AppImage
|
||||||
|
dist/*.deb
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|||||||
@ -24,8 +24,14 @@ asar: true
|
|||||||
|
|
||||||
win:
|
win:
|
||||||
target:
|
target:
|
||||||
- nsis
|
- target: nsis
|
||||||
- portable
|
arch:
|
||||||
|
- x64
|
||||||
|
- arm64
|
||||||
|
- target: portable
|
||||||
|
arch:
|
||||||
|
- x64
|
||||||
|
- arm64
|
||||||
icon: ./scripts/logo.ico
|
icon: ./scripts/logo.ico
|
||||||
artifactName: ${productName}-${version}-${os}-${arch}.${ext}
|
artifactName: ${productName}-${version}-${os}-${arch}.${ext}
|
||||||
|
|
||||||
@ -34,22 +40,34 @@ nsis:
|
|||||||
allowToChangeInstallationDirectory: true
|
allowToChangeInstallationDirectory: true
|
||||||
perMachine: true
|
perMachine: true
|
||||||
shortcutName: ${productName}
|
shortcutName: ${productName}
|
||||||
artifactName: ${productName}-Setup-${version}.${ext}
|
artifactName: ${productName}-Setup-${version}-${arch}.${ext}
|
||||||
installerIcon: './scripts/logo.ico'
|
installerIcon: './scripts/logo.ico'
|
||||||
uninstallerIcon: './scripts/logo.ico'
|
uninstallerIcon: './scripts/logo.ico'
|
||||||
|
|
||||||
mac:
|
mac:
|
||||||
target:
|
target:
|
||||||
- dmg
|
- target: dmg
|
||||||
- zip
|
arch:
|
||||||
|
- x64
|
||||||
|
- arm64
|
||||||
|
- target: zip
|
||||||
|
arch:
|
||||||
|
- x64
|
||||||
|
- arm64
|
||||||
icon: ./scripts/logo.icns
|
icon: ./scripts/logo.icns
|
||||||
category: public.app-category.developer-tools
|
category: public.app-category.developer-tools
|
||||||
artifactName: ${productName}-${version}-${os}-${arch}.${ext}
|
artifactName: ${productName}-${version}-${os}-${arch}.${ext}
|
||||||
|
|
||||||
linux:
|
linux:
|
||||||
target:
|
target:
|
||||||
- AppImage
|
- target: AppImage
|
||||||
- deb
|
arch:
|
||||||
|
- x64
|
||||||
|
- arm64
|
||||||
|
- target: deb
|
||||||
|
arch:
|
||||||
|
- x64
|
||||||
|
- arm64
|
||||||
icon: ./scripts/logo.png
|
icon: ./scripts/logo.png
|
||||||
category: Development
|
category: Development
|
||||||
artifactName: ${productName}-${version}-${os}-${arch}.${ext}
|
artifactName: ${productName}-${version}-${os}-${arch}.${ext}
|
||||||
|
|||||||
@ -1,8 +1,12 @@
|
|||||||
import { app, BrowserWindow } from "electron";
|
import { app, BrowserWindow } from "electron";
|
||||||
import path from "path";
|
import path from "path";
|
||||||
import startServe, { closeServe } from "src/app";
|
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({
|
const win = new BrowserWindow({
|
||||||
width: 900,
|
width: 900,
|
||||||
height: 600,
|
height: 600,
|
||||||
@ -14,14 +18,28 @@ function createMainWindow(): void {
|
|||||||
const htmlPath = isDev
|
const htmlPath = isDev
|
||||||
? path.join(process.cwd(), "scripts", "web", "index.html")
|
? path.join(process.cwd(), "scripts", "web", "index.html")
|
||||||
: path.join(app.getAppPath(), "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 () => {
|
app.whenReady().then(async () => {
|
||||||
createMainWindow();
|
|
||||||
try {
|
try {
|
||||||
await startServe();
|
const port = await startServe(false);
|
||||||
|
createMainWindow(60000);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error("[服务启动失败]:", err);
|
console.error("[服务启动失败]:", err);
|
||||||
|
// 如果服务启动失败,使用默认端口创建窗口
|
||||||
|
createMainWindow(defaultPort);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -30,7 +48,10 @@ app.on("window-all-closed", () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
app.on("activate", () => {
|
app.on("activate", () => {
|
||||||
if (BrowserWindow.getAllWindows().length === 0) createMainWindow();
|
if (BrowserWindow.getAllWindows().length === 0) {
|
||||||
|
// 重新激活时使用默认端口
|
||||||
|
createMainWindow(defaultPort);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
app.on("before-quit", async (event) => {
|
app.on("before-quit", async (event) => {
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
15
src/app.ts
15
src/app.ts
@ -14,7 +14,7 @@ import jwt from "jsonwebtoken";
|
|||||||
const app = express();
|
const app = express();
|
||||||
let server: ReturnType<typeof app.listen> | null = null;
|
let server: ReturnType<typeof app.listen> | null = null;
|
||||||
|
|
||||||
export default async function startServe() {
|
export default async function startServe(randomPort: Boolean = false) {
|
||||||
if (process.env.NODE_ENV == "dev") await buildRoute();
|
if (process.env.NODE_ENV == "dev") await buildRoute();
|
||||||
|
|
||||||
expressWs(app);
|
expressWs(app);
|
||||||
@ -77,11 +77,14 @@ export default async function startServe() {
|
|||||||
res.status(err.status || 500).send(err);
|
res.status(err.status || 500).send(err);
|
||||||
});
|
});
|
||||||
|
|
||||||
const port = parseInt(process.env.PORT || "60000");
|
const port = randomPort ? 0 : parseInt(process.env.PORT || "60000");
|
||||||
server = app.listen(port, async () => {
|
return await new Promise((resolve, reject) => {
|
||||||
const address = server?.address();
|
server = app.listen(port, async (v) => {
|
||||||
const realPort = typeof address === "string" ? address : address?.port;
|
const address = server?.address();
|
||||||
console.log(`[服务启动成功]: http://localhost:${realPort}`);
|
const realPort = typeof address === "string" ? address : address?.port;
|
||||||
|
console.log(`[服务启动成功]: http://localhost:${realPort}`);
|
||||||
|
resolve(realPort);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
3
src/types/database.d.ts
vendored
3
src/types/database.d.ts
vendored
@ -1,4 +1,4 @@
|
|||||||
// @db-hash 0f9789bd5ad2eebd79bd502988efcb4e
|
// @db-hash e31d315edc912b97f549368fcf5fc453
|
||||||
//该文件由脚本自动生成,请勿手动修改
|
//该文件由脚本自动生成,请勿手动修改
|
||||||
|
|
||||||
export interface t_aiModelMap {
|
export interface t_aiModelMap {
|
||||||
@ -159,6 +159,7 @@ export interface t_videoConfig {
|
|||||||
'createTime'?: number | null;
|
'createTime'?: number | null;
|
||||||
'duration'?: number | null;
|
'duration'?: number | null;
|
||||||
'endFrame'?: string | null;
|
'endFrame'?: string | null;
|
||||||
|
'errorReason'?: string | null;
|
||||||
'id'?: number;
|
'id'?: number;
|
||||||
'images'?: string | null;
|
'images'?: string | null;
|
||||||
'manufacturer'?: string | null;
|
'manufacturer'?: string | null;
|
||||||
|
|||||||
@ -52,11 +52,11 @@ export default async (input: VideoConfig, config: AIConfig) => {
|
|||||||
|
|
||||||
// 轮询任务状态
|
// 轮询任务状态
|
||||||
return await pollTask(async () => {
|
return await pollTask(async () => {
|
||||||
const { status, content } = (
|
const data = await axios.get(`${baseUrl}/${taskId}`, {
|
||||||
await axios.get(`${baseUrl}/${taskId}`, {
|
headers: { Authorization: authorization },
|
||||||
headers: { Authorization: authorization },
|
});
|
||||||
})
|
|
||||||
).data;
|
const { status, content } = data.data;
|
||||||
|
|
||||||
switch (status) {
|
switch (status) {
|
||||||
case "succeeded":
|
case "succeeded":
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user