Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use world.Export instead of rustg http for byond account age #5927

Merged
merged 1 commit into from
Mar 16, 2024
Merged
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
16 changes: 10 additions & 6 deletions code/datums/entities/player.dm
Original file line number Diff line number Diff line change
Expand Up @@ -455,15 +455,19 @@ BSQL_PROTECT_DATUM(/datum/entity/player)
LAZYSET(stats, S.stat_id, S)

/datum/entity/player/proc/load_byond_account_age()
var/datum/http_request/request = new()
request.prepare(RUSTG_HTTP_METHOD_GET, "https://www.byond.com/members/[ckey]?format=text")
request.execute_blocking()
var/datum/http_response/response = request.into_response()
if(response.errored)
var/list/http_request = world.Export("http://byond.com/members/[ckey]?format=text")
if(!http_request)
log_admin("Could not check BYOND account age for [ckey] - no response from server.")
return

var/body = file2text(http_request["CONTENT"])
if(!body)
log_admin("Could not check BYOND account age for [ckey] - invalid response.")
return

var/static/regex/regex = regex("joined = \"(\\d{4}-\\d{2}-\\d{2})\"")
if(!regex.Find(response.body))
if(!regex.Find(body))
log_admin("Could not check BYOND account age for [ckey] - no valid date in response.")
return

byond_account_age = regex.group[1]
Expand Down
Loading