diff --git a/components/IscnRegisterForm.vue b/components/IscnRegisterForm.vue
index d818b144..51a97ccf 100644
--- a/components/IscnRegisterForm.vue
+++ b/components/IscnRegisterForm.vue
@@ -594,6 +594,7 @@
@@ -1005,7 +1006,7 @@ export default class IscnRegisterForm extends Vue {
authorDescriptions: this.authorDescriptions,
contentFingerprints: this.customContentFingerprints,
inLanguage: this.language,
- thumbnail: this.epubMetadata.thumbnail,
+ thumbnailUrl: this.epubMetadata?.thumbnailUrl,
}
}
diff --git a/components/IscnUploadForm.vue b/components/IscnUploadForm.vue
index bdc8c72e..507431ff 100644
--- a/components/IscnUploadForm.vue
+++ b/components/IscnUploadForm.vue
@@ -264,7 +264,7 @@ import ePub from 'epubjs';
import { OfflineSigner } from '@cosmjs/proto-signing'
-import { IS_CHAIN_UPGRADING, UPLOAD_FILESIZE_MAX, IPFS_VIEW_GATEWAY_URL } from '~/constant'
+import { IS_CHAIN_UPGRADING, UPLOAD_FILESIZE_MAX } from '~/constant'
import { logTrackerEvent } from '~/utils/logger'
import { estimateBundlrFilePrice, uploadSingleFileToBundlr } from '~/utils/arweave/v2'
import {
@@ -566,13 +566,6 @@ export default class UploadForm extends Vue {
}
epubMetadata.ipfsHash = ipfsHash
- epubMetadata.thumbnail = {
- "@type": "ImageObject",
- url: `${IPFS_VIEW_GATEWAY_URL}${ipfsHash}`,
- name: `${file.name}_cover`,
- description: `${file.name}_cover`,
- encodingFormat: "image/jpeg",
- };
const reader = new FileReader()
reader.onload = (e) => {
@@ -670,7 +663,7 @@ export default class UploadForm extends Vue {
this.sentArweaveTransactionHashes.set(ipfsHash, { transactionHash: '', arweaveId });
const metadata = this.epubMetadataList.find((data: any) => data.ipfsHash === ipfsHash)
if (metadata) {
- metadata.thumbnail.contentUrl = `https://arweave.net/${arweaveId}`;
+ metadata.thumbnailUrl = `ar://${arweaveId}`;
}
}
if (!this.arweaveFeeTargetAddress) {
@@ -748,8 +741,8 @@ export default class UploadForm extends Vue {
const uploadedData = this.sentArweaveTransactionHashes.get(records.ipfsHash) || {};
this.sentArweaveTransactionHashes.set(records.ipfsHash, { ...uploadedData, arweaveId });
if (tempRecord.fileName === 'cover.jpeg') {
- const metadata = this.epubMetadataList.find((file: any) => file.ipfsHash === records.thumbnail.url)
- metadata.thumbnail.contentUrl = `https://arweave.net/${arweaveId}`
+ const metadata = this.epubMetadataList.find((file: any) => file.ipfsHash === records.ipfsHash)
+ metadata.thumbnailUrl = `ar://${arweaveId}`
}
this.$emit('arweaveUploaded', { arweaveId })
this.isOpenSignDialog = false
@@ -805,6 +798,16 @@ export default class UploadForm extends Vue {
}
const uploadArweaveIdList = Array.from(this.sentArweaveTransactionHashes.values()).map(entry => entry.arweaveId);
+ this.fileRecords.forEach((record: any, index:number) => {
+ if (this.sentArweaveTransactionHashes.has(record.ipfsHash)) {
+ const arweaveId = this.sentArweaveTransactionHashes.get(
+ record.ipfsHash,
+ )?.arweaveId
+ if (arweaveId) {
+ this.fileRecords[index].arweaveId = `ar://${arweaveId}`
+ }
+ }
+ })
this.$emit('submit', { fileRecords: this.fileRecords, arweaveIds: uploadArweaveIdList, epubMetadata: this.epubMetadataList[0] })
}
diff --git a/components/SameAsFieldList.vue b/components/SameAsFieldList.vue
index ce882d65..243d09d8 100644
--- a/components/SameAsFieldList.vue
+++ b/components/SameAsFieldList.vue
@@ -16,13 +16,13 @@
-
+
-
+
handleSelectValue({ value, index: i })"
/>
+
@Prop({ default: () => [] }) readonly currentList!: Array
+ @Prop({ default: () => [] }) readonly fileRecords!: Array
@Prop(String) readonly name!: string | undefined
sameAsList: any = [{
@@ -112,20 +120,27 @@ export default class WalletFieldList extends Vue {
id: `${list.url}-${list.filename}`,
filename: list.filename,
filetype: list.filetype || SAME_AS_FILE_TYPES[0],
+ originFileName: list.originFileName,
}))
} else if (this.formatUrlOptions.length) {
- this.sameAsList = this.formatUrlOptions.map((url, index) => ({
- url,
- id: `${url}-${index}`,
- filename: this.formatName,
- filetype: SAME_AS_FILE_TYPES[0],
- }))
+ this.sameAsList = this.formatUrlOptions.map((url, index) =>{
+ const originFile = this.fileRecords.find((file) => (file.arweaveId === url))
+ const formattedFileType = this.formatFileType(originFile.fileType);
+ return{
+ url,
+ id: `${url}-${index}`,
+ filename: this.formatName,
+ filetype: formattedFileType || SAME_AS_FILE_TYPES[0],
+ originFileName: originFile.fileName,
+ }
+ })
} else {
this.sameAsList = [{
url: '',
id: 1,
filename: this.formatName,
filetype: SAME_AS_FILE_TYPES[0],
+ originFileName:'',
}]
}
}
@@ -159,5 +174,34 @@ export default class WalletFieldList extends Vue {
this.deleteEmptyField()
this.$emit('onConfirm', this.sameAsList)
}
+
+ // eslint-disable-next-line class-methods-use-this
+ formatFileType(fileType: string) {
+ let formattedFileType = ''
+ if (fileType) {
+ switch (true) {
+ case fileType.includes('jpg'):
+ case fileType.includes('jpeg'):
+ formattedFileType = 'jpg'
+ break
+ case fileType.includes('png'):
+ formattedFileType = 'png'
+ break
+ case fileType.includes('audio'):
+ formattedFileType = 'mp3'
+ break
+ case fileType.includes('pdf'):
+ formattedFileType = 'pdf'
+ break
+ case fileType.includes('epub'):
+ formattedFileType = 'epub'
+ break
+ default:
+ formattedFileType = ''
+ break
+ }
+ }
+ return formattedFileType
+ }
}
diff --git a/locales/en.json b/locales/en.json
index 8eed747d..3b57682b 100644
--- a/locales/en.json
+++ b/locales/en.json
@@ -216,6 +216,7 @@
"IscnRegisterForm.label.name": "Name",
"IscnRegisterForm.label.fileName": "File name",
"IscnRegisterForm.label.fileType": "File type",
+ "IscnRegisterForm.label.originFile": "origin file: {name}",
"IscnRegisterForm.label.numbersProtocol": "Numbers Protocol",
"IscnRegisterForm.label.numbersProtocol.details": "Register your image asset in {link}",
"IscnRegisterForm.label.numbersProtocol.details.link": "Numbers Protocol",
diff --git a/utils/cosmos/iscn/iscn.type.ts b/utils/cosmos/iscn/iscn.type.ts
index 377bdffa..42bd0afa 100644
--- a/utils/cosmos/iscn/iscn.type.ts
+++ b/utils/cosmos/iscn/iscn.type.ts
@@ -25,7 +25,7 @@ export interface ISCNRegisterPayload {
recordNotes?: string;
memo?: string;
inLanguage?: string;
- thumbnail?: any;
+ thumbnailUrl?: string;
}
export interface ISCNRecordWithID extends ISCNRecord {
id: string;