mirror of
https://github.com/Aurorastation/Aurora.3.git
synced 2026-01-14 03:12:30 +00:00
* SDQL2 update * fix that verb * cl * fix that * toworld * this is pointless * update info * siiiiick.. * vv edit update * fix that * fix editing vars * fix VV * Port the /TG/ globals controller. * part 1 * part 2 * oops * part 3 * Hollow Purple * sadas * bsbsdb * muda na agaki ta * ids 1-15 * 16-31 * 41-75 * bring me back to how things used to be before i lost it all * the strength of mayhem * final touches * cl * protect some vars * update sdql2 to use glob * stuff? * forgot that is not defined there * whoops * observ * but it never gets better * a --------- Co-authored-by: Matt Atlas <liermattia@gmail.com>
68 lines
1.8 KiB
Plaintext
68 lines
1.8 KiB
Plaintext
var/global/forumuser_api_key = null
|
|
|
|
/datum/forum_user
|
|
var/forum_member_id
|
|
var/forum_name
|
|
var/forum_primary_group
|
|
var/list/forum_secondary_groups = list()
|
|
var/discord_id
|
|
var/ckey
|
|
var/psync_game_disabled = FALSE
|
|
|
|
/datum/forum_user/New(data)
|
|
forum_member_id = data["forum_member_id"]
|
|
forum_name = data["forum_name"]
|
|
forum_primary_group = data["forum_primary_group"]
|
|
|
|
for (var/id in splittext(data["forum_secondary_groups"], ","))
|
|
forum_secondary_groups += text2num(id)
|
|
|
|
discord_id = data["discord_id"]
|
|
ckey = data["ckey"]
|
|
if(data["psync_game_disabled"] == 1) //This here is needed because the data can be null, 1 or 0
|
|
psync_game_disabled = TRUE
|
|
|
|
/datum/http_request/forumuser_api
|
|
|
|
/datum/http_request/forumuser_api/proc/prepare_roles_query(role_id)
|
|
var/url = "[GLOB.config.forumuser_api_url]/staff/[role_id]"
|
|
|
|
var/list/headers = list("Authorization" = "Bearer [forumuser_api_key]")
|
|
|
|
prepare(RUSTG_HTTP_METHOD_GET, url, headers=headers)
|
|
|
|
/datum/http_request/forumuser_api/proc/prepare_user_discord(discord_id)
|
|
var/url = "[GLOB.config.forumuser_api_url]/user/discord/[discord_id]"
|
|
|
|
var/list/headers = list("Authorization" = "Bearer [forumuser_api_key]")
|
|
|
|
prepare(RUSTG_HTTP_METHOD_GET, url, headers=headers)
|
|
|
|
/datum/http_request/forumuser_api/proc/prepare_user_ckey(ckey)
|
|
var/url = "[GLOB.config.forumuser_api_url]/user/ckey/[ckey]"
|
|
|
|
var/list/headers = list("Authorization" = "Bearer [forumuser_api_key]")
|
|
|
|
prepare(RUSTG_HTTP_METHOD_GET, url, headers=headers)
|
|
|
|
/datum/http_request/forumuser_api/into_response()
|
|
var/datum/http_response/R = ..()
|
|
|
|
if (R.errored)
|
|
return R
|
|
|
|
try
|
|
R.body = json_decode(R.body)
|
|
catch
|
|
R.errored = TRUE
|
|
R.error = "Malformed JSON returned."
|
|
return R
|
|
|
|
var/list/users = list()
|
|
for (var/d in R.body)
|
|
users += new /datum/forum_user(d)
|
|
|
|
R.body = users
|
|
|
|
return R
|