fix: correctly lock URL when connected to a server (Y)
This commit is contained in:
parent
0a0b87bee6
commit
bd180ef652
1 changed files with 7 additions and 4 deletions
|
|
@ -21,6 +21,7 @@ import { getItemFromBlock } from './chatUtils'
|
|||
import { gamepadUiCursorState, moveGamepadCursorByPx } from './react/GamepadUiCursor'
|
||||
import { completeTexturePackInstall, resourcePackState } from './resourcePack'
|
||||
import { showNotification } from './react/NotificationProvider'
|
||||
import { lastConnectOptions } from './react/AppStatusProvider'
|
||||
|
||||
|
||||
export const customKeymaps = proxy(JSON.parse(localStorage.keymap || '{}')) as UserOverridesConfig
|
||||
|
|
@ -303,15 +304,17 @@ function lockUrl () {
|
|||
newQs = `loadSave=${save}`
|
||||
} else if (process.env.NODE_ENV === 'development') {
|
||||
newQs = `reconnect=1`
|
||||
} else {
|
||||
} else if (lastConnectOptions.value?.server) {
|
||||
const qs = new URLSearchParams()
|
||||
const { server, version } = localStorage
|
||||
const { server, botVersion } = lastConnectOptions.value
|
||||
qs.set('server', server)
|
||||
if (version) qs.set('version', version)
|
||||
if (botVersion) qs.set('version', botVersion)
|
||||
newQs = String(qs.toString())
|
||||
}
|
||||
|
||||
window.history.replaceState({}, '', `${window.location.pathname}?${newQs}`)
|
||||
if (newQs) {
|
||||
window.history.replaceState({}, '', `${window.location.pathname}?${newQs}`)
|
||||
}
|
||||
}
|
||||
|
||||
function cycleHotbarSlot (dir: 1 | -1) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue