Skip to content

Commit

Permalink
remove url encoding check, as it was broken
Browse files Browse the repository at this point in the history
  • Loading branch information
Regisle committed Nov 22, 2024
1 parent 26a80ef commit b5aa293
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions src/Classes/ImportTab.lua
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,11 @@ local ImportTabClass = newClass("ImportTab", "ControlHost", "Control", function(
self:DownloadCharacterList()
end)
self.controls.accountNameGo.enabled = function()
return self.controls.accountName.buf:match("%S[#%-(%%23)]%d%d%d%d$")
return self.controls.accountName.buf:match("%S[#%-]%d%d%d%d$")
end
self.controls.accountNameGo.tooltipFunc = function(tooltip)
tooltip:Clear()
if not self.controls.accountName.buf:match("[#%-(%%23)]%d%d%d%d$") then
if not self.controls.accountName.buf:match("[#%-]%d%d%d%d$") then
tooltip:AddLine(16, "^7Missing discriminator e.g. " .. self.controls.accountName.buf .. "#1234")
end
end
Expand Down Expand Up @@ -99,7 +99,7 @@ local ImportTabClass = newClass("ImportTab", "ControlHost", "Control", function(

self.controls.accountNameMissingDiscriminator = new("LabelControl", {"BOTTOMLEFT",self.controls.accountNameUnicode,"TOPLEFT"}, {0, -4, 0, 18}, "^1Missing discriminator e.g. #1234")
self.controls.accountNameMissingDiscriminator.shown = function()
return not self.controls.accountName.buf:match("[#%-(%%23)]%d%d%d%d$")
return not self.controls.accountName.buf:match("[#%-]%d%d%d%d$")
end


Expand Down Expand Up @@ -423,8 +423,8 @@ function ImportTabClass:DownloadCharacterList()
else
accountName = self.controls.accountName.buf:gsub("^[%s?]+", ""):gsub("[%s?]+$", ""):gsub("%s", "+")
end
accountName = accountName:gsub("(.*)[#%-]", "%1#")
local sessionID = #self.controls.sessionInput.buf == 32 and self.controls.sessionInput.buf or (main.gameAccounts[accountName] and main.gameAccounts[accountName].sessionID)
accountName = ReplaceDiscriminatorSafely(accountName)
launch:DownloadPage(realm.hostName.."character-window/get-characters?accountName="..accountName:gsub("#", "%%23").."&realm="..realm.realmCode, function(response, errMsg)
if errMsg == "Response code: 401" then
self.charImportStatus = colorCodes.NEGATIVE.."Sign-in is required."
Expand Down Expand Up @@ -469,7 +469,7 @@ function ImportTabClass:DownloadCharacterList()
self.charImportMode = "GETSESSIONID"
return
end
realAccountName = ReplaceDiscriminatorSafely(realAccountName)
realAccountName = realAccountName:gsub("(.*)[#%-]", "%1#")
accountName = realAccountName
self.controls.accountName:SetText(realAccountName)
self.charImportStatus = "Character list successfully retrieved."
Expand Down Expand Up @@ -1139,10 +1139,6 @@ function HexToChar(x)
return string.char(tonumber(x, 16))
end

function ReplaceDiscriminatorSafely(accountName)
return accountName:gsub("(.*)[#%-]", "%1#")
end

function UrlDecode(url)
if url == nil then
return
Expand Down

0 comments on commit b5aa293

Please sign in to comment.