2016-08-26 14:19:03 +02:00
|
|
|
'use strict';
|
|
|
|
|
2016-11-24 16:19:01 +01:00
|
|
|
const fs = require('fs');
|
2016-08-26 14:19:03 +02:00
|
|
|
const path = require('path');
|
2016-11-24 16:19:01 +01:00
|
|
|
|
2016-08-26 14:19:03 +02:00
|
|
|
/**
|
|
|
|
* A set of functions called "actions" for `Admin`
|
|
|
|
*/
|
|
|
|
|
|
|
|
module.exports = {
|
|
|
|
|
2016-12-01 16:44:03 +01:00
|
|
|
index: async ctx => {
|
2016-11-22 12:05:02 +01:00
|
|
|
// Send the HTML file with injected scripts
|
2016-11-24 16:19:01 +01:00
|
|
|
ctx.body = strapi.admin.services.admin.generateAdminIndexFile();
|
2016-08-26 14:19:03 +02:00
|
|
|
},
|
|
|
|
|
2016-12-01 16:44:03 +01:00
|
|
|
file: async ctx => {
|
2016-11-24 16:19:01 +01:00
|
|
|
try {
|
|
|
|
const file = fs.readFileSync(path.resolve(__dirname, '..', 'public', 'build', ctx.params.file));
|
|
|
|
ctx.body = file;
|
|
|
|
} catch (err) {
|
|
|
|
ctx.body = ctx.notFound();
|
|
|
|
}
|
2016-08-26 14:19:03 +02:00
|
|
|
}
|
|
|
|
};
|