From 8fa2c84140c46d61547ae215ee2b7019c062fe9a Mon Sep 17 00:00:00 2001 From: SkyratBot <59378654+SkyratBot@users.noreply.github.com> Date: Sat, 10 Jul 2021 14:12:46 +0100 Subject: [PATCH] [MIRROR] Fix some station name html encoding for plaintext handlers (#6822) * Fix some station name html encoding for plaintext handlers (#60021) * fix (double) encoding * tfw no server friends and no send2sameserver * Fix some station name html encoding for plaintext handlers Co-authored-by: Wayland-Smithy <64715958+Wayland-Smithy@users.noreply.github.com> --- code/__HELPERS/names.dm | 4 +- code/controllers/subsystem/ticker.dm | 47 ++++++++++--------- .../game/machinery/computer/communications.dm | 2 +- code/game/objects/items/charter.dm | 6 +-- 4 files changed, 30 insertions(+), 29 deletions(-) diff --git a/code/__HELPERS/names.dm b/code/__HELPERS/names.dm index ff85451dd11..9994623a5f2 100644 --- a/code/__HELPERS/names.dm +++ b/code/__HELPERS/names.dm @@ -50,9 +50,9 @@ GLOBAL_VAR(command_name) var/config_server_name = CONFIG_GET(string/servername) if(config_server_name) - world.name = "[config_server_name][config_server_name == GLOB.station_name ? "" : ": [GLOB.station_name]"]" + world.name = "[config_server_name][config_server_name == GLOB.station_name ? "" : ": [html_decode(GLOB.station_name)]"]" else - world.name = GLOB.station_name + world.name = html_decode(GLOB.station_name) /proc/new_station_name() diff --git a/code/controllers/subsystem/ticker.dm b/code/controllers/subsystem/ticker.dm index 2fe0b022b2f..ccf11c70899 100644 --- a/code/controllers/subsystem/ticker.dm +++ b/code/controllers/subsystem/ticker.dm @@ -553,54 +553,55 @@ SUBSYSTEM_DEF(ticker) /datum/controller/subsystem/ticker/proc/send_news_report() var/news_message var/news_source = "Nanotrasen News Network" + var/decoded_station_name = html_decode(station_name()) //decode station_name to avoid minor_announce double encode switch(news_report) if(NUKE_SYNDICATE_BASE) - news_message = "In a daring raid, the heroic crew of [station_name()] detonated a nuclear device in the heart of a terrorist base." + news_message = "In a daring raid, the heroic crew of [decoded_station_name] detonated a nuclear device in the heart of a terrorist base." if(STATION_DESTROYED_NUKE) - news_message = "We would like to reassure all employees that the reports of a Syndicate backed nuclear attack on [station_name()] are, in fact, a hoax. Have a secure day!" + news_message = "We would like to reassure all employees that the reports of a Syndicate backed nuclear attack on [decoded_station_name] are, in fact, a hoax. Have a secure day!" if(STATION_EVACUATED) if(emergency_reason) - news_message = "[station_name()] has been evacuated after transmitting the following distress beacon:\n\n[emergency_reason]" + news_message = "[decoded_station_name] has been evacuated after transmitting the following distress beacon:\n\n[emergency_reason]" else - news_message = "The crew of [station_name()] has been evacuated amid unconfirmed reports of enemy activity." + news_message = "The crew of [decoded_station_name] has been evacuated amid unconfirmed reports of enemy activity." if(BLOB_WIN) - news_message = "[station_name()] was overcome by an unknown biological outbreak, killing all crew on board. Don't let it happen to you! Remember, a clean work station is a safe work station." + news_message = "[decoded_station_name] was overcome by an unknown biological outbreak, killing all crew on board. Don't let it happen to you! Remember, a clean work station is a safe work station." if(BLOB_NUKE) - news_message = "[station_name()] is currently undergoing decontanimation after a controlled burst of radiation was used to remove a biological ooze. All employees were safely evacuated prior, and are enjoying a relaxing vacation." + news_message = "[decoded_station_name] is currently undergoing decontanimation after a controlled burst of radiation was used to remove a biological ooze. All employees were safely evacuated prior, and are enjoying a relaxing vacation." if(BLOB_DESTROYED) - news_message = "[station_name()] is currently undergoing decontamination procedures after the destruction of a biological hazard. As a reminder, any crew members experiencing cramps or bloating should report immediately to security for incineration." + news_message = "[decoded_station_name] is currently undergoing decontamination procedures after the destruction of a biological hazard. As a reminder, any crew members experiencing cramps or bloating should report immediately to security for incineration." if(CULT_ESCAPE) - news_message = "Security Alert: A group of religious fanatics have escaped from [station_name()]." + news_message = "Security Alert: A group of religious fanatics have escaped from [decoded_station_name]." if(CULT_FAILURE) - news_message = "Following the dismantling of a restricted cult aboard [station_name()], we would like to remind all employees that worship outside of the Chapel is strictly prohibited, and cause for termination." + news_message = "Following the dismantling of a restricted cult aboard [decoded_station_name], we would like to remind all employees that worship outside of the Chapel is strictly prohibited, and cause for termination." if(CULT_SUMMON) - news_message = "Company officials would like to clarify that [station_name()] was scheduled to be decommissioned following meteor damage earlier this year. Earlier reports of an unknowable eldritch horror were made in error." + news_message = "Company officials would like to clarify that [decoded_station_name] was scheduled to be decommissioned following meteor damage earlier this year. Earlier reports of an unknowable eldritch horror were made in error." if(NUKE_MISS) - news_message = "The Syndicate have bungled a terrorist attack [station_name()], detonating a nuclear weapon in empty space nearby." + news_message = "The Syndicate have bungled a terrorist attack [decoded_station_name], detonating a nuclear weapon in empty space nearby." if(OPERATIVES_KILLED) - news_message = "Repairs to [station_name()] are underway after an elite Syndicate death squad was wiped out by the crew." + news_message = "Repairs to [decoded_station_name] are underway after an elite Syndicate death squad was wiped out by the crew." if(OPERATIVE_SKIRMISH) - news_message = "A skirmish between security forces and Syndicate agents aboard [station_name()] ended with both sides bloodied but intact." + news_message = "A skirmish between security forces and Syndicate agents aboard [decoded_station_name] ended with both sides bloodied but intact." if(REVS_WIN) - news_message = "Company officials have reassured investors that despite a union led revolt aboard [station_name()] there will be no wage increases for workers." + news_message = "Company officials have reassured investors that despite a union led revolt aboard [decoded_station_name] there will be no wage increases for workers." if(REVS_LOSE) - news_message = "[station_name()] quickly put down a misguided attempt at mutiny. Remember, unionizing is illegal!" + news_message = "[decoded_station_name] quickly put down a misguided attempt at mutiny. Remember, unionizing is illegal!" if(WIZARD_KILLED) - news_message = "Tensions have flared with the Space Wizard Federation following the death of one of their members aboard [station_name()]." + news_message = "Tensions have flared with the Space Wizard Federation following the death of one of their members aboard [decoded_station_name]." if(STATION_NUKED) - news_message = "[station_name()] activated its self-destruct device for unknown reasons. Attempts to clone the Captain so he can be arrested and executed are underway." + news_message = "[decoded_station_name] activated its self-destruct device for unknown reasons. Attempts to clone the Captain so he can be arrested and executed are underway." if(CLOCK_SUMMON) - news_message = "The garbled messages about hailing a mouse and strange energy readings from [station_name()] have been discovered to be an ill-advised, if thorough, prank by a clown." + news_message = "The garbled messages about hailing a mouse and strange energy readings from [decoded_station_name] have been discovered to be an ill-advised, if thorough, prank by a clown." if(CLOCK_SILICONS) - news_message = "The project started by [station_name()] to upgrade their silicon units with advanced equipment have been largely successful, though they have thus far refused to release schematics in a violation of company policy." + news_message = "The project started by [decoded_station_name] to upgrade their silicon units with advanced equipment have been largely successful, though they have thus far refused to release schematics in a violation of company policy." if(CLOCK_PROSELYTIZATION) - news_message = "The burst of energy released near [station_name()] has been confirmed as merely a test of a new weapon. However, due to an unexpected mechanical error, their communications system has been knocked offline." + news_message = "The burst of energy released near [decoded_station_name] has been confirmed as merely a test of a new weapon. However, due to an unexpected mechanical error, their communications system has been knocked offline." if(SHUTTLE_HIJACK) - news_message = "During routine evacuation procedures, the emergency shuttle of [station_name()] had its navigation protocols corrupted and went off course, but was recovered shortly after." + news_message = "During routine evacuation procedures, the emergency shuttle of [decoded_station_name] had its navigation protocols corrupted and went off course, but was recovered shortly after." if(GANG_OPERATING) - news_message = "The company would like to state that any rumors of criminal organizing on board stations such as [station_name()] are falsehoods, and not to be emulated." + news_message = "The company would like to state that any rumors of criminal organizing on board stations such as [decoded_station_name] are falsehoods, and not to be emulated." if(GANG_DESTROYED) - news_message = "The crew of [station_name()] would like to thank the Spinward Stellar Coalition Police Department for quickly resolving a minor terror threat to the station." + news_message = "The crew of [decoded_station_name] would like to thank the Spinward Stellar Coalition Police Department for quickly resolving a minor terror threat to the station." //SKYRAT EDIT - START if(SSblackbox.first_death) diff --git a/code/game/machinery/computer/communications.dm b/code/game/machinery/computer/communications.dm index 6ec53ff0c43..60b49c3d811 100755 --- a/code/game/machinery/computer/communications.dm +++ b/code/game/machinery/computer/communications.dm @@ -270,7 +270,7 @@ payload["network"] = network_name payload["sender_ckey"] = usr.ckey - send2otherserver(station_name(), message, "Comms_Console", destination == "all" ? null : list(destination), additional_data = payload) + send2otherserver(html_decode(station_name()), message, "Comms_Console", destination == "all" ? null : list(destination), additional_data = payload) minor_announce(message, title = "Outgoing message to allied station") usr.log_talk(message, LOG_SAY, tag = "message to the other server") message_admins("[ADMIN_LOOKUPFLW(usr)] has sent a message to the other server\[s].") diff --git a/code/game/objects/items/charter.dm b/code/game/objects/items/charter.dm index a621d1a9c0d..3d0e83a3420 100644 --- a/code/game/objects/items/charter.dm +++ b/code/game/objects/items/charter.dm @@ -83,7 +83,7 @@ /obj/item/station_charter/proc/rename_station(designation, uname, ureal_name, ukey) set_station_name(designation) - minor_announce("[ureal_name] has designated your station as [station_name()]", "Captain's Charter", 0) + minor_announce("[ureal_name] has designated your station as [html_decode(station_name())]", "Captain's Charter") //decode station_name to avoid minor_announce double encode log_game("[ukey] has renamed the station as [station_name()].") name = "station charter for [station_name()]" @@ -112,7 +112,7 @@ /obj/item/station_charter/banner/rename_station(designation, uname, ureal_name, ukey) set_station_name(designation) - minor_announce("[ureal_name] has designated the [name_type] as [station_name()]", "Captain's Banner", 0) + minor_announce("[ureal_name] has designated the [name_type] as [html_decode(station_name())]", "Captain's Banner") //decode station_name to avoid minor_announce double encode log_game("[ukey] has renamed the [name_type] as [station_name()].") name = "banner of [station_name()]" desc = "The banner bears the official coat of arms of Nanotrasen, signifying that [station_name()] has been claimed by Captain [uname] in the name of the company." @@ -148,7 +148,7 @@ /obj/item/station_charter/revolution/rename_station(designation, uname, ureal_name, ukey) set_station_name(designation) - minor_announce("Head Revolutionary [ureal_name] has declared the station's new name as [station_name()]!", "Revolution Banner", 0) + minor_announce("Head Revolutionary [ureal_name] has declared the station's new name as [html_decode(station_name())]!", "Revolution Banner") //decode station_name to avoid minor_announce double encode log_game("[ukey] has renamed the station as [station_name()].") name = "banner of [station_name()]" desc = "A banner symbolizing a bloody victory over treacherous tyrants. The revolutionary leader [uname] has named the station [station_name()] to make clear that this station shall never be shackled by oppressors again."