Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/Classes/ImportTab.lua
Original file line number Diff line number Diff line change
Expand Up @@ -160,11 +160,11 @@ local ImportTabClass = newClass("ImportTab", "ControlHost", "Control", function(
self.controls.exportFrom:SelByValue(self.exportWebsiteSelected or main.lastExportWebsite or "Pastebin", "id")
self.controls.generateCodeByLink = new("ButtonControl", { "LEFT", self.controls.exportFrom, "RIGHT"}, {8, 0, 100, 20}, "Share", function()
local exportWebsite = exportWebsitesList[self.controls.exportFrom.selIndex]
local response = buildSites.UploadBuild(self.controls.generateCodeOut.buf, exportWebsite)
if response then
local subScriptId = buildSites.UploadBuild(self.controls.generateCodeOut.buf, exportWebsite)
if subScriptId then
self.controls.generateCodeOut:SetText("")
self.controls.generateCodeByLink.label = "Creating link..."
launch:RegisterSubScript(response, function(pasteLink, errMsg)
launch:RegisterSubScript(subScriptId, function(pasteLink, errMsg)
self.controls.generateCodeByLink.label = "Share"
if errMsg then
main:OpenMessagePopup(exportWebsite.id, "Error creating link:\n"..errMsg)
Expand Down
4 changes: 2 additions & 2 deletions src/Classes/PoEAPI.lua
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,9 @@ function PoEAPIClass:FetchAuthToken(callback)
if id then
launch.subScripts[id] = {
type = "DOWNLOAD",
callback = function(code, state, port)
callback = function(code, errMsg, state, port)
if not code then
ConPrintf("Failed to get code from server")
ConPrintf("Failed to get code from server: %s", errMsg)
self.authToken = nil
self.refreshToken = nil
self.tokenExpiry = nil
Expand Down
4 changes: 2 additions & 2 deletions src/Launch.lua
Original file line number Diff line number Diff line change
Expand Up @@ -299,13 +299,13 @@ function launch:DownloadPage(url, callback, params)
errMsg = "No data returned"
end
ConPrintf("Download complete. Status: %s", errMsg or "OK")
return responseHeader, responseBody, errMsg
return responseBody, errMsg, responseHeader
]]
local id = LaunchSubScript(script, "", "ConPrintf", url, params.header, params.body, self.connectionProtocol, self.proxyURL)
if id then
self.subScripts[id] = {
type = "DOWNLOAD",
callback = function(responseHeader, responseBody, errMsg)
callback = function(responseBody, errMsg, responseHeader)
callback({header=responseHeader, body=responseBody}, errMsg)
end
}
Expand Down
6 changes: 5 additions & 1 deletion src/LaunchServer.lua
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,7 @@ end
-- IO, so that it can operate concurrently, but hopefully that isn't necessary.
local attempt = 1
local stopAt = os.time() + 30
local errMsg
local shouldRetry, code, state = true, nil, nil
while (os.time() < stopAt) and shouldRetry do
-- `settimeout`` applies only to individual operations, but we're more concerned with not spending more than 30
Expand All @@ -197,4 +198,7 @@ while (os.time() < stopAt) and shouldRetry do
attempt = attempt + 1
end
server:close()
return code, state, port
if os.time() >= stopAt then
errMsg = "Timeout reached without a response received by the local server"
end
return code, errMsg, state, port