Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Display deprecated content #1073

Merged
merged 26 commits into from
Feb 16, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
c5bd4a9
fix-faq-background
makoto Dec 8, 2020
a48c98b
Merge branch 'dev' of https://github.com/ensdomains/ens-app into dev
makoto Dec 10, 2020
1f08c3a
Merge branch 'dev' of https://github.com/ensdomains/ens-app into dev
makoto Dec 11, 2020
9f3d994
Merge branch 'dev' of https://github.com/ensdomains/ens-app into dev
makoto Dec 14, 2020
87442c8
Merge branch 'dev' of https://github.com/ensdomains/ens-app into dev
makoto Dec 21, 2020
0a4eca1
Merge branch 'dev' of https://github.com/ensdomains/ens-app into dev
makoto Jan 18, 2021
4a01a63
Merge branch 'dev' of https://github.com/ensdomains/ens-app into dev
makoto Jan 19, 2021
089078c
Merge branch 'dev' of https://github.com/ensdomains/ens-app into dev
makoto Jan 19, 2021
da6ec2f
Merge branch 'dev' of https://github.com/ensdomains/ens-app into dev
makoto Jan 21, 2021
78f8586
Merge branch 'dev' of https://github.com/ensdomains/ens-app into dev
makoto Jan 21, 2021
53edbac
Merge branch 'dev' of https://github.com/ensdomains/ens-app into dev
makoto Jan 22, 2021
db2e86d
Merge branch 'dev' of https://github.com/ensdomains/ens-app into dev
makoto Jan 26, 2021
2638e87
Merge branch 'dev' of https://github.com/ensdomains/ens-app into dev
makoto Jan 28, 2021
56e2903
Merge branch 'dev' of https://github.com/ensdomains/ens-app into dev
makoto Jan 28, 2021
79140ec
Update content-hash to 2.5.4
makoto Feb 10, 2021
14b297f
Display error for invliad ipns value
makoto Feb 10, 2021
28628e1
Fix bug
makoto Feb 10, 2021
a19bd4d
Bump ui to 3.0.60
makoto Feb 10, 2021
6258f27
Use getProtocolType instead of encode and decode
makoto Feb 15, 2021
c53d9e7
Merge branch 'dev' of https://github.com/ensdomains/ens-app into dev
makoto Feb 15, 2021
35644aa
Merge branch 'dev' of https://github.com/ensdomains/ens-app into dev
makoto Feb 16, 2021
ccadbef
Merge branch 'dev' into display-deprecated-content
makoto Feb 16, 2021
a28e4ea
Bump ui
makoto Feb 16, 2021
618cd2c
Add test to invalidate deprecated ipns
makoto Feb 16, 2021
3c2fab6
Fix failing test
makoto Feb 16, 2021
908b95e
Change test to use different test data
makoto Feb 16, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions cypress/integration/nameDetail.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -358,6 +358,19 @@ describe('Name detail view', () => {
])
})

it('cannot change deprecated ipns contenthash', () => {
const url = `${NAME_ROOT}/abittooawesome4.eth`
cy.visit(url)
const DEPRECATED_CONTENT_HASH = 'ipns://app.uniswap.org'
cy.queryByText(DEPRECATED_CONTENT_HASH, { timeout: 10000 }).should('exist')

cy.getByTestId('name-details', { timeout: 10000 }).within(container => {
cy.getByText('Add/Edit Record').click({ force: true })
cy.wait(2000)
cy.queryByTestId('content-record-input-invalid')
})
})

it('can delete records', () => {
cy.visit(`${NAME_ROOT}/notsoawesome.eth`)
cy.getByTestId('name-details').within(container => {
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@
"@toruslabs/torus-embed": "^1.8.6",
"@walletconnect/web3-provider": "^1.3.1",
"@ensdomains/address-encoder": "^0.2.6",
"@ensdomains/mock": "^2.0.34",
"@ensdomains/mock": "^2.0.36",
"@ensdomains/react-ens-address": "^0.0.27",
"@ensdomains/ui": "^3.0.58",
"@ensdomains/ui": "^3.0.61",
"apollo-cache-inmemory": "^1.2.9",
"apollo-client": "^2.4.5",
"apollo-link": "^1.2.2",
Expand Down
5 changes: 3 additions & 2 deletions src/api/manager/resolvers.js
Original file line number Diff line number Diff line change
Expand Up @@ -654,7 +654,7 @@ const resolvers = {
records.content === ''
? emptyAddress
: records.content
? encodeContenthash(records.content)
? encodeContenthash(records.content)?.encoded
: undefined,
records.textRecords,
records.coins
Expand Down Expand Up @@ -807,7 +807,8 @@ const resolvers = {
provider
})
const content = await resolverInstanceWithoutSigner.content(namehash)
return encodeContenthash('bzz://' + content)
const { encoded } = encodeContenthash('bzz://' + content)
return encoded
}

async function getContenthash(name) {
Expand Down
16 changes: 3 additions & 13 deletions src/components/Links/ContentHashLink.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react'
import styled from '@emotion/styled/macro'
import { ReactComponent as ExternalLinkIcon } from '../Icons/externalLink.svg'
import { decodeContenthash, encodeContenthash } from '@ensdomains/ui'
import { getProtocolType } from '@ensdomains/ui'

const ContentHashLinkContainer = styled('a')`
display: inline-block;
Expand All @@ -22,22 +22,12 @@ const ContentHashLinkContainer = styled('a')`
}
`

const DecodedError = styled('div')`
white-space: normal;
overflow: scroll;
`

const ContentHashLink = ({ value, contentType, domain }) => {
if (contentType === 'oldcontent') {
if (contentType === 'oldcontent' || !value) {
return <div>{value}</div>
}

const encoded = encodeContenthash(value)
const { protocolType, decoded, error } = decodeContenthash(encoded)
const { protocolType, decoded } = getProtocolType(value)
let externalLink, url
if (error) {
return <DecodedError>{error}</DecodedError>
}
if (protocolType === 'ipfs') {
externalLink = `https://dweb.link/ipfs/${decoded}` // using ipfs's secured origin gateway
url = `ipfs://${decoded}`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ const ContentHashEditable = ({
<>
<EditRecord>
<RecordInput
testId="content-record-input"
testId={`content-record-input${isInvalid ? '-invalid' : ''}`}
onChange={event => {
const value = event.target.value
setUpdatedRecords(records => ({
Expand Down
4 changes: 2 additions & 2 deletions src/utils/records.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ export function validateRecord({ type, value, contentType, selectedKey }) {
return isAddress
case 'content':
if (value === EMPTY_ADDRESS) return true // delete record
const encoded = encodeContenthash(value)
if (encoded) {
const { encoded, error: encodeError } = encodeContenthash(value)
if (!encodeError && encoded) {
return isValidContenthash(encoded)
} else {
return false
Expand Down
37 changes: 32 additions & 5 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1385,6 +1385,15 @@
multicodec "^1.0.4"
multihashes "^2.0.0"

"@ensdomains/content-hash@^2.5.5":
version "2.5.5"
resolved "https://registry.yarnpkg.com/@ensdomains/content-hash/-/content-hash-2.5.5.tgz#3efb64ced7bc8c76d883648519fdcaa312ad6ae9"
integrity sha512-g97tsnHku7fC+uyWAPj71TlLmgI2TsMtDEsiXAGvK73eC67aTVCsEagk6sPIZbB7+iKV3DY2wTQQos2VGBLMTw==
dependencies:
cids "^0.8.3"
multicodec "^1.0.4"
multihashes "^2.0.0"

"@ensdomains/[email protected]", "@ensdomains/contracts@^0.0.1":
version "0.0.1"
resolved "https://registry.yarnpkg.com/@ensdomains/contracts/-/contracts-0.0.1.tgz#edb841955adbd6f86bddaf9d05f6d239d25d5ab7"
Expand Down Expand Up @@ -1429,6 +1438,24 @@
table "^5.4.6"
web3 "^1.3.0"

"@ensdomains/mock@^2.0.36":
version "2.0.36"
resolved "https://registry.yarnpkg.com/@ensdomains/mock/-/mock-2.0.36.tgz#308eb17b86b58a68990a89a872d1ba249cac5d55"
integrity sha512-JNtXo4m9wfDL0SHFHbAPQbWVNEagLbNKq+UzHlUTx+OWa9wZK6wNwJFi63o2p0IQiTpQJs1zc5MC/HQATH76Vg==
dependencies:
"@0xproject/utils" "^2.0.2"
"@babel/runtime" "^7.4.4"
"@ensdomains/contracts" "^0.0.1"
"@ensdomains/dnssec-oracle-anchors" "^0.0.1"
chalk "^3.0.0"
cross-fetch "^3.0.2"
dns-packet "^5.2.1"
eth-ens-namehash "^2.0.8"
lodash "^4.17.11"
moment "^2.26.0"
table "^5.4.6"
web3 "^1.3.0"

"@ensdomains/react-ens-address@^0.0.27":
version "0.0.27"
resolved "https://registry.yarnpkg.com/@ensdomains/react-ens-address/-/react-ens-address-0.0.27.tgz#42ba9a4563ad60b146bdb2b0c260b2a1f86baa8b"
Expand Down Expand Up @@ -1465,16 +1492,16 @@
lodash "^4.17.11"
web3 "^1.3.0"

"@ensdomains/ui@^3.0.58":
version "3.0.58"
resolved "https://registry.yarnpkg.com/@ensdomains/ui/-/ui-3.0.58.tgz#b028b190f036c4151e771e2c74e91b8e279af006"
integrity sha512-EUWB2QtZQ/q8WFvk/MaxPiVB7EWaQktqTICmLYAI7MtTPSgOoxxAV/v0j2b5J+yeXzylYLavJSv9c6eHaw+JSw==
"@ensdomains/ui@^3.0.61":
version "3.0.61"
resolved "https://registry.yarnpkg.com/@ensdomains/ui/-/ui-3.0.61.tgz#8263cce026eb4496b44618de843fac42ab0fbdaa"
integrity sha512-QrweOs7dfjX0h0DG1kybm+lMEBEt2da6R9JnPxvaYLSVesN0ikT3CWwum0WopJw8p7d7D/1T4+gkHGD/o7vxkA==
dependencies:
"@0xproject/utils" "^2.0.2"
"@babel/plugin-proposal-class-properties" "^7.8.3"
"@babel/runtime" "^7.4.4"
"@ensdomains/address-encoder" "^0.2.5"
"@ensdomains/content-hash" "^2.5.3"
"@ensdomains/content-hash" "^2.5.5"
"@ensdomains/contracts" "^0.0.1"
"@ensdomains/dnsprovejs" "^0.2.0"
"@ensdomains/mock" "^2.0.34"
Expand Down