2021-01-14 20:01:43 +03:00
|
|
|
const config = require('../../../shared/config');
|
|
|
|
const externalRequest = require('../../lib/request-external');
|
2021-10-08 17:32:16 +03:00
|
|
|
const tpl = require('@tryghost/tpl');
|
2021-01-14 20:01:43 +03:00
|
|
|
const OEmbed = require('../../services/oembed');
|
2021-10-08 17:32:16 +03:00
|
|
|
const oembed = new OEmbed({config, externalRequest, tpl});
|
2020-06-08 17:06:00 +03:00
|
|
|
|
2019-08-09 17:11:24 +03:00
|
|
|
module.exports = {
|
|
|
|
docName: 'oembed',
|
|
|
|
|
|
|
|
read: {
|
|
|
|
permissions: false,
|
|
|
|
data: [
|
2019-08-27 17:01:02 +03:00
|
|
|
'url',
|
|
|
|
'type'
|
2019-08-09 17:11:24 +03:00
|
|
|
],
|
|
|
|
options: [],
|
|
|
|
query({data}) {
|
2019-08-27 17:01:02 +03:00
|
|
|
let {url, type} = data;
|
2019-08-09 17:11:24 +03:00
|
|
|
|
2021-08-23 09:36:18 +03:00
|
|
|
return oembed.fetchOembedDataFromUrl(url, type);
|
2019-08-09 17:11:24 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|