stellar / laboratory

82 stars 95 forks source link

Forward old laboratory links to `old-lab.stellar.org` using the frontend redirect #967

Open janewang opened 3 weeks ago

janewang commented 3 weeks ago

What problem does your feature solve?

Some users have old links that don't load anymore.

What would you like to see?

Check if the URL has a hash and change the URL to https://old-lab.stellar.org/...#.....

What alternatives are there?

leighmcculloch commented 3 weeks ago

For example, links like this which someone sent to me just before the migration, and then I clicked just after the migration, don't load: https://laboratory.stellar.org/#explorer?resource=accounts&endpoint=single&values=eyJhY2NvdW50X2lkIjoiR0FBWkk0VENSM1RZNU9KSENUSkMyQTRRU1k2Q0pXSkg1SUFKVEdLSU4yRVI3TEJOVktPQ0NXTjcifQ%3D%3D&network=public

I think it'd be better developer experience if we could identify these old lab URLs in new lab, and redirect instead to the appropriate new lab URL.

quietbits commented 3 weeks ago

@leighmcculloch We would need to manually map old URLs to new ones, which would be a lot of work. The old Lab doesn't have routes (everything is set in params), and the state structure is also different. It's probably not worth the effort.

leighmcculloch commented 3 weeks ago

@leighmcculloch We would need to manually map old URLs to new ones, which would be a lot of work. The old Lab doesn't have routes (everything is set in params), and the state structure is also different. It's probably not worth the effort.

I ran into this problem because someone had posted a link to an old-lab url with fields already filled out, but I couldn't use it any longer because the link was now broken. I doubt I'm the only case where this will happen, but maybe. I defer to @janewang on priorities if this is a costly piece of work, but at the very least if we needed a simple solution we could do as @janewang proposed above and redirect them to old-lab.

janewang commented 3 weeks ago

@mwtzzz has been looking for a solution with Cloudflare then k8s ingress today. Assigning to him

leighmcculloch commented 3 weeks ago

The old Lab doesn't have routes (everything is set in params)

The old Lab urls have everything set in the fragment, the part after the #. Browsers don't send the fragment to the server, so unless we're using Cloudflare or k8s to inject JavaScript to handle the redirect, I don't think those tools are a great fit. This likely needs to be frontend code that identifies the presence of the old fragment format and redirects using JavaScript.

(And it'll need to do that without redirecting on valid uses of fragments in the new lab.)

mwtzzz commented 3 weeks ago

I was unable to do this in Cloudflare or k8s, so bunting back to Jane so she can implement Leigh's solution.

mwtzzz commented 3 weeks ago

Confirming again, after having looked into it more, it is not possible in k8s. The only way we could have done it is with server-snippets which we have disabled because of security reasons. So, there's no way for us to do it in Cloudflare or K8s.

You guys have a choice: a) accept the current behavior, or b) remove the redirect from laboratory and handle all such redirects in front-end code.