Skip to content

Commit c71c576

Browse files
committed
removed default ipfs gateway url
1 parent bb9a338 commit c71c576

File tree

1 file changed

+14
-15
lines changed

1 file changed

+14
-15
lines changed

Diff for: src/modules/files/files.ts

+14-15
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
import axios from 'axios';
2+
import merge from 'lodash-es/merge.js';
3+
4+
import { BaseModule } from '../_baseModule.js';
25
import { MediaType } from '../../enums.js';
36
import { getFileType, getIpfsCid } from '../../helpers/files.js';
47
import { isIpfsProtocol, isUrl } from '../../helpers/strings.js';
5-
import { BaseModule } from '../_baseModule.js';
68
import { File, FilesConfigs } from './types.js';
7-
import merge from 'lodash-es/merge.js';
8-
99

1010
/**
1111
* Files class
@@ -25,10 +25,14 @@ export default class Files extends BaseModule {
2525

2626
public setConfigs(configs: FilesConfigs) {
2727
super.setConfigs(configs);
28-
this.configs = merge({
29-
ipfsGatewayUrl: 'https://ipfs.algonode.xyz/ipfs',
30-
transformUrl: undefined,
31-
}, this.configs, configs);
28+
this.configs = merge(
29+
{
30+
ipfsGatewayUrl: '',
31+
transformUrl: undefined,
32+
},
33+
this.configs,
34+
configs,
35+
);
3236
}
3337
/**
3438
* load data from URL
@@ -43,8 +47,9 @@ export default class Files extends BaseModule {
4347
mime: undefined,
4448
thumbnail: undefined,
4549
content: undefined,
46-
}
47-
if (this.configs.transformUrl) file.url = await Promise.resolve(this.configs.transformUrl(url));
50+
};
51+
if (this.configs.transformUrl)
52+
file.url = await Promise.resolve(this.configs.transformUrl(url));
4853
if (!isUrl(file.url) && !isIpfsProtocol(file.url)) return file;
4954
file.cid = getIpfsCid(file.url);
5055
if (file.cid) file.url = this.getIpfsUrl(file.cid);
@@ -56,7 +61,6 @@ export default class Files extends BaseModule {
5661
return file;
5762
}
5863

59-
6064
/**
6165
* Set props based on type
6266
* ==================================================
@@ -80,8 +84,6 @@ export default class Files extends BaseModule {
8084
return;
8185
}
8286
}
83-
84-
8587

8688
/**
8789
* load JSON media
@@ -93,7 +95,6 @@ export default class Files extends BaseModule {
9395
file.content = json.data;
9496
}
9597

96-
9798
/**
9899
* Get an IPFS gateway url for a specific cid
99100
* ==================================================
@@ -102,6 +103,4 @@ export default class Files extends BaseModule {
102103
public getIpfsUrl(cid: string) {
103104
return `${this.configs.ipfsGatewayUrl}/${cid}`;
104105
}
105-
106106
}
107-

0 commit comments

Comments
 (0)