Bugfix: Babel js backtick fix (#1383)

* Back ticks to protect JS from apostrophes in babel translations

Fixes #1319

* Update new_device_keys.jinja

* Update hwi.jinja

* Update messages.pot

* Updated translation files against latest messages.pot
This commit is contained in:
kdmukai 2021-09-09 08:19:14 -05:00 committed by GitHub
parent 6a1e0d56d9
commit 5f623b02cd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
66 changed files with 15355 additions and 11656 deletions

File diff suppressed because it is too large Load diff

View file

@ -75,13 +75,13 @@
let advancedSettigns = document.getElementById('advanced_settings');
if (advancedSettigns.style.display === 'block') {
advancedSettigns.style.display = 'none';
advancedButton.innerHTML = 'Advanced ▶';
advancedButton.innerHTML = `{{ _("Advanced") }} ▶`;
if (isCoinSelectionActive()) {
toggleExpand();
}
} else {
advancedSettigns.style.display = 'block';
advancedButton.innerHTML = 'Advanced ▼';
advancedButton.innerHTML = `{{ _("Advanced") }} ▼`;
}
}

View file

@ -267,7 +267,7 @@
{# url routes are not defined in hwi_bridge mode. `url_for` will fail. #}
<script>
async function toggleHideSensitiveInfo() {
showNotification('{{ "Revealing" if specter.hide_sensitive_info else "Hiding"}} sensitive info...', 0);
showNotification(`{{ _("Revealing") if specter.hide_sensitive_info else _("Hiding") }} sensitive info...`, 0);
let url = `{{ url_for('toggle_hide_sensitive_info') }}`;
var formData = new FormData();
formData.append('csrf_token', '{{ csrf_token() }}');
@ -288,7 +288,7 @@
location.reload();
return
};
showError('Failed to toggle sensitive info mode...')
showError(`{{ _("Failed to toggle sensitive info mode...") }}`)
} catch(e) {
console.log("Caught error: ", e);
showError(e);

View file

@ -194,9 +194,9 @@
<script>
async function togglePriceCheck(showPrice) {
if (showPrice) {
showNotification('{{ _("Turning on show price mode...") }}', 0)
showNotification(`{{ _("Turning on show price mode...") }}`, 0)
} else {
showNotification('{{ _("Turning off show price mode...") }}', 0)
showNotification(`{{ _("Turning off show price mode...") }}`, 0)
}
let url = `{{ url_for('price_endpoint.toggle') }}`;
var formData = new FormData(document.getElementById('price-form'));
@ -217,7 +217,7 @@
location.reload();
return
};
showError('{{ _("Failed to toggle price mode...") }}')
showError(`{{ _("Failed to toggle price mode...") }}`)
} catch(e) {
console.log("Caught error: ", e);
showError(e);
@ -225,7 +225,7 @@
}
async function savePriceData(reload) {
showNotification('{{ _("Updating price data...") }}', 0)
showNotification(`{{ _("Updating price data...") }}`, 0)
let url = `{{ url_for('price_endpoint.update') }}`;
var formData = new FormData(document.getElementById('price-form'));
try {
@ -245,7 +245,7 @@
location.reload();
return
};
showError('{{ _("Failed to fetch price data from selected provider, please try again or select another provider.") }}')
showError(`{{ _("Failed to fetch price data from selected provider, please try again or select another provider.") }}`)
} catch(e) {
console.log("Caught error: ", e);
showError(e);

View file

@ -7,7 +7,7 @@ function addKeys(data){
let candidates = data.split("\n");
candidates = candidates.filter(e=>!loaded.includes(e));
if(candidates.length == 0){
showNotification("No new keys are added.");
showNotification(`{{ _("No new keys are added.") }}`);
}else{
showNotification(`Added ${candidates.length} keys.`);
}

View file

@ -173,7 +173,7 @@
document.getElementById('signature-label').style.display = 'block';
document.getElementById('signature').innerText = signature;
showPageOverlay('message-signing');
showNotification('{{ _("Message was signed successfully!") }}')
showNotification(`{{ _("Message was signed successfully!") }}`)
}
</script>
{% endblock %}

View file

@ -54,7 +54,7 @@
}
// this shouldn't happen actually
if(devices.length == 0){
showError("No devices found :(");
showError(`{{ _("No devices found :(") }}`); // that's an old-school frown emoji -- ":(" -- not a weird typo
return;
}

View file

@ -185,15 +185,15 @@
} else {
let xpubPurpose = 'Custom'
if (xpub.startsWith("ypub") || xpub.startsWith("upub")) {
xpubPurpose = '{{ _("#0 Single Sig (Nested)") }}';
xpubPurpose = `{{ _("#0 Single Sig (Nested)") }}`;
} else if (xpub.startsWith("vpub") || xpub.startsWith("zpub")) {
xpubPurpose = '{{ _("#0 Single Sig (Segwit)") }}';
xpubPurpose = `{{ _("#0 Single Sig (Segwit)") }}`;
}
addXpub(xpubPurpose, 'm/', xpub)
}
})
if (document.getElementById('edit-xpubs-table-btn').innerHTML != 'Edit') {
if (document.getElementById('edit-xpubs-table-btn').innerHTML != `{{ _("Edit") }}`) {
for (let el of document.getElementsByClassName('xpubs_edit')) {
el.style.visibility = 'visible';
}
@ -286,11 +286,11 @@
function editXpubsTable(editBtn) {
let visibility = '';
if (editBtn.innerHTML == '{{ _("Edit") }}') {
editBtn.innerHTML = '{{ _("Done") }}';
if (editBtn.innerHTML == `{{ _("Edit") }}`) {
editBtn.innerHTML = `{{ _("Done") }}`;
visibility = 'visible';
} else {
editBtn.innerHTML = '{{ _("Edit") }}';
editBtn.innerHTML = `{{ _("Edit") }}`;
visibility = 'hidden';
}
document.getElementById('edit_select_add_method').style.display = 'table-row';
@ -319,7 +319,7 @@
}
// this shouldn't happen actually
if(devices.length == 0){
showError('{{ _("No devices found :(") }}');
showError(`{{ _("No devices found :(") }}`);
return;
}
@ -353,7 +353,7 @@
"{specter.chain}"
);
if(xpub == null){
showError('{{ _("Failed to retrive device data. Please try again.") }}');
showError(`{{ _("Failed to retrive device data. Please try again.") }}`);
return;
}
@ -485,7 +485,7 @@
let str = `[${obj.xfp}/${path}]${obj.xpub}`;
addXpubs(str);
}else{
showError('{{ _("Unknown key format") }}');
showError(`{{ _("Unknown key format") }}`);
}
}else{
addXpubs(result);

View file

@ -125,7 +125,7 @@
)
) {
toggleAdvanced();
showError("You have set values in the Advanced section but left it hidden. Please verify they are correct or delete them, then click again to submit.")
showError(`{{ _("You have set values in the Advanced section but left it hidden. Please verify they are correct or delete them, then click again to submit.") }}`)
hiddenAdvancedConfirmed = true;
return false;
}
@ -202,10 +202,10 @@
let advancedSettings = document.getElementById('advanced-settings');
if (advancedSettings.style.display === 'block') {
advancedSettings.style.display = 'none';
advancedButton.innerHTML = '{{ _("Advanced") }} &#9654;';
advancedButton.innerHTML = `{{ _("Advanced") }} &#9654;`;
} else {
advancedSettings.style.display = 'block';
advancedButton.innerHTML = '{{ _("Advanced") }} &#9660;';
advancedButton.innerHTML = `{{ _("Advanced") }} &#9660;`;
}
}
</script>

View file

@ -177,13 +177,13 @@ m/48h/{{ 0 if specter.info.chain == "main" else 1 }}h/0h/2h</textarea>
let advancedSettings = document.getElementById('advanced_settings');
if (advancedSettings.style.display === 'block') {
advancedSettings.style.display = 'none';
advancedButton.innerHTML = '{{ _("Advanced") }} &#9654;';
advancedButton.innerHTML = `{{ _("Advanced") }} &#9654;`;
if (isCoinSelectionActive()) {
toggleExpand();
}
} else {
advancedSettings.style.display = 'block';
advancedButton.innerHTML = '{{ _("Advanced") }} &#9660;';
advancedButton.innerHTML = `{{ _("Advanced") }} &#9660;`;
}
}
@ -198,7 +198,7 @@ m/48h/{{ 0 if specter.info.chain == "main" else 1 }}h/0h/2h</textarea>
importMnemonic.style.display = 'none';
generateMnemonicBtn.className = generateMnemonicBtn.className += ' checked';
importMnemonicBtn.className = importMnemonicBtn.className.replace(/checked/, '');
mnemonicValue.value = '{{ mnemonic }}'
mnemonicValue.value = `{{ mnemonic }}`
} else {
generatedMnemonic.style.display = 'none';
importMnemonic.style.display = 'block';
@ -285,7 +285,7 @@ m/48h/{{ 0 if specter.info.chain == "main" else 1 }}h/0h/2h</textarea>
}
// this shouldn't happen actually
if(devices.length == 0){
showError('{{ _("No devices found") }} :(');
showError(`{{ _("No devices found") }} :(`);
return;
}
console.log(devices)
@ -431,7 +431,7 @@ m/48h/{{ 0 if specter.info.chain == "main" else 1 }}h/0h/2h</textarea>
addKeys(str);
setDeviceType('cobo');
}else{
showError('{{ _("Unknown key format") }}');
showError(`{{ _("Unknown key format") }}`);
}
}else{
addKeys(result);

View file

@ -154,7 +154,7 @@
this.label.innerText = this.address
}
} else {
showError('{{ _("Failed to update address label. Please refresh the page and try again.") }}')
showError(`{{ _("Failed to update address label. Please refresh the page and try again.") }}`)
}
}
@ -229,10 +229,10 @@
}
return;
}
showError('{{ _("Failed to fetch data. Please refresh the page and retry.") }}');
showError(`{{ _("Failed to fetch data. Please refresh the page and retry.") }}`);
} catch(e) {
console.log('{{ _("Caught error fetching address label") }}: ', e);
showError('{{ _("Failed to fetch data. Please refresh the page and retry.") }}');
console.log(`{{ _("Caught error fetching address label") }}: `, e);
showError(`{{ _("Failed to fetch data. Please refresh the page and retry.") }}`);
}
}

View file

@ -117,9 +117,9 @@
displayAddressOnDevice(this.addressData.address, JSON.stringify(descriptor));
return;
}
showError('{{ _("Failed to load address data to display...") }}');
showError(`{{ _("Failed to load address data to display...") }}`);
} catch(e) {
showError('{{ _("Failed to load address data to display...") }}');
showError(`{{ _("Failed to load address data to display...") }}`);
showError(e);
}
}

View file

@ -515,7 +515,7 @@
}
return;
}
showError('{{ _("Failed to fetch addresses list") }}')
showError(`{{ _("Failed to fetch addresses list") }}`)
} catch (e) {
console.log("Caught error: ", e);
showError(`{{ _("Failed to fetch addresses list") }}: ${e}`);

View file

@ -161,7 +161,7 @@
this.label.innerText = this.asset
}
} else {
showError('Failed to update asset label. Please refresh the page and try again.')
showError(`{{ _("Failed to update asset label. Please refresh the page and try again.") }}`)
}
}

View file

@ -19,7 +19,7 @@
let inp = document.getElementById("hwi_passphrase_passphrase");
let submit = document.createElement('button');
submit.classList.add('btn');
submit.innerHTML = '{{ _("Submit") }}';
submit.innerHTML = `{{ _("Submit") }}`;
let result = null;
submit.addEventListener('click', e=>{
result = inp.value;

View file

@ -13,7 +13,7 @@
async function enterPin(device, promptPin=true){
let result = null;
if (promptPin) {
showHWIProgress('{{ _("Processing...") }}', `{{ _("Keep your") }} ${capitalize(device.type)} {{ _("connected") }}.`);
showHWIProgress(`{{ _("Processing...") }}`, `{{ _("Keep your") }} ${capitalize(device.type)} {{ _("connected") }}.`);
try {
result = await hwi.promptPin(device);
} catch (error) {
@ -59,7 +59,7 @@
el.appendChild(document.createElement('br'));
let submit = document.createElement('button');
submit.classList.add('btn');
submit.innerHTML = '{{ _("Submit") }}';
submit.innerHTML = `{{ _("Submit") }}`;
submit.addEventListener('click', e=>{
pinReady = true;
});
@ -81,7 +81,7 @@
}
hidePageOverlay();
// now we have PIN - send it
showHWIProgress('{{ _("Processing...") }}', `{{ _("Keep your") }} ${capitalize(device.type)} {{ _("connected") }}.`);
showHWIProgress(`{{ _("Processing...") }}`, `{{ _("Keep your") }} ${capitalize(device.type)} {{ _("connected") }}.`);
result = null;
try {
result = await hwi.sendPin(device, pin);

View file

@ -50,7 +50,7 @@
return null;
}
showHWIProgress('{{ _("Processing...") }}', `{{ _("Keep your") }} ${capitalize(selectedDevice.type)} {{ _("connected") }}.`);
showHWIProgress(`{{ _("Processing...") }}`, `{{ _("Keep your") }} ${capitalize(selectedDevice.type)} {{ _("connected") }}.`);
// Get the device again as it is now unlocked and the fingerprint is available
let rescanDevices = await enumerate(selectedDevice.type, selectedDevice.path, passphrase);
if (rescanDevices.length == 1) {
@ -75,7 +75,7 @@
return null;
}
if(!('success' in result) || !result.success){
throw '{{ _("Failed to unlock device! Invalid PIN code?") }}';
throw `{{ _("Failed to unlock device! Invalid PIN code?") }}`;
}
device.needs_pin_sent = false;
}
@ -86,7 +86,7 @@
console.log("need password...");
let passphrase = await enterPassphrase(device);
if(passphrase == null){
throw "Operation is terminated";
throw `{{ _("Operation is terminated") }}`;
}
return passphrase;
}
@ -99,7 +99,7 @@
return;
}
let device = await selectDevice(devices, '');
showHWIProgress('{{ _("Processing...") }}', `{{ _("Keep your") }} ${capitalize(device.type)} {{ _("connected") }}.`);
showHWIProgress(`{{ _("Processing...") }}`, `{{ _("Keep your") }} ${capitalize(device.type)} {{ _("connected") }}.`);
let result = null;
try {
result = await hwi.togglePassphrase(device);
@ -119,10 +119,10 @@
return null;
}
if(!('success' in result) || !result.success){
throw "Failed to unlock device! Invalid PIN code?";
throw `{{ _("Failed to unlock device! Invalid PIN code?") }}`;
}
}
showNotification(device.type + ' {{ _("passphrase toggled successfully") }}', 5000)
showNotification(device.type + ` {{ _("passphrase toggled successfully") }}`, 5000)
}
async function signMessage(deviceType, message, derivationPath, fingerprint=null){
@ -137,10 +137,10 @@
}
if (fingerprint && device.fingerprint != fingerprint) {
handleHWIError('{{ _("Selected device does not have matching signing key.") }}');
handleHWIError(`{{ _("Selected device does not have matching signing key.") }}`);
return;
}
showHWIProgress('{{ _("Signing message...") }}', `{{ _("Confirm on your") }} ${capitalize(device.type)}.`);
showHWIProgress(`{{ _("Signing message...") }}`, `{{ _("Confirm on your") }} ${capitalize(device.type)}.`);
let signature = null;
try {
signature = await hwi.signMessage(device, message, derivationPath);

View file

@ -35,10 +35,10 @@
}
if (fingerprint && device.fingerprint != fingerprint) {
handleHWIError('{{ _("Selected device does not have matching signing key.") }}');
handleHWIError(`{{ _("Selected device does not have matching signing key.") }}`);
return;
}
showHWIProgress('{{ _("Signing transaction...") }}', `{{ _("Confirm on your") }} ${capitalize(device.type)}.`);
showHWIProgress(`{{ _("Signing transaction...") }}`, `{{ _("Confirm on your") }} ${capitalize(device.type)}.`);
let signedTx = null;
try {
signedTx = await hwi.signTx(device, psbt);
@ -87,12 +87,12 @@
(("{{ specter.chain }}" != "regtest" || !result.startsWith("tb")) ||
address.slice(0, -6) != "bcrt" + result.slice(2, -6))
) {
showError('{{ _("Addresses did not match! Be careful! Please contact support and beware of using the displayed address!") }}');
showError(`{{ _("Addresses did not match! Be careful! Please contact support and beware of using the displayed address!") }}`);
} else {
if (device.type == 'coldcard') {
showNotification('{{ _("Address displayed successfully! Please check the device screen.") }}', 7000);
showNotification(`{{ _("Address displayed successfully! Please check the device screen.") }}`, 7000);
} else {
showNotification('{{ _("Address was verified successfully!") }}', 5000);
showNotification(`{{ _("Address was verified successfully!") }}`, 5000);
}
}
}

View file

@ -47,7 +47,7 @@
<script type="text/javascript">
function showHWIProgress(title='{{ _("Processing...") }}', text='{{ _("Keep your wallet connected.") }}'){
function showHWIProgress(title=`{{ _("Processing...") }}`, text=`{{ _("Keep your wallet connected.") }}`){
document.getElementById('hwi_progress_title').innerHTML = title;
document.getElementById('hwi_progress_text').innerHTML = text;
showPageOverlay('hwi_progress');
@ -82,7 +82,7 @@
}
// detect device
if (devicePath == null) {
showHWIProgress('{{ _("Detecting...") }}', '{{ _("Plug in your device") }}');
showHWIProgress(`{{ _("Detecting...") }}`, `{{ _("Plug in your device") }}`);
}
let result = [];
let retryCounter = 0;
@ -160,7 +160,7 @@
async function getXpubs(device, account=0, passphrase=""){
// detect device
showHWIProgress('{{ _("Extracting public keys...") }}',
showHWIProgress(`{{ _("Extracting public keys...") }}`,
`{{ _("It may take a while.") }}<br><br>{{ _("Keep your") }} ${capitalize(device.type)} {{ _("connected") }}.`);
let result = [];
try {
@ -180,7 +180,7 @@
async function getXpub(device, derivation="", passphrase="", chain=""){
// detect device
showHWIProgress('{{ _("Extracting public key...") }}<br><span style=\'font-size: 0.8em;\'>{{ _("Derivation") }}: ' + derivation + "</span>",
showHWIProgress(`{{ _("Extracting public key...") }}<br><span style=\'font-size: 0.8em;\'>{{ _("Derivation") }}: ` + derivation + "</span>",
`{{ _("It may take a while.") }}<br><br>{{ _("Keep your") }} ${capitalize(device.type)} {{ _("connected") }}.`);
let result = [];
try {
@ -200,7 +200,7 @@
async function getMasterBlindingKey(device, passphrase="", chain=""){
// detect device
showHWIProgress('{{ _("Extracting master blinding key...") }}',
showHWIProgress(`{{ _("Extracting master blinding key...") }}`,
`{{ _("Please confirm action on your") }} ${capitalize(device.type)} {{ _("device") }}.`);
let result = [];
try {

View file

@ -21,7 +21,7 @@ function changeLanguage(selectObj) {
if (jsonResponse.success) {
location.reload();
} else {
showError('{{ _("Failed to change language") }}')
showError(`{{ _("Failed to change language") }}`)
}
return;
})

View file

@ -47,15 +47,15 @@
let assetLabelField = document.getElementById('new_asset_label');
let assetsList = document.getElementById('liquid-assets-list');
if (!isHex(assetIDField.value) || assetIDField.value.length !== 64) {
showError('{{_("Asset ID is invalid, must be 64 hex characters")}}', 5000);
showError(`{{_("Asset ID is invalid, must be 64 hex characters")}}`, 5000);
return false;
}
if (existingAssets.indexOf(assetIDField.value) != -1) {
showError('{{_("This asset is already in the registry.")}}', 5000);
showError(`{{_("This asset is already in the registry.")}}`, 5000);
return false;
}
if (assetLabelField.value == '') {
showError('{{_("Asset label must not be empty.")}}', 5000);
showError(`{{_("Asset label must not be empty.")}}`, 5000);
return false;
}
formData.append('asset', assetIDField.value);
@ -97,7 +97,7 @@
async function removeAsset(asset) {
if (existingAssets.indexOf(asset) == -1) {
showError('{{_("Asset ID does not exist")}}', 5000);
showError(`{{_("Asset ID does not exist")}}`, 5000);
return false;
}
let url = `{{ url_for('settings_endpoint.set_asset_label') }}`;

View file

@ -26,7 +26,7 @@
hidePageOverlay();
combine(result);
} else {
showError('{{ _("Scan failed, please try again...") }}', 3000);
showError(`{{ _("Scan failed, please try again...") }}`, 3000);
}
});
</script>

View file

@ -204,7 +204,7 @@ class QRCodeElement extends HTMLElement {
value = this.maybe_remove_checksum(value);
this.qrcode.makeCode(value);
if(this.isQRlarge){
this.note.innerHTML = '{{ _("Click to animate") }}';
this.note.innerHTML = `{{ _("Click to animate") }}`;
}
}
});
@ -401,7 +401,7 @@ class QRCodeElement extends HTMLElement {
this.note.innerHTML = "";
}else{
this.isQRlarge = true;
this.note.innerHTML = "Click to animate";
this.note.innerHTML = `{{ _("Click to animate") }}`;
}
// we have to use chunks
if(this.isQRtoolarge){

View file

@ -43,7 +43,7 @@
<script>
let totalUserBalance = parseFloat(parseFloat("{{ specter.wallet_manager.wallets.values() | sum(attribute='fullbalance') }}").toFixed(8));
async function fetchTotalSupply() {
document.getElementById('total_supply').innerHTML = '{{ _("Running the numbers... (this might take a few minutes)") }}';
document.getElementById('total_supply').innerHTML = `{{ _("Running the numbers... (this might take a few minutes)") }}`;
try {
const response = await fetch(
"{{ url_for('txout_set_info') }}",

View file

@ -281,7 +281,7 @@
document.addEventListener("DOMContentLoaded", function(){
if ('{{ specter.device_manager.devices_names | length }}' == '0') {
document.getElementById('toggle_devices_list').innerHTML = '{{ _("Devices") }}';
document.getElementById('toggle_devices_list').innerHTML = `{{ _("Devices") }}`;
} else {
document.getElementById('toggle_devices_list').addEventListener('click', (event) => {
toggleList('devices', '{{ _("Devices") }}');
@ -289,7 +289,7 @@
}
if ('{{ specter.wallet_manager.wallets_names | length }}' == '0') {
document.getElementById('toggle_wallets_list').innerHTML = '{{ _("Wallets") }}';
document.getElementById('toggle_wallets_list').innerHTML = `{{ _("Wallets") }}`;
} else {
document.getElementById('toggle_wallets_list').addEventListener('click', (event) => {
toggleList('wallets', '{{ _("Wallets") }}');

View file

@ -65,7 +65,7 @@
} catch(e) {
this.note.innerText = '{{ _("Failed to load transaction details...") }}';
console.log("Caught error fetching decoded transaction: ", e);
showError('{{ _("Failed to fetch data. Please refresh the page and retry.") }}');
showError(`{{ _("Failed to fetch data. Please refresh the page and retry.") }}`);
}
return null;
}
@ -278,7 +278,7 @@
return jsonResponse.isMine;
}
} catch(e) {
showError('{{ _("Failed to load address data...") }}');
showError(`{{ _("Failed to load address data...") }}`);
showError(e);
}
return false;

View file

@ -238,13 +238,13 @@
txDataPopup.innerHTML = `
<form action="${url}" method="POST">
<h1>${rbfType == 'cancel' ? '{{ _("Cancel") }}' : '{{ _("Speed up") }}'} {{ _("the Transaction") }}</h1>
<p>{{ _("You can") }} ${rbfType == 'cancel' ? '{{ _("cancel") }}' : '{{ _("speed up") }}'} {{ _("the transaction by increasing its fee rate") }}${rbfType == 'cancel' ? ' {{ _("and sending the funds back to yourself") }}' : ''}:</p>
<p>{{ _("You can") }} ${rbfType == 'cancel' ? `{{ _("cancel") }}` : `{{ _("speed up") }}`} {{ _("the transaction by increasing its fee rate") }}${rbfType == 'cancel' ? ` {{ _("and sending the funds back to yourself") }}` : ''}:</p>
<input type="hidden" name="rbf_tx_id" value='${this.tx.txid}' />
<input type="number" min="${newFee}" value="${newFee}" class="fee_rate" name="rbf_fee_rate" id="rbf_fee_rate" min="1" step="any" autocomplete="off"> sat/vbyte
<input type="hidden" class="csrf-token" name="csrf_token" value="{{ csrf_token() }}"/>
<br>
<br>
<button type="submit" name="action" value="${rbfType == 'cancel' ? 'rbf_cancel' : 'rbf'}" class="btn centered ${rbfType == 'cancel' ? 'danger' : ''}">${rbfType == 'cancel' ? '{{ _("Cancel transaction") }}' : '{{ _("Speed up!") }}'}</button>
<button type="submit" name="action" value="${rbfType == 'cancel' ? 'rbf_cancel' : 'rbf'}" class="btn centered ${rbfType == 'cancel' ? 'danger' : ''}">${rbfType == 'cancel' ? `{{ _("Cancel transaction") }}` : `{{ _("Speed up!") }}`}</button>
<br>
<span class="toggle_advanced_rbf" style="cursor: pointer;">{{ _("Advanced") }} {% if show_advanced_settings %}&#9660;{% else %}&#9654;{% endif %}</span>
<div class="advanced_rbf hidden warning">
@ -258,10 +258,10 @@
let advancedSettings = txDataPopup.querySelector('.advanced_rbf')
if (advancedSettings.classList.contains('hidden')) {
advancedSettings.classList.remove('hidden')
advancedButton.innerHTML = 'Advanced &#9660;';
advancedButton.innerHTML = `{{ _("Advanced") }} &#9660;`;
} else {
advancedSettings.classList.add('hidden')
advancedButton.innerHTML = 'Advanced &#9654;';
advancedButton.innerHTML = `{{ _("Advanced") }} &#9654;`;
}
}

View file

@ -651,7 +651,7 @@
}
return
};
showError('{{ _("Failed to fetch transactions list.") }}')
showError(`{{ _("Failed to fetch transactions list.") }}`)
} catch(e) {
console.log("Caught error: ", e);
showError(`{{ _("Failed to fetch transactions list.") }}: ${e}`);

View file

@ -204,7 +204,7 @@
document.getElementById('host').value = host;
document.getElementById('port').value = port;
} catch {
showError('{{ _("Failed to read connection data from the QR") }}', 3000)
showError(`{{ _("Failed to read connection data from the QR") }}`, 3000)
}
});
}

View file

@ -142,7 +142,7 @@
let devices = []
files = e.currentTarget.files;
if (e.currentTarget.files.length == 1 && e.currentTarget.files[0].type == 'application/zip') {
showError("Cannot upload as ZIP file, please unzip the file and upload by selecting the extracted folder", 10000);
showError(`{{ _("Cannot upload as ZIP file, please unzip the file and upload by selecting the extracted folder") }}`, 10000);
return;
}
console.log(files);

View file

@ -95,9 +95,9 @@
<script>
async function testHWIConnection() {
if (await enumerate()) {
showNotification('{{ _("Device detected successfully! USB connections configured correctly!") }}');
showNotification(`{{ _("Device detected successfully! USB connections configured correctly!") }}`);
} else {
showError('{{ _("Failed to detect devices") }}');
showError(`{{ _("Failed to detect devices") }}`);
}
}
function switchHWIBridgeConfView(viewType) {

View file

@ -139,7 +139,7 @@
function checkAuthEabled() {
{% if specter.config.auth.method == "none" %}
document.getElementById('hidden_service').checked = false;
showError('{{ _("Please set an authentication method before enabling the hidden service") }}')
showError(`{{ _("Please set an authentication method before enabling the hidden service") }}`)
{% else %}
return true;
{% endif %}

View file

@ -37,7 +37,7 @@
}
showError(jsonResponse.error, 4000);
} catch(e) {
showError('{{ _("Failed to download Bitcoin Core...") }}');
showError(`{{ _("Failed to download Bitcoin Core...") }}`);
showError(e);
}
}

View file

@ -179,7 +179,7 @@
}
showError(jsonResponse.error, 4000);
} catch(e) {
showError('{{ _("Failed to start Bitcoin Core...") }}');
showError(`{{ _("Failed to start Bitcoin Core...") }}`);
showError(e);
}
}

View file

@ -60,10 +60,10 @@
let advancedSettings = document.getElementById(`advanced_settings`);
if (advancedSettings.classList.contains("hidden")) {
advancedSettings.classList.remove("hidden");
advancedButton.innerHTML = '{{ _("Advanced") }} &#9660;';
advancedButton.innerHTML = `{{ _("Advanced") }} &#9660;`;
} else {
advancedSettings.classList.add("hidden");
advancedButton.innerHTML = '{{ _("Advanced") }} &#9654;';
advancedButton.innerHTML = `{{ _("Advanced") }} &#9654;`;
}
}
@ -80,7 +80,7 @@
);
let result = await response.json();
if (result.error) {
showError('{{ _("Encountered an error:") }}' + result.error);
showError(`{{ _("Encountered an error:") }}` + result.error);
document.getElementById('progress-details').classList.add('hidden');
hidePageOverlay('progress-details');
return;
@ -104,7 +104,7 @@
document.getElementById('show-progress-details').classList.remove('hidden');
document.getElementById('reset-setup-process').classList.remove('hidden');
showPageOverlay('progress-details');
document.getElementById('progress-details').innerHTML = '{{ _("Starting up...") }}';
document.getElementById('progress-details').innerHTML = `{{ _("Starting up...") }}`;
setTimeout(fetchProgress, 1000);
}

View file

@ -41,7 +41,7 @@
}
showError(jsonResponse.error, 4000);
} catch(e) {
showError('{{ _("Failed to download Tor daemon...") }}');
showError(`{{ _("Failed to download Tor daemon...") }}`);
showError(e);
}
}

View file

@ -38,7 +38,7 @@
scanner.start();
document.getElementById("popup").style.display = 'flex';
}catch(e){
showError("Can't start the QR scanner!\n\n" + e);
showError(`{{ _("Can't start the QR scanner!") }}\n\n` + e);
}
});
document.getElementById("popup").addEventListener("click", function(){

View file

@ -55,7 +55,7 @@
}
}
if (checkedCount < 2) {
showNotification('Please select at least 2 devices for your multisig')
showNotification(`{{ _("Please select at least 2 devices for your multisig") }}`);
return false;
}
}

View file

@ -103,7 +103,7 @@
download="{{ wallet.name | ascii20 }}.txt"
href="data:text/plain;charset=US-ASCII,{{ device.export_wallet(wallet) }}"
{% if device.device_type == 'coldcard' %}
onclick="showNotification('{{ _("Import wallet file to your ColdCard: Settings -> Multisig Wallets -> Import from SD") }}', 0)"
onclick="showNotification(`{{ _("Import wallet file to your ColdCard: Settings -> Multisig Wallets -> Import from SD") }}`, 0)"
{% endif %}
class="btn centered padded">
{{ _("Save") }} {{ device.name }} {{ _("file") }}
@ -177,10 +177,10 @@
let advancedSettings = document.getElementById(`advanced_pdf_export_container`);
if (advancedSettings.classList.contains("hidden")) {
advancedSettings.classList.remove("hidden");
advancedButton.innerHTML = '{{ _("Advanced") }} &#9660;';
advancedButton.innerHTML = `{{ _("Advanced") }} &#9660;`;
} else {
advancedSettings.classList.add("hidden");
advancedButton.innerHTML = '{{ _("Advanced") }} &#9654;';
advancedButton.innerHTML = `{{ _("Advanced") }} &#9654;`;
}
}

View file

@ -343,7 +343,7 @@
async function setMaxAmount(i) {
let amountInput = document.getElementById('amount_' + i);
if (!validateAddress(i)) {
showError('{{ _("Please first enter a valid address") }}');
showError(`{{ _("Please first enter a valid address") }}`);
return;
}
if(units[i] == 'sat' || units[i] == 'btc'){
@ -391,7 +391,7 @@
if (isNaN(amount)) {
setVisibility('amount_errors_container', 'block');
document.getElementById('amount_errors_container')
.innerHTML = '{{ _("Amount entered is invalid!") }}';
.innerHTML = `{{ _("Amount entered is invalid!") }}`;
return false;
}
@ -410,12 +410,12 @@
} else if (shouldSelectMoreCoins(unit, amount)) {
setVisibility('amount_errors_container', 'block');
document.getElementById('amount_errors_container')
.innerHTML = '{{ _("You need to select more coins to match your amount!") }}';
.innerHTML = `{{ _("You need to select more coins to match your amount!") }}`;
return false;
} else if (isInvalidValue(unit, amount)) {
setVisibility('amount_errors_container', 'block');
document.getElementById('amount_errors_container')
.innerHTML = '{{ _("Invalid amount! Wrong unit?") }}';
.innerHTML = `{{ _("Invalid amount! Wrong unit?") }}`;
return false;
} else {
setVisibility('amount_errors_container', 'none');
@ -451,7 +451,7 @@
}
}
if (submitted && !amount) {
showError('{{ _("Please enter the amount that you wish to send") }}', 5000);
showError(`{{ _("Please enter the amount that you wish to send") }}`, 5000);
}
if (document.getElementById("amount_" + i).value == '') {
amount = 0;
@ -465,7 +465,7 @@
for(let i in amounts) {
if (!validateAddress(i)) {
if (submitted) {
showError('{{ _("Please enter a valid recipient address") }}', 5000);
showError(`{{ _("Please enter a valid recipient address") }}`, 5000);
}
createPSBTButton.setAttribute('type', 'button');
return;
@ -508,13 +508,13 @@
let advancedSettings = document.getElementById('advanced_settings');
if (advancedSettings.style.display === 'block') {
advancedSettings.style.display = 'none';
advancedButton.innerHTML = '{{ _("Advanced") }} &#9654;';
advancedButton.innerHTML = `{{ _("Advanced") }} &#9654;`;
if (isCoinSelectionActive()) {
toggleExpand();
}
} else {
advancedSettings.style.display = 'block';
advancedButton.innerHTML = '{{ _("Advanced") }} &#9660;';
advancedButton.innerHTML = `{{ _("Advanced") }} &#9660;`;
}
}

View file

@ -415,7 +415,7 @@
}
async function broadcastLocal(tx) {
showNotification("{{ _('Sending transaction...') }}");
showNotification(`{{ _('Sending transaction...') }}`);
let url="{{ url_for('wallets_endpoint.broadcast', wallet_alias=wallet.alias) }}";
var formData = new FormData();
@ -437,15 +437,15 @@
hidePageOverlay();
window.location.replace("{{ url_for('wallets_endpoint.history', wallet_alias=wallet.alias) }}");
} else {
showError("{{ _('Server failed to broadcast transactions!') }}\n" + jsonResponse.error);
showError(`{{ _('Server failed to broadcast transactions!') }}\n` + jsonResponse.error);
}
} catch(e) {
showError("{{ _('Server failed to broadcast transactions!') }}\n" + e);
showError(`{{ _('Server failed to broadcast transactions!') }}\n` + e);
}
}
async function broadcastBlockExplorer(tx, explorer, useTor) {
showNotification("{{ _('Sending transaction...') }}", 0);
showNotification(`{{ _('Sending transaction...') }}`, 0);
let url = "{{ url_for('wallets_endpoint.broadcast_blockexplorer', wallet_alias=wallet.alias) }}";
@ -470,10 +470,10 @@
hidePageOverlay();
window.location.replace("{{ url_for('wallets_endpoint.history', wallet_alias=wallet.alias) }}");
} else {
showError("{{ _('Server failed to broadcast transactions!') }}\n" + jsonResponse.error);
showError(`{{ _('Server failed to broadcast transactions!') }}\n` + jsonResponse.error);
}
} catch(e) {
showError("{{ _('Server failed to broadcast transactions!') }}\n" + e);
showError(`{{ _('Server failed to broadcast transactions!') }}\n` + e);
}
}

View file

@ -17,7 +17,7 @@
<a
id="electrum_export"
download="{{ wallet.alias | ascii20 }}_electrum.backup"
onclick="showNotification('Import wallet file to your Electrum: File -> Open -> Choose... -> {{ wallet.alias | ascii20 }}_electrum.backup', 0)"
onclick="showNotification(`Import wallet file to your Electrum: File -> Open -> Choose... -> {{ wallet.alias | ascii20 }}_electrum.backup`, 0)"
class="btn centered padded">
Download Electrum (Watch-Only) File
</a>

View file

@ -362,10 +362,10 @@
let keysList = document.getElementById('keys_list');
if (keysList.style.display !== 'none') {
keysList.style.display = 'none';
titleButton.innerHTML = '{{ _("Show keys details") }}';
titleButton.innerHTML = `{{ _("Show keys details") }}`;
} else {
keysList.style.display = 'block';
titleButton.innerHTML = '{{ _("Hide keys details") }}';
titleButton.innerHTML = `{{ _("Hide keys details") }}`;
}
}
@ -395,10 +395,10 @@
let advancedSettings = document.getElementById(`advanced_pdf_export_container`);
if (advancedSettings.classList.contains("hidden")) {
advancedSettings.classList.remove("hidden");
advancedButton.innerHTML = '{{ _("Advanced") }} &#9660;';
advancedButton.innerHTML = `{{ _("Advanced") }} &#9660;`;
} else {
advancedSettings.classList.add("hidden");
advancedButton.innerHTML = '{{ _("Advanced") }} &#9654;';
advancedButton.innerHTML = `{{ _("Advanced") }} &#9654;`;
}
}