mirror of
https://github.com/idanoo/autobrr
synced 2025-07-23 08:49:13 +00:00
fix(irc): urlencode SSEKey for SSE streams (#990)
apply RFC4648 to base64 sseKey to fix urlEncoding
This commit is contained in:
parent
ecc84f5f2d
commit
8721ab65ce
2 changed files with 6 additions and 2 deletions
|
@ -654,5 +654,5 @@ func (s *service) removeSSEStream(networkId int64, channel string) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func genSSEKey(networkId int64, channel string) string {
|
func genSSEKey(networkId int64, channel string) string {
|
||||||
return base64.URLEncoding.EncodeToString([]byte(fmt.Sprintf("%d%s", networkId, strings.ToLower(channel))))
|
return base64.RawURLEncoding.EncodeToString([]byte(fmt.Sprintf("%d%s", networkId, strings.ToLower(channel))))
|
||||||
}
|
}
|
||||||
|
|
|
@ -629,7 +629,11 @@ export const Events = ({ network, channel }: EventsProps) => {
|
||||||
};
|
};
|
||||||
|
|
||||||
useEffect(() => {
|
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);
|
const es = APIClient.irc.events(key);
|
||||||
|
|
||||||
es.onmessage = (event) => {
|
es.onmessage = (event) => {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue