diff --git a/src/Lighthouse/uploadEncrypted/decrypt/browser.ts b/src/Lighthouse/uploadEncrypted/decrypt/browser.ts index 9808ef6..6d1beba 100644 --- a/src/Lighthouse/uploadEncrypted/decrypt/browser.ts +++ b/src/Lighthouse/uploadEncrypted/decrypt/browser.ts @@ -6,10 +6,12 @@ import { fetchWithTimeout } from '../../utils/util' export default async ( cid: string, fileEncryptionKey: string, - mimeType: string + mimeType: string, + gatewayUrl?: string ) => { + const gateway = gatewayUrl || lighthouseConfig.lighthouseGateway const response = await fetchWithTimeout( - lighthouseConfig.lighthouseGateway + '/api/v0/cat/' + cid, + gateway + '/api/v0/cat/' + cid, { method: 'POST', timeout: 7200000, diff --git a/src/Lighthouse/uploadEncrypted/decrypt/index.ts b/src/Lighthouse/uploadEncrypted/decrypt/index.ts index 7e9f42c..c8d0aef 100644 --- a/src/Lighthouse/uploadEncrypted/decrypt/index.ts +++ b/src/Lighthouse/uploadEncrypted/decrypt/index.ts @@ -4,13 +4,14 @@ import node from './node' export default async ( cid: string | any, fileEncryptionKey: string, - mimeType = 'null' + mimeType = 'null', + gatewayUrl?: string ) => { // Upload File to IPFS //@ts-ignore if (typeof window === 'undefined') { - return await node(cid, fileEncryptionKey) + return await node(cid, fileEncryptionKey, gatewayUrl) } else { - return await browser(cid, fileEncryptionKey, mimeType) + return await browser(cid, fileEncryptionKey, mimeType, gatewayUrl) } } diff --git a/src/Lighthouse/uploadEncrypted/decrypt/node.ts b/src/Lighthouse/uploadEncrypted/decrypt/node.ts index 77f584a..64b40d7 100644 --- a/src/Lighthouse/uploadEncrypted/decrypt/node.ts +++ b/src/Lighthouse/uploadEncrypted/decrypt/node.ts @@ -3,10 +3,11 @@ import { decryptFile } from '../encryptionNode' import { lighthouseConfig } from '../../../lighthouse.config' import { fetchWithTimeout } from '../../utils/util' -export default async (cid: string, fileEncryptionKey: any) => { +export default async (cid: string, fileEncryptionKey: any, gatewayUrl?: string) => { try { + const gateway = gatewayUrl || lighthouseConfig.lighthouseGateway const response = await fetchWithTimeout( - lighthouseConfig.lighthouseGateway + '/api/v0/cat/' + cid, + gateway + '/api/v0/cat/' + cid, { method: 'POST', timeout: 7200000,