From f1326c753a1fc3d9b63f930c1eb2f21827cd18f0 Mon Sep 17 00:00:00 2001 From: Kyep Date: Tue, 15 Sep 2020 14:26:06 -0700 Subject: [PATCH 1/5] Server awareness of pending updates --- code/_globalvars/misc.dm | 1 + code/game/world.dm | 13 ++++++++++--- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/code/_globalvars/misc.dm b/code/_globalvars/misc.dm index 283d92a954f..1aad0690627 100644 --- a/code/_globalvars/misc.dm +++ b/code/_globalvars/misc.dm @@ -92,6 +92,7 @@ GLOBAL_VAR(map_name) // Self explanatory GLOBAL_DATUM_INIT(data_core, /datum/datacore, new) // Station datacore, manifest, etc GLOBAL_VAR_INIT(panic_bunker_enabled, FALSE) // Is the panic bunker enabled +GLOBAL_VAR_INIT(pending_server_update, FALSE) //Database connections //A connection is established on world creation. Ideally, the connection dies when the server restarts (After feedback logging.). diff --git a/code/game/world.dm b/code/game/world.dm index c279fa24b54..a840093bff2 100644 --- a/code/game/world.dm +++ b/code/game/world.dm @@ -222,8 +222,11 @@ GLOBAL_VAR_INIT(world_topic_spam_protect_time, world.timeofday) if(input["key"] != config.comms_password) return "Bad Key" else + var/prtext = input["announce"] + if(findtext(prtext, "Pull request merged by") != 0) + GLOB.pending_server_update = TRUE for(var/client/C in GLOB.clients) - to_chat(C, "PR: [input["announce"]]") + to_chat(C, "PR: [prtext]") else if("kick" in input) /* @@ -270,7 +273,7 @@ GLOBAL_VAR_INIT(world_topic_spam_protect_time, world.timeofday) else if("hostannounce" in input) if(!key_valid) return keySpamProtect(addr) - + GLOB.pending_server_update = TRUE to_chat(world, "
Server Announcement: [input["message"]]
") /proc/keySpamProtect(var/addr) @@ -339,8 +342,12 @@ GLOBAL_VAR_INIT(world_topic_spam_protect_time, world.timeofday) return #endif + var/secs_before_auto_reconnect = 10 + if(GLOB.pending_server_update) + secs_before_auto_reconnect = 60 + to_chat(world, "Reboot will take a little longer, due to pending updates.") for(var/client/C in GLOB.clients) - var/secs_before_auto_reconnect = 10 // TODO: make it higher if server is due for an update @AffectedArc07 + C << output(list2params(list(secs_before_auto_reconnect)), "browseroutput:reboot") if(config.server) //if you set a server location in config.txt, it sends you there instead of trying to reconnect to the same world address. -- NeoFite C << link("byond://[config.server]") From ee36b731d3cd58bbb5e5575934982efbb2e5850a Mon Sep 17 00:00:00 2001 From: Kyep Date: Tue, 15 Sep 2020 14:34:21 -0700 Subject: [PATCH 2/5] better filtering --- code/game/world.dm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/game/world.dm b/code/game/world.dm index a840093bff2..4c83c1d3bd1 100644 --- a/code/game/world.dm +++ b/code/game/world.dm @@ -223,7 +223,7 @@ GLOBAL_VAR_INIT(world_topic_spam_protect_time, world.timeofday) return "Bad Key" else var/prtext = input["announce"] - if(findtext(prtext, "Pull request merged by") != 0) + if(copytext(prtext, 1, 25) == "Pull requested merged by") GLOB.pending_server_update = TRUE for(var/client/C in GLOB.clients) to_chat(C, "PR: [prtext]") From 147a39c061396db052561f3368303bba99f25d59 Mon Sep 17 00:00:00 2001 From: Kyep Date: Tue, 15 Sep 2020 14:58:33 -0700 Subject: [PATCH 3/5] typo fix --- code/game/world.dm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/game/world.dm b/code/game/world.dm index 4c83c1d3bd1..ef5b2bc9136 100644 --- a/code/game/world.dm +++ b/code/game/world.dm @@ -223,7 +223,7 @@ GLOBAL_VAR_INIT(world_topic_spam_protect_time, world.timeofday) return "Bad Key" else var/prtext = input["announce"] - if(copytext(prtext, 1, 25) == "Pull requested merged by") + if(copytext(prtext, 1, 23) == "Pull request merged by") GLOB.pending_server_update = TRUE for(var/client/C in GLOB.clients) to_chat(C, "PR: [prtext]") From bef1b0b3bcdbbfea96b5760888145848dcc4bebe Mon Sep 17 00:00:00 2001 From: Kyep Date: Tue, 15 Sep 2020 15:44:46 -0700 Subject: [PATCH 4/5] urlencode --- code/game/world.dm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/game/world.dm b/code/game/world.dm index ef5b2bc9136..8923b84a3f1 100644 --- a/code/game/world.dm +++ b/code/game/world.dm @@ -223,7 +223,7 @@ GLOBAL_VAR_INIT(world_topic_spam_protect_time, world.timeofday) return "Bad Key" else var/prtext = input["announce"] - if(copytext(prtext, 1, 23) == "Pull request merged by") + if(copytext(prtext, 1, 23) == "Pull+Request+merged+by") // its urlencoded GLOB.pending_server_update = TRUE for(var/client/C in GLOB.clients) to_chat(C, "PR: [prtext]") From 2e9b2fe7e35bdb43363d503c3614d2d3bd5611e4 Mon Sep 17 00:00:00 2001 From: Kyep <16434066+Kyep@users.noreply.github.com> Date: Wed, 16 Sep 2020 18:47:38 +0000 Subject: [PATCH 5/5] taking AA's suggestion Co-authored-by: AffectedArc07 <25063394+AffectedArc07@users.noreply.github.com> --- code/game/world.dm | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/code/game/world.dm b/code/game/world.dm index 8923b84a3f1..abec7a93fe0 100644 --- a/code/game/world.dm +++ b/code/game/world.dm @@ -223,7 +223,8 @@ GLOBAL_VAR_INIT(world_topic_spam_protect_time, world.timeofday) return "Bad Key" else var/prtext = input["announce"] - if(copytext(prtext, 1, 23) == "Pull+Request+merged+by") // its urlencoded + var/pr_substring = copytext(prtext, 1, 23) + if(pr_substring == "Pull Request merged by") GLOB.pending_server_update = TRUE for(var/client/C in GLOB.clients) to_chat(C, "PR: [prtext]")