修改base_url,修复错误的wss默认地址
This commit is contained in:
parent
f83048f3e9
commit
ba89b0f2dc
@ -56,7 +56,7 @@
|
||||
:class="{ disabled: entering }"
|
||||
@tap="enterGame('minesweeper_free')"
|
||||
>
|
||||
<text class="free-btn-text">🍭 免费试玩 (正式场获胜有奖)</text>
|
||||
<text class="free-btn-text">🍭 练习试玩 </text>
|
||||
</view>
|
||||
|
||||
<view
|
||||
|
||||
@ -555,8 +555,17 @@ export default {
|
||||
},
|
||||
async initNakama(token, server, key, stableUid = null) {
|
||||
try {
|
||||
const serverUrl = server || 'wss://kdy.1024tool.vip';
|
||||
// 兜底逻辑: 如果服务器地址是占位符或无效地址,使用默认值
|
||||
const serverUrl = (server && server.includes('yourdomain.com')) || !server
|
||||
? 'wss://kdy.1024tool.vip'
|
||||
: server;
|
||||
const serverKey = key || 'defaultkey';
|
||||
|
||||
// 如果检测到占位符地址并使用了默认值,记录日志
|
||||
if (server && server.includes('yourdomain.com')) {
|
||||
console.warn('[Nakama] 检测到占位符服务器地址,已自动切换为默认服务器: kdy.1024tool.vip');
|
||||
}
|
||||
|
||||
nakamaManager.initClient(serverUrl, serverKey);
|
||||
this.gameToken = token;
|
||||
|
||||
|
||||
@ -107,7 +107,18 @@ export default {
|
||||
this.loading = true;
|
||||
try {
|
||||
if (!nakamaManager.isConnected) {
|
||||
nakamaManager.initClient(this.nakamaServer || 'wss://kdy.1024tool.vip', this.nakamaKey || 'defaultkey');
|
||||
// 兜底逻辑: 如果服务器地址是占位符或无效地址,使用默认值
|
||||
const nakamaServer = (this.nakamaServer && this.nakamaServer.includes('yourdomain.com')) || !this.nakamaServer
|
||||
? 'wss://kdy.1024tool.vip'
|
||||
: this.nakamaServer;
|
||||
const nakamaKey = this.nakamaKey || 'defaultkey';
|
||||
|
||||
// 如果检测到占位符地址并使用了默认值,记录日志
|
||||
if (this.nakamaServer && this.nakamaServer.includes('yourdomain.com')) {
|
||||
console.warn('[Nakama] 检测到占位符服务器地址,已自动切换为默认服务器: kdy.1024tool.vip');
|
||||
}
|
||||
|
||||
nakamaManager.initClient(nakamaServer, nakamaKey);
|
||||
// 只进行认证,不自动连接
|
||||
await nakamaManager.authenticateWithGameToken(this.gameToken);
|
||||
}
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
const BASE_URL = 'http://127.0.0.1:9991'
|
||||
const BASE_URL = 'https://kdy.1024tool.vip'
|
||||
|
||||
let authModalShown = false
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user