Skip to content

Commit

Permalink
Updates client versions (#2411)
Browse files Browse the repository at this point in the history
Co-authored-by: Bokkiewokkie <[email protected]>
Co-authored-by: Kyle Spier-Swenson <[email protected]>
Co-authored-by: LemonInTheDark <[email protected]>
  • Loading branch information
4 people authored Dec 1, 2023
1 parent 7e082e3 commit a0613c3
Show file tree
Hide file tree
Showing 3 changed files with 80 additions and 48 deletions.
8 changes: 8 additions & 0 deletions code/controllers/configuration/entries/general.dm
Original file line number Diff line number Diff line change
Expand Up @@ -413,6 +413,10 @@
config_entry_value = null
min_val = 500

/datum/config_entry/number/client_warn_build
default = null
min_val = 0

/datum/config_entry/string/client_warn_message
config_entry_value = "Your version of byond may have issues or be blocked from accessing this server in the future."

Expand All @@ -429,6 +433,10 @@
config_entry_value = null
min_val = 0

/datum/config_entry/number/client_max_build
config_entry_value = null
min_val = 0

/datum/config_entry/number/minute_topic_limit
config_entry_value = null
min_val = 0
Expand Down
104 changes: 65 additions & 39 deletions code/modules/client/client_procs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@


#define UPLOAD_LIMIT 10485760 //Restricts client uploads to the server to 1MB //Could probably do with being lower.
#define MAX_RECOMMENDED_CLIENT 1589

GLOBAL_LIST_INIT(blacklisted_builds, list(
"1407" = "bug preventing client display overrides from working leads to clients being able to see things/mobs they shouldn't be able to see",
Expand Down Expand Up @@ -264,28 +263,44 @@ GLOBAL_LIST_INIT(blacklisted_builds, list(
log_access("Login: [key_name(src)] from [address ? address : "localhost"]-[computer_id] || BYOND v[full_version]")

var/alert_mob_dupe_login = FALSE
var/alert_admin_multikey = FALSE
if(CONFIG_GET(flag/log_access))
for(var/I in GLOB.clients)
if(!I || I == src)
var/list/joined_players = list()
for(var/player_ckey in GLOB.joined_player_list)
joined_players[player_ckey] = 1

for(var/joined_player_ckey in (GLOB.directory | joined_players))
if (!joined_player_ckey || joined_player_ckey == ckey)
continue
var/client/C = I
if(C.key && (C.key != key) )
var/matches
if( (C.address == address) )
matches += "IP ([address])"
if( (C.computer_id == computer_id) )
if(matches)
matches += " and "
matches += "ID ([computer_id])"
alert_mob_dupe_login = TRUE
if(matches)
if(C)
message_admins("<span class='danger'><B>Notice: </B></span><span class='notice'>[key_name_admin(src)] has the same [matches] as [key_name_admin(C)].</span>")
log_access("Notice: [key_name(src)] has the same [matches] as [key_name(C)].")
else
message_admins("<span class='danger'><B>Notice: </B></span><span class='notice'>[key_name_admin(src)] has the same [matches] as [key_name_admin(C)] (no longer logged in). </span>")
log_access("Notice: [key_name(src)] has the same [matches] as [key_name(C)] (no longer logged in).")

var/datum/preferences/joined_player_preferences = GLOB.preferences_datums[joined_player_ckey]
if(!joined_player_preferences)
continue //this shouldn't happen.

var/client/C = GLOB.directory[joined_player_ckey]
var/in_round = ""
if (joined_players[joined_player_ckey])
in_round = " who has played in the current round"
var/message_type = "Notice"

var/matches
if(joined_player_preferences.last_ip == address)
matches += "IP ([address])"
if(joined_player_preferences.last_id == computer_id)
if(matches)
matches = "BOTH [matches] and "
alert_admin_multikey = TRUE
message_type = "MULTIKEY"
matches += "Computer ID ([computer_id])"
alert_mob_dupe_login = TRUE

if(matches)
if(C)
message_admins("<span class='danger'><B>[message_type]: </B></span><span class='notice'>Connecting player [key_name_admin(src)] has the same [matches] as [key_name_admin(C)]<b>[in_round]</b>.</span>")
log_admin_private("[message_type]: Connecting player [key_name(src)] has the same [matches] as [key_name(C)][in_round].")
else
message_admins("<span class='danger'><B>[message_type]: </B></span><span class='notice'>Connecting player [key_name_admin(src)] has the same [matches] as [joined_player_ckey](no longer logged in)<b>[in_round]</b>.</span> ")
log_admin_private("[message_type]: Connecting player [key_name(src)] has the same [matches] as [joined_player_ckey](no longer logged in)[in_round].")
if(GLOB.player_details[ckey])
player_details = GLOB.player_details[ckey]
player_details.byond_version = full_version
Expand All @@ -310,54 +325,65 @@ GLOBAL_LIST_INIT(blacklisted_builds, list(
to_chat_immediate(src, "<span class='danger'>Byond build [byond_build] ([byond_version].[byond_build]) has been blacklisted for the following reason: [GLOB.blacklisted_builds[num2text(byond_build)]].</span>")
to_chat_immediate(src, "<span class='danger'>Please download a new version of byond. If [byond_build] is the latest, you can go to <a href=\"https://secure.byond.com/download/build\">BYOND's website</a> to download other versions.</span>")
if(connecting_admin)
to_chat(src, "As an admin, you are being allowed to continue using this version, but please consider changing byond versions")
to_chat_immediate(src, "As an admin, you are being allowed to continue using this version, but please consider changing byond versions")
else
qdel(src)
return
if(byond_build > MAX_RECOMMENDED_CLIENT)
to_chat(src, "<span class='userdanger'>Your version of byond is over the maximum recommended version for clients (build [MAX_RECOMMENDED_CLIENT]) and may be unstable.</span>")

var/max_recommended_client = CONFIG_GET(number/client_max_build)
if(byond_build > max_recommended_client)
to_chat(src, "<span class='userdanger'>Your version of byond is over the maximum recommended version for clients (build [max_recommended_client]) and may be unstable.</span>")
to_chat(src, "<span class='danger'>Please download an older version of byond. You can go to <a href=\"https://secure.byond.com/download/build\">BYOND's website</a> to download other versions.</span>")
if(SSinput.initialized)
set_macros()

// Initialize tgui panel
tgui_panel.Initialize()

if(alert_mob_dupe_login)
spawn()
alert(mob, "You have logged in already with another key this round, please log out of this one NOW or risk being banned!")
if(alert_mob_dupe_login && !holder)
var/dupe_login_message = "Your ComputerID has already logged in with another key this round, please log out of this one NOW or risk being banned!"
if (alert_admin_multikey)
dupe_login_message += "\nAdmins have been informed."
message_admins("<span class='danger'><B>MULTIKEYING: </B></span><span class='notice'>[key_name_admin(src)] has a matching CID+IP with another player and is clearly multikeying. They have been warned to leave the server or risk getting banned.</span>")
log_admin_private("MULTIKEYING: [key_name(src)] has a matching CID+IP with another player and is clearly multikeying. They have been warned to leave the server or risk getting banned.")
spawn(0.5 SECONDS) //needs to run during world init, do not convert to add timer
alert(mob, dupe_login_message) //players get banned if they don't see this message, do not convert to tgui_alert (or even tg_alert) please.
to_chat_immediate(mob, "<span class='danger'>[dupe_login_message]</span>")


connection_time = world.time
connection_realtime = world.realtime
connection_timeofday = world.timeofday
winset(src, null, "command=\".configure graphics-hwmode on\"")
var/cev = CONFIG_GET(number/client_error_version)
var/ceb = CONFIG_GET(number/client_error_build)
var/cwv = CONFIG_GET(number/client_warn_version)
if (byond_version < cev || byond_build < ceb) //Out of date client.
var/breaking_version = CONFIG_GET(number/client_error_version)
var/breaking_build = CONFIG_GET(number/client_error_build)
var/warn_version = CONFIG_GET(number/client_warn_version)
var/warn_build = CONFIG_GET(number/client_warn_build)

if (byond_version < breaking_version || (byond_version == breaking_version && byond_build < breaking_build)) //Out of date client.
to_chat_immediate(src, "<span class='danger'><b>Your version of BYOND is too old:</b></span>")
to_chat_immediate(src, CONFIG_GET(string/client_error_message))
to_chat_immediate(src, "Your version: [byond_version].[byond_build]")
to_chat_immediate(src, "Required version: [cev].[ceb] or later")
to_chat_immediate(src, "Required version: [breaking_version].[breaking_build] or later")
to_chat_immediate(src, "Visit <a href=\"https://secure.byond.com/download\">BYOND's website</a> to get the latest version of BYOND.")
if (connecting_admin)
to_chat(src, "Because you are an admin, you are being allowed to walk past this limitation, But it is still STRONGLY suggested you upgrade")
to_chat_immediate(src, "Because you are an admin, you are being allowed to walk past this limitation, But it is still STRONGLY suggested you upgrade")
else
qdel(src)
return 0
else if (byond_version < cwv) //We have words for this client.
return
else if (byond_version < warn_version || (byond_version == warn_version && byond_build < warn_build)) //We have words for this client.
if(CONFIG_GET(flag/client_warn_popup))
var/msg = "<b>Your version of byond may be getting out of date:</b><br>"
msg += CONFIG_GET(string/client_warn_message) + "<br><br>"
msg += "Your version: [byond_version]<br>"
msg += "Required version to remove this message: [cwv] or later<br>"
msg += "Your version: [byond_version].[byond_build]<br>"
msg += "Required version to remove this message: [warn_version].[warn_build] or later<br>"
msg += "Visit <a href=\"https://secure.byond.com/download\">BYOND's website</a> to get the latest version of BYOND.<br>"
src << browse(msg, "window=warning_popup")
else
to_chat(src, "<span class='danger'><b>Your version of byond may be getting out of date:</b></span>")
to_chat(src, CONFIG_GET(string/client_warn_message))
to_chat(src, "Your version: [byond_version]")
to_chat(src, "Required version to remove this message: [cwv] or later")
to_chat(src, "Your version: [byond_version].[byond_build]")
to_chat(src, "Required version to remove this message: [warn_version].[warn_build] or later")
to_chat(src, "Visit <a href=\"https://secure.byond.com/download\">BYOND's website</a> to get the latest version of BYOND.")

if (connection == "web" && !connecting_admin)
Expand Down Expand Up @@ -831,7 +857,7 @@ GLOBAL_LIST_INIT(blacklisted_builds, list(
var/url = winget(src, null, "url")
//special javascript to make them reconnect under a new window.
src << browse({"<a id='link' href="byond://[url]?token=[token]">byond://[url]?token=[token]</a><script type="text/javascript">document.getElementById("link").click();window.location="byond://winset?command=.quit"</script>"}, "border=0;titlebar=0;size=1x1;window=redirect")
to_chat(src, {"<a href="byond://[url]?token=[token]">You will be automatically taken to the game, if not, click here to be taken manually</a>"})
to_chat_immediate(src, {"<a href="byond://[url]?token=[token]">You will be automatically taken to the game, if not, click here to be taken manually</a>"})

/client/proc/note_randomizer_user()
add_system_note("CID-Error", "Detected as using a cid randomizer.")
Expand Down
16 changes: 7 additions & 9 deletions config/config.txt
Original file line number Diff line number Diff line change
Expand Up @@ -456,18 +456,16 @@ AUTOADMIN_RANK Admin
## These trigger for any version below (non-inclusive) the given version, so 510 triggers on 509 or lower.
## These messages will be followed by one stating the clients current version and the required version for clarity.
## If CLIENT_WARN_POPUP is uncommented a popup window with the message will be displayed instead

#Warn, Allows connection but warns about possibile instability.
CLIENT_WARN_POPUP
CLIENT_WARN_VERSION 0
#Wish we had a build check for this
CLIENT_WARN_MESSAGE Currently Unused! If you see this message yell at Francinum!

#Error, Blocks non-admin connection.
#CLIENT_WARN_VERSION 513
#CLIENT_WARN_BUILD 1421
#CLIENT_WARN_POPUP
#CLIENT_WARN_MESSAGE 512 is no longer being directly supported as version 513 is set to become the new stable version soon. We've made a number of changes to take advantage of the improvements made in 513 which should make for a smoother experience. We will be removing support for 512 when this new version replaces it as stable, so it's recommended that you upgrade now. (You can update to the BETA via the website or directly in the BYOND client)
CLIENT_ERROR_VERSION 514
CLIENT_ERROR_MESSAGE Your version of byond is not supported. Please upgrade.
## The minimum build needed for joining the server, if using 513, a good minimum build would be 1526.
CLIENT_ERROR_BUILD 1583
CLIENT_ERROR_BUILD 1589
## The maximum build recommended for clients
CLIENT_MAX_BUILD 1614

## TOPIC RATE LIMITING
## This allows you to limit how many topic calls (clicking on an interface window) the client can do in any given game second and/or game minute.
Expand Down

0 comments on commit a0613c3

Please sign in to comment.