测试完成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
|
||||
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 }}
|
||||
|
||||
@ -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}
|
||||
|
||||
@ -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) => {
|
||||
|
||||
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();
|
||||
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();
|
||||
|
||||
expressWs(app);
|
||||
@ -77,11 +77,14 @@ export default async function startServe() {
|
||||
res.status(err.status || 500).send(err);
|
||||
});
|
||||
|
||||
const port = parseInt(process.env.PORT || "60000");
|
||||
server = app.listen(port, async () => {
|
||||
const address = server?.address();
|
||||
const realPort = typeof address === "string" ? address : address?.port;
|
||||
console.log(`[服务启动成功]: http://localhost:${realPort}`);
|
||||
const port = randomPort ? 0 : parseInt(process.env.PORT || "60000");
|
||||
return await new Promise((resolve, reject) => {
|
||||
server = app.listen(port, async (v) => {
|
||||
const address = server?.address();
|
||||
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 {
|
||||
@ -159,6 +159,7 @@ export interface t_videoConfig {
|
||||
'createTime'?: number | null;
|
||||
'duration'?: number | null;
|
||||
'endFrame'?: string | null;
|
||||
'errorReason'?: string | null;
|
||||
'id'?: number;
|
||||
'images'?: string | null;
|
||||
'manufacturer'?: string | null;
|
||||
|
||||
@ -52,11 +52,11 @@ export default async (input: VideoConfig, config: AIConfig) => {
|
||||
|
||||
// 轮询任务状态
|
||||
return await pollTask(async () => {
|
||||
const { status, content } = (
|
||||
await axios.get(`${baseUrl}/${taskId}`, {
|
||||
headers: { Authorization: authorization },
|
||||
})
|
||||
).data;
|
||||
const data = await axios.get(`${baseUrl}/${taskId}`, {
|
||||
headers: { Authorization: authorization },
|
||||
});
|
||||
|
||||
const { status, content } = data.data;
|
||||
|
||||
switch (status) {
|
||||
case "succeeded":
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user