fleet/website/api/controllers/docs/view-app-library.js
Eric e890981e1c
Website: Move documentation pages into docs/ folder, rename scripts to script-library (#42510)
Changes:
- Moved documentation pages into the docs/ folder
- Updated routes, poicies, and importer.less
- Renamed the "scripts" page to "script-library" to be consistent with
the other landing pages for YAML documentation
- removed a stray console.log() in the new-licence page script
2026-03-26 15:32:48 -05:00

51 lines
1.1 KiB
JavaScript
Vendored

module.exports = {
friendlyName: 'View app library',
description: 'Display "App library" page.',
exits: {
success: {
viewTemplatePath: 'pages/docs/app-library'
},
badConfig: { responseType: 'badConfig' },
},
fn: async function () {
if (!_.isObject(sails.config.builtStaticContent) || !_.isArray(sails.config.builtStaticContent.appLibrary) || !sails.config.builtStaticContent.appLibrary) {
throw {badConfig: 'builtStaticContent.appLibrary'};
}
let allApps = sails.config.builtStaticContent.appLibrary;
let macOsApps = _.filter(allApps, (app)=>{
return app.platform === 'darwin';
});
macOsApps = _.sortBy(macOsApps, (app)=>{
return app.name.toLowerCase();
});
let windowsApps = _.filter(allApps, (app)=>{
return app.platform === 'windows';
});
windowsApps = _.sortBy(windowsApps, (app)=>{
return app.name.toLowerCase();
});
// Respond with view.
return {
allApps,
windowsApps,
macOsApps,
algoliaPublicKey: sails.config.custom.algoliaPublicKey,
};
}
};