From cd710f97d66aac28d1f6e4340b199176c44db6d3 Mon Sep 17 00:00:00 2001 From: Theodore Abshire Date: Sat, 19 Aug 2023 01:21:05 -0700 Subject: [PATCH] feat(demo): Improve bug report button in demo This updates the bug template for the bug report button in the demo, to be closer to the current bug template. It also adds the bug label, and makes it fill out the URIs of the asset playing in a more readable way. Fixes #5056 --- demo/autoTemplate.txt | 45 +++++++++++++++++++++++++++++++++++++----- demo/customWarning.txt | 4 ++-- demo/main.js | 38 ++++++++++++++++++++++++++++++----- 3 files changed, 75 insertions(+), 12 deletions(-) diff --git a/demo/autoTemplate.txt b/demo/autoTemplate.txt index 6efd1f61c9..dbea725f08 100644 --- a/demo/autoTemplate.txt +++ b/demo/autoTemplate.txt @@ -1,17 +1,52 @@ -RE:customwarning **Have you read the [FAQ](https://bit.ly/ShakaFAQ) and checked for duplicate open issues?** -**What link can we use to reproduce this?** -RE:link +**If the problem is related to FairPlay, have you read the tutorial?** + **What version of Shaka Player are you using?** -RE:player +`RE:player` + + + +**Can you reproduce the issue with our latest release version?** + + +**Can you reproduce the issue with the latest code from `main`?** + + +**Are you using the demo app or your own custom app?** +The demo + + +**If custom app, can you reproduce the issue using our demo app?** +N/A **What browser and OS are you using?** -RE:browser +`RE:browser` + + +**For embedded devices (smart TVs, etc.), what model and firmware version are you using?** +N/A + + +**What are the manifest and license server URIs?** +RE:customwarning +RE:uris + + +**What configuration are you using? What is the output of `player.getConfiguration()`?** + **What did you do?** diff --git a/demo/customWarning.txt b/demo/customWarning.txt index 34c99ffef1..c38cab341d 100644 --- a/demo/customWarning.txt +++ b/demo/customWarning.txt @@ -2,7 +2,7 @@ Note: This auto-filled issue template contains the manifest and license server of the asset you were playing at the time you pressed the bug report button. We have detected that you were playing a custom asset. -If this asset's URL is confidential, you might instead want to fill out an issue -template manually: +If this asset's URL is confidential, you might instead want to censor this or +fill out an issue template manually: https://github.com/shaka-project/shaka-player/issues/new/choose --> diff --git a/demo/main.js b/demo/main.js index 0464052d38..abe7142531 100644 --- a/demo/main.js +++ b/demo/main.js @@ -296,7 +296,32 @@ shakaDemo.Main = class { text = text.replace(replaceString, value); }; fillInTemplate('RE:player', shaka.Player.version); - fillInTemplate('RE:link', window.location.href); + if (this.selectedAsset) { + const uriLines = []; + const addLine = (key, value) => { + uriLines.push(key + '= `' + value + '`'); + }; + addLine('uri', this.selectedAsset.manifestUri); + if (this.selectedAsset.adTagUri) { + addLine('ad tag uri', this.selectedAsset.adTagUri); + } + if (this.selectedAsset.licenseServers.size) { + const uri = this.selectedAsset.licenseServers.values().next().value; + addLine('license server', uri); + for (const drmSystem of this.selectedAsset.licenseServers.keys()) { + if (!shakaDemo.Main.commonDrmSystems.includes(drmSystem)) { + addLine('drm system', drmSystem); + break; + } + } + } + if (this.selectedAsset.certificateUri) { + addLine('certificate', this.selectedAsset.certificateUri); + } + fillInTemplate('RE:uris', uriLines.join('\n')); + } else { + fillInTemplate('RE:uris', 'No asset'); + } fillInTemplate('RE:browser', navigator.userAgent); if (this.selectedAsset && this.selectedAsset.source == shakaAssets.Source.CUSTOM) { @@ -308,11 +333,14 @@ shakaDemo.Main = class { fillInTemplate('RE:customwarning\n', ''); } + const urlTerms = []; + urlTerms.push('labels=type%3A+bug'); + urlTerms.push('body=' + encodeURIComponent(text)); + const url = 'https://github.com/shaka-project/shaka-player/issues/new?' + + urlTerms.join('&'); + // Navigate to the github issue opening interface, with the - // partially-filled template as a preset body. - let url = 'https://github.com/shaka-project/shaka-player/issues/new?'; - url += 'body=' + encodeURIComponent(text); - // Open in another tab. + // partially-filled template as a preset body, opening in another tab. window.open(url, '_blank'); }