From d2b97697781c350ab68f60b9250aa7ac170a594c Mon Sep 17 00:00:00 2001 From: William Chong Date: Fri, 16 Feb 2024 19:39:48 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=F0=9F=8E=A8=20Rename=20confusing=20name=20?= =?UTF-8?q?regarding=20epub=20thumbnail?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/IscnRegisterForm.vue | 2 +- components/IscnUploadForm.vue | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/components/IscnRegisterForm.vue b/components/IscnRegisterForm.vue index 58d5b9d6..3c106de1 100644 --- a/components/IscnRegisterForm.vue +++ b/components/IscnRegisterForm.vue @@ -1121,7 +1121,7 @@ export default class IscnRegisterForm extends Vue { this.author.authorDescription = 'Author' this.language = this.epubMetadata.language this.tags = this.epubMetadata.tags - this.thumbnailUrl = this.formatArweave(this.epubMetadata.thumbnailUrl) as string + this.thumbnailUrl = this.formatArweave(this.epubMetadata.thumbnailArweaveId) as string if (this.author.name) { this.authors.push(this.author) } diff --git a/components/IscnUploadForm.vue b/components/IscnUploadForm.vue index 2032b616..950c7923 100644 --- a/components/IscnUploadForm.vue +++ b/components/IscnUploadForm.vue @@ -524,7 +524,7 @@ export default class IscnUploadForm extends Vue { Hash.of(Buffer.from(fileBytes)), ]) - epubMetadata.ipfsHash = ipfsHash + epubMetadata.thumbnailIpfsHash = ipfsHash const fileRecord: any = { fileName: coverFile.name, @@ -590,7 +590,7 @@ export default class IscnUploadForm extends Vue { const deletedFile = this.fileRecords[index]; this.fileRecords.splice(index, 1); - const indexToDelete = this.epubMetadataList.findIndex(item => item.ipfsHash === deletedFile.ipfsHashList); + const indexToDelete = this.epubMetadataList.findIndex(item => item.thumbnailIpfsHash === deletedFile.ipfsHashList); if (indexToDelete !== -1) { this.epubMetadataList.splice(indexToDelete, 1); } @@ -635,9 +635,9 @@ export default class IscnUploadForm extends Vue { } if (arweaveId) { this.sentArweaveTransactionInfo.set(ipfsHash, { transactionHash: '', arweaveId }); - const metadata = this.epubMetadataList.find((data: any) => data.ipfsHash === ipfsHash) + const metadata = this.epubMetadataList.find((data: any) => data.thumbnailIpfsHash === ipfsHash) if (metadata) { - metadata.thumbnailUrl = arweaveId; + metadata.thumbnailArweaveId = arweaveId; } } if (!this.arweaveFeeTargetAddress) { @@ -718,9 +718,9 @@ export default class IscnUploadForm extends Vue { const uploadedData = this.sentArweaveTransactionInfo.get(records.ipfsHash) || {}; this.sentArweaveTransactionInfo.set(records.ipfsHash, { ...uploadedData, arweaveId }); if (tempRecord.fileName.includes('cover.jpeg')) { - const metadata = this.epubMetadataList.find((file: any) => file.ipfsHash === records.ipfsHash) + const metadata = this.epubMetadataList.find((file: any) => file.thum === records.ipfsHash) if (metadata) { - metadata.thumbnailUrl = arweaveId + metadata.thumbnailArweaveId = arweaveId } } this.$emit('arweaveUploaded', { arweaveId }) From 5a7f79b547b647eebb00f61eddfa6d11e7ee6ae3 Mon Sep 17 00:00:00 2001 From: William Chong Date: Fri, 16 Feb 2024 19:42:30 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=F0=9F=8E=A8=20Rename=20object=20name=20fro?= =?UTF-8?q?m=20records=20to=20record?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/IscnUploadForm.vue | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/components/IscnUploadForm.vue b/components/IscnUploadForm.vue index 950c7923..e3a470aa 100644 --- a/components/IscnUploadForm.vue +++ b/components/IscnUploadForm.vue @@ -654,10 +654,10 @@ export default class IscnUploadForm extends Vue { } } - async sendArweaveFeeTx(records: any): Promise { + async sendArweaveFeeTx(record: any): Promise { logTrackerEvent(this, 'ISCNCreate', 'SendArFeeTx', '', 1); - if (this.sentArweaveTransactionInfo.has(records.ipfsHash)) { - const transactionInfo = this.sentArweaveTransactionInfo.get(records.ipfsHash); + if (this.sentArweaveTransactionInfo.has(record.ipfsHash)) { + const transactionInfo = this.sentArweaveTransactionInfo.get(record.ipfsHash); if (transactionInfo && transactionInfo.transactionHash) { return transactionInfo.transactionHash; } @@ -667,12 +667,12 @@ export default class IscnUploadForm extends Vue { if (!this.signer) throw new Error('SIGNER_NOT_INITED'); if (!this.arweaveFeeTargetAddress) throw new Error('TARGET_ADDRESS_NOT_SET'); this.uploadStatus = 'signing'; - const memo = JSON.stringify({ ipfs: records.ipfsHash, fileSize: records.fileBlob?.size || 0 }); + const memo = JSON.stringify({ ipfs: record.ipfsHash, fileSize: record.fileBlob?.size || 0 }); try { const { transactionHash } = await sendLIKE(this.address, this.arweaveFeeTargetAddress, this.arweaveFee.toFixed(), this.signer, memo); if (transactionHash) { - const existingData = this.sentArweaveTransactionInfo.get(records.ipfsHash) || {}; - this.sentArweaveTransactionInfo.set(records.ipfsHash, { ...existingData, transactionHash }); + const existingData = this.sentArweaveTransactionInfo.get(record.ipfsHash) || {}; + this.sentArweaveTransactionInfo.set(record.ipfsHash, { ...existingData, transactionHash }); return transactionHash; } @@ -687,11 +687,11 @@ export default class IscnUploadForm extends Vue { return ''; } - async submitToArweave(records: any): Promise { - const existingData = this.sentArweaveTransactionInfo.get(records.ipfsHash) || {}; + async submitToArweave(record: any): Promise { + const existingData = this.sentArweaveTransactionInfo.get(record.ipfsHash) || {}; const { transactionHash, arweaveId: uploadArweaveId } = existingData; if (uploadArweaveId) return - const tempRecord = {...records} + const tempRecord = {...record} logTrackerEvent(this, 'ISCNCreate', 'SubmitToArweave', '', 1); if (!tempRecord.fileBlob) return; this.isOpenSignDialog = true; @@ -715,10 +715,10 @@ export default class IscnUploadForm extends Vue { txHash: tempRecord.transactionHash, }); if (arweaveId) { - const uploadedData = this.sentArweaveTransactionInfo.get(records.ipfsHash) || {}; - this.sentArweaveTransactionInfo.set(records.ipfsHash, { ...uploadedData, arweaveId }); + const uploadedData = this.sentArweaveTransactionInfo.get(record.ipfsHash) || {}; + this.sentArweaveTransactionInfo.set(record.ipfsHash, { ...uploadedData, arweaveId }); if (tempRecord.fileName.includes('cover.jpeg')) { - const metadata = this.epubMetadataList.find((file: any) => file.thum === records.ipfsHash) + const metadata = this.epubMetadataList.find((file: any) => file.thum === record.ipfsHash) if (metadata) { metadata.thumbnailArweaveId = arweaveId } From 388f3d89fb624089b93e4311f48bd9d537fea826 Mon Sep 17 00:00:00 2001 From: William Chong <6198816+williamchong@users.noreply.github.com> Date: Fri, 16 Feb 2024 20:41:39 +0800 Subject: [PATCH 3/3] Update components/IscnUploadForm.vue Co-authored-by: AuroraHuang22 <75730405+AuroraHuang22@users.noreply.github.com> --- components/IscnUploadForm.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/IscnUploadForm.vue b/components/IscnUploadForm.vue index e3a470aa..5abb5400 100644 --- a/components/IscnUploadForm.vue +++ b/components/IscnUploadForm.vue @@ -718,7 +718,7 @@ export default class IscnUploadForm extends Vue { const uploadedData = this.sentArweaveTransactionInfo.get(record.ipfsHash) || {}; this.sentArweaveTransactionInfo.set(record.ipfsHash, { ...uploadedData, arweaveId }); if (tempRecord.fileName.includes('cover.jpeg')) { - const metadata = this.epubMetadataList.find((file: any) => file.thum === record.ipfsHash) + const metadata = this.epubMetadataList.find((file: any) => file.thumbnailIpfsHash === record.ipfsHash) if (metadata) { metadata.thumbnailArweaveId = arweaveId }