Skip to content

Commit

Permalink
cleaned up state url credential fix code
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisj committed Nov 8, 2023
1 parent d5a389a commit 950a744
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/neuroglancer/datasource/state_share.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +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);
const stateUrlWithoutProtocol = stateUrl.toString().split(stateUrl.protocol)[1];
const stateUrlWithCredentialsProtocol = `${protocol}${stateUrlWithoutProtocol}`;
const link = `${window.location.origin}/#!${stateUrlWithCredentialsProtocol}`;
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 950a744

Please sign in to comment.