viebel / klipse

Klipse is a JavaScript plugin for embedding interactive code snippets in tech blogs.
http://blog.klipse.tech/
GNU General Public License v3.0
3.1k stars 153 forks source link

Add link shortening #387

Closed jayhoogle closed 3 years ago

jayhoogle commented 3 years ago

Closes #130

Uses the Cutt.ly API to generate a short link when the user hits Ctrl+S. If there's an issue generating the short link, the current URL is returned instead.

Checking with the Cutt.ly team to see if localhost can be added as an accepted origin as those URLs currently fail to convert to a short link, and also to see if URL generation can be limited to the origins localhost and app.klipse.tech.

jayhoogle commented 3 years ago

@viebel here's the PR for my implementation of a link shortener. If you'd prefer a system that doesn't require a key, there is also the is.gd API which would provide much the same functionality but with a little less code, but still no ability to convert localhost URLs to short links.

jayhoogle commented 3 years ago

@viebel I haven't heard from Cutt.ly so I've reverted to using is.gd so the code is cleaner and a little faster to run, too. Also means there are no API keys in the code. Let me know whether you're happy for this to merge.

viebel commented 3 years ago

@jayhoogle Sounds good. Will review it soon

jayhoogle commented 3 years ago

@viebel great, thanks!

viebel commented 3 years ago

@jayhoogle The link shortening feature only makes sense in the Klipse web app. Please submit a PR to Klipse app repo.

jayhoogle commented 3 years ago

Closing in favour of this.