mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-23 05:00:55 +01:00
[MIRROR] CentCom Galactic Ban DB: Bigger and Better Edition (#247)
* CentCom Galactic Ban DB: Bigger and Better Edition (#52588) Admins will now be able to look up a player's bans from several other servers via the player panel. My hope is that porting this to as many servers as possible will encourage more servers to make their bans publicly viewable so they can be included in this system. Direct access to a server's database is not required (or even supported). Supported servers: BeeStation /vg/station OracleStation FTL13 Fulpstation TGMC Planned support (WIP): World Server Yogstation Halo: SSE Any other server willing to make their bans publicly visible. API: https://centcom.melonmesa.com Source: https://github.com/bobbahbrown/CentCom Changelog cl ike709 and bobbahbrown add: Admins can now see your bans on (some) other servers. /cl * CentCom Galactic Ban DB: Bigger and Better Edition Co-authored-by: ike709 <ike709@users.noreply.github.com>
This commit is contained in:
@@ -40,6 +40,11 @@
|
||||
|
||||
if(M.client)
|
||||
body += "<br>\[<b>First Seen:</b> [M.client.player_join_date]\]\[<b>Byond account registered on:</b> [M.client.account_join_date]\]"
|
||||
body += "<br><br><b>CentCom Galactic Ban DB: </b> "
|
||||
if(CONFIG_GET(string/centcom_ban_db))
|
||||
body += "<a href='?_src_=holder;[HrefToken()];centcomlookup=[M.client.ckey]'>Search</a>"
|
||||
else
|
||||
body += "<i>Disabled</i>"
|
||||
body += "<br><br><b>Show related accounts by:</b> "
|
||||
body += "\[ <a href='?_src_=holder;[HrefToken()];showrelatedacc=cid;client=[REF(M.client)]'>CID</a> | "
|
||||
body += "<a href='?_src_=holder;[HrefToken()];showrelatedacc=ip;client=[REF(M.client)]'>IP</a> \]"
|
||||
|
||||
@@ -2071,6 +2071,71 @@
|
||||
|
||||
usr << browse(dat.Join("<br>"), "window=related_[C];size=420x300")
|
||||
|
||||
else if(href_list["centcomlookup"])
|
||||
if(!check_rights(R_ADMIN))
|
||||
return
|
||||
|
||||
if(!CONFIG_GET(string/centcom_ban_db))
|
||||
to_chat(usr, "<span class='warning'>Centcom Galactic Ban DB is disabled!</span>")
|
||||
return
|
||||
|
||||
var/ckey = href_list["centcomlookup"]
|
||||
|
||||
// Make the request
|
||||
var/datum/http_request/request = new()
|
||||
request.prepare(RUSTG_HTTP_METHOD_GET, "[CONFIG_GET(string/centcom_ban_db)]/[ckey]", "", "")
|
||||
request.begin_async()
|
||||
UNTIL(request.is_complete() || !usr)
|
||||
if (!usr)
|
||||
return
|
||||
var/datum/http_response/response = request.into_response()
|
||||
|
||||
var/list/bans
|
||||
|
||||
var/list/dat = list("<meta http-equiv='Content-Type' content='text/html; charset=UTF-8'><body>")
|
||||
|
||||
if(response.errored)
|
||||
dat += "<br>Failed to connect to CentCom."
|
||||
else if(response.status_code != 200)
|
||||
dat += "<br>Failed to connect to CentCom. Status code: [response.status_code]"
|
||||
else
|
||||
if(response.body == "[]")
|
||||
dat += "<center><b>0 bans detected for [ckey]</b></center>"
|
||||
else
|
||||
bans = json_decode(response["body"])
|
||||
|
||||
//Ignore bans from non-whitelisted sources, if a whitelist exists
|
||||
var/list/valid_sources
|
||||
if(CONFIG_GET(string/centcom_source_whitelist))
|
||||
valid_sources = splittext(CONFIG_GET(string/centcom_source_whitelist), ",")
|
||||
dat += "<center><b>Bans detected for [ckey]</b></center>"
|
||||
else
|
||||
//Ban count is potentially inaccurate if they're using a whitelist
|
||||
dat += "<center><b>[bans.len] ban\s detected for [ckey]</b></center>"
|
||||
|
||||
for(var/list/ban in bans)
|
||||
if(valid_sources && !(ban["sourceName"] in valid_sources))
|
||||
continue
|
||||
dat += "<b>Server: </b> [sanitize(ban["sourceName"])]<br>"
|
||||
dat += "<b>RP Level: </b> [sanitize(ban["sourceRoleplayLevel"])]<br>"
|
||||
dat += "<b>Type: </b> [sanitize(ban["type"])]<br>"
|
||||
dat += "<b>Banned By: </b> [sanitize(ban["bannedBy"])]<br>"
|
||||
dat += "<b>Reason: </b> [sanitize(ban["reason"])]<br>"
|
||||
dat += "<b>Datetime: </b> [sanitize(ban["bannedOn"])]<br>"
|
||||
var/expiration = ban["expires"]
|
||||
dat += "<b>Expires: </b> [expiration ? "[sanitize(expiration)]" : "Permanent"]<br>"
|
||||
if(ban["type"] == "job")
|
||||
dat += "<b>Jobs: </b> "
|
||||
var/list/jobs = ban["jobs"]
|
||||
dat += sanitize(jobs.Join(", "))
|
||||
dat += "<br>"
|
||||
dat += "<hr>"
|
||||
|
||||
dat += "<br></body>"
|
||||
var/datum/browser/popup = new(usr, "centcomlookup-[ckey]", "<div align='center'>Central Command Galactic Ban Database</div>", 700, 600)
|
||||
popup.set_content(dat.Join())
|
||||
popup.open(0)
|
||||
|
||||
else if(href_list["modantagrep"])
|
||||
if(!check_rights(R_ADMIN))
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user