From 5e5f89b32954130a061717c6d5d0bb7a1042e8d5 Mon Sep 17 00:00:00 2001 From: Amelix Date: Wed, 4 May 2022 14:38:34 +0100 Subject: [PATCH] update to work with API 2.0 --- package.json | 2 +- src/classes/Client.ts | 4 ++-- src/config.ts | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index 99de976..03dac28 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@amelix/phoenix.js", - "version": "1.0.2", + "version": "1.0.3", "description": "A feature-rich API wrapper for the critically acclaimed chatting app Phoenix.. or something.", "main": "lib/index.js", "types": "lib/index.d.ts", diff --git a/src/classes/Client.ts b/src/classes/Client.ts index 1f9a51a..c10f31d 100644 --- a/src/classes/Client.ts +++ b/src/classes/Client.ts @@ -114,7 +114,7 @@ export class Client extends EventEmitter { private connect() { const socketOptions: { [k: string]: any; } = {}; - socketOptions.query = { token: "Bearer " + this.token }; + socketOptions.query = { token: this.token }; this.socket = io("https://" + hostname, socketOptions); @@ -327,7 +327,7 @@ export class Client extends EventEmitter { async request(method="GET", path:string, headers:{[k: string]: string}={}, write?:any): Promise> { if (typeof write === "object") write = JSON.stringify(write); - headers.auth = "Bearer " + this.token + headers.authorization = this.token return new Promise((resolve, reject) => { const req = https.request({ diff --git a/src/config.ts b/src/config.ts index 728ab6e..53e2a55 100644 --- a/src/config.ts +++ b/src/config.ts @@ -1,4 +1,4 @@ -export const hostname = "phoenix.amelix.xyz" +export const hostname = "api.phoenix.amelix.xyz" export const apiPath = "" export const defaultIcon = 'https://' + hostname + '/avatars/default' export const messageQueryLimit = 150 \ No newline at end of file