From 901eb28665003436acba8548927db68a7ccc0c37 Mon Sep 17 00:00:00 2001 From: Russell Dempsey <1173416+SgtPooki@users.noreply.github.com> Date: Wed, 8 Jun 2022 13:51:10 -0700 Subject: [PATCH 1/4] feat: File pinningModal shows link to compliance reports --- public/locales/en/files.json | 1 + src/constants/pinning.js | 4 ++++ src/files/modals/pinning-modal/PinningModal.js | 2 ++ 3 files changed, 7 insertions(+) diff --git a/public/locales/en/files.json b/public/locales/en/files.json index 7ae96d234..96d26822d 100644 --- a/public/locales/en/files.json +++ b/public/locales/en/files.json @@ -45,6 +45,7 @@ }, "pinningModal": { "title": "Select where you would like to pin these items.", + "complianceLabel": "Check pinning services' compliance", "footer": "Need to add or configure a pinning service? Go to <1>Settings.", "localNode": "Local node", "totalSize": "Total size: {size}" diff --git a/src/constants/pinning.js b/src/constants/pinning.js index 43923b738..5d407cfb5 100644 --- a/src/constants/pinning.js +++ b/src/constants/pinning.js @@ -1,6 +1,9 @@ // This is a list of predefined templates for popular services from the IPFS // community. We are open to reviewing PRs that add more entries here, // but only well-established and mission-aligned services will be accepted. + +const complianceReportsHomepage = 'https://ipfs-shipyard.github.io/pinning-service-compliance' + const pinningServiceTemplates = [ { name: 'Pinata', @@ -11,5 +14,6 @@ const pinningServiceTemplates = [ ] export { + complianceReportsHomepage, pinningServiceTemplates } diff --git a/src/files/modals/pinning-modal/PinningModal.js b/src/files/modals/pinning-modal/PinningModal.js index bc88cb2d7..43975075c 100644 --- a/src/files/modals/pinning-modal/PinningModal.js +++ b/src/files/modals/pinning-modal/PinningModal.js @@ -6,6 +6,7 @@ import Button from '../../../components/button/Button' import Checkbox from '../../../components/checkbox/Checkbox' import GlyphPin from '../../../icons/GlyphPin' import { Modal, ModalActions, ModalBody } from '../../../components/modal/Modal' +import { complianceReportsHomepage } from '../../../constants/pinning' import { connect } from 'redux-bundler-react' import './PinningModal.css' @@ -69,6 +70,7 @@ export const PinningModal = ({ t, tReady, onCancel, onPinningSet, file, pinningS Need to add or configure a pinning service? Go to Settings.

*/} + { t('pinningModal.complianceLabel') }

{t('pinningModal.totalSize', { size: humanSize(size) })}

From dfd6b47a35035503f34a83bf1db7b100d5301735 Mon Sep 17 00:00:00 2001 From: Russell Dempsey <1173416+SgtPooki@users.noreply.github.com> Date: Wed, 8 Jun 2022 14:10:51 -0700 Subject: [PATCH 2/4] feat: PinningManagerModal shows link to service's compliance report if available --- .../PinningManagerModal.js | 2 +- .../PinningManagerServiceModal.js | 3 ++- src/constants/pinning.js | 19 ++++++++++++++++++- 3 files changed, 21 insertions(+), 3 deletions(-) diff --git a/src/components/pinning-manager/pinning-manager-modal/PinningManagerModal.js b/src/components/pinning-manager/pinning-manager-modal/PinningManagerModal.js index 298987096..eb29ddd39 100644 --- a/src/components/pinning-manager/pinning-manager-modal/PinningManagerModal.js +++ b/src/components/pinning-manager/pinning-manager-modal/PinningManagerModal.js @@ -46,7 +46,7 @@ const PinningManagerModal = ({ t, tReady, onLeave, className, remoteServiceTempl ) diff --git a/src/components/pinning-manager/pinning-manager-service-modal/PinningManagerServiceModal.js b/src/components/pinning-manager/pinning-manager-service-modal/PinningManagerServiceModal.js index bb6a96df7..ca9c529fa 100644 --- a/src/components/pinning-manager/pinning-manager-service-modal/PinningManagerServiceModal.js +++ b/src/components/pinning-manager/pinning-manager-service-modal/PinningManagerServiceModal.js @@ -10,7 +10,7 @@ import { Modal, ModalBody, ModalActions } from '../../modal/Modal' import Button from '../../button/Button' import './PinningManagerServiceModal.css' -const PinningManagerServiceModal = ({ t, onLeave, onSuccess, className, service, tReady, doAddPinningService, nickname, apiEndpoint, visitServiceUrl, secretApiKey, ...props }) => { +const PinningManagerServiceModal = ({ t, onLeave, onSuccess, className, service, tReady, doAddPinningService, nickname, apiEndpoint, visitServiceUrl, secretApiKey, complianceReportUrl, ...props }) => { const { register, errors, clearErrors, setError, handleSubmit } = useForm({ defaultValues: { nickname, @@ -40,6 +40,7 @@ const PinningManagerServiceModal = ({ t, onLeave, onSuccess, className, service,

{ t('pinningServiceModal.title') }

+ {complianceReportUrl && ({ nickname } pinning compliance report) }
{ service.icon && service.name && ( diff --git a/src/constants/pinning.js b/src/constants/pinning.js index 5d407cfb5..ed7afc5ab 100644 --- a/src/constants/pinning.js +++ b/src/constants/pinning.js @@ -1,9 +1,22 @@ +// @ts-check // This is a list of predefined templates for popular services from the IPFS // community. We are open to reviewing PRs that add more entries here, // but only well-established and mission-aligned services will be accepted. const complianceReportsHomepage = 'https://ipfs-shipyard.github.io/pinning-service-compliance' +/** + * @typedef {object} PinningServiceTemplate + * @property {string} name + * @property {string} icon + * @property {string} apiEndpoint + * @property {string} visitServiceUrl + * @property {string} [complianceReportUrl] + */ + +/** + * @type {PinningServiceTemplate[]} + */ const pinningServiceTemplates = [ { name: 'Pinata', @@ -11,7 +24,11 @@ const pinningServiceTemplates = [ apiEndpoint: 'https://api.pinata.cloud/psa', visitServiceUrl: 'https://pinata.cloud/documentation#PinningServicesAPI' } -] +].map((service) => { + const domain = new URL(service.apiEndpoint).hostname + service.complianceReportUrl = `${complianceReportsHomepage}/${domain}.html` + return service +}) export { complianceReportsHomepage, From 1f502ffc07ddcf60d67622b6ca598b78d246bffc Mon Sep 17 00:00:00 2001 From: Russell Dempsey <1173416+SgtPooki@users.noreply.github.com> Date: Tue, 14 Jun 2022 11:31:52 -0700 Subject: [PATCH 3/4] fix: use transifex string with interpolation --- public/locales/en/files.json | 2 +- public/locales/en/settings.json | 3 ++- .../PinningManagerServiceModal.js | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/public/locales/en/files.json b/public/locales/en/files.json index 96d26822d..7a9b090ef 100644 --- a/public/locales/en/files.json +++ b/public/locales/en/files.json @@ -45,7 +45,7 @@ }, "pinningModal": { "title": "Select where you would like to pin these items.", - "complianceLabel": "Check pinning services' compliance", + "complianceLabel": "🔍 Check pinning services' compliance", "footer": "Need to add or configure a pinning service? Go to <1>Settings.", "localNode": "Local node", "totalSize": "Total size: {size}" diff --git a/public/locales/en/settings.json b/public/locales/en/settings.json index 291f1524d..9c891a9a1 100644 --- a/public/locales/en/settings.json +++ b/public/locales/en/settings.json @@ -41,7 +41,8 @@ "apiEndpointPlaceholder": "URL for its API endpoint", "secretApiKey": "Secret access token", "secretApiKeyHowToLink": "How to generate a new token", - "autoUpload": "Auto upload" + "autoUpload": "Auto upload", + "complianceLabel": "{nickname} pinning compliance report" }, "autoUploadModal": { "title": "Change upload policy for {name}", diff --git a/src/components/pinning-manager/pinning-manager-service-modal/PinningManagerServiceModal.js b/src/components/pinning-manager/pinning-manager-service-modal/PinningManagerServiceModal.js index ca9c529fa..d7b615dcc 100644 --- a/src/components/pinning-manager/pinning-manager-service-modal/PinningManagerServiceModal.js +++ b/src/components/pinning-manager/pinning-manager-service-modal/PinningManagerServiceModal.js @@ -40,7 +40,7 @@ const PinningManagerServiceModal = ({ t, onLeave, onSuccess, className, service,

{ t('pinningServiceModal.title') }

- {complianceReportUrl && ({ nickname } pinning compliance report) } + {complianceReportUrl && ({t('pinningServiceModal.complianceLabel', { nickname })}) }
{ service.icon && service.name && ( From 28a51623e0df38b4e8b0d76ee5d2ce9d7ddd3545 Mon Sep 17 00:00:00 2001 From: Russell Dempsey <1173416+SgtPooki@users.noreply.github.com> Date: Tue, 14 Jun 2022 11:34:24 -0700 Subject: [PATCH 4/4] chore: add magnifying glass emoji to string --- public/locales/en/settings.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/locales/en/settings.json b/public/locales/en/settings.json index 9c891a9a1..d9aeb8cad 100644 --- a/public/locales/en/settings.json +++ b/public/locales/en/settings.json @@ -42,7 +42,7 @@ "secretApiKey": "Secret access token", "secretApiKeyHowToLink": "How to generate a new token", "autoUpload": "Auto upload", - "complianceLabel": "{nickname} pinning compliance report" + "complianceLabel": "🔍 {nickname} pinning compliance report" }, "autoUploadModal": { "title": "Change upload policy for {name}",