diff --git a/game/entry.js b/game/entry.js index 464de927a..fdb22bb60 100644 --- a/game/entry.js +++ b/game/entry.js @@ -1,34 +1,35 @@ -/* - const module = import('../noname.js'); - - module.then(({ ai, game, get, lib, _status, ui, boot }) => { - const coreAndVersion = get.coreInfo(); - const core = coreAndVersion[0], version = coreAndVersion[1]; - if (core === 'chrome' && !isNaN(version) && version < 77) { - const tip = '检测到您的浏览器内核版本小于77,请及时升级浏览器或手机webview内核!'; - console.warn(tip); - game.print(tip); - const redirect_tip = '您使用的浏览器或无名杀客户端内核版本过低,将在未来的版本被废弃!\n点击“确认”以前往GitHub下载最新版无名杀客户端(可能需要科学上网)。'; - if (confirm(redirect_tip)) { - window.open('https://github.com/libccy/noname/releases/tag/chromium77-client'); - } - } - boot().then(lib.other.ignore); - }); - */ - -import { game, get, lib, boot } from "../noname.js" - -const coreAndVersion = get.coreInfo(); -const core = coreAndVersion[0], version = coreAndVersion[1]; -if (core === 'chrome' && !isNaN(version) && version < 77) { - const tip = '检测到您的浏览器内核版本小于77,请及时升级浏览器或手机webview内核!'; - console.warn(tip); - game.print(tip); - const redirect_tip = '您使用的浏览器或无名杀客户端内核版本过低,将在未来的版本被废弃!\n点击“确认”以前往GitHub下载最新版无名杀客户端(可能需要科学上网)。'; - if (confirm(redirect_tip)) { - window.open('https://github.com/libccy/noname/releases/tag/chromium77-client'); - } -} -boot().then(lib.other.ignore); - +/* + const module = import('../noname.js'); + + module.then(({ ai, game, get, lib, _status, ui, boot }) => { + const coreAndVersion = get.coreInfo(); + const core = coreAndVersion[0], version = coreAndVersion[1]; + if (core === 'chrome' && !isNaN(version) && version < 77) { + const tip = '检测到您的浏览器内核版本小于77,请及时升级浏览器或手机webview内核!'; + console.warn(tip); + game.print(tip); + const redirect_tip = '您使用的浏览器或无名杀客户端内核版本过低,将在未来的版本被废弃!\n点击“确认”以前往GitHub下载最新版无名杀客户端(可能需要科学上网)。'; + if (confirm(redirect_tip)) { + window.open('https://github.com/libccy/noname/releases/tag/chromium77-client'); + } + } + boot().then(lib.other.ignore); + }); + */ + +import { game, get, lib, boot } from "../noname.js" +import { userAgent } from "../noname/util/index.js"; + +const coreAndVersion = get.coreInfo(); +const core = coreAndVersion[0], version = coreAndVersion[1]; +if (core === 'chrome' && !isNaN(version) && version < 77) { + const tip = '检测到您的浏览器内核版本小于77,请及时升级浏览器或手机webview内核!'; + console.warn(tip); + game.print(tip); + const redirect_tip = `您使用的浏览器或无名杀客户端内核版本过低,将在未来的版本被废弃!\n目前使用的浏览器UA信息为:\n${userAgent}\n点击“确认”以前往GitHub下载最新版无名杀客户端(可能需要科学上网)。`; + if (confirm(redirect_tip)) { + window.open('https://github.com/libccy/noname/releases/tag/chromium77-client'); + } +} +boot().then(lib.other.ignore); + diff --git a/game/game.js b/game/game.js index 04ba0207d..a1cde798c 100644 --- a/game/game.js +++ b/game/game.js @@ -62,6 +62,7 @@ new Promise(resolve => { const regex = /(firefox|chrome|safari)\/([\d.]+)/; let result; if (!(result = userAgent.match(regex))) return ["other", NaN]; + // @ts-ignore if (result[1] !== "safari") return [result[1], parseInt(result[2])]; result = userAgent.match(/version\/([\d.]+).*safari/); // @ts-ignore @@ -78,7 +79,7 @@ new Promise(resolve => { if (core in supportMap && supportMap[core] > version) { const tip = '检测到您的浏览器内核版本无法支持ES Module,请立即升级浏览器或手机webview内核!'; console.error(tip); - const redirect_tip = '您使用的浏览器或无名杀客户端内核版本过低,已经无法正常运行无名杀!\n点击“确认”以前往GitHub下载最新版无名杀客户端(可能需要科学上网)。\n稍后您的无名杀将自动退出(可能的话)'; + const redirect_tip = `您使用的浏览器或无名杀客户端内核版本过低,已经无法正常运行无名杀!\n目前使用的浏览器UA信息为:\n${userAgent}\n点击“确认”以前往GitHub下载最新版无名杀客户端(可能需要科学上网)。\n稍后您的无名杀将自动退出(可能的话)`; if (confirm(redirect_tip)) { window.open('https://github.com/libccy/noname/releases/tag/chromium77-client'); } @@ -91,7 +92,7 @@ new Promise(resolve => { script.async = true script.onerror = (event) => { console.error(event) - const message = `您使用的浏览器或《无名杀》客户端加载内容失败!\n若您使用的客户端为自带内核的旧版“兼容版”,请及时更新客户端版本!\n若您使用的客户端为手机端的非兼容版《无名杀》,请尝试更新手机的WebView内核,或者更换为1.8.2版本及以上的兼容版!\n若您是直接使用浏览器加载index.html进行游戏,请改为运行文件夹内的“noname-server.exe”(或使用VSCode等工具启动Live Server),以动态服务器的方式启动《无名杀》!`; + const message = `您使用的浏览器或《无名杀》客户端加载内容失败!\n目前使用的浏览器UA信息为:\n${userAgent}\n若您使用的客户端为自带内核的旧版“兼容版”,请及时更新客户端版本!\n若您使用的客户端为手机端的非兼容版《无名杀》,请尝试更新手机的WebView内核,或者更换为1.8.2版本及以上的兼容版!\n若您是直接使用浏览器加载index.html进行游戏,请改为运行文件夹内的“noname-server.exe”(或使用VSCode等工具启动Live Server),以动态服务器的方式启动《无名杀》!`; console.error(message); alert(message); exit()