0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-01-27 22:49:56 -05:00
ghost/core/server/services/themes/index.js
Naz 84c88683ba Removed method complexity in themes API controller
refs https://github.com/TryGhost/Team/issues/694

- The controller code is not meant to contain complex business logic.
- Kept the pattern used in all modules under services/themes. The install module shold be refactored into a class with DI pattern when touched next.
2021-09-03 20:33:28 +04:00

33 lines
865 B
JavaScript

const activate = require('./activate');
const themeLoader = require('./loader');
const storage = require('./storage');
const getJSON = require('./to-json');
const installer = require('./installer');
const settingsCache = require('../../../shared/settings-cache');
module.exports = {
/*
* Load the currently active theme
*/
init: async () => {
const themeName = settingsCache.get('active_theme');
return activate.loadAndActivate(themeName);
},
/**
* Load all inactive themes
*/
loadInactiveThemes: themeLoader.loadAllThemes,
/**
* Methods used in the API
*/
api: {
getJSON,
activate: activate.activate,
getZip: storage.getZip,
setFromZip: storage.setFromZip,
installFromGithub: installer.installFromGithub,
destroy: storage.destroy
}
};