in wiki-interface/ui/js/sidebar_br.js [433:474]
async function performDownload() {
// Get the content from the div with id "ratingPageContent"
const content = document.getElementById('ratingPageContent').value;
const b64source = btoa(content);
const mimeType = document.getElementById('ratingMimeType').value;
const transactionId = document.getElementById('ratingTransactionId').value;
let data = {
inputDoc: b64source,
mimeType: mimeType,
transactionId: transactionId
}
try {
const response = await fetch('/api/v1/download', {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify(data)
});
if (!response.ok) {
throw new Error('Network response was not ok');
}
const responseData = await response.text();
const popup = window.open('', '_blank', 'width=800,height=600');
if (popup) {
popup.document.write(responseData);
popup.document.close();
} else {
alert("Could not open popup window. Please check your browser settings.");
}
} catch (error) {
console.error('There was a problem with the fetch operation:', error);
// Handle errors here (e.g., display an error message to the user)
return null; // or some default value or error representation
}
}