Merge branch 'develop' into feature/large-files-and-names

This commit is contained in:
nico.benaz 2025-05-24 14:13:01 +02:00 committed by GitHub
commit 5f0b5ec4ef
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 26 additions and 6 deletions

View File

@ -148,6 +148,11 @@ export const encryptAndPublishSymmetricKeyGroupChat = async ({
service: 'DOCUMENT_PRIVATE', service: 'DOCUMENT_PRIVATE',
identifier: `symmetric-qchat-group-${groupId}`, identifier: `symmetric-qchat-group-${groupId}`,
uploadType: 'base64', uploadType: 'base64',
file: encryptedData,
service: 'DOCUMENT_PRIVATE',
identifier: `symmetric-qchat-group-${groupId}`,
uploadType: 'file',
isBase64: true,
withFee: true, withFee: true,
}); });
return { return {
@ -215,6 +220,9 @@ export const encryptAndPublishSymmetricKeyGroupChatForAdmins = async ({
service: 'DOCUMENT_PRIVATE', service: 'DOCUMENT_PRIVATE',
identifier: `admins-symmetric-qchat-group-${groupId}`, identifier: `admins-symmetric-qchat-group-${groupId}`,
uploadType: 'base64', uploadType: 'base64',
file: encryptedData,
uploadType: 'file',
isBase64: true,
withFee: true, withFee: true,
}); });
return { return {
@ -249,9 +257,11 @@ export const publishGroupEncryptedResource = async ({
const data = await publishData({ const data = await publishData({
registeredName, registeredName,
data: encryptedData, data: encryptedData,
uploadType: 'base64',
file: encryptedData,
service: 'DOCUMENT', service: 'DOCUMENT',
identifier, identifier,
uploadType: 'base64', isBase64: true,
withFee: true, withFee: true,
}); });
return data; return data;
@ -284,6 +294,9 @@ export const publishOnQDN = async ({
}) => { }) => {
if (data && service) { if (data && service) {
const registeredName = name || (await getNameInfo()); const registeredName = name || (await getNameInfo());
}) => {
if (data && service) {
const registeredName = await getNameInfo();
if (!registeredName) if (!registeredName)
throw new Error( throw new Error(
i18n.t('core:message.generic.name_publish', { i18n.t('core:message.generic.name_publish', {
@ -294,9 +307,11 @@ export const publishOnQDN = async ({
const res = await publishData({ const res = await publishData({
registeredName, registeredName,
data, data,
file: data,
service, service,
identifier, identifier,
uploadType, uploadType,
isBase64: true,
withFee: true, withFee: true,
title, title,
description, description,

View File

@ -83,25 +83,29 @@ async function getKeyPair() {
} }
export const publishData = async ({ export const publishData = async ({
category,
data, data,
description,
feeAmount, feeAmount,
filename, filename,
identifier, identifier,
isBase64, isBase64,
registeredName, registeredName,
file,
service, service,
identifier,
uploadType,
withFee,
title,
description,
category,
tag1, tag1,
tag2, tag2,
tag3, tag3,
tag4, tag4,
tag5, tag5,
title,
uploadType,
withFee,
}: any) => { }: any) => {
console.log('data', data); console.log('data', data);
feeAmount,
}: any) => {
const validateName = async (receiverName: string) => { const validateName = async (receiverName: string) => {
return await reusableGet(`/names/${receiverName}`); return await reusableGet(`/names/${receiverName}`);
}; };
@ -228,6 +232,7 @@ export const publishData = async ({
let transactionBytes = await uploadData(registeredName, data, fee); let transactionBytes = await uploadData(registeredName, data, fee);
console.log('transactionBytes length', transactionBytes?.length); console.log('transactionBytes length', transactionBytes?.length);
if (!transactionBytes || transactionBytes.error) { if (!transactionBytes || transactionBytes.error) {
throw new Error(transactionBytes?.message || 'Error when uploading'); throw new Error(transactionBytes?.message || 'Error when uploading');
} else if (transactionBytes.includes('Error 500 Internal Server Error')) { } else if (transactionBytes.includes('Error 500 Internal Server Error')) {