Not sending requests when not logged in from now on

This commit is contained in:
entar 2025-09-05 14:40:56 +07:00
parent 7a4ae19b28
commit f14173fa68
2 changed files with 15 additions and 2 deletions

View File

@ -1,4 +1,4 @@
return {
id = "",
key = ""
id = "1017262",
key = "46059c43ef883ba29b7e1d5b782b9366"
}

View File

@ -147,6 +147,7 @@ end
-- data store
function GJ.fetchData(key, isGlobal)
if not GJ.isLoggedIn then return end
local pu, pt = true, true
if isGlobal then pu, pt = false, false end
@ -156,6 +157,7 @@ function GJ.fetchData(key, isGlobal)
end
function GJ.setData(key, data, isGlobal)
if not GJ.isLoggedIn then return end
local pu, pt = true, true
if isGlobal then pu, pt = false, false end
@ -163,6 +165,7 @@ function GJ.setData(key, data, isGlobal)
end
function GJ.setBigData(key, data, isGlobal)
if not GJ.isLoggedIn then return end
local pu, pt = true, true
if isGlobal then pu, pt = false, false end
@ -170,6 +173,7 @@ function GJ.setBigData(key, data, isGlobal)
end
function GJ.updateData(key, value, operation, isGlobal)
if not GJ.isLoggedIn then return end
local pu, pt = true, true
if isGlobal then pu, pt = false, false end
@ -178,6 +182,7 @@ function GJ.updateData(key, value, operation, isGlobal)
end
function GJ.removeData(key, isGlobal)
if not GJ.isLoggedIn then return end
local pu, pt = true, true
if isGlobal then pu, pt = false, false end
@ -185,6 +190,7 @@ function GJ.removeData(key, isGlobal)
end
function GJ.fetchStorageKeys(isGlobal)
if not GJ.isLoggedIn then return end
local pu, pt = true, true
if isGlobal then pu, pt = false, false end
@ -200,12 +206,14 @@ end
-- trophies
function GJ.giveTrophy(id)
if not GJ.isLoggedIn then return end
local s = string.find(req("trophies/add-achieved/?trophy_id=" .. id, "dump", true, true), "SUCCESS") ~= nil
GJ.fetchAllTrophies(true)
return s
end
function GJ.fetchTrophy(id)
if not GJ.isLoggedIn then return end
local d = req("trophies/?trophy_id=" .. tostring(id), "keypair", true, true)
local t = {}
@ -216,10 +224,12 @@ function GJ.fetchTrophy(id)
end
function GJ.fetchTrophiesByStatus(achieved)
if not GJ.isLoggedIn then return end
return handleTrophies("achieved=" .. (achieved and "true" or "false"))
end
function GJ.fetchAllTrophies(f)
if not GJ.isLoggedIn then return end
if f then
GJ.trophies = handleTrophies("")
end
@ -228,6 +238,7 @@ end
-- scores
function GJ.addScore(score, desc, tableID, guestName, extraData)
if not GJ.isLoggedIn then return end
local pu, pt, s = true, true, ""
if guestName then pu, pt, s = false, false, s .. "&guest=" .. escape(guestName) end
@ -238,6 +249,7 @@ function GJ.addScore(score, desc, tableID, guestName, extraData)
end
function GJ.fetchScores(limit, tableID)
if not GJ.isLoggedIn then return end
local pu, pt, s = true, true, ""
if tableID then pu, pt, s = false, false, "&table_id=" .. escape(tableID) end
@ -257,6 +269,7 @@ function GJ.fetchScores(limit, tableID)
end
function GJ.fetchTables()
if not GJ.isLoggedIn then return end
local d = req("scores/tables/?", "keypair", false, false)
local t, f = {}