-
Notifications
You must be signed in to change notification settings - Fork 562
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #186 from jcfun/dev
- 修复linux下无法记录窗口大小和位置的问题 - 修复主进程端口占用时无法自动切换端口的问题 - 统一程序关闭按钮的效果
- Loading branch information
Showing
4 changed files
with
4,485 additions
and
5,568 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -74,6 +74,7 @@ linux: | |
icon: public/imgs/icons/favicon-512x512.png | ||
# 构建类型 | ||
target: | ||
- pacman | ||
- AppImage | ||
- deb | ||
- rpm | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,22 @@ | ||
import { join } from "path"; | ||
import express from "express"; | ||
import expressProxy from "express-http-proxy"; | ||
import checkPort from "./utils/checkPort"; | ||
|
||
/** | ||
* 启动主服务器 | ||
* @returns {import('http').Server} HTTP 服务器实例 | ||
*/ | ||
export const startMainServer = async () => { | ||
const { MAIN_VITE_MAIN_PORT, MAIN_VITE_SERVER_HOST, MAIN_VITE_SERVER_PORT } = import.meta.env; | ||
const port = MAIN_VITE_MAIN_PORT ?? 7899; | ||
const port = await checkPort(MAIN_VITE_MAIN_PORT ?? 7899); | ||
process.env.MAIN_VITE_MAIN_PORT = port; | ||
const apiHost = `http://${MAIN_VITE_SERVER_HOST}:${MAIN_VITE_SERVER_PORT}`; | ||
const expressApp = express(); | ||
// 代理 | ||
expressApp.use("/", express.static(join(__dirname, "../renderer/"))); | ||
expressApp.use("/api", expressProxy(apiHost)); | ||
console.log("生产模式主进程端口: ", port); | ||
// 启动 Express 应用服务器,并监听指定端口 | ||
return expressApp.listen(port, "127.0.0.1"); | ||
}; |
Oops, something went wrong.