mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-22 18:31:57 +03:00
0703596ace
no issue - Logic with slightly more complex structure belongs to the service. Extracting it there also show's how little of an API the oembed service should actually expose
24 lines
579 B
JavaScript
24 lines
579 B
JavaScript
const config = require('../../../shared/config');
|
|
const externalRequest = require('../../lib/request-external');
|
|
const i18n = require('../../../shared/i18n');
|
|
const OEmbed = require('../../services/oembed');
|
|
const oembed = new OEmbed({config, externalRequest, i18n});
|
|
|
|
module.exports = {
|
|
docName: 'oembed',
|
|
|
|
read: {
|
|
permissions: false,
|
|
data: [
|
|
'url',
|
|
'type'
|
|
],
|
|
options: [],
|
|
query({data}) {
|
|
let {url, type} = data;
|
|
|
|
return oembed.fetchOembedDataFromUrl(url, type);
|
|
}
|
|
}
|
|
};
|