buzzk 2.3.6 → 2.3.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/chat.js +6 -6
- package/lib/oauth.js +3 -2
- package/lib/val.js +0 -3
- package/package.json +1 -1
package/lib/chat.js
CHANGED
|
@@ -103,7 +103,7 @@ class chzzkChat {
|
|
|
103
103
|
console.log("[WS] Connected!");
|
|
104
104
|
});
|
|
105
105
|
|
|
106
|
-
this.#ws.
|
|
106
|
+
this.#ws.once("SYSTEM", async (data) => {
|
|
107
107
|
data = JSON.parse(data);
|
|
108
108
|
|
|
109
109
|
if (data.type == "connected") {
|
|
@@ -146,7 +146,7 @@ class chzzkChat {
|
|
|
146
146
|
//Events
|
|
147
147
|
|
|
148
148
|
//Disconnect Handle
|
|
149
|
-
this.#ws.
|
|
149
|
+
this.#ws.once("error", (error) => {
|
|
150
150
|
if (!this.#status.reconnect) return;
|
|
151
151
|
|
|
152
152
|
console.log("[WS] Disconnected! (" + error + ")");
|
|
@@ -154,7 +154,7 @@ class chzzkChat {
|
|
|
154
154
|
return this.#rePromise();
|
|
155
155
|
});
|
|
156
156
|
|
|
157
|
-
this.#ws.
|
|
157
|
+
this.#ws.once("disconnect", (data) => {
|
|
158
158
|
if (this.#callbacks.disconnect) this.#callbacks.disconnect(data);
|
|
159
159
|
if (!this.#status.reconnect) return;
|
|
160
160
|
|
|
@@ -163,7 +163,7 @@ class chzzkChat {
|
|
|
163
163
|
return this.#rePromise();
|
|
164
164
|
});
|
|
165
165
|
|
|
166
|
-
this.#ws.
|
|
166
|
+
this.#ws.once("connect_error", (data) => {
|
|
167
167
|
if (!this.#status.reconnect) return;
|
|
168
168
|
|
|
169
169
|
console.log("[WS] Disconnected! (" + data + ")");
|
|
@@ -171,7 +171,7 @@ class chzzkChat {
|
|
|
171
171
|
return this.#rePromise();
|
|
172
172
|
});
|
|
173
173
|
|
|
174
|
-
this.#ws.
|
|
174
|
+
this.#ws.once("connect_timeout", () => {
|
|
175
175
|
if (!this.#status.reconnect) return;
|
|
176
176
|
|
|
177
177
|
console.log("[WS] Disconnected! (Connect Timeout)");
|
|
@@ -179,7 +179,7 @@ class chzzkChat {
|
|
|
179
179
|
return this.#rePromise();
|
|
180
180
|
});
|
|
181
181
|
|
|
182
|
-
this.#ws.
|
|
182
|
+
this.#ws.once("handshake_timeout", () => {
|
|
183
183
|
if (!this.#status.reconnect) return;
|
|
184
184
|
|
|
185
185
|
console.log("[WS] Disconnected! (Handshake Timeout)");
|
package/lib/oauth.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const { USER, CLIENT } = require("./tool.js");
|
|
2
|
-
const { AUTH
|
|
2
|
+
const { AUTH } = require("./val.js");
|
|
3
3
|
|
|
4
4
|
const channel = require("./channel.js");
|
|
5
5
|
|
|
@@ -28,9 +28,10 @@ class chzzkToken {
|
|
|
28
28
|
|
|
29
29
|
/**
|
|
30
30
|
* @param {string} code
|
|
31
|
+
* @param {string} state
|
|
31
32
|
* @returns {Promise<chzzkTokenData>}
|
|
32
33
|
*/
|
|
33
|
-
async function get (code) {
|
|
34
|
+
async function get (code, state) {
|
|
34
35
|
return new Promise(async (resolve, reject) => {
|
|
35
36
|
let options = {
|
|
36
37
|
grantType: "authorization_code",
|
package/lib/val.js
CHANGED
|
@@ -3,8 +3,6 @@ const chzzkBaseURL = "https://api.chzzk.naver.com/";
|
|
|
3
3
|
const gameBaseURL = "https://comm-api.game.naver.com/";
|
|
4
4
|
const naverBaseURL = "https://apis.naver.com/";
|
|
5
5
|
|
|
6
|
-
const state = "zxclDasdfA25";
|
|
7
|
-
|
|
8
6
|
let NID = {
|
|
9
7
|
AUT: null,
|
|
10
8
|
SES: null
|
|
@@ -38,7 +36,6 @@ module.exports = {
|
|
|
38
36
|
chzzkBaseURL: chzzkBaseURL,
|
|
39
37
|
gameBaseURL: gameBaseURL,
|
|
40
38
|
naverBaseURL: naverBaseURL,
|
|
41
|
-
state: state,
|
|
42
39
|
NID: NID,
|
|
43
40
|
AUTH: AUTH,
|
|
44
41
|
login: login,
|