Parcourir la source

Merge branch 'reactify-admin/CustomizePage' into adjust-layout-customize-page

itizawa il y a 6 ans
Parent
commit
934e92fa51
1 fichiers modifiés avec 9 ajouts et 6 suppressions
  1. 9 6
      src/server/routes/apiv3/customize-setting.js

+ 9 - 6
src/server/routes/apiv3/customize-setting.js

@@ -69,26 +69,29 @@ module.exports = (crowi) => {
 
   const { ApiV3FormValidator } = crowi.middlewares;
 
-  // TODO GW-533 implement accurate validation
   const validator = {
     layoutTheme: [
-      body('layoutType').isString(),
-      body('themeType').isString(),
+      body('layoutType').isString().isIn(['growi', 'kibela', 'crowi']),
+      body('themeType').isString().isIn([
+        'default', 'nature', 'mono-blue', 'wood', 'island', 'christmas', 'antarctic', 'default-dark', 'future', 'blue-night', 'halloween',
+      ]),
     ],
     behavior: [
-      body('behaviorType').isString(),
+      body('behaviorType').isString().isIn(['growi', 'crowi-plus']),
     ],
     function: [
       body('isEnabledTimeline').isBoolean(),
       body('isSavedStatesOfTabChanges').isBoolean(),
       body('isEnabledAttachTitleHeader').isBoolean(),
-      body('recentCreatedLimit').isInt(),
+      body('recentCreatedLimit').isInt().isInt({ min: 1, max: 1000 }),
     ],
     customizeHeader: [
       body('customizeHeader').isString(),
     ],
     highlight: [
-      body('highlightJsStyle').isString(),
+      body('highlightJsStyle').isString().isIn([
+        'github', 'github-gist', 'atom-one-light', 'xcode', 'vs', 'atom-one-dark', 'hybrid', 'monokai', 'tororrow-night', 'vs2015',
+      ]),
       body('highlightJsStyleBorder').isBoolean(),
     ],
     customizeCss: [