playroom icon indicating copy to clipboard operation
playroom copied to clipboard

URL Shortening

Open bryanberger opened this issue 5 years ago • 4 comments

Putting this here as i'll probably implement this, but, It would be nice to have an ability to copy a shortURL (instead of base64 links) for pasting in Slack/etc.

I was pairing with another dev the other day and we passed 4-5 links back and forth taking over our slack convo with huge link blocks. (I ended up just using bit.ly, but it would be nice if I could copy a short-link right from the playroom)

bryanberger avatar Sep 16 '19 14:09 bryanberger

We have the same experience. This would need to be configurable in a way, for private installs of playroom that can't rely on external third party services for the short urls. Probably "just" a button that can post to an API and get the short url back, copy it to clipboard :woman_shrugging: ?

pascalduez avatar Sep 16 '19 17:09 pascalduez

It may be possible to do some compression clientside using a fancy algorithm. The one I've linked is used by itty.bitty

tom-sherman avatar Mar 05 '20 14:03 tom-sherman

@tom-sherman We already do client side compression using lz-string.

mattcompiles avatar Mar 05 '20 22:03 mattcompiles

I added a new config option and modified Playroom.js:

{
  shortlinkComponent: './ShortlinkComponent.js'
  ...
}

onClick in the ShortlinkComponent I fetch bit.ly, passing the base64 url using their api and then copy-to-clipboard the result. You could of course use any service you'd like.

main_full

seems good, i'll fix up a PR

bryanberger avatar Mar 09 '20 14:03 bryanberger