diff --git a/src/contstants.ts b/src/contstants.ts index 1193ba1..9427c6d 100644 --- a/src/contstants.ts +++ b/src/contstants.ts @@ -30,7 +30,12 @@ export const packageRepos = { "merkle-root-updater": "merkle-root-updater." + packagesDomain, } as const; -export const sitesENS = ["tornadocash.eth", "nova.tornadocash.eth", "relayers-ui.tornadocash.eth", "docs.tornadocash.eth"] as const; +export const sitesENS = [ + rootTornadoDomain, + "nova." + rootTornadoDomain, + "relayers-ui." + rootTornadoDomain, + "docs." + rootTornadoDomain, +] as const; export const knownIpfsResources = [ `https://ipfs.io/ipfs/`, diff --git a/src/downloader.ts b/src/downloader.ts index c83ac17..4f7bdcf 100644 --- a/src/downloader.ts +++ b/src/downloader.ts @@ -26,7 +26,9 @@ export async function getENSDomainContenthash(domain: string): Promise { } export async function getV1Cids(domains: Domains): Promise { - const promises = Object.entries(domains).map(([repoName, domain]) => (async () => [repoName, await getENSDomainContenthash(domain)])()); + const promises = Object.entries(domains).map(([repoName, domain]) => + (async () => [repoName, await getENSDomainContenthash(domain as string)])() + ); const result = await Promise.allSettled(promises); const ipfsCids = result.reduce((acc, res) => { if (res.status === "rejected") console.error(res.reason); @@ -38,12 +40,12 @@ export async function getV1Cids(domains: Domains): Promise { return ipfsCids; } -export async function downloadGitRepoFromIpfs(repoFolder: string, repoName: string, repoHash: string, retryAttempt: number = 0) { +export async function downloadGitRepoFromIpfs(reposFolder: string, repoName: string, repoHash: string, retryAttempt: number = 0) { if (retryAttempt > knownIpfsResources.length) return console.error(`Cannot download ${repoName}, all known IPFS gateaways checked.`); try { - await git.clone(knownIpfsResources[retryAttempt] + repoHash, path.join(repoFolder, repoName)); + await git.clone(knownIpfsResources[retryAttempt] + repoHash, path.join(reposFolder, repoName)); } catch (e) { console.error(`Cannot download ${repoName} from ${knownIpfsResources[retryAttempt]}, retry with other gateaway...`); - downloadGitRepoFromIpfs(repoFolder, repoName, repoHash, retryAttempt++); + downloadGitRepoFromIpfs(reposFolder, repoName, repoHash, retryAttempt++); } }