Add translations

This commit is contained in:
Nicola Benaglia 2025-05-22 18:30:07 +02:00
parent 26587bd3b0
commit 6942ac98ab
3 changed files with 243 additions and 55 deletions

View File

@ -55,10 +55,12 @@
"decrypt_data": "could not decrypt data", "decrypt_data": "could not decrypt data",
"field_not_found_json": "{{ field }} not found in JSON", "field_not_found_json": "{{ field }} not found in JSON",
"incorrect_password": "incorrect password", "incorrect_password": "incorrect password",
"invalid_qortal_link": "invalid qortal link",
"invalid_secret_key": "secretKey is not valid", "invalid_secret_key": "secretKey is not valid",
"name_not_existing": "name does not exist", "name_not_existing": "name does not exist",
"name_not_registered": "name not registered", "name_not_registered": "name not registered",
"unable_block_user": "unable to block user", "unable_block_user": "unable to block user",
"unable_fetch_user_account": "unable to fetch user account",
"unable_decrypt": "unable to decrypt", "unable_decrypt": "unable to decrypt",
"unable_reencrypt_secret_key": "unable to re-encrypt secret key" "unable_reencrypt_secret_key": "unable to re-encrypt secret key"
}, },

View File

@ -1,19 +1,35 @@
{ {
"always_authenticate": "always authenticate automatically", "always_authenticate": "always authenticate automatically",
"authenticate": "Do you give this application permission to authenticate?", "authenticate": "do you give this application permission to authenticate?",
"description": "description: {{ description }}", "description": "description: {{ description }}",
"deploy_at": "would you like to deploy this AT?",
"message": { "message": {
"error": { "error": {
"failed_cancel_sell_order": "failed to Cancel Sell Order. Try again!", "failed_cancel_sell_order": "failed to Cancel Sell Order. Try again!",
"failed_retrieve_file": "failed to retrieve file",
"no_data_encrypted_resource": "no data in the encrypted resource",
"no_group_key": "no group key found",
"timeout_request": "request timed out",
"unable_create_tradebot": "unable to create tradebot", "unable_create_tradebot": "unable to create tradebot",
"unable_decrypt": "unable to decrypt",
"unable_encrypt": "unable to encrypt",
"unable_process_transaction": "unable to process transaction", "unable_process_transaction": "unable to process transaction",
"user_declined_request": "user declined request" "user_declined_request": "user declined request"
}, },
"generic": { "generic": {
"max_retry_transaction": "max retries reached. Skipping transaction." "include_data_decrypt": "please include data to decrypt",
"include_data_encrypt": "please include data to encrypt",
"max_retry_transaction": "max retries reached. Skipping transaction.",
"no_action_public_node": "this action cannot be done through a public node",
"provide_group_id": "please provide a groupId",
"user_declined_delete": "user declined delete hosted resources",
"user_declined_list": "user declined to get list of hosted resources"
} }
}, },
"name": "name: {{ name }}",
"option": "option: {{ option }}",
"options": "options: {{ optionList }}", "options": "options: {{ optionList }}",
"poll": "poll: {{ name }}", "poll": "poll: {{ name }}",
"request_create_poll": "you are requesting to create the poll below:" "request_create_poll": "you are requesting to create the poll below:",
"request_vote_poll": "you are being requested to vote on the poll below:"
} }

View File

@ -252,9 +252,17 @@ const _deployAt = async (
const resPermission = await getUserPermission( const resPermission = await getUserPermission(
{ {
text1: 'Would you like to deploy this AT?', text1: i18n.t('question:deploy_at', {
text2: `Name: ${name}`, postProcess: 'capitalizeFirstChar',
text3: `Description: ${description}`, }),
text2: i18n.t('question:name', {
name: name,
postProcess: 'capitalizeFirstChar',
}),
text3: i18n.t('question:description', {
description: description,
postProcess: 'capitalizeFirstChar',
}),
fee: fee.fee, fee: fee.fee,
}, },
isFromExtension isFromExtension
@ -314,12 +322,21 @@ export const _voteOnPoll = async (
) => { ) => {
const fee = await getFee('VOTE_ON_POLL'); const fee = await getFee('VOTE_ON_POLL');
let resPermission = {}; let resPermission = {};
if (!skipPermission) { if (!skipPermission) {
resPermission = await getUserPermission( resPermission = await getUserPermission(
{ {
text1: 'You are being requested to vote on the poll below:', text1: i18n.t('question:request_vote_poll', {
text2: `Poll: ${pollName}`, postProcess: 'capitalizeFirstChar',
text3: `Option: ${optionName}`, }),
text2: i18n.t('question:poll', {
name: pollName,
postProcess: 'capitalizeFirstChar',
}),
text3: i18n.t('question:option', {
option: optionName,
postProcess: 'capitalizeFirstChar',
}),
fee: fee.fee, fee: fee.fee,
}, },
isFromExtension isFromExtension
@ -383,7 +400,12 @@ const handleFileMessage = (event) => {
if (result) { if (result) {
resolve(result); resolve(result);
} else { } else {
reject(error || 'Failed to retrieve file'); reject(
error ||
i18n.t('question:message.error.failed_retrieve_file', {
postProcess: 'capitalizeFirstChar',
})
);
} }
} }
}; };
@ -406,20 +428,17 @@ function getFileFromContentScript(fileId) {
// Timeout to handle no response scenario // Timeout to handle no response scenario
setTimeout(() => { setTimeout(() => {
if (fileRequestResolvers.has(requestId)) { if (fileRequestResolvers.has(requestId)) {
fileRequestResolvers.get(requestId).reject('Request timed out'); fileRequestResolvers.get(requestId).reject(
i18n.t('question:message.error.timeout_request', {
postProcess: 'capitalizeFirstChar',
})
);
fileRequestResolvers.delete(requestId); // Clean up on timeout fileRequestResolvers.delete(requestId); // Clean up on timeout
} }
}, 10000); // 10-second timeout }, 10000); // 10-second timeout
}); });
} }
// function sendToSaveFilePicker(data) {
// window.postMessage({
// action: "SHOW_SAVE_FILE_PICKER",
// payload: data,
// }, "*");
// }
const responseResolvers = new Map(); const responseResolvers = new Map();
const handleMessage = (event) => { const handleMessage = (event) => {
@ -518,7 +537,11 @@ export const getUserAccount = async ({
); );
} }
} catch (error) { } catch (error) {
throw new Error('Unable to fetch user account'); throw new Error(
i18n.t('auth:message.error.unable_fetch_user_account', {
postProcess: 'capitalizeFirstChar',
})
);
} }
}; };
@ -529,7 +552,11 @@ export const encryptData = async (data, sender) => {
data64 = await fileToBase64(data?.file || data?.blob); data64 = await fileToBase64(data?.file || data?.blob);
} }
if (!data64) { if (!data64) {
throw new Error('Please include data to encrypt'); throw new Error(
i18n.t('question:message.generic.include_data_encrypt', {
postProcess: 'capitalizeFirstChar',
})
);
} }
const resKeyPair = await getKeyPair(); const resKeyPair = await getKeyPair();
const parsedData = resKeyPair; const parsedData = resKeyPair;
@ -545,7 +572,11 @@ export const encryptData = async (data, sender) => {
if (encryptDataResponse) { if (encryptDataResponse) {
return encryptDataResponse; return encryptDataResponse;
} else { } else {
throw new Error('Unable to encrypt'); throw new Error(
i18n.t('question:message.error.unable_encrypt', {
postProcess: 'capitalizeFirstChar',
})
);
} }
}; };
@ -554,13 +585,21 @@ export const encryptQortalGroupData = async (data, sender) => {
let groupId = data?.groupId; let groupId = data?.groupId;
let isAdmins = data?.isAdmins; let isAdmins = data?.isAdmins;
if (!groupId) { if (!groupId) {
throw new Error('Please provide a groupId'); throw new Error(
i18n.t('question:message.generic.provide_group_id', {
postProcess: 'capitalizeFirstChar',
})
);
} }
if (data?.file || data?.blob) { if (data?.file || data?.blob) {
data64 = await fileToBase64(data?.file || data?.blob); data64 = await fileToBase64(data?.file || data?.blob);
} }
if (!data64) { if (!data64) {
throw new Error('Please include data to encrypt'); throw new Error(
i18n.t('question:message.generic.include_data_encrypt', {
postProcess: 'capitalizeFirstChar',
})
);
} }
let secretKeyObject; let secretKeyObject;
@ -578,7 +617,12 @@ export const encryptQortalGroupData = async (data, sender) => {
const { names } = await getGroupAdmins(groupId); const { names } = await getGroupAdmins(groupId);
const publish = await getPublishesFromAdmins(names, groupId); const publish = await getPublishesFromAdmins(names, groupId);
if (publish === false) throw new Error('No group key found.'); if (publish === false)
throw new Error(
i18n.t('question:message.error.no_group_key', {
postProcess: 'capitalizeFirstChar',
})
);
const url = await createEndpoint( const url = await createEndpoint(
`/arbitrary/DOCUMENT_PRIVATE/${publish.name}/${ `/arbitrary/DOCUMENT_PRIVATE/${publish.name}/${
publish.identifier publish.identifier
@ -594,7 +638,11 @@ export const encryptQortalGroupData = async (data, sender) => {
const decryptedKeyToObject = uint8ArrayToObject(dataint8Array); const decryptedKeyToObject = uint8ArrayToObject(dataint8Array);
if (!validateSecretKey(decryptedKeyToObject)) if (!validateSecretKey(decryptedKeyToObject))
throw new Error('SecretKey is not valid'); throw new Error(
i18n.t('auth:message.error.invalid_secret_key', {
postProcess: 'capitalizeFirstChar',
})
);
secretKeyObject = decryptedKeyToObject; secretKeyObject = decryptedKeyToObject;
groupSecretkeys[groupId] = { groupSecretkeys[groupId] = {
secretKeyObject, secretKeyObject,
@ -615,7 +663,12 @@ export const encryptQortalGroupData = async (data, sender) => {
const { names } = await getGroupAdmins(groupId); const { names } = await getGroupAdmins(groupId);
const publish = await getPublishesFromAdminsAdminSpace(names, groupId); const publish = await getPublishesFromAdminsAdminSpace(names, groupId);
if (publish === false) throw new Error('No group key found.'); if (publish === false)
throw new Error(
i18n.t('question:message.error.no_group_key', {
postProcess: 'capitalizeFirstChar',
})
);
const url = await createEndpoint( const url = await createEndpoint(
`/arbitrary/DOCUMENT_PRIVATE/${publish.name}/${ `/arbitrary/DOCUMENT_PRIVATE/${publish.name}/${
publish.identifier publish.identifier
@ -629,7 +682,11 @@ export const encryptQortalGroupData = async (data, sender) => {
const decryptedKeyToObject = uint8ArrayToObject(dataint8Array); const decryptedKeyToObject = uint8ArrayToObject(dataint8Array);
if (!validateSecretKey(decryptedKeyToObject)) if (!validateSecretKey(decryptedKeyToObject))
throw new Error('SecretKey is not valid'); throw new Error(
i18n.t('auth:message.error.invalid_secret_key', {
postProcess: 'capitalizeFirstChar',
})
);
secretKeyObject = decryptedKeyToObject; secretKeyObject = decryptedKeyToObject;
groupSecretkeys[`admins-${groupId}`] = { groupSecretkeys[`admins-${groupId}`] = {
secretKeyObject, secretKeyObject,
@ -646,7 +703,11 @@ export const encryptQortalGroupData = async (data, sender) => {
if (resGroupEncryptedResource) { if (resGroupEncryptedResource) {
return resGroupEncryptedResource; return resGroupEncryptedResource;
} else { } else {
throw new Error('Unable to encrypt'); throw new Error(
i18n.t('question:message.error.unable_encrypt', {
postProcess: 'capitalizeFirstChar',
})
);
} }
}; };
@ -655,11 +716,19 @@ export const decryptQortalGroupData = async (data, sender) => {
let groupId = data?.groupId; let groupId = data?.groupId;
let isAdmins = data?.isAdmins; let isAdmins = data?.isAdmins;
if (!groupId) { if (!groupId) {
throw new Error('Please provide a groupId'); throw new Error(
i18n.t('question:message.generic.provide_group_id', {
postProcess: 'capitalizeFirstChar',
})
);
} }
if (!data64) { if (!data64) {
throw new Error('Please include data to encrypt'); throw new Error(
i18n.t('question:message.generic.include_data_encrypt', {
postProcess: 'capitalizeFirstChar',
})
);
} }
let secretKeyObject; let secretKeyObject;
@ -676,7 +745,12 @@ export const decryptQortalGroupData = async (data, sender) => {
const { names } = await getGroupAdmins(groupId); const { names } = await getGroupAdmins(groupId);
const publish = await getPublishesFromAdmins(names, groupId); const publish = await getPublishesFromAdmins(names, groupId);
if (publish === false) throw new Error('No group key found.'); if (publish === false)
throw new Error(
i18n.t('question:message.error.no_group_key', {
postProcess: 'capitalizeFirstChar',
})
);
const url = await createEndpoint( const url = await createEndpoint(
`/arbitrary/DOCUMENT_PRIVATE/${publish.name}/${ `/arbitrary/DOCUMENT_PRIVATE/${publish.name}/${
publish.identifier publish.identifier
@ -690,7 +764,11 @@ export const decryptQortalGroupData = async (data, sender) => {
const dataint8Array = base64ToUint8Array(decryptedKey.data); const dataint8Array = base64ToUint8Array(decryptedKey.data);
const decryptedKeyToObject = uint8ArrayToObject(dataint8Array); const decryptedKeyToObject = uint8ArrayToObject(dataint8Array);
if (!validateSecretKey(decryptedKeyToObject)) if (!validateSecretKey(decryptedKeyToObject))
throw new Error('SecretKey is not valid'); throw new Error(
i18n.t('auth:message.error.invalid_secret_key', {
postProcess: 'capitalizeFirstChar',
})
);
secretKeyObject = decryptedKeyToObject; secretKeyObject = decryptedKeyToObject;
groupSecretkeys[groupId] = { groupSecretkeys[groupId] = {
secretKeyObject, secretKeyObject,
@ -710,7 +788,12 @@ export const decryptQortalGroupData = async (data, sender) => {
const { names } = await getGroupAdmins(groupId); const { names } = await getGroupAdmins(groupId);
const publish = await getPublishesFromAdminsAdminSpace(names, groupId); const publish = await getPublishesFromAdminsAdminSpace(names, groupId);
if (publish === false) throw new Error('No group key found.'); if (publish === false)
throw new Error(
i18n.t('question:message.error.no_group_key', {
postProcess: 'capitalizeFirstChar',
})
);
const url = await createEndpoint( const url = await createEndpoint(
`/arbitrary/DOCUMENT_PRIVATE/${publish.name}/${ `/arbitrary/DOCUMENT_PRIVATE/${publish.name}/${
publish.identifier publish.identifier
@ -724,7 +807,11 @@ export const decryptQortalGroupData = async (data, sender) => {
const dataint8Array = base64ToUint8Array(decryptedKey.data); const dataint8Array = base64ToUint8Array(decryptedKey.data);
const decryptedKeyToObject = uint8ArrayToObject(dataint8Array); const decryptedKeyToObject = uint8ArrayToObject(dataint8Array);
if (!validateSecretKey(decryptedKeyToObject)) if (!validateSecretKey(decryptedKeyToObject))
throw new Error('SecretKey is not valid'); throw new Error(
i18n.t('auth:message.error.invalid_secret_key', {
postProcess: 'capitalizeFirstChar',
})
);
secretKeyObject = decryptedKeyToObject; secretKeyObject = decryptedKeyToObject;
groupSecretkeys[`admins-${groupId}`] = { groupSecretkeys[`admins-${groupId}`] = {
secretKeyObject, secretKeyObject,
@ -741,7 +828,11 @@ export const decryptQortalGroupData = async (data, sender) => {
if (resGroupDecryptResource) { if (resGroupDecryptResource) {
return resGroupDecryptResource; return resGroupDecryptResource;
} else { } else {
throw new Error('Unable to decrypt'); throw new Error(
i18n.t('question:message.error.unable_encrypt', {
postProcess: 'capitalizeFirstChar',
})
);
} }
}; };
@ -752,7 +843,11 @@ export const encryptDataWithSharingKey = async (data, sender) => {
data64 = await fileToBase64(data?.file || data?.blob); data64 = await fileToBase64(data?.file || data?.blob);
} }
if (!data64) { if (!data64) {
throw new Error('Please include data to encrypt'); throw new Error(
i18n.t('question:message.generic.include_data_encrypt', {
postProcess: 'capitalizeFirstChar',
})
);
} }
const symmetricKey = createSymmetricKeyAndNonce(); const symmetricKey = createSymmetricKeyAndNonce();
const dataObject = { const dataObject = {
@ -776,7 +871,11 @@ export const encryptDataWithSharingKey = async (data, sender) => {
if (encryptDataResponse) { if (encryptDataResponse) {
return encryptDataResponse; return encryptDataResponse;
} else { } else {
throw new Error('Unable to encrypt'); throw new Error(
i18n.t('question:message.error.unable_encrypt', {
postProcess: 'capitalizeFirstChar',
})
);
} }
}; };
@ -784,22 +883,36 @@ export const decryptDataWithSharingKey = async (data, sender) => {
const { encryptedData, key } = data; const { encryptedData, key } = data;
if (!encryptedData) { if (!encryptedData) {
throw new Error('Please include data to decrypt'); throw new Error(
i18n.t('question:message.generic.include_data_decrypt', {
postProcess: 'capitalizeFirstChar',
})
);
} }
const decryptedData = await decryptGroupEncryptionWithSharingKey({ const decryptedData = await decryptGroupEncryptionWithSharingKey({
data64EncryptedData: encryptedData, data64EncryptedData: encryptedData,
key, key,
}); });
const base64ToObject = JSON.parse(atob(decryptedData)); const base64ToObject = JSON.parse(atob(decryptedData));
if (!base64ToObject.data) if (!base64ToObject.data)
throw new Error('No data in the encrypted resource'); throw new Error(
i18n.t('question:message.error.no_data_encrypted_resource', {
postProcess: 'capitalizeFirstChar',
})
);
return base64ToObject.data; return base64ToObject.data;
}; };
export const getHostedData = async (data, isFromExtension) => { export const getHostedData = async (data, isFromExtension) => {
const isGateway = await isRunningGateway(); const isGateway = await isRunningGateway();
if (isGateway) { if (isGateway) {
throw new Error('This action cannot be done through a public node'); throw new Error(
i18n.t('question:message.generic.no_action_public_node', {
postProcess: 'capitalizeFirstChar',
})
);
} }
const resPermission = await getUserPermission( const resPermission = await getUserPermission(
{ {
@ -825,14 +938,22 @@ export const getHostedData = async (data, isFromExtension) => {
const dataResponse = await response.json(); const dataResponse = await response.json();
return dataResponse; return dataResponse;
} else { } else {
throw new Error('User declined to get list of hosted resources'); throw new Error(
i18n.t('question:message.generic.user_declined_list', {
postProcess: 'capitalizeFirstChar',
})
);
} }
}; };
export const deleteHostedData = async (data, isFromExtension) => { export const deleteHostedData = async (data, isFromExtension) => {
const isGateway = await isRunningGateway(); const isGateway = await isRunningGateway();
if (isGateway) { if (isGateway) {
throw new Error('This action cannot be done through a public node'); throw new Error(
i18n.t('question:message.generic.no_action_public_node', {
postProcess: 'capitalizeFirstChar',
})
);
} }
const requiredFields = ['hostedData']; const requiredFields = ['hostedData'];
const missingFields: string[] = []; const missingFields: string[] = [];
@ -865,13 +986,17 @@ export const deleteHostedData = async (data, isFromExtension) => {
}, },
}); });
} catch (error) { } catch (error) {
//error console.log(error);
} }
} }
return true; return true;
} else { } else {
throw new Error('User declined delete hosted resources'); throw new Error(
i18n.t('question:message.generic.user_declined_delete', {
postProcess: 'capitalizeFirstChar',
})
);
} }
}; };
export const decryptData = async (data) => { export const decryptData = async (data) => {
@ -912,13 +1037,21 @@ export const decryptData = async (data) => {
const decryptedDataToBase64 = uint8ArrayToBase64(decryptedData); const decryptedDataToBase64 = uint8ArrayToBase64(decryptedData);
return decryptedDataToBase64; return decryptedDataToBase64;
} }
throw new Error('Unable to decrypt'); throw new Error(
i18n.t('question:message.error.unable_encrypt', {
postProcess: 'capitalizeFirstChar',
})
);
}; };
export const getListItems = async (data, isFromExtension) => { export const getListItems = async (data, isFromExtension) => {
const isGateway = await isRunningGateway(); const isGateway = await isRunningGateway();
if (isGateway) { if (isGateway) {
throw new Error('This action cannot be done through a public node'); throw new Error(
i18n.t('question:message.generic.no_action_public_node', {
postProcess: 'capitalizeFirstChar',
})
);
} }
const requiredFields = ['list_name']; const requiredFields = ['list_name'];
const missingFields: string[] = []; const missingFields: string[] = [];
@ -975,7 +1108,11 @@ export const getListItems = async (data, isFromExtension) => {
export const addListItems = async (data, isFromExtension) => { export const addListItems = async (data, isFromExtension) => {
const isGateway = await isRunningGateway(); const isGateway = await isRunningGateway();
if (isGateway) { if (isGateway) {
throw new Error('This action cannot be done through a public node'); throw new Error(
i18n.t('question:message.generic.no_action_public_node', {
postProcess: 'capitalizeFirstChar',
})
);
} }
const requiredFields = ['list_name', 'items']; const requiredFields = ['list_name', 'items'];
const missingFields: string[] = []; const missingFields: string[] = [];
@ -1033,7 +1170,11 @@ export const addListItems = async (data, isFromExtension) => {
export const deleteListItems = async (data, isFromExtension) => { export const deleteListItems = async (data, isFromExtension) => {
const isGateway = await isRunningGateway(); const isGateway = await isRunningGateway();
if (isGateway) { if (isGateway) {
throw new Error('This action cannot be done through a public node'); throw new Error(
i18n.t('question:message.generic.no_action_public_node', {
postProcess: 'capitalizeFirstChar',
})
);
} }
const requiredFields = ['list_name']; const requiredFields = ['list_name'];
const missingFields: string[] = []; const missingFields: string[] = [];
@ -2741,7 +2882,11 @@ function calculateRateFromFee(totalFee, sizeInBytes) {
export const updateForeignFee = async (data, isFromExtension) => { export const updateForeignFee = async (data, isFromExtension) => {
const isGateway = await isRunningGateway(); const isGateway = await isRunningGateway();
if (isGateway) { if (isGateway) {
throw new Error('This action cannot be done through a public node'); throw new Error(
i18n.t('question:message.generic.no_action_public_node', {
postProcess: 'capitalizeFirstChar',
})
);
} }
const requiredFields = ['coin', 'type', 'value']; const requiredFields = ['coin', 'type', 'value'];
const missingFields: string[] = []; const missingFields: string[] = [];
@ -2864,7 +3009,11 @@ export const getServerConnectionHistory = async (data) => {
export const setCurrentForeignServer = async (data, isFromExtension) => { export const setCurrentForeignServer = async (data, isFromExtension) => {
const isGateway = await isRunningGateway(); const isGateway = await isRunningGateway();
if (isGateway) { if (isGateway) {
throw new Error('This action cannot be done through a public node'); throw new Error(
i18n.t('question:message.generic.no_action_public_node', {
postProcess: 'capitalizeFirstChar',
})
);
} }
const requiredFields = ['coin']; const requiredFields = ['coin'];
const missingFields: string[] = []; const missingFields: string[] = [];
@ -2939,7 +3088,11 @@ export const setCurrentForeignServer = async (data, isFromExtension) => {
export const addForeignServer = async (data, isFromExtension) => { export const addForeignServer = async (data, isFromExtension) => {
const isGateway = await isRunningGateway(); const isGateway = await isRunningGateway();
if (isGateway) { if (isGateway) {
throw new Error('This action cannot be done through a public node'); throw new Error(
i18n.t('question:message.generic.no_action_public_node', {
postProcess: 'capitalizeFirstChar',
})
);
} }
const requiredFields = ['coin']; const requiredFields = ['coin'];
const missingFields: string[] = []; const missingFields: string[] = [];
@ -3014,7 +3167,11 @@ export const addForeignServer = async (data, isFromExtension) => {
export const removeForeignServer = async (data, isFromExtension) => { export const removeForeignServer = async (data, isFromExtension) => {
const isGateway = await isRunningGateway(); const isGateway = await isRunningGateway();
if (isGateway) { if (isGateway) {
throw new Error('This action cannot be done through a public node'); throw new Error(
i18n.t('question:message.generic.no_action_public_node', {
postProcess: 'capitalizeFirstChar',
})
);
} }
const requiredFields = ['coin']; const requiredFields = ['coin'];
const missingFields: string[] = []; const missingFields: string[] = [];
@ -4093,12 +4250,21 @@ export const openNewTab = async (data, isFromExtension) => {
const res = extractComponents(data.qortalLink); const res = extractComponents(data.qortalLink);
if (res) { if (res) {
const { service, name, identifier, path } = res; const { service, name, identifier, path } = res;
if (!service && !name) throw new Error('Invalid qortal link'); if (!service && !name)
throw new Error(
i18n.t('auth:message.error.invalid_qortal_link', {
postProcess: 'capitalizeFirstChar',
})
);
executeEvent('addTab', { data: { service, name, identifier, path } }); executeEvent('addTab', { data: { service, name, identifier, path } });
executeEvent('open-apps-mode', {}); executeEvent('open-apps-mode', {});
return true; return true;
} else { } else {
throw new Error('Invalid qortal link'); throw new Error(
i18n.t('auth:message.error.invalid_qortal_link', {
postProcess: 'capitalizeFirstChar',
})
);
} }
}; };
@ -4128,7 +4294,11 @@ export const adminAction = async (data, isFromExtension) => {
} }
const isGateway = await isRunningGateway(); const isGateway = await isRunningGateway();
if (isGateway) { if (isGateway) {
throw new Error('This action cannot be done through a public node'); throw new Error(
i18n.t('question:message.generic.no_action_public_node', {
postProcess: 'capitalizeFirstChar',
})
);
} }
let apiEndpoint = ''; let apiEndpoint = '';