Skip to content

Commit

Permalink
fix(state_share): new method to include credentials for state sharing (
Browse files Browse the repository at this point in the history
…#500)

* fix(state_share): new method to include credentials for state sharing due to chrome introducing restrictions on setting protocols using the URL API

* cleaned up state url credential fix code
  • Loading branch information
chrisj authored Nov 18, 2023
1 parent 4717511 commit ada384e
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/neuroglancer/datasource/state_share.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,9 @@ export class StateShare extends RefCounted { // call it a widget? no because it
body: JSON.stringify(viewer.state.toJSON())
}, responseJson)
.then((res) => {
const stateUrl = new URL(res);
stateUrl.protocol = protocol; // copy protocol in case it contains authentication type
const link = `${window.location.origin}/#!${stateUrl}`;
const stateUrlProtcol = new URL(res).protocol;
const stateUrlWithoutProtocol = res.substring(stateUrlProtcol.length);
const link = `${window.location.origin}/#!${protocol}${stateUrlWithoutProtocol}`;
navigator.clipboard.writeText(link).then(() => {
StatusMessage.showTemporaryMessage('Share link copied to clipboard');
});
Expand Down

0 comments on commit ada384e

Please sign in to comment.