diff --git a/i18n/en-US/manager.json b/i18n/en-US/manager.json index 25a9064..39c73ed 100644 --- a/i18n/en-US/manager.json +++ b/i18n/en-US/manager.json @@ -21,7 +21,7 @@ "useHttpServer": "User http server(avoid certificate error)", "serverToPlay": "Server to play (0 is China server, 1 is Japan server, 2 is America server)", "proxyUrl": "Proxy server address (leave it empty if you don't want to use it)", - "userAgent": "Useragent", + "userAgent": "User-Agent", "vanillaMode": "Vanilla mode (no extensions)", "userLibPath": "'User Library' Path", "localVersion": "Version", diff --git a/i18n/zh-CN/manager.json b/i18n/zh-CN/manager.json index 99d57dd..c1f13ac 100644 --- a/i18n/zh-CN/manager.json +++ b/i18n/zh-CN/manager.json @@ -18,7 +18,7 @@ "serverToPlay": "游戏服务器(0为国服,1为日服,2为美服)", "proxyUrl": "代理服务器地址(留空为不使用代理)", "userAgent": "User-Agent", - "vanillaMode": "纯洁模式(停用所有扩展)", + "vanillaMode": "纯净模式(停用所有扩展)", "userLibPath": "用户库目录", "localVersion": "版本", "isManagerHide": "退出游戏后回到管理器界面", diff --git a/i18n/zh-TW/manager.json b/i18n/zh-TW/manager.json index b9656dd..213a7f8 100644 --- a/i18n/zh-TW/manager.json +++ b/i18n/zh-TW/manager.json @@ -21,8 +21,8 @@ "useHttpServer": "\u4f7f\u7528 http \u670d\u52d9\u5668\uff08\u4e0d\u5b58\u5728\u8b49\u66f8\u932f\u8aa4\uff09", "serverToPlay": "\u904a\u6232\u4f3a\u670d\u5668\uff080\u70ba\u570b\u4f3a\uff0c1\u70ba\u65e5\u4f3a\uff0c2\u70ba\u7f8e\u4f3a\uff09", "proxyUrl": "\u4ee3\u7406\u4f3a\u670d\u5668\u5730\u5740\uff08\u7559\u7a7a\u70ba\u4e0d\u4f7f\u7528\u4ee3\u7406\uff09", - "userAgent": "\u7528\u6236\u4ee3\u7406", - "vanillaMode": "Vanilla mode (no extensions)", + "userAgent": "User-Agent", + "vanillaMode": "\u7d14\u6de8\u6a21\u5f0f\uff08\u505c\u7528\u6240\u6709\u64f4\u5c55\uff09", "userLibPath": "\u8cc7\u6599\u593e\u76ee\u9304", "localVersion": "\u7248\u672c", "isManagerHide": "\u9000\u51fa\u904a\u6232\u5f8c\uff0c\u8fd4\u56de\u6a94\u6848\u7e3d\u7ba1", diff --git a/src/bin/main/mainLoader.ts b/src/bin/main/mainLoader.ts index c271e3b..3ca5781 100644 --- a/src/bin/main/mainLoader.ts +++ b/src/bin/main/mainLoader.ts @@ -106,7 +106,7 @@ function redirectGameWindow(url: string, gameWindow: Electron.WebviewTag) { const localUrl = getLocalUrlWithParams(url) console.log('[Majsoul Plus] Redirect Target:' + localUrl) - gameWindow.loadURL(localUrl, {userAgent: navigator.userAgent}) + gameWindow.loadURL(localUrl) } function scaleWindow(percent = scalePercent) { @@ -140,8 +140,6 @@ mainWindow.addEventListener('dom-ready', () => { } else { scaleWindow(100) } - - mainWindow.useragent = navigator.userAgent }) ipcRenderer.on( diff --git a/src/index.ts b/src/index.ts index 0e85b36..d5ea2e0 100644 --- a/src/index.ts +++ b/src/index.ts @@ -142,11 +142,13 @@ app.on('ready', () => { // 资源管理器通知启动游戏 ipcMain.on('start-game', () => { - // 加载服务器路由规则 - LoadServer() + if (!UserConfigs.userData.vanillaMode) { + // 加载服务器路由规则 + LoadServer() - // 启动服务器 - ListenServer(Global.ServerPort) + // 启动服务器 + ListenServer(Global.ServerPort) + } if (!process.env.SERVER_ONLY) { GameWindows.newWindow() diff --git a/src/windows/game.ts b/src/windows/game.ts index 68feda8..434af5b 100644 --- a/src/windows/game.ts +++ b/src/windows/game.ts @@ -21,6 +21,7 @@ import { ListenServer, LoadServer } from '../server' +import { getRemoteUrl } from '../utils'; import { ToolManager } from '../tool/tool' import { AudioPlayer, initPlayer, shutoffPlayer } from './audioPlayer' import { ManagerWindow } from './manager' @@ -103,15 +104,21 @@ export function newGameWindow(id: number) { window.setMenu(getGameWindowMenu(id)) window.webContents.on('dom-ready', () => { - // 加载本地服务器地址 - const http = UserConfigs.userData.useHttpServer - const port = (UserConfigs.userData.useHttpServer - ? (httpServer.address() as AddressInfo) - : (httpsServer.address() as AddressInfo) - ).port - const url = `http${ - UserConfigs.userData.useHttpServer ? '' : 's' - }://localhost:${port}/` + let url, port, http + + if (UserConfigs.userData.vanillaMode) { + url = getRemoteUrl('/') + } else { + // 加载本地服务器地址 + http = UserConfigs.userData.useHttpServer + port = (UserConfigs.userData.useHttpServer + ? (httpServer.address() as AddressInfo) + : (httpsServer.address() as AddressInfo) + ).port + url = `http${ + UserConfigs.userData.useHttpServer ? '' : 's' + }://localhost:${port}/` + } window.webContents.send( 'load-url', @@ -165,7 +172,7 @@ export function newGameWindow(id: number) { window.webContents.userAgent = UserConfigs.window.userAgent // 载入本地启动器 - window.loadURL('file://' + path.join(__dirname, '../bin/main/index.html'), {userAgent: UserConfigs.window.userAgent}) + window.loadURL('file://' + path.join(__dirname, '../bin/main/index.html')) // 在 debug 启动环境下打开开发者工具 if (process.env.NODE_ENV === 'development') {