Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 3e425458ff | |||
| 7ad962d2d0 | |||
| 1cb14aa0fc |
2
.env.14_200
Normal file
2
.env.14_200
Normal file
@@ -0,0 +1,2 @@
|
||||
VITE_h5_client_url=https://bqwlg.ii999.live:20038
|
||||
VITE_HsAppCode=1
|
||||
@@ -1,2 +1,2 @@
|
||||
VITE_h5_client_url=http://10.102.9.139:18901
|
||||
VITE_h5_client_url=http://10.101.27.243:18900
|
||||
VITE_HsAppCode=1
|
||||
|
||||
2
.env.pingshan
Normal file
2
.env.pingshan
Normal file
@@ -0,0 +1,2 @@
|
||||
VITE_h5_client_url=http://172.22.33.66:18900
|
||||
VITE_HsAppCode=1
|
||||
2
.env.shenranqi
Normal file
2
.env.shenranqi
Normal file
@@ -0,0 +1,2 @@
|
||||
VITE_h5_client_url=http://10.9.18.138:18900
|
||||
VITE_HsAppCode=1
|
||||
44
electron-builder-shenranqi.yml
Normal file
44
electron-builder-shenranqi.yml
Normal file
@@ -0,0 +1,44 @@
|
||||
appId: com.huashiai.dify-market-manager-gui
|
||||
compression: maximum
|
||||
productName: 深燃智能体平台
|
||||
directories:
|
||||
buildResources: build
|
||||
files:
|
||||
- '!**/.vscode/*'
|
||||
- '!src/*'
|
||||
- '!electron.vite.config.{js,ts,mjs,cjs}'
|
||||
- '!{.eslintignore,.eslintrc.cjs,.prettierignore,.prettierrc.yaml,dev-app-update.yml,CHANGELOG.md,README.md}'
|
||||
- '!{.env,.env.*,.npmrc,pnpm-lock.yaml}'
|
||||
asarUnpack:
|
||||
- resources/**
|
||||
win:
|
||||
executableName: 深燃智能体平台
|
||||
nsis:
|
||||
artifactName: ${name}-${version}-setup.${ext}
|
||||
shortcutName: ${productName}
|
||||
uninstallDisplayName: ${productName}
|
||||
createDesktopShortcut: always
|
||||
mac:
|
||||
entitlementsInherit: build/entitlements.mac.plist
|
||||
extendInfo:
|
||||
- NSCameraUsageDescription: Application requests access to the device's camera.
|
||||
- NSMicrophoneUsageDescription: Application requests access to the device's microphone.
|
||||
- NSDocumentsFolderUsageDescription: Application requests access to the user's Documents folder.
|
||||
- NSDownloadsFolderUsageDescription: Application requests access to the user's Downloads folder.
|
||||
notarize: false
|
||||
dmg:
|
||||
artifactName: ${name}-${version}.${ext}
|
||||
linux:
|
||||
target:
|
||||
- AppImage
|
||||
- deb
|
||||
maintainer: huashiai.org
|
||||
category: Utility
|
||||
appImage:
|
||||
artifactName: ${name}-${version}.${ext}
|
||||
npmRebuild: false
|
||||
publish:
|
||||
provider: generic
|
||||
url: ""
|
||||
electronDownload:
|
||||
mirror: https://npmmirror.com/mirrors/electron/
|
||||
@@ -1,6 +1,6 @@
|
||||
appId: com.huashiai.dify-market-manager-gui
|
||||
compression: maximum
|
||||
productName: 龙岗区百千万AI智能体共创平台
|
||||
productName: 百千万AI智能体共创平台
|
||||
directories:
|
||||
buildResources: build
|
||||
files:
|
||||
@@ -12,7 +12,7 @@ files:
|
||||
asarUnpack:
|
||||
- resources/**
|
||||
win:
|
||||
executableName: 龙岗区百千万AI智能体共创平台
|
||||
executableName: 百千万AI智能体共创平台
|
||||
nsis:
|
||||
artifactName: ${name}-${version}-setup.${ext}
|
||||
shortcutName: ${productName}
|
||||
|
||||
@@ -12,6 +12,8 @@
|
||||
"dev": "electron-vite --mode 13_27",
|
||||
"dev:11_120_test": "electron-vite --mode 11_120_test",
|
||||
"dev:lgzs": "electron-vite --mode lgzs",
|
||||
"dev:shenranqi": "electron-vite --mode shenranqi",
|
||||
"dev:pingshan": "electron-vite --mode pingshan",
|
||||
"dev:lgzs_test": "electron-vite --mode lgzs_test",
|
||||
"dev:lg_mirror": "electron-vite --mode lg_mirror",
|
||||
"package": "electron-forge package",
|
||||
@@ -22,9 +24,10 @@
|
||||
"build:unpack": "npm run build && electron-builder --dir",
|
||||
"build:win": "electron-vite build --mode 11.120 && electron-builder --win ",
|
||||
"build:win_11_120": "electron-vite build --mode 11_120 && electron-builder --win ",
|
||||
"build:win_shenranqi": "electron-vite build --mode shenranqi && electron-builder --win ",
|
||||
"build:win_13_27": "electron-vite build --mode 13_27 && electron-builder --win ",
|
||||
"build:win_14_200": "electron-vite build --mode 14_200 && electron-builder --win ",
|
||||
"build:win_lgzs": "electron-vite build --mode lgzs && electron-builder --win ",
|
||||
"build:win_lgzs_test": "electron-vite build --mode lgzs_test && electron-builder --win ",
|
||||
"build:win_jiangsu": "electron-vite build --mode jiangsu && electron-builder --win ",
|
||||
"build:win_nanshan": "electron-vite build --mode nanshan && electron-builder --win",
|
||||
"build:win_huashiai": "electron-vite build --mode huashiai && electron-builder --win",
|
||||
@@ -53,6 +56,8 @@
|
||||
"xe-utils": "^3.7.4"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@electron-forge/cli": "^6.2.1",
|
||||
"@electron-forge/maker-deb": "^6.2.1",
|
||||
"@electron-toolkit/eslint-config": "^2.0.0",
|
||||
"@electron-toolkit/eslint-config-prettier": "^3.0.0",
|
||||
"@vitejs/plugin-vue": "^5.2.1",
|
||||
|
||||
@@ -25,11 +25,9 @@ export function setupIPC() {
|
||||
logger.info('=======================================initClientData')
|
||||
logger.info(data)
|
||||
|
||||
setStoreValue("h5_data", data);
|
||||
setStoreValue("token", data.token);
|
||||
setStoreValue("dify_access_token:", data.dify_access_token);
|
||||
setStoreValue("dify_refresh_token", data.dify_refresh_token);
|
||||
setStoreValue("dify_csrf_token", data.dify_csrf_token);
|
||||
setStoreValue("userInfo", data.userInfo);
|
||||
|
||||
setStoreValue("apiUrl", data.apiUrl);
|
||||
@@ -209,7 +207,7 @@ export function setupIPC() {
|
||||
newWindow.webContents.on('did-fail-load', (event, errorCode, errorDescription) => {
|
||||
console.error('页面加载失败:', errorDescription);
|
||||
failLoadCount++;
|
||||
|
||||
|
||||
if (failLoadCount <= maxRetries) {
|
||||
console.log(`页面加载失败,${retryDelay}ms后进行第${failLoadCount}次重试...`);
|
||||
setTimeout(() => {
|
||||
@@ -254,7 +252,7 @@ export function setupIPC() {
|
||||
newWindow.webContents.on('did-fail-load', (event, errorCode, errorDescription) => {
|
||||
console.error('页面加载失败:', errorDescription);
|
||||
failLoadCount2++;
|
||||
|
||||
|
||||
if (failLoadCount2 <= maxRetries2) {
|
||||
console.log(`页面加载失败,${retryDelay2}ms后进行第${failLoadCount2}次重试...`);
|
||||
setTimeout(() => {
|
||||
@@ -309,7 +307,7 @@ export function setupIPC() {
|
||||
const urlParts = fileUrl.split('/');
|
||||
fileName = urlParts[urlParts.length - 1] || '';
|
||||
}
|
||||
|
||||
|
||||
// 解码文件名,解决中文乱码问题
|
||||
try {
|
||||
fileName = decodeURIComponent(fileName);
|
||||
@@ -317,7 +315,7 @@ export function setupIPC() {
|
||||
// 如果解码失败,保持原文件名
|
||||
logger.warn(`文件名解码失败: ${fileName}`);
|
||||
}
|
||||
|
||||
|
||||
// 如果提取的文件名为空,使用时间戳生成默认名称
|
||||
if (!fileName || fileName === '') {
|
||||
fileName = `downloaded_file_${Date.now()}`;
|
||||
@@ -325,12 +323,12 @@ export function setupIPC() {
|
||||
|
||||
// 获取用户下载目录
|
||||
const downloadDir = path.join(os.homedir(), 'Downloads');
|
||||
|
||||
|
||||
// 确保下载目录存在
|
||||
if (!fs.existsSync(downloadDir)) {
|
||||
fs.mkdirSync(downloadDir, { recursive: true });
|
||||
}
|
||||
|
||||
|
||||
const outputLocationPath = path.join(downloadDir, fileName);
|
||||
const writer = fs.createWriteStream(outputLocationPath);
|
||||
let receivedBytes = 0;
|
||||
@@ -387,11 +385,11 @@ export function setupIPC() {
|
||||
try {
|
||||
// 标记为正在重启,避免其他退出逻辑干扰
|
||||
app.isRestarting = true;
|
||||
|
||||
|
||||
// 确保所有窗口都被正确关闭
|
||||
const windows = BrowserWindow.getAllWindows();
|
||||
logger.info(`准备关闭 ${windows.length} 个窗口`);
|
||||
|
||||
|
||||
windows.forEach(window => {
|
||||
if (!window.isDestroyed()) {
|
||||
try {
|
||||
@@ -402,7 +400,7 @@ export function setupIPC() {
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
// 延迟执行重启,确保窗口关闭完成
|
||||
setTimeout(() => {
|
||||
try {
|
||||
@@ -419,7 +417,7 @@ export function setupIPC() {
|
||||
}
|
||||
}
|
||||
}, 1000);
|
||||
|
||||
|
||||
return { success: true };
|
||||
} catch (error) {
|
||||
logger.error(`重启软件失败: ${error.message}`);
|
||||
|
||||
@@ -17,8 +17,6 @@ let difyfullScreenWindow = null
|
||||
let drageWindow = null
|
||||
let apiConfigWindow = null
|
||||
let configWindow = null
|
||||
|
||||
let cookieLogTimer = null
|
||||
import { clearAllSessionData } from './utils/cacheUtils.js'
|
||||
// 权限授权
|
||||
async function checkMediaAccess(mediaType){
|
||||
@@ -87,18 +85,7 @@ export async function createWindow() {
|
||||
// 创建菜单
|
||||
createMenu(mainWindow, difyfullScreenWindow)
|
||||
|
||||
|
||||
|
||||
const isDebugger=getStoreValue("isDebugger");
|
||||
|
||||
|
||||
const localStorageStatements = [
|
||||
`localStorage.setItem("IsHsAiApp","IsHsAiApp");`,
|
||||
`localStorage.setItem("HsAppCode",${import.meta.env.VITE_HsAppCode});`,
|
||||
`localStorage.setItem("isDebugger",${isDebugger});`
|
||||
].join('\n');
|
||||
|
||||
let code = `${localStorageStatements};`;
|
||||
let code = `localStorage.setItem("IsHsAiApp","IsHsAiApp");localStorage.setItem("HsAppCode",${import.meta.env.VITE_HsAppCode});`
|
||||
|
||||
|
||||
const isAdmin = getStoreValue("isAdmin")
|
||||
@@ -120,17 +107,12 @@ export async function createWindow() {
|
||||
|
||||
// 监听快捷键 F12 来打开/关闭 DevTools
|
||||
mainWindow.webContents.on('before-input-event', (event, input) => {
|
||||
|
||||
const isDebugger=getStoreValue("isDebugger");
|
||||
if (isDebugger==1){
|
||||
if (input.key === 'F12') {
|
||||
mainWindow.webContents.toggleDevTools()
|
||||
} else if (input.key === 'F5') {
|
||||
logger.info('全屏窗口 F5 快捷键触发')
|
||||
mainWindow.reload()
|
||||
}
|
||||
if (input.key === 'F12') {
|
||||
mainWindow.webContents.toggleDevTools()
|
||||
} else if (input.key === 'F5') {
|
||||
logger.info('主窗口 F5 快捷键触发')
|
||||
mainWindow.reload()
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
|
||||
@@ -192,10 +174,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 () => {
|
||||
@@ -309,30 +291,19 @@ function registerShortcuts(window=null) {
|
||||
|
||||
logger.info(`F5快捷键注册${success ? '成功' : '失败'}`)
|
||||
|
||||
|
||||
|
||||
const isDebugger=getStoreValue("isDebugger");
|
||||
if (isDebugger==1){
|
||||
const isRegistered_F12 = globalShortcut.isRegistered('F12');
|
||||
logger.info(`Is F12 registered: ${isRegistered_F12}`);
|
||||
}
|
||||
|
||||
|
||||
const isRegistered_F12 = globalShortcut.isRegistered('F12');
|
||||
logger.info(`Is F12 registered: ${isRegistered_F12}`);
|
||||
|
||||
// 桌面端快要退出的时候,注销快捷键
|
||||
app.on('will-quit', () => {
|
||||
globalShortcut.unregisterAll() // 注销所有快捷键
|
||||
})
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
export async function createNewWindow(url, access_token, refresh_token,sandbox=false) {
|
||||
const origin_url = url
|
||||
logger.info('==========createNewWindow')
|
||||
logger.info('==========createNewWindow sandbox',sandbox)
|
||||
const csrf_token=getStoreValue("dify_csrf_token")
|
||||
|
||||
await checkAndApplyDeviceAccessPrivilege()
|
||||
|
||||
@@ -342,7 +313,6 @@ export async function createNewWindow(url, access_token, refresh_token,sandbox=f
|
||||
show: false,
|
||||
icon: icon,
|
||||
webPreferences: {
|
||||
partition: 'persist:my-shared-session',
|
||||
contextIsolation: false,
|
||||
nodeIntegration: true,
|
||||
nodeIntegrationInWorker: true,
|
||||
@@ -359,25 +329,9 @@ export async function createNewWindow(url, access_token, refresh_token,sandbox=f
|
||||
registerShortcuts(difyfullScreenWindow)
|
||||
})
|
||||
|
||||
const hs_version = getStoreValue("hs_version")
|
||||
const dify_csrf_token = getStoreValue("dify_csrf_token")
|
||||
|
||||
const cookieStatements = [
|
||||
`document.cookie = "access_token=${access_token}; path=/";`,
|
||||
`document.cookie = "refresh_token=${refresh_token}; path=/";`,
|
||||
`document.cookie = "csrf_token=${dify_csrf_token}; path=/";`,
|
||||
`document.cookie = "hs_version=${hs_version}; path=/";`
|
||||
].join('\n');
|
||||
|
||||
const localStorageStatements = [
|
||||
`localStorage.setItem("IsHsAiApp", "IsHsAiApp");`,
|
||||
`localStorage.setItem("console_token", "${access_token}");`,
|
||||
`localStorage.setItem("refresh_token", "12");`
|
||||
].join('\n');
|
||||
|
||||
let code = `${localStorageStatements}\n${cookieStatements};`;
|
||||
|
||||
let code = `localStorage.setItem("IsHsAiApp","IsHsAiApp");localStorage.setItem("console_token","${access_token}");localStorage.setItem("refresh_token","12");`
|
||||
const isAdmin = getStoreValue("isAdmin")
|
||||
const hs_version = getStoreValue("hs_version")
|
||||
let display='';
|
||||
|
||||
if (isAdmin==true){
|
||||
@@ -400,7 +354,7 @@ export async function createNewWindow(url, access_token, refresh_token,sandbox=f
|
||||
`
|
||||
}
|
||||
|
||||
code=code+`;document.cookie="hs_version=${hs_version}; path=/";`
|
||||
code=code+`document.cookie="hs_version=${hs_version}";`
|
||||
|
||||
difyfullScreenWindow.webContents.on('did-finish-load', () => {
|
||||
difyfullScreenWindow.webContents
|
||||
@@ -410,7 +364,6 @@ export async function createNewWindow(url, access_token, refresh_token,sandbox=f
|
||||
.catch((error) => {
|
||||
console.error('Error:', error)
|
||||
})
|
||||
startCookieLogger(2000)
|
||||
let times = 0
|
||||
let timer = setInterval(() => {
|
||||
if (times > 3) {
|
||||
@@ -434,16 +387,12 @@ export async function createNewWindow(url, access_token, refresh_token,sandbox=f
|
||||
|
||||
// 监听快捷键 F12 来打开/关闭 DevTools
|
||||
difyfullScreenWindow.webContents.on('before-input-event', (event, input) => {
|
||||
const isDebugger=getStoreValue("isDebugger");
|
||||
if (isDebugger==1){
|
||||
if (input.key === 'F12') {
|
||||
difyfullScreenWindow.webContents.toggleDevTools()
|
||||
} else if (input.key === 'F5') {
|
||||
logger.info('全屏窗口 F5 快捷键触发')
|
||||
difyfullScreenWindow.reload()
|
||||
}
|
||||
if (input.key === 'F12') {
|
||||
difyfullScreenWindow.webContents.toggleDevTools()
|
||||
} else if (input.key === 'F5') {
|
||||
logger.info('全屏窗口 F5 快捷键触发')
|
||||
difyfullScreenWindow.reload()
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
difyfullScreenWindow.webContents.setWindowOpenHandler((details) => {
|
||||
@@ -454,10 +403,6 @@ export async function createNewWindow(url, access_token, refresh_token,sandbox=f
|
||||
difyfullScreenWindow.on('closed', () => {
|
||||
logger.info('主窗口已关闭')
|
||||
difyfullScreenWindow = null
|
||||
if (cookieLogTimer) {
|
||||
clearInterval(cookieLogTimer)
|
||||
cookieLogTimer = null
|
||||
}
|
||||
})
|
||||
|
||||
difyfullScreenWindow.webContents.on('did-navigate', (event, url) => {
|
||||
@@ -558,18 +503,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();
|
||||
@@ -599,93 +544,6 @@ export async function createNewWindow(url, access_token, refresh_token,sandbox=f
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取并打印全屏窗口的 Cookie 数据
|
||||
* 每次调用从当前页面会话中读取 Cookie 并输出到控制台
|
||||
*/
|
||||
export async function logDifyFullScreenCookies() {
|
||||
try {
|
||||
if (!difyfullScreenWindow || difyfullScreenWindow.isDestroyed()) {
|
||||
return
|
||||
}
|
||||
const wc = difyfullScreenWindow.webContents
|
||||
const currentURL = wc.getURL()
|
||||
const sess = wc.session
|
||||
let cookies = []
|
||||
if (currentURL && typeof currentURL === 'string' && currentURL.length > 0) {
|
||||
cookies = await sess.cookies.get({ url: currentURL })
|
||||
} else {
|
||||
cookies = await sess.cookies.get({})
|
||||
}
|
||||
const simplified = cookies.map(c => ({
|
||||
name: c.name,
|
||||
value: c.value,
|
||||
domain: c.domain,
|
||||
path: c.path,
|
||||
httpOnly: c.httpOnly,
|
||||
secure: c.secure,
|
||||
sameSite: c.sameSite
|
||||
}))
|
||||
|
||||
logger.info('difyfullScreenWindow cookies:', simplified)
|
||||
|
||||
const needSync = new Set(['access_token', 'csrf_token', 'refresh_token'])
|
||||
for (const c of cookies) {
|
||||
if (needSync.has(c.name)) {
|
||||
|
||||
if (c.name === 'access_token') {
|
||||
setStoreValue('dify_access_token', c.value)
|
||||
} else if (c.name === 'csrf_token') {
|
||||
setStoreValue('dify_csrf_token', c.value)
|
||||
} else if (c.name === 'refresh_token') {
|
||||
setStoreValue('dify_refresh_token', c.value)
|
||||
}
|
||||
await setCookieToMainWindow(c.name, c.value)
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
logger.error('获取 Cookie 失败:', error)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 启动 Cookie 轮询打印
|
||||
* 以指定间隔定时获取并打印 Cookie,默认 2000ms
|
||||
* 如果已在运行则不会重复启动
|
||||
*/
|
||||
export function startCookieLogger(intervalMs = 2000) {
|
||||
if (cookieLogTimer) {
|
||||
return
|
||||
}
|
||||
cookieLogTimer = setInterval(() => {
|
||||
logDifyFullScreenCookies()
|
||||
}, intervalMs)
|
||||
}
|
||||
|
||||
/**
|
||||
* 将指定名称和值的 Cookie 写入主窗口
|
||||
*/
|
||||
async function setCookieToMainWindow(name, value) {
|
||||
try {
|
||||
if (!mainWindow || mainWindow.isDestroyed()) {
|
||||
return
|
||||
}
|
||||
const targetBase = getStoreValue('h5_client_url') || ''
|
||||
const targetUrl = targetBase ? `${targetBase}/` : (mainWindow.webContents.getURL() || 'http://localhost/')
|
||||
const msess = mainWindow.webContents.session
|
||||
await msess.cookies.set({
|
||||
url: targetUrl,
|
||||
name,
|
||||
value,
|
||||
path: '/'
|
||||
})
|
||||
await mainWindow.webContents.executeJavaScript(`document.cookie = "${name}=${value}; path=/";`)
|
||||
logger.info(`已写入主窗口 Cookie: ${name}`)
|
||||
} catch (error) {
|
||||
logger.error('写入主窗口 Cookie 失败:', error)
|
||||
}
|
||||
}
|
||||
|
||||
export function createDrageWindow() {
|
||||
logger.info('开始创建悬浮窗口')
|
||||
|
||||
@@ -706,7 +564,6 @@ export function createDrageWindow() {
|
||||
alwaysOnTop: true,
|
||||
autoHideMenuBar: true,
|
||||
webPreferences: {
|
||||
partition: 'persist:my-shared-session',
|
||||
contextIsolation: false,
|
||||
nodeIntegration: true,
|
||||
nodeIntegrationInWorker: true,
|
||||
@@ -749,18 +606,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();
|
||||
@@ -904,7 +761,6 @@ export function createConfigWindow() {
|
||||
parent: getMainWindow(),
|
||||
modal: true,
|
||||
webPreferences: {
|
||||
partition: 'persist:my-shared-session',
|
||||
contextIsolation: false,
|
||||
nodeIntegration: true,
|
||||
nodeIntegrationInWorker: true,
|
||||
|
||||
Reference in New Issue
Block a user