mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-21 01:41:46 +03:00
4da7e7f0cb
refs: https://github.com/TryGhost/Team/issues/831 - This ultimately fixes the index.js file - It also makes it super clear what methods in the themeService are used by the API, and which are part of the service loading logic - It also moves the activate and init function into a single file in a way that highlights they are very similar - They are also very similar to what happens in storage.setFromZip but that code is mixed up with storage code at the moment
32 lines
767 B
JavaScript
32 lines
767 B
JavaScript
const activate = require('./activate');
|
|
const themeLoader = require('./loader');
|
|
const storage = require('./storage');
|
|
const getJSON = require('./to-json');
|
|
|
|
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,
|
|
destroy: storage.destroy
|
|
}
|
|
};
|