客户端打包

This commit is contained in:
2025-11-28 15:15:36 +08:00
parent 57c40d0b3a
commit 26750c3c2a
21 changed files with 22 additions and 17 deletions

View File

@@ -65,8 +65,10 @@ export async function createWindow() {
// Create the browser window.
mainWindow = new BrowserWindow({
width: 420,
height: 900,
width: 1480,
height: 980,
minWidth: 1480,
minHeight: 980,
show: false,
media: {
audio: true,
@@ -161,7 +163,7 @@ export async function createWindow() {
setStoreValue("h5_client_url", import.meta.env.VITE_h5_client_url)
}
const h5_client_url=getStoreValue("h5_client_url")+"/h5_client/"
const h5_client_url=getStoreValue("h5_client_url")+"/pc_client/"
logger.info("==================================== mainWindow.loadURL:"+h5_client_url)
// 加载存储的 URL
@@ -174,10 +176,10 @@ export async function createWindow() {
mainWindow.webContents.on('did-fail-load', async (event, errorCode, errorDescription, validatedURL) => {
logger.error(`主窗口页面加载失败: code=${errorCode}, desc=${errorDescription}, url=${validatedURL}, 失败次数: ${failLoadCount + 1}`)
// 增加失败计数
failLoadCount++;
if (failLoadCount <= maxRetries) {
logger.info(`页面加载失败,${retryDelay}ms后进行第${failLoadCount}次重试...`);
setTimeout(async () => {
@@ -503,18 +505,18 @@ export async function createNewWindow(url, access_token, refresh_token,sandbox=f
difyfullScreenWindow.webContents.on('did-fail-load', async (event, errorCode, errorDescription, validatedURL) => {
logger.error(`全屏窗口页面加载失败: code=${errorCode}, desc=${errorDescription}, url=${validatedURL}, 失败次数: ${failLoadCount + 1}`)
failLoadCount++;
if (failLoadCount <= maxRetries) {
logger.info(`全屏窗口页面加载失败,${retryDelay}ms后进行第${failLoadCount}次重试...`);
setTimeout(async () => {
try {
// 在重试前先检查网络连接
const { checkDefaultClientConnection } = await import('./utils/networkUtils.js');
const isNetworkConnected = await checkDefaultClientConnection(3000);
if (isNetworkConnected) {
logger.info('网络连接正常,重新加载全屏窗口页面');
difyfullScreenWindow.reload();
@@ -606,18 +608,18 @@ export function createDrageWindow() {
drageWindow.webContents.on('did-fail-load', async (event, errorCode, errorDescription, validatedURL) => {
logger.error(`悬浮窗口页面加载失败: code=${errorCode}, desc=${errorDescription}, url=${validatedURL}, 失败次数: ${drageFailLoadCount + 1}`)
drageFailLoadCount++;
if (drageFailLoadCount <= drageMaxRetries) {
logger.info(`悬浮窗口页面加载失败,${drageRetryDelay}ms后进行第${drageFailLoadCount}次重试...`);
setTimeout(async () => {
try {
// 在重试前先检查网络连接
const { checkDefaultClientConnection } = await import('./utils/networkUtils.js');
const isNetworkConnected = await checkDefaultClientConnection(3000);
if (isNetworkConnected) {
logger.info('网络连接正常,重新加载悬浮窗口页面');
drageWindow.reload();
@@ -653,6 +655,8 @@ export async function tokenExpireTimer(){
const LOG_INTERVAL = 60000; // 日志打印间隔60秒打印一次
const tokenExpireTimer = setInterval(async () => {
return false;
const currentTime = Date.now();
const lastActiveTime = getStoreValue("lastActiveTime")||null