Skip to content

Commit

Permalink
Test for secure context
Browse files Browse the repository at this point in the history
  • Loading branch information
panaaj committed Oct 5, 2024
1 parent 0988859 commit 32c241a
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/app/app.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -851,7 +851,7 @@
<li>Click and drag to move anchor.</li>
} @if(draw.forSave.id !== 'anchor') {
<li>Click and drag to move point.</li>
<li>Ctrl-Click or Right click to remove point from line.</li>
<li>Ctrl-Click or Tap-hold to remove point from line.</li>
}
</ol>
</div>
Expand Down
21 changes: 14 additions & 7 deletions src/app/app.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -452,13 +452,20 @@ export class AppComponent {
public openExperiment(e: { choice: string; value?: any }) {
switch (e.choice) {
case 'debugCapture':
navigator.clipboard.writeText(
JSON.stringify({
data: this.app.data,
config: this.app.config
})
);
this.app.showMessage('Debug data catpured to clipboard.');
if (window.isSecureContext) {
navigator.clipboard.writeText(
JSON.stringify({
data: this.app.data,
config: this.app.config
})
);
this.app.showMessage('Debug data catpured to clipboard.');
} else {
this.app.showAlert(
'Feature Unavailable',
'This feature is only available in a secure context!\n e.g. https, http://localhost, http://127.0.0.1'
);
}
break;
case 'tracks': // tracks
this.bottomSheet
Expand Down

0 comments on commit 32c241a

Please sign in to comment.