Skip to content

Commit

Permalink
Merge pull request #1093 from xhianil/E621-images
Browse files Browse the repository at this point in the history
E621 images
  • Loading branch information
MosleyTheMalO authored Mar 2, 2024
2 parents 2508f28 + b3890bc commit b07d12e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions code/datums/elements/flavor_text.dm
Original file line number Diff line number Diff line change
Expand Up @@ -172,11 +172,11 @@ GLOBAL_LIST_EMPTY(mobs_with_editable_flavor_text) //et tu, hacky code
return

// Validate the headshot URL
var/static/link_regex = regex("https://i\\.gyazo\\.com|https://media\\.discordapp\\.net|https://cdn\\.discordapp\\.com|https://media\\.discordapp\\.net$")
var/static/link_regex = regex("https://i\\.gyazo\\.com|https://media\\.discordapp\\.net|https://cdn\\.discordapp\\.com|https://media\\.discordapp\\.net$|https://static1\\.e621\\.net")
var/static/end_regex = regex("\\.jpg|\\.png|\\.jpeg$")

if(!findtext(new_headshot, link_regex))
to_chat(src, span_warning("The link needs to be an unshortened Gyazo or Discordapp link!"))
to_chat(src, span_warning("The link needs to be an unshortened Gyazo, E621, or Discordapp link!"))
return
if(!findtext(new_headshot, end_regex))
to_chat(src, span_warning("You need either \".png\", \".jpg\", or \".jpeg\" in the link!"))
Expand Down
4 changes: 2 additions & 2 deletions code/modules/client/preferences.dm
Original file line number Diff line number Diff line change
Expand Up @@ -3996,11 +3996,11 @@ GLOBAL_LIST_EMPTY(preferences_datums)
features["headshot_link"] = null
return

var/static/link_regex = regex("https://i.gyazo.com|https://media.discordapp.net|https://cdn.discordapp.com|https://media.discordapp.net$") //Do not touch the damn duplicates.
var/static/link_regex = regex("https://i.gyazo.com|https://media.discordapp.net|https://cdn.discordapp.com|https://media.discordapp.net$|https://static1.e621.net") //Do not touch the damn duplicates.
var/static/end_regex = regex(".jpg|.jpg|.png|.jpeg|.jpeg") //Regex is terrible, don't touch the duplicate extensions

if(!findtext(usr_input, link_regex, 1, 29))
to_chat(usr, span_warning("The link needs to be an unshortened Gyazo or Discordapp link!"))
to_chat(usr, span_warning("The link needs to be an unshortened Gyazo, E621, or Discordapp link!"))
return
if(!findtext(usr_input, end_regex, -8))
to_chat(usr, span_warning("You need either \".png\", \".jpg\", or \".jpeg\" in the link!"))
Expand Down

0 comments on commit b07d12e

Please sign in to comment.