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

Fixes xenos seeing raw html on paper #5329

Merged
merged 19 commits into from Dec 31, 2023
Merged

Fixes xenos seeing raw html on paper #5329

merged 19 commits into from Dec 31, 2023

Conversation

ghost
Copy link

@ghost ghost commented Dec 28, 2023

About the pull request

Continuation of #4654 , to fix #4609 . This fix should make it so that when xenos examine paper it no longer displays a blank page and the raw html was replaced with the formatted scrambled message.

Explain why it's good for the game

raw html is rather ugly

johnwick.mp4

Changelog

🆑
fix: fixes xenos being able to view raw html on paper.
/:cl:

@github-actions github-actions bot added the Fix Fix one bug, make ten more label Dec 28, 2023
@ghost ghost marked this pull request as draft December 28, 2023 22:22
@ghost
Copy link
Author

ghost commented Dec 28, 2023

For parity or anyone too lazy to view the comments on the old pr, they are as follows:

You also need to check for quotation marks inside of HTML tags. Consider a tag such as . So when you are inside an HTML tag and run into a quotation mark (either single ' or double "), then you advance until you find the matching quotation mark. Perhaps you could add a couple booleans for this, e.g. need_single_quote and need_double_quote.
Maybe it would be a bit overkill but it's probably good to be safe.

Carefully-crafted user input would make this replace text inside of HTML tags. This should be reworked to be a bit more similar to how /proc/stars works, where the final message is being appended to in the original for loop. In this case, you could be appending scrambled_string from the loop before to a variable representing the final output. I suspect that would also be better performance-wise compared to repeatedly searching through the whole text for replacements.
Your current code also means that duplicates of unscrambled_message_key would get the same star text, while doing it iteratively would preserve the original behavior of not duplicating star text instances.

@ghost ghost marked this pull request as ready for review December 29, 2023 06:02
Copy link
Contributor

@Drulikar Drulikar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At the moment this works, though it would be nice for at least the <style> block to not get scrambled:

image

Instead of:

image

(Normal view:)
image

If you would like to try or adapt my experiment supporting this, git apply this patch:
patch.diff.txt

Test procedure:

  1. Load USS Runtime
  2. Spawn "faxmachine
  3. Send a blank fax
  4. Admin reply to it with custom message w/ HTML
  5. Inspect reply with a xeno

code/modules/mob/mob_helpers.dm Outdated Show resolved Hide resolved
code/modules/mob/mob_helpers.dm Outdated Show resolved Hide resolved
code/modules/mob/mob_helpers.dm Outdated Show resolved Hide resolved
code/modules/paperwork/paper.dm Outdated Show resolved Hide resolved
code/modules/mob/mob_helpers.dm Show resolved Hide resolved
code/modules/mob/mob_helpers.dm Outdated Show resolved Hide resolved
@Drulikar Drulikar added this pull request to the merge queue Dec 31, 2023
Merged via the queue into cmss13-devs:master with commit 686984d Dec 31, 2023
26 checks passed
cm13-github added a commit that referenced this pull request Dec 31, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Fix Fix one bug, make ten more
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Xenos can see raw HTML tags on papers
1 participant