shlinkio / shlink-web-client

A React-based client application for Shlink
https://app.shlink.io
MIT License
299 stars 80 forks source link

Ability to deep-link when the client is shared #1360

Closed piotrdomagalski closed 1 week ago

piotrdomagalski commented 2 weeks ago

Summary

Currently, it looks like the server UUID is generated client-side. In environment we have, where the Web Client is shared and comes pre-configured with environment variables, every user gets their own server UUID. This makes it impossible to deep-link (e.g. as a 404 redirection) to the "Create short URL" and other pages.

It would be great if the UUID could either be set externally via environment variable, or a URL route would be added where in addition to using the server UUID, the domain (base URL) would also be accepted.

Use case

It makes it possible to share deep links to various subpages in the app.

acelaya commented 2 weeks ago

This was requested some time ago https://github.com/shlinkio/shlink-web-client/issues/435, and the author even gave it a go to a possible implementation https://github.com/shlinkio/shlink-web-client/pull/437

However, the particular implementation was a bit too complex from my point of view. Since the person requesting the feature lost interest, the feature request was also closed.

But I think this is something useful to have and there should be a simpler way to achieve it, either by allowing to provide unique server slugs, or by trying to calculate them in a way that produces consistent results.

acelaya commented 1 week ago

This feature is now implemented, and will be released with shlink-web-client 4.3

Starting with that version, servers will not be created with a random ID. Instead, a unique slug will be calculated from the server name and url.

For example, for a server with name Server name and url https://examplre.com/foo/bar, the ID will be server-name-example.com-foo-bar.

In case of ID collision, Shlink will append an autoincremental number to make sure IDs are unique.

This is something that should not happen when setting a single initial server via env vars, but could happen when defining a multi-server servers.json file, when importing servers, or when manually creating a new server on an instance where other servers already exist.