Skip to content
This repository has been archived by the owner on Aug 6, 2024. It is now read-only.

Commit

Permalink
Add Client-ID to all Twitch API requests
Browse files Browse the repository at this point in the history
  • Loading branch information
Ippytraxx committed Aug 7, 2016
1 parent bb838cd commit 77ca78a
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/config.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@
#define _CONFIG_H

#define GT_LOCALE_DIR "@LOCALE_DIR@"
#define CLIENT_ID "afjnp6n4ufzott4atb3xpb8l5a31aav"

#endif
3 changes: 3 additions & 0 deletions src/gt-twitch.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#include "gt-game.h"
#include "gt-app.h"
#include "utils.h"
#include "config.h"
#include <libsoup/soup.h>
#include <glib/gprintf.h>
#include <glib/gi18n.h>
Expand Down Expand Up @@ -171,6 +172,8 @@ send_message(GtTwitch* self, SoupMessage* msg)

g_info("{GtTwitch} Sending message to uri '%s'", uri);

soup_message_headers_append(msg->request_headers, "Client-ID", CLIENT_ID);

soup_session_send_message(priv->soup, msg);

g_debug("{GtTwitch} Received code '%d' and response '%s'", msg->status_code, msg->response_body->data);
Expand Down
3 changes: 3 additions & 0 deletions src/utils.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#include "utils.h"
#include "config.h"
#include <glib/gstdio.h>
#include <glib.h>
#include <stdlib.h>
Expand Down Expand Up @@ -92,6 +93,7 @@ utils_download_picture(SoupSession* soup, const gchar* url)
GError* err = NULL;

msg = soup_message_new("GET", url);
soup_message_headers_append(msg->request_headers, "Client-ID", CLIENT_ID);
input = soup_session_send(soup, msg, NULL, &err);

if (err)
Expand Down Expand Up @@ -120,6 +122,7 @@ utils_download_picture_if_newer(SoupSession* soup, const gchar* url, gint64 time
GdkPixbuf* ret;

msg = soup_message_new(SOUP_METHOD_HEAD, url);
soup_message_headers_append(msg->request_headers, "Client-ID", CLIENT_ID);
soup_status = soup_session_send_message(soup, msg);

if (SOUP_STATUS_IS_SUCCESSFUL(soup_status) &&
Expand Down

0 comments on commit 77ca78a

Please sign in to comment.