Skip to content

Conversation

RussTorres
Copy link

Using the "Share" button to post to a state server on an http deployment on most browsers will send the correct request, but quietly fail copying the link to the clipboard because the navigator requires a secure context.

In this commit I introduce a function that replicates the original behavior in the secure context, while providing a workaround when the original method would fail. I also modify the returned link to include the pathname, which I believe was leading to incompatible copied links when being serving on a subpath.

It's not uncommon to want to stand up http versions of neuroglancer to talk to custom state servers or view local http data sources -- I think this makes deployment easier for those cases and hopefully eliminates some confusion -- let me know what you think.

Thanks!
Russel

@fcollman
Copy link
Contributor

fcollman commented Jun 7, 2025

You might want to resolve this with #789

@jbms
Copy link
Collaborator

jbms commented Jul 28, 2025

Thanks for looking into this. There is an existing method in src/util/clipboard.ts --- does that solve this problem?

@RussTorres
Copy link
Author

Thanks @jbms it looks like setClipboard does solve the copying problem -- I didn't realize this was already implemented.
Adding a commit using that. It still looks like the pathname addition to link is a required addition on some deployments.

@jbms
Copy link
Collaborator

jbms commented Jul 29, 2025

Please fix the lint error. Thanks

@jbms
Copy link
Collaborator

jbms commented Jul 30, 2025

there are still formatting issues --- note that you can run those tests locally to speed up iteration

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants