Skip to content

Commit

Permalink
Always select the support bundle
Browse files Browse the repository at this point in the history
  • Loading branch information
ConfusedPolarBear committed Oct 27, 2022
1 parent b89d764 commit d8c8f1c
Showing 1 changed file with 9 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -456,29 +456,22 @@ <h3>Fingerprint Visualizer</h3>
const bundle = await fetchWithAuth("IntroSkipper/SupportBundle", "GET", null);
const bundleText = await bundle.text();

// Display it to the user
document.querySelector("textarea#supportBundle").value = bundleText;
// Display it to the user and select all
const ta = document.querySelector("textarea#supportBundle");
ta.value = bundleText;
ta.focus();
ta.setSelectionRange(0, ta.value.length);

// Attempt to copy it to the clipboard automatically, falling back to selecting
// all text and prompting the user to press ctrl c.
// Attempt to copy it to the clipboard automatically, falling back
// to prompting the user to press Ctrl + C.
try {
navigator.clipboard.writeText(bundleText)
navigator.clipboard.writeText(bundleText);
Dashboard.alert("Support bundle copied to clipboard");
} catch {
supportBundleCopyFailed();
Dashboard.alert("Press Ctrl+C to copy support bundle");
}
}

// if the automatic bundle copy fails (likely due to an insecure context), have the
// user copy it manually.
function supportBundleCopyFailed() {
const ta = document.querySelector("textarea#supportBundle");
ta.focus();
ta.setSelectionRange(0, ta.value.length);

Dashboard.alert("Press Ctrl+C to copy support bundle");
}

// show changed, populate seasons
async function showChanged() {
clearSelect(selectSeason);
Expand Down

0 comments on commit d8c8f1c

Please sign in to comment.