Skip to content

amydevs/rxgithub

Repository files navigation

rxgithub (RustyFixGithub)

Embed Code Snippets, Images, Gifs, Videos, Gists, & more on Discord, Slack, Telegram, Twitter, etc.

image

Usage

You can either:

  • Add rx before your github.com link to make it rxgithub.com, OR
  • Intall the bookmarklet it by highlighting the contents of the above code block, and then dragging it to your bookmark toolbar. Clicking on the bookmarklet will copy the rxgithub enabled URL to your clipboard. (source)
javascript:(function()%7Bconst%20githubUrl%20%3D%20%22https%3A%2F%2Fgithub.com%22%3B%0Aif%20(window.location.href.startsWith(githubUrl))%20%7B%0A%20%20%20%20const%20rxGithubUrl%20%3D%20%22https%3A%2F%2Frxgithub.com%22%20%2B%20window.location.href.substring(githubUrl.length)%3B%0A%20%20%20%20navigator.clipboard.writeText(rxGithubUrl)%3B%0A%7D%7D)()%3B

Embed Gists

image

Embed SVGs

image

Embed Images

image

Embed Videos

image image

How Does it Work?

When a request hits an rxgithub.com URL, the user-agent is matched against a list of well-known bot user-agents. If the request appears to be from a bot, an HTML webpage is shown with all the required <meta> tags for Open-Graph compatibility. Otherwise, browser users are redirected to the original GitHub URL.

A HEAD request is made to the associated raw.githubusercontent.com URL to determine the Content-Type and it shows the appropriate <meta> tags for the content.

If the content is either code or an SVG, the server generates an image on the fly to serve to the open-graph crawler.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published