Ghost/core/server/api/canary/oembed.js
Sam Lord 76f06fae3c
Revert "Revert "Extract logging from DI patterns, only use @tryghost/logging package"" (#13884)
This reverts commit fa8c3ebe99.

Reverting the revert, which will allow us to fully switch to @tryghost/logging v2.
2021-12-14 11:22:39 +00:00

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);
}
}
};