Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
6 changes: 4 additions & 2 deletions src/Lighthouse/uploadEncrypted/decrypt/browser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
7 changes: 4 additions & 3 deletions src/Lighthouse/uploadEncrypted/decrypt/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}
5 changes: 3 additions & 2 deletions src/Lighthouse/uploadEncrypted/decrypt/node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Loading