Fix url encoding for room names
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
cc1808c9ec
commit
a5d769e9b5
|
@ -48,7 +48,7 @@ function Meeting(props: Props) {
|
||||||
setMeetingStarted(true)
|
setMeetingStarted(true)
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{roomData.roomName}
|
{decodeURI(roomData.roomName)}
|
||||||
</a>
|
</a>
|
||||||
</h3>
|
</h3>
|
||||||
{roomData.participants.map((participant) => (
|
{roomData.participants.map((participant) => (
|
||||||
|
|
|
@ -8,7 +8,7 @@ function MeetingNameInput(props: { roomName: string; currentUser: string }) {
|
||||||
const [_, setMeetingStarted] = useMeetingStarted()
|
const [_, setMeetingStarted] = useMeetingStarted()
|
||||||
|
|
||||||
const onInput: React.ChangeEventHandler<HTMLInputElement> = (event) => {
|
const onInput: React.ChangeEventHandler<HTMLInputElement> = (event) => {
|
||||||
updateRoomName(event.target.value)
|
updateRoomName(encodeURI(event.target.value))
|
||||||
event.preventDefault()
|
event.preventDefault()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -23,7 +23,7 @@ function MeetingNameInput(props: { roomName: string; currentUser: string }) {
|
||||||
<div className="meeting-name-input">
|
<div className="meeting-name-input">
|
||||||
<h1>Greetings {props.currentUser}</h1>
|
<h1>Greetings {props.currentUser}</h1>
|
||||||
<form onSubmit={onSubmit}>
|
<form onSubmit={onSubmit}>
|
||||||
<input placeholder="Roomname" type="text" value={roomName} onChange={onInput} />
|
<input placeholder="Roomname" type="text" value={decodeURI(roomName)} onChange={onInput} />
|
||||||
<button type="submit">Enter the adventure</button>
|
<button type="submit">Enter the adventure</button>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -31,7 +31,7 @@ function Sidebar(props: Props) {
|
||||||
setMeetingStarted(true)
|
setMeetingStarted(true)
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{roomData.roomName}
|
{decodeURI(roomData.roomName)}
|
||||||
</a>
|
</a>
|
||||||
</h3>
|
</h3>
|
||||||
{roomData.participants.map((participant) => (
|
{roomData.participants.map((participant) => (
|
||||||
|
|
|
@ -2,7 +2,15 @@ import { useState } from 'react'
|
||||||
import { UsersData } from '../background/types/roomData'
|
import { UsersData } from '../background/types/roomData'
|
||||||
|
|
||||||
function useRoomData() {
|
function useRoomData() {
|
||||||
const [roomData, setRoomData] = useState<UsersData>()
|
const [roomData, setRoomDataInternal] = useState<UsersData>()
|
||||||
|
|
||||||
|
const setRoomData = (usersData: UsersData) => {
|
||||||
|
usersData.roomsData = usersData.roomsData.map((roomData) => {
|
||||||
|
roomData.roomName = decodeURI(roomData.roomName)
|
||||||
|
return roomData
|
||||||
|
})
|
||||||
|
setRoomDataInternal(usersData)
|
||||||
|
}
|
||||||
|
|
||||||
return { roomData, setRoomData }
|
return { roomData, setRoomData }
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,7 +46,7 @@ function setRoomNameInUrl(roomName: string) {
|
||||||
|
|
||||||
function setRoomNameInTitle(roomName: string) {
|
function setRoomNameInTitle(roomName: string) {
|
||||||
if (!!roomName) {
|
if (!!roomName) {
|
||||||
document.title = roomName
|
document.title = decodeURI(roomName)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue