mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-21 01:41:46 +03:00
76f06fae3c
This reverts commit fa8c3ebe99
.
Reverting the revert, which will allow us to fully switch to @tryghost/logging v2.
41 lines
926 B
JavaScript
41 lines
926 B
JavaScript
const config = require('../../../shared/config');
|
|
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({
|
|
config: {
|
|
apiKey: config.get('opensea').privateReadOnlyApiKey
|
|
}
|
|
});
|
|
|
|
const Twitter = require('../../services/twitter-embed');
|
|
const twitter = new Twitter({
|
|
config: {
|
|
bearerToken: config.get('twitter').privateReadOnlyToken
|
|
}
|
|
});
|
|
|
|
oembed.registerProvider(nft);
|
|
oembed.registerProvider(twitter);
|
|
|
|
module.exports = {
|
|
docName: 'oembed',
|
|
|
|
read: {
|
|
permissions: false,
|
|
data: [
|
|
'url',
|
|
'type'
|
|
],
|
|
options: [],
|
|
query({data}) {
|
|
let {url, type} = data;
|
|
|
|
return oembed.fetchOembedDataFromUrl(url, type);
|
|
}
|
|
}
|
|
};
|