diff --git a/index.html b/index.html index 76210df..45c6462 100644 --- a/index.html +++ b/index.html @@ -661,9 +661,25 @@ ], "category": "blockchain-explorer", "allowDownload": false, - "appHash": "012cd0b6bcb6de664cdecfb93bbdeb4bce53497bf549917dc717ef8b8d35858d", "repoHash": "1d5cc442744f429fba5ad97ada001bfed2556d0ec7e1443b4ededb65f6ba5c61", "repoLink": "https://github.com/ranchimall/blockbook" + }, { + "name": "ICO Exchange", + "description": "An exchange for ICO token trading", + "icon": html``, + "appLink": "https://ranchimall.net/exchange", + "moreLink": "#/dapps/ico-exchange", + "tags": [ + "exchange", + "ICO", + "RMT", + "RanchiMall", + "tokens", + ], + "category": "finance", + "allowDownload": false, + "repoHash": "bcd943193b9a76991e8d1ebd4bd88a30ece97f69efe80c37f3c5a733c76a2b6b", + "repoLink": "https://github.com/ranchimall/flo-exchange" } ].sort((a, b) => a.name.localeCompare(b.name)); @@ -753,7 +769,6 @@ renderElem(e.target.closest('.flex'), html` Failed integrity check `) - } else { renderElem(getRef('integrity_check_popup__content'), html`
@@ -764,6 +779,7 @@

${hashes} `) + } else { renderElem(getRef('integrity_check_popup__content'), html`
@@ -939,22 +955,31 @@ try { linkToVerify = addProtocolToUrl(linkToVerify); linkToVerify = parseUrlWithoutHashAndQuery(linkToVerify) - let knownHash, hasValidHash + let knownHash, latestHash, hasValidHash const dappInfo = dappsList.find(({ appLink }) => linkToVerify.includes(appLink)) if (!dappInfo) return false + const { appHash, repoHash } = dappInfo if (linkToVerify.includes('https://blockbook.ranchimall.net')) { // blockbook is special case // it is a server side rendered app // so we need to check the hash of the repo // and not the hash of the link content latestHash = await getRepoHash('blockbook') - knownHash = dappInfo.repoHash + knownHash = repoHash } else { - latestHash = await getLinkContentHash(linkToVerify) - latestHash = latestHash[linkToVerify] - knownHash = dappInfo.appHash + const [contentHash, latestRepoHash] = await Promise.all([ + getLinkContentHash(linkToVerify), + getRepoHash(dappInfo.appLink.split('/').pop()) + ]) + latestHash = contentHash[linkToVerify] + knownHash = appHash + hasValidHash = latestHash === knownHash && repoHash === latestRepoHash; + if (!hasValidHash && repoHash !== latestRepoHash) { + latestHash = latestRepoHash + knownHash = repoHash + } } - return { hasValidHash: latestHash === knownHash, latestHash, knownHash } + return { hasValidHash, latestHash, knownHash } } catch (e) { console.error(e) return false