Fully support Pl3xmap URLs

This commit is contained in:
James Lyne 2021-09-07 23:08:44 +01:00
parent 298f5a1448
commit b2f58f681c
2 changed files with 4 additions and 3 deletions

View File

@ -121,7 +121,8 @@ export default defineComponent({
//Remove legacy url if one was parsed //Remove legacy url if one was parsed
if(parsedUrl.legacy) { if(parsedUrl.legacy) {
const url = new URL(window.location.href); const url = new URL(window.location.href);
url.searchParams.delete('worldname'); url.searchParams.delete('worldname'); //Dynmap
url.searchParams.delete('world'); //Pl3xmap
url.searchParams.delete('mapname'); url.searchParams.delete('mapname');
url.searchParams.delete('x'); url.searchParams.delete('x');
url.searchParams.delete('y'); url.searchParams.delete('y');

View File

@ -156,11 +156,11 @@ export const parseMapHash = (hash: string) => {
} }
export const parseMapSearchParams = (query: URLSearchParams) => { export const parseMapSearchParams = (query: URLSearchParams) => {
const world = query.get('worldname') || undefined, const world = query.get('worldname') /* Dynmap */ || query.get('world') /* Pl3xmap */ || undefined,
map = query.get('mapname') || undefined, map = query.get('mapname') || undefined,
location = [ location = [
query.get('x') || '', query.get('x') || '',
query.get('y') || '', query.get('y') || '64',
query.get('z') || '' query.get('z') || ''
].map(item => parseFloat(item)).filter(item => !isNaN(item) && isFinite(item)), ].map(item => parseFloat(item)).filter(item => !isNaN(item) && isFinite(item)),
zoom = query.has('zoom') ? parseInt(query.get('zoom') as string) : undefined; zoom = query.has('zoom') ? parseInt(query.get('zoom') as string) : undefined;