|
@@ -42,6 +42,12 @@ const ErrorV3 = require('../../models/vo/error-apiv3');
|
|
|
* type: boolean
|
|
* type: boolean
|
|
|
* recentCreatedLimit:
|
|
* recentCreatedLimit:
|
|
|
* type: number
|
|
* type: number
|
|
|
|
|
+ * CustomizeHighlight:
|
|
|
|
|
+ * type: object
|
|
|
|
|
+ * styleName:
|
|
|
|
|
+ * type: string
|
|
|
|
|
+ * styleBorder:
|
|
|
|
|
+ * type: boolean
|
|
|
* CustomizeHeader:
|
|
* CustomizeHeader:
|
|
|
* type: object
|
|
* type: object
|
|
|
* customizeHeader:
|
|
* customizeHeader:
|
|
@@ -80,6 +86,10 @@ module.exports = (crowi) => {
|
|
|
customizeHeader: [
|
|
customizeHeader: [
|
|
|
body('customizeHeader').isString(),
|
|
body('customizeHeader').isString(),
|
|
|
],
|
|
],
|
|
|
|
|
+ highlight: [
|
|
|
|
|
+ body('highlightJsStyle').isString(),
|
|
|
|
|
+ body('highlightJsStyleBorder').isBoolean(),
|
|
|
|
|
+ ],
|
|
|
customizeCss: [
|
|
customizeCss: [
|
|
|
body('customizeCss').isString(),
|
|
body('customizeCss').isString(),
|
|
|
],
|
|
],
|
|
@@ -253,6 +263,57 @@ module.exports = (crowi) => {
|
|
|
}
|
|
}
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * @swagger
|
|
|
|
|
+ *
|
|
|
|
|
+ * /customize-setting/highlight:
|
|
|
|
|
+ * put:
|
|
|
|
|
+ * tags: [CustomizeSetting]
|
|
|
|
|
+ * description: Update highlight
|
|
|
|
|
+ * requestBody:
|
|
|
|
|
+ * required: true
|
|
|
|
|
+ * content:
|
|
|
|
|
+ * application/json:
|
|
|
|
|
+ * schama:
|
|
|
|
|
+ * type: object
|
|
|
|
|
+ * properties:
|
|
|
|
|
+ * highlightJsStyle:
|
|
|
|
|
+ * description: style name of highlight
|
|
|
|
|
+ * type: string
|
|
|
|
|
+ * highlightJsStyleBorder:
|
|
|
|
|
+ * description: enable border of highlight
|
|
|
|
|
+ * type: boolean
|
|
|
|
|
+ * responses:
|
|
|
|
|
+ * 200:
|
|
|
|
|
+ * description: Succeeded to update highlight
|
|
|
|
|
+ * content:
|
|
|
|
|
+ * application/json:
|
|
|
|
|
+ * schema:
|
|
|
|
|
+ * properties:
|
|
|
|
|
+ * customizedParams:
|
|
|
|
|
+ * $ref: '#/components/schemas/CustomizeHighlight'
|
|
|
|
|
+ */
|
|
|
|
|
+ router.put('/highlight', loginRequiredStrictly, adminRequired, csrf, validator.highlight, ApiV3FormValidator, async(req, res) => {
|
|
|
|
|
+ const requestParams = {
|
|
|
|
|
+ 'customize:highlightJsStyle': req.body.highlightJsStyle,
|
|
|
|
|
+ 'customize:highlightJsStyleBorder': req.body.highlightJsStyleBorder,
|
|
|
|
|
+ };
|
|
|
|
|
+
|
|
|
|
|
+ try {
|
|
|
|
|
+ await crowi.configManager.updateConfigsInTheSameNamespace('crowi', requestParams);
|
|
|
|
|
+ const customizedParams = {
|
|
|
|
|
+ styleName: await crowi.configManager.getConfig('crowi', 'customize:highlightJsStyle'),
|
|
|
|
|
+ styleBorder: await crowi.configManager.getConfig('crowi', 'customize:highlightJsStyleBorder'),
|
|
|
|
|
+ };
|
|
|
|
|
+ return res.apiv3({ customizedParams });
|
|
|
|
|
+ }
|
|
|
|
|
+ catch (err) {
|
|
|
|
|
+ const msg = 'Error occurred in updating highlight';
|
|
|
|
|
+ logger.error('Error', err);
|
|
|
|
|
+ return res.apiv3Err(new ErrorV3(msg, 'update-highlight-failed'));
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+
|
|
|
/**
|
|
/**
|
|
|
* @swagger
|
|
* @swagger
|
|
|
*
|
|
*
|