community-plugins icon indicating copy to clipboard operation
community-plugins copied to clipboard

πŸ”Œ Plugin: url-shortener

Open MarAvFe opened this issue 2 years ago β€’ 11 comments

πŸ”– Summary

A URL-shortener which you enable a path to detect. You go to localhost:8080/short/ABC123 and backstage retrieves that the ABC123 url exists and redirects the browser to localhost:8080/my/full/path/and/likely/long/link

🌐 Project website (if applicable)

It could be implemented with https://github.com/ai/nanoid

✌️ Context

Whenever a new entity is registered, a short URL can be generated and stored in DB as a key-value format. Then in the router component you add a prefix path like /short where the rest of the path will be matched to a long link in the db.

Optionally, you can generate these short links only on demand on the entity page; adding a button to Generate short URL which stores the reference and returns the short url.

πŸ‘€ Have you spent some time to check if this plugin request has been raised before?

  • [X] I checked and didn't find similar issue

🏒 Have you read the Code of Conduct?

Are you willing to submit PR?

Yes I am willing to submit a PR!

MarAvFe avatar May 25 '23 04:05 MarAvFe

Sounds good! is this something that you want to contribute? :pray:

benjdlambert avatar May 25 '23 08:05 benjdlambert

I am, yes! For what I've checked, I'm planning on a front and backend parts.

Frontend would be a list with all the created short links and a few statistics like the total, and the top 10 recently used. Or it could simply be that "Create" button on the software catalog, kind of how badges plugin works.

Backend would be:

  • a url to create and retrieve a new short URL, that stores the map to the DB
  • a url to actually retrieve the long URL of a specific map
  • a url to retrieve the mentioned statistics for the front component. I'm unsure if this last part provides value of if it's making the scope too much complex

MarAvFe avatar May 25 '23 11:05 MarAvFe

Sounds good! I will assign you to the ticket! πŸ‘

benjdlambert avatar May 26 '23 09:05 benjdlambert

I have worked on it a little. Please checkout https://github.com/shailahir/backstage-plugin-shorturl and https://github.com/shailahir/backstage-plugin-shorturl-backend @MarAvFe @benjdlambert

shailahir avatar Jun 29 '23 18:06 shailahir

transferring to the community plugins repo

freben avatar Apr 23 '24 14:04 freben

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

github-actions[bot] avatar Aug 31 '24 12:08 github-actions[bot]

any chance we can get this opened back up? This is a cool plugin idea.

billabongrob avatar Sep 12 '24 20:09 billabongrob

Yes! I had forgotten this. By the time I opened it, the task exceeded my backstage knowledge and I couldn't work on it. But I recently did my first collab to backstage and understand the contributing guides.

I was looking at it and @shailahir's code is mostly done! It might only be a matter of creating PR for front and backend.

I'll just add some optional config tweaks and submit the PR.

MarAvFe avatar Sep 12 '24 23:09 MarAvFe

I was thinking this at one point to add as a tool to https://github.com/drodil/backstage-plugin-toolbox .. Maybe I will at some point now that I have good reference implementation πŸ˜…

drodil avatar Sep 13 '24 17:09 drodil

I'd advise against that to keep the DB isolated. For a big team, if your shortlink is lost once, you lose trust in the library. And your references are immediately outdated.

Actually, this prompted me an idea. To have a frontend module with a "error redirecting" screen where you can error handle that case and lead the user for support.

avila-m-6 avatar Sep 13 '24 22:09 avila-m-6

One other consideration while we’re all excited about this would be associating a user/group as a β€œresponsible” party for the record. Could allow for modification/deletion permissions down the line.

billabongrob avatar Sep 13 '24 22:09 billabongrob

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

github-actions[bot] avatar Nov 13 '24 00:11 github-actions[bot]