Skip to content

Commit

Permalink
feat(demo): Improve bug report button in demo (shaka-project#5510)
Browse files Browse the repository at this point in the history
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 shaka-project#5056
  • Loading branch information
theodab authored and Rodolphe Breton committed Nov 30, 2023
1 parent e83c16b commit 78c264a
Show file tree
Hide file tree
Showing 3 changed files with 75 additions and 12 deletions.
45 changes: 40 additions & 5 deletions demo/autoTemplate.txt
Original file line number Diff line number Diff line change
@@ -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?**
<!-- NOTE: https://shaka-player-demo.appspot.com/docs/api/tutorial-fairplay.html -->


**What version of Shaka Player are you using?**
RE:player
`RE:player`
<!-- NOTE:
Only some versions of the application are maintained, if your version
is older, first update to a newer one. See:
https://github.com/shaka-project/shaka-player/blob/main/maintained-branches.md
--->


**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()`?**
<!-- NOTE:
You can censor URLs to keep them private, but include them in the email. You
can also use JSON.stringify(obj, null, 2) to print nicely on platforms that
don't print objects well in the console. DON'T SEND '[object Object]'!
-->


**What did you do?**
Expand Down
4 changes: 2 additions & 2 deletions demo/customWarning.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
-->
38 changes: 33 additions & 5 deletions demo/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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');
}

Expand Down

0 comments on commit 78c264a

Please sign in to comment.