Chrome/Firefox extension "Share to discourse"

this is a challenging subject… how can i get useful links onto discourse at the press of a button.

I suppose the logic can’t be far different from a “Post to Discourse” button in iOS Share sheet.

This could be programmed as follows;

  • Receive input from Share Sheet, the button on Share Sheet will be name of the Shortcut
  • Get text from Shortcut input
  • Text ook (part of the word Look as in “Look what i found on”)
  • Text I (as in “I found”)
  • Text Source: (as in saying where the URL is from)
  • Text heck (part of the word Check as in “Check out what i found”)
  • If any of above text is the input text
  • Replace Source: with just want a link
  • Get URLs from that
  • Get host
  • Get path
  • Get query
  • Encode host, path, ?, them query, as URL
  • Text https://yourdomain.co.uk/new-topic?title=Shared%20from%20iOS&body=https://[encoded URL]
  • Open that Text in Safari

Otherwise

  • If the shortcut input text contains g.co
  • Match https?://(.*) in Text
  • Get group at index 1 in matches
  • Text https://yourdomain.co.uk/new-topic?title=Shared%20from%20iOS&body=https://[the text]
  • Open that Text in Safari

Otherwise

  • If shortcut input text contains youtube
  • get host
  • get path
  • get query
  • encode
  • text of the forum url
  • open in safari

Otherwise

  • text is just text
  • just let the body be the text

:rofl:

1 Like