Skip to content

Commit 7e512dc

Browse files
author
LocalIdentity
committed
Revert "Fix various issues with subscript errors (#1345)"
This reverts commit 601a278.
1 parent 7ccc9f2 commit 7e512dc

File tree

4 files changed

+9
-14
lines changed

4 files changed

+9
-14
lines changed

src/Classes/ImportTab.lua

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -160,11 +160,11 @@ local ImportTabClass = newClass("ImportTab", "ControlHost", "Control", function(
160160
self.controls.exportFrom:SelByValue(self.exportWebsiteSelected or main.lastExportWebsite or "Pastebin", "id")
161161
self.controls.generateCodeByLink = new("ButtonControl", { "LEFT", self.controls.exportFrom, "RIGHT"}, {8, 0, 100, 20}, "Share", function()
162162
local exportWebsite = exportWebsitesList[self.controls.exportFrom.selIndex]
163-
local subScriptId = buildSites.UploadBuild(self.controls.generateCodeOut.buf, exportWebsite)
164-
if subScriptId then
163+
local response = buildSites.UploadBuild(self.controls.generateCodeOut.buf, exportWebsite)
164+
if response then
165165
self.controls.generateCodeOut:SetText("")
166166
self.controls.generateCodeByLink.label = "Creating link..."
167-
launch:RegisterSubScript(subScriptId, function(pasteLink, errMsg)
167+
launch:RegisterSubScript(response, function(pasteLink, errMsg)
168168
self.controls.generateCodeByLink.label = "Share"
169169
if errMsg then
170170
main:OpenMessagePopup(exportWebsite.id, "Error creating link:\n"..errMsg)

src/Classes/PoEAPI.lua

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,10 +80,9 @@ function PoEAPIClass:FetchAuthToken(callback)
8080
if id then
8181
launch.subScripts[id] = {
8282
type = "DOWNLOAD",
83-
callback = function(response, errMsg)
84-
local code, state, port = unpack(response or {})
83+
callback = function(code, state, port)
8584
if not code then
86-
ConPrintf("Failed to get code from server: %s", errMsg)
85+
ConPrintf("Failed to get code from server")
8786
self.authToken = nil
8887
self.refreshToken = nil
8988
self.tokenExpiry = nil

src/Launch.lua

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -299,18 +299,14 @@ function launch:DownloadPage(url, callback, params)
299299
errMsg = "No data returned"
300300
end
301301
ConPrintf("Download complete. Status: %s", errMsg or "OK")
302-
return {responseHeader, responseBody}, errMsg
302+
return responseHeader, responseBody, errMsg
303303
]]
304304
local id = LaunchSubScript(script, "", "ConPrintf", url, params.header, params.body, self.connectionProtocol, self.proxyURL)
305305
if id then
306306
self.subScripts[id] = {
307307
type = "DOWNLOAD",
308-
callback = function(response, errMsg)
309-
if response then
310-
callback({header=response[1], body=response[2]}, errMsg)
311-
else
312-
callback({}, errMsg)
313-
end
308+
callback = function(responseHeader, responseBody, errMsg)
309+
callback({header=responseHeader, body=responseBody}, errMsg)
314310
end
315311
}
316312
end

src/LaunchServer.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,4 +197,4 @@ while (os.time() < stopAt) and shouldRetry do
197197
attempt = attempt + 1
198198
end
199199
server:close()
200-
return {code, state, port}
200+
return code, state, port

0 commit comments

Comments
 (0)