Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(demo): Improve bug report button in demo #5510

Merged
merged 1 commit into from
Aug 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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:
Copy link
Contributor Author

@theodab theodab Aug 19, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried to add code to automatically fill this out, like some of the other parameters here.
However, the github API has a length limit, and that made the request too long.

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