diff --git a/index.html b/index.html index b5b869c..7a3d456 100644 --- a/index.html +++ b/index.html @@ -748,7 +748,7 @@ pseudoDisable(e.target, true) renderElem(e.target, html`Checking...`) const { hasValidHash, knownHash, latestHash } = await hasAKnownHash(appLink) - const hashes = html` + const hashes = latestHash && knownHash && html`
+ The dapp has failed integrity check. Please don't use it. +
+- The dapp has failed integrity check. Please don't use it. -
- ${hashes} `) } else { renderElem(getRef('integrity_check_popup__content'), html` @@ -947,7 +966,7 @@ let knownHash, latestHash, hasValidHash const dappInfo = dappsList.find(({ appLink }) => linkToVerify.includes(appLink)) if (!dappInfo) return false - const { appHash, repoHash } = dappInfo + const { appHash, repoHash, automatedChecking = false } = dappInfo if (linkToVerify.includes('https://blockbook.ranchimall.net')) { // blockbook is special case // it is a server side rendered app @@ -957,16 +976,22 @@ knownHash = repoHash hasValidHash = latestHash === knownHash } else { - const [contentHash, latestRepoHash] = await Promise.all([ - getLinkContentHash(linkToVerify), - getRepoHash(dappInfo.appLink.split('/').pop()) - ]) - latestHash = contentHash[0].hash - knownHash = appHash - hasValidHash = latestHash === knownHash && repoHash === latestRepoHash; - if (!hasValidHash && repoHash !== latestRepoHash) { - latestHash = latestRepoHash - knownHash = repoHash + if (automatedChecking) { + const latestRepoHash = await getRepoHash(dappInfo.appLink.split('/').pop()) + latestHash = knownHash = latestRepoHash + hasValidHash = true + } else { + const [contentHash, latestRepoHash] = await Promise.all([ + getLinkContentHash(linkToVerify), + getRepoHash(dappInfo.appLink.split('/').pop()) + ]) + latestHash = contentHash[0].hash + knownHash = appHash + hasValidHash = latestHash === knownHash && repoHash === latestRepoHash; + if (!hasValidHash && repoHash !== latestRepoHash) { + latestHash = latestRepoHash + knownHash = repoHash + } } } return { hasValidHash, latestHash, knownHash } @@ -1026,12 +1051,38 @@ `) } else { getRef('verification_form').after(html.node/*html*/` -+ Please don't enter your private key on this link. +
+Link you provided is not genuine
- ${hashes} `) } } catch (e) {