flame/controllers/config/updateCSS.js

26 lines
671 B
JavaScript
Raw Normal View History

const asyncWrapper = require('../../middleware/asyncWrapper');
const File = require('../../utils/File');
const { join } = require('path');
2021-10-28 14:05:21 +00:00
const fs = require('fs');
// @desc Update custom CSS file
// @route PUT /api/config/0/css
// @access Public
const updateCSS = asyncWrapper(async (req, res, next) => {
const file = new File(join(__dirname, '../../public/flame.css'));
file.write(req.body.styles, false);
// Copy file to docker volume
fs.copyFileSync(
join(__dirname, '../../public/flame.css'),
join(__dirname, '../../data/flame.css')
);
res.status(200).json({
success: true,
data: {},
});
});
module.exports = updateCSS;