fix(irc): urlencode SSEKey for SSE streams (#990)

apply RFC4648 to base64 sseKey to fix urlEncoding
This commit is contained in:
Fabricio Silva 2023-06-17 13:44:20 +01:00 committed by GitHub
parent ecc84f5f2d
commit 8721ab65ce
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 2 deletions

View file

@ -629,7 +629,11 @@ export const Events = ({ network, channel }: EventsProps) => {
};
useEffect(() => {
const key = btoa(`${network.id}${channel.toLowerCase()}`);
// Following RFC4648
const key = window.btoa(`${network.id}${channel.toLowerCase()}`)
.replaceAll("+", "-")
.replaceAll("/", "_")
.replaceAll("=", "");
const es = APIClient.irc.events(key);
es.onmessage = (event) => {