From 66d0aa150216e481f7c210e772568e20edfcee17 Mon Sep 17 00:00:00 2001 From: Alan Bixby Date: Sat, 8 Jun 2024 08:04:23 -0400 Subject: [PATCH 1/2] (lint): fix linting on publishToTopic --- lib/games/publishToTopic.js | 43 ++++++++++++++++++------------------- 1 file changed, 21 insertions(+), 22 deletions(-) diff --git a/lib/games/publishToTopic.js b/lib/games/publishToTopic.js index a1a964a7d..ebd2017fc 100644 --- a/lib/games/publishToTopic.js +++ b/lib/games/publishToTopic.js @@ -20,35 +20,34 @@ exports.optional = ['jar'] function publishToTopic (universeId, topic, data, jar) { return new Promise((resolve, reject) => { - const httpOpt = { url: `//apis.roblox.com/messaging-service/v1/universes/${universeId}/topics/${topic}`, - options: { - json: true, - resolveWithFullResponse: true, - jar, - method: 'POST', - body: { message: JSON.stringify(data) }, - headers: { - 'Content-Type': 'application/json' - } + options: { + json: true, + resolveWithFullResponse: true, + jar, + method: 'POST', + body: { message: JSON.stringify(data) }, + headers: { + 'Content-Type': 'application/json' } + } } - return http(httpOpt) - .then(function (res) { - if (res.statusCode === 200) { - resolve(true) - } else { - if (typeof(res.body) === "string") { - reject(new Error(`[${res.statusCode}] ${res.statusMessage} ${res.body}`)) + return http(httpOpt) + .then(function (res) { + if (res.statusCode === 200) { + resolve(true) } else { - const data = Object.assign(res.body) - reject(new Error(`[${res.statusCode}] ${data.Error} ${data.Message}`)) + if (typeof (res.body) === 'string') { + reject(new Error(`[${res.statusCode}] ${res.statusMessage} ${res.body}`)) + } else { + const data = Object.assign(res.body) + reject(new Error(`[${res.statusCode}] ${data.Error} ${data.Message}`)) + } } - } - }) - .catch(reject) + }) + .catch(reject) }) } From 5b8a3a9a279f92aebd22531a4ac537f52529f597 Mon Sep 17 00:00:00 2001 From: Alan Bixby Date: Sat, 8 Jun 2024 08:04:59 -0400 Subject: [PATCH 2/2] (fix): follow redirect on getCurrentUser to address error from the 302 redirect on localizations -> /fr/mobilapi/userinfo --- lib/util/getCurrentUser.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/util/getCurrentUser.js b/lib/util/getCurrentUser.js index 1bce78220..6c3b05e3e 100644 --- a/lib/util/getCurrentUser.js +++ b/lib/util/getCurrentUser.js @@ -25,7 +25,7 @@ exports.func = async function (args) { options: { resolveWithFullResponse: true, method: 'GET', - followRedirect: false, + followRedirect: true, jar } }