From 2be7d8e06640f0d49f8644436f60dce7f2803441 Mon Sep 17 00:00:00 2001 From: AuroraHuang22 Date: Thu, 19 Oct 2023 18:46:49 +0800 Subject: [PATCH 1/6] =?UTF-8?q?=E2=9C=8F=EF=B8=8F=20Add=20sameAs=20prefix?= =?UTF-8?q?=20for=20filetypeOptions?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/SameAsFieldList.vue | 20 ++++++++++---------- constant/index.ts | 2 +- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/components/SameAsFieldList.vue b/components/SameAsFieldList.vue index 42cf2afa..851c9600 100644 --- a/components/SameAsFieldList.vue +++ b/components/SameAsFieldList.vue @@ -25,8 +25,8 @@ @@ -68,7 +68,7 @@ From 3a91e262c3bab8c00672cf5384e80c239001a0d2 Mon Sep 17 00:00:00 2001 From: AuroraHuang22 Date: Thu, 19 Oct 2023 19:32:28 +0800 Subject: [PATCH 3/6] =?UTF-8?q?=E2=99=BB=EF=B8=8F=20Improve=20formatting?= =?UTF-8?q?=20of=20generateData?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/IscnUploadedInfo.vue | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/components/IscnUploadedInfo.vue b/components/IscnUploadedInfo.vue index ae87d5c2..ff315363 100644 --- a/components/IscnUploadedInfo.vue +++ b/components/IscnUploadedInfo.vue @@ -238,20 +238,11 @@ export default class IscnUploadedInfo extends Vue { } handleClickDownload() { - const { url, name, keywords, usageInfo, author, description, sameAs } = - this.metadata const generateData = { contentMetadata: { - url, - name, + ...this.metadata, '@type': this.type, - version: 1, '@context': "http://schema.org/", - keywords, - usageInfo, - author, - description, - sameAs, }, stakeholders: this.recordData?.stakeholders, contentFingerprints: this.contentFingerprints, From c461a20ecf5890c3521bed97648a02174e84911e Mon Sep 17 00:00:00 2001 From: AuroraHuang22 Date: Thu, 19 Oct 2023 19:50:47 +0800 Subject: [PATCH 4/6] =?UTF-8?q?=F0=9F=9A=B8=20Format=20sameAs=20default=20?= =?UTF-8?q?filename?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/IscnRegisterForm.vue | 1 - components/SameAsFieldList.vue | 18 ++++++++++++++---- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/components/IscnRegisterForm.vue b/components/IscnRegisterForm.vue index 890fa86c..98539034 100644 --- a/components/IscnRegisterForm.vue +++ b/components/IscnRegisterForm.vue @@ -1183,7 +1183,6 @@ export default class IscnRegisterForm extends Vue { confirmSameAsChange(value: any) { logTrackerEvent(this, 'ISCNCreate', 'ConfirmSameAsChange', '', 1); - console.log('value',value) this.sameAsList = value this.isOpenSameAsDialog = false } diff --git a/components/SameAsFieldList.vue b/components/SameAsFieldList.vue index 851c9600..aeedeaf3 100644 --- a/components/SameAsFieldList.vue +++ b/components/SameAsFieldList.vue @@ -92,8 +92,18 @@ export default class WalletFieldList extends Vue { return SAME_AS_FILE_TYPES } - get formatName(){ - return this.name ? this.name.toUpperCase() : '' + get formatName() { + if (!this.name) { + return ''; + } + if (/[\u4E00-\u9FA5]/.test(this.name)) { + return this.name; + } + return this.name.replace(/[.,!?;:'"(){}[\]<>]/g, '').replace(/\s+/g, '_').toUpperCase(); + } + + get formatUrlOptions() { + return this.urlOptions.filter(url => url.startsWith('ar://')) } mounted() { @@ -104,8 +114,8 @@ export default class WalletFieldList extends Vue { filename: list.filename, filetype: list.filetype || SAME_AS_FILE_TYPES[0], })) - } else if (this.urlOptions.length) { - this.sameAsList = this.urlOptions.map((url, index) => ({ + } else if (this.formatUrlOptions.length) { + this.sameAsList = this.formatUrlOptions.map((url, index) => ({ url, id: `${url}-${index}`, filename: this.formatName, From bddcc097841e499ebcec26b9e255fec8d76fd859 Mon Sep 17 00:00:00 2001 From: AuroraHuang22 Date: Thu, 19 Oct 2023 21:27:17 +0800 Subject: [PATCH 5/6] =?UTF-8?q?=F0=9F=9A=B8=20Automatically=20detect=20boo?= =?UTF-8?q?k=20type?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/IscnRegisterForm.vue | 1 + 1 file changed, 1 insertion(+) diff --git a/components/IscnRegisterForm.vue b/components/IscnRegisterForm.vue index 98539034..7ba6da0f 100644 --- a/components/IscnRegisterForm.vue +++ b/components/IscnRegisterForm.vue @@ -852,6 +852,7 @@ export default class IscnRegisterForm extends Vue { get defaultType() { if (this.isPhoto) return 'Photo' if (this.isImage) return 'Image' + if (this.fileType === 'application/pdf' || this.fileType === 'application/epub+zip') return 'Book' return 'CreativeWork' } From 6dfd382e23d7cae8603bb3c0aa269b9a68d429ed Mon Sep 17 00:00:00 2001 From: AuroraHuang22 Date: Thu, 19 Oct 2023 23:05:39 +0800 Subject: [PATCH 6/6] =?UTF-8?q?=F0=9F=9A=B8=20Store=20more=20efficient=20l?= =?UTF-8?q?icense=20information?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/IscnRegisterForm.vue | 43 ++++++++++++++++++++++----------- 1 file changed, 29 insertions(+), 14 deletions(-) diff --git a/components/IscnRegisterForm.vue b/components/IscnRegisterForm.vue index 7ba6da0f..83352992 100644 --- a/components/IscnRegisterForm.vue +++ b/components/IscnRegisterForm.vue @@ -353,11 +353,16 @@ class="mb-[12px]" > + @@ -745,11 +750,6 @@ export default class IscnRegisterForm extends Vue { 'CreativeWork', ] - licenseOptions = [ - 'Copyright. All rights reserved.', - 'CC BY 4.0', - ] - fileTypeOptions = [ 'epub', 'pdf', @@ -758,6 +758,12 @@ export default class IscnRegisterForm extends Vue { 'png', ] + licenseMap: { [key: string]: string | null }= { + 'Copyright. All rights reserved.': 'All Rights Reserved', + 'CC BY 4.0': 'https://creativecommons.org/licenses/by/4.0/', + 'Other': null, + } + author: Author = { name: '', url: [], @@ -773,6 +779,7 @@ export default class IscnRegisterForm extends Vue { sameAs: string[] = [] url: string = '' license: string = this.licenseOptions[0] + customLicense: string = '' authorName: string = '' authorUrl: string[] = [] authorWalletAddress: string[] = [] @@ -885,13 +892,21 @@ export default class IscnRegisterForm extends Vue { } get formattedSameAsList() { - return this.sameAsList.map((sameAs: { filename: any; filetype: any; url: any }) => { - if (sameAs.filename && sameAs.filetype) { - return `${sameAs.url}?name=${sameAs.filename}.${sameAs.filetype}`; - } - return ''; - }); -} + return this.sameAsList.map((sameAs: { filename: any; filetype: any; url: any }) => { + if (sameAs.filename && sameAs.filetype) { + return `${sameAs.url}?name=${sameAs.filename}.${sameAs.filetype}`; + } + return ''; + }); + } + + get licenseOptions() { + return Object.keys(this.licenseMap) + } + + get formattedLicense() { + return this.licenseMap[this.license] || this.customLicense; + } get errorMsg() { switch (this.error) { @@ -965,7 +980,7 @@ export default class IscnRegisterForm extends Vue { sameAs: this.formattedSameAsList, url: this.url, exifInfo: this.exif, - license: this.license, + license: this.formattedLicense, ipfsHash: this.uploadIpfsHash || this.ipfsHash, arweaveId: this.uploadArweaveId || this.arweaveId, numbersProtocolAssetId: this.numbersProtocolAssetId,