swap some stuff out for version lib

This commit is contained in:
Jill 2023-01-07 17:34:41 +03:00
parent a433157a53
commit 2a33ec3621
3 changed files with 5 additions and 5 deletions

View File

@ -37,7 +37,7 @@ CrystalGauntlet.endpoints["/getGJComments21.php"] = ->(context : HTTP::Server::C
special = rs.read(Int32)
if params["binaryVersion"].to_i32 > 31
if Versions.parse(params["gameVersion"]) >= Versions::V2_1
comments_str << [
Format.fmt_comment({
2 => Base64.urlsafe_encode(comment),

View File

@ -80,7 +80,7 @@ CrystalGauntlet.endpoints["/downloadGJLevel22.php"] = ->(context : HTTP::Server:
xor_pass = "0"
if !password
password = "0"
elsif params["gameVersion"].to_i >= 20
elsif Versions.parse(params["gameVersion"]) >= Versions::V2_0
xor_pass = Base64.urlsafe_encode(XorCrypt.encrypt_string(password, "26364"))
else
xor_pass = password
@ -151,7 +151,7 @@ CrystalGauntlet.endpoints["/downloadGJLevel22.php"] = ->(context : HTTP::Server:
end
end
if level_exists
if level_exists
DATABASE.exec "update levels set downloads = downloads + 1 where id = ?", level_id
end

View File

@ -15,7 +15,7 @@ CrystalGauntlet.endpoints["/uploadGJLevel21.php"] = ->(context : HTTP::Server::C
song_id = params["songID"] == "0" ? params["audioTrack"] : params["songID"]
description = params["levelDesc"]
if params["gameVersion"].to_i >= 20 # 2.0
if Versions.parse(params["gameVersion"]) >= Versions::V2_0
description = Clean.clean_special(Base64.decode_string description)
else
description = Clean.clean_special(description)
@ -142,4 +142,4 @@ CrystalGauntlet.endpoints["/uploadGJLevel21.php"] = ->(context : HTTP::Server::C
end
}
CrystalGauntlet.endpoints["/uploadGJLevel20.php"] = CrystalGauntlet.endpoints["/uploadGJLevel21.php"]
CrystalGauntlet.endpoints["/uploadGJLevel20.php"] = CrystalGauntlet.endpoints["/uploadGJLevel21.php"]