0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-01-20 22:42:53 -05:00
ghost/core/frontend/services/proxy.js
Hannah Wolfe a4a9ba7940
🔥 Removed versioned APIs
refs: https://github.com/TryGhost/Toolbox/issues/229

- we are getting rid of the concept of having multiple api versions in a single ghost install
- removed all the code for multiple api versions & left canary wired up, but without the version in the URL
- TODO: reorganise the folders so there's no canary folder when we're closer to shipping
        we need to minimise the pain of merging changes across from main for now
2022-04-28 15:37:09 +01:00

49 lines
1.7 KiB
JavaScript

// This file contains everything that the helpers and frontend apps require from the core of Ghost
const settingsCache = require('../../shared/settings-cache');
const config = require('../../shared/config');
// Require from the handlebars framework
const {SafeString} = require('./handlebars');
module.exports = {
/**
* Section two: data manipulation
* Stuff that modifies API data (SDK layer)
*/
metaData: require('../meta'),
socialUrls: require('@tryghost/social-urls'),
blogIcon: require('../../server/lib/image').blogIcon,
// Used by router service and {{get}} helper to prepare data for optimal usage in themes
prepareContextResource(data) {
(Array.isArray(data) ? data : [data]).forEach((resource) => {
// feature_image_caption contains HTML, making it a SafeString spares theme devs from triple-curlies
if (resource.feature_image_caption) {
resource.feature_image_caption = new SafeString(resource.feature_image_caption);
}
});
},
/**
* Section three: Core API
* Parts of Ghost core that the frontend currently needs
*/
// Config! Keys used:
// isPrivacyDisabled & referrerPolicy used in ghost_head
config: {
get: config.get.bind(config),
isPrivacyDisabled: config.isPrivacyDisabled.bind(config)
},
// TODO: Only expose "get"
settingsCache: settingsCache,
// TODO: Expose less of the API to make this safe
api: require('../../server/api').endpoints,
// Labs utils for enabling/disabling helpers
labs: require('../../shared/labs'),
// URGH... Yuk (unhelpful comment :D)
urlService: require('../../server/services/url'),
urlUtils: require('../../shared/url-utils')
};