mirror of
https://github.com/SirHumza/orbisRPC.git
synced 2026-10-12 16:01:20 +02:00
fix(discord): use unauthenticated /api/gateway endpoint, drop dead code
/api/gateway/bot requires a bot Authorization header; we authenticate as a user OAuth2 token, so it always 401s. /api/gateway is public. Remove a no-op ternary that selected the same resource either way.
This commit is contained in:
1 parent
7c6ea67e40
commit
6be235b60f
1 file changed
+3
-3
+3
-3
@@ -23,9 +23,9 @@ int discord_connect(discord_t *d, const char *token, const char *intent){
|
||||
(void)intent;
|
||||
memset(d,0,sizeof(*d));
|
||||
strncpy(d->token, token, sizeof d->token-1);
|
||||
/* fetch gateway url */
|
||||
/* fetch gateway url (public endpoint, no bot auth needed) */
|
||||
char resp[512];
|
||||
if(http_get("https://discord.com/api/gateway/bot",resp,sizeof resp)!=0){
|
||||
if(http_get("https://discord.com/api/gateway",resp,sizeof resp)!=0){
|
||||
log_msg("gateway fetch failed; using default");
|
||||
}
|
||||
char url[512]="wss://gateway.discord.gg";
|
||||
@@ -36,7 +36,7 @@ int discord_connect(discord_t *d, const char *token, const char *intent){
|
||||
jl_free(r);
|
||||
}
|
||||
char key[64]=""; make_key(key);
|
||||
const char *res=(strstr(url,"discord.gg"))? "/?v=10&encoding=json":"/?v=10&encoding=json";
|
||||
const char *res="/?v=10&encoding=json";
|
||||
/* host parse: take after https:// or default gateway.discord.gg */
|
||||
const char *host="gateway.discord.gg";
|
||||
int port=443;
|
||||
|
||||
Reference in new issue
Block a user