mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-09-22 02:19:59 +03:00
Added OpenSea API key to config
refs https://github.com/TryGhost/Team/issues/1237 We want to use an API key for OpenSea where possible so that we do not run into rate limit issues.
This commit is contained in:
parent
2540be63c1
commit
c4021b6eb4
@ -4,7 +4,11 @@ const externalRequest = require('../../lib/request-external');
|
||||
const OEmbed = require('../../services/oembed');
|
||||
const oembed = new OEmbed({config, externalRequest});
|
||||
const NFT = require('../../services/nft-oembed');
|
||||
const nft = new NFT();
|
||||
const nft = new NFT({
|
||||
config: {
|
||||
apiKey: config.get('opensea').privateReadOnlyApiKey
|
||||
}
|
||||
});
|
||||
oembed.registerProvider(nft);
|
||||
|
||||
module.exports = {
|
||||
|
@ -35,8 +35,13 @@ class NFTOEmbedProvider {
|
||||
if (!match) {
|
||||
return null;
|
||||
}
|
||||
const headers = {};
|
||||
if (this.dependencies.config.apiKey) {
|
||||
headers['X-API-KEY'] = this.dependencies.config.apiKey;
|
||||
}
|
||||
const result = await externalRequest(`https://api.opensea.io/api/v1/asset/${transaction}/${asset}/?format=json`, {
|
||||
json: true
|
||||
json: true,
|
||||
headers
|
||||
});
|
||||
return {
|
||||
version: '1.0',
|
||||
|
@ -133,5 +133,8 @@
|
||||
"tenor": {
|
||||
"apiKey": null,
|
||||
"contentFilter": "off"
|
||||
},
|
||||
"opensea": {
|
||||
"privateReadOnlyApiKey": null
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user