web: Add query string to `Report Bug` link
* web: Add query string to the Report Bug link (closes #1753)
This commit is contained in:
parent
c4d7b24629
commit
63be0455a8
|
@ -91,6 +91,7 @@ export class RufflePlayer extends HTMLElement {
|
||||||
private playButton: HTMLElement;
|
private playButton: HTMLElement;
|
||||||
private unmuteOverlay: HTMLElement;
|
private unmuteOverlay: HTMLElement;
|
||||||
private rightClickMenu: HTMLElement;
|
private rightClickMenu: HTMLElement;
|
||||||
|
private swfUrl?: string;
|
||||||
private instance: Ruffle | null;
|
private instance: Ruffle | null;
|
||||||
private _trace_observer: ((message: string) => void) | null;
|
private _trace_observer: ((message: string) => void) | null;
|
||||||
|
|
||||||
|
@ -409,6 +410,14 @@ export class RufflePlayer extends HTMLElement {
|
||||||
|
|
||||||
if ("url" in options) {
|
if ("url" in options) {
|
||||||
console.log("Loading SWF file " + options.url);
|
console.log("Loading SWF file " + options.url);
|
||||||
|
try {
|
||||||
|
this.swfUrl = new URL(
|
||||||
|
options.url,
|
||||||
|
document.location.href
|
||||||
|
).href;
|
||||||
|
} catch {
|
||||||
|
this.swfUrl = options.url;
|
||||||
|
}
|
||||||
|
|
||||||
const parameters = {
|
const parameters = {
|
||||||
...sanitizeParameters(
|
...sanitizeParameters(
|
||||||
|
@ -712,25 +721,6 @@ export class RufflePlayer extends HTMLElement {
|
||||||
}
|
}
|
||||||
this.panicked = true;
|
this.panicked = true;
|
||||||
|
|
||||||
// Clears out any existing content (ie play button or canvas) and replaces it with the error screen
|
|
||||||
this.container.innerHTML = `
|
|
||||||
<div id="panic">
|
|
||||||
<div id="panic-title">Something went wrong :(</div>
|
|
||||||
<div id="panic-body">
|
|
||||||
<p>Ruffle has encountered a major issue whilst trying to display this Flash content.</p>
|
|
||||||
<p>This isn't supposed to happen, so we'd really appreciate if you could file a bug!</p>
|
|
||||||
</div>
|
|
||||||
<div id="panic-footer">
|
|
||||||
<ul>
|
|
||||||
<li><a href="https://github.com/ruffle-rs/ruffle/issues/new">Report Bug</a></li>
|
|
||||||
<li><a href="#" id="panic-view-details">View Error Details</a></li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
`;
|
|
||||||
(<HTMLLinkElement>(
|
|
||||||
this.container.querySelector("#panic-view-details")
|
|
||||||
)).onclick = () => {
|
|
||||||
let errorText = "# Error Info\n";
|
let errorText = "# Error Info\n";
|
||||||
|
|
||||||
if (error instanceof Error) {
|
if (error instanceof Error) {
|
||||||
|
@ -748,6 +738,7 @@ export class RufflePlayer extends HTMLElement {
|
||||||
|
|
||||||
errorText += "\n# Page Info\n";
|
errorText += "\n# Page Info\n";
|
||||||
errorText += `Page URL: ${document.location.href}\n`;
|
errorText += `Page URL: ${document.location.href}\n`;
|
||||||
|
if (this.swfUrl) errorText += `SWF URL: ${this.swfUrl}\n`;
|
||||||
|
|
||||||
errorText += "\n# Browser Info\n";
|
errorText += "\n# Browser Info\n";
|
||||||
errorText += `Useragent: ${window.navigator.userAgent}\n`;
|
errorText += `Useragent: ${window.navigator.userAgent}\n`;
|
||||||
|
@ -760,6 +751,32 @@ export class RufflePlayer extends HTMLElement {
|
||||||
errorText += `Built: %BUILD_DATE%\n`;
|
errorText += `Built: %BUILD_DATE%\n`;
|
||||||
errorText += `Commit: %COMMIT_HASH%\n`;
|
errorText += `Commit: %COMMIT_HASH%\n`;
|
||||||
|
|
||||||
|
const issueTitle = `Ruffle Error on ${document.location.href}`;
|
||||||
|
const issueLink =
|
||||||
|
"https://github.com/ruffle-rs/ruffle/issues/new?title=" +
|
||||||
|
encodeURIComponent(issueTitle) +
|
||||||
|
"&body=" +
|
||||||
|
encodeURIComponent(errorText);
|
||||||
|
|
||||||
|
// Clears out any existing content (ie play button or canvas) and replaces it with the error screen
|
||||||
|
this.container.innerHTML = `
|
||||||
|
<div id="panic">
|
||||||
|
<div id="panic-title">Something went wrong :(</div>
|
||||||
|
<div id="panic-body">
|
||||||
|
<p>Ruffle has encountered a major issue whilst trying to display this Flash content.</p>
|
||||||
|
<p>This isn't supposed to happen, so we'd really appreciate if you could file a bug!</p>
|
||||||
|
</div>
|
||||||
|
<div id="panic-footer">
|
||||||
|
<ul>
|
||||||
|
<li><a href=${issueLink}>Report Bug</a></li>
|
||||||
|
<li><a href="#" id="panic-view-details">View Error Details</a></li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
`;
|
||||||
|
(<HTMLLinkElement>(
|
||||||
|
this.container.querySelector("#panic-view-details")
|
||||||
|
)).onclick = () => {
|
||||||
this.container.querySelector(
|
this.container.querySelector(
|
||||||
"#panic-body"
|
"#panic-body"
|
||||||
)!.innerHTML = `<textarea>${errorText}</textarea>`;
|
)!.innerHTML = `<textarea>${errorText}</textarea>`;
|
||||||
|
|
Loading…
Reference in New Issue