Skip to content

Commit

Permalink
fix: correctly lock URL when connected to a server (Y)
Browse files Browse the repository at this point in the history
  • Loading branch information
zardoy committed Oct 1, 2024
1 parent 0a0b87b commit bd180ef
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/controls.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit bd180ef

Please sign in to comment.