From 39d988f0870f0b1d38b0eef2cedcf18a7a34c1cf Mon Sep 17 00:00:00 2001 From: Atsushi Nakatsugawa Date: Thu, 31 Oct 2024 18:25:00 +0900 Subject: [PATCH 1/5] Add Swagger doc to /_api/v3/admin-home/ --- .../app/src/server/routes/apiv3/admin-home.js | 29 +++++++++++++++---- 1 file changed, 23 insertions(+), 6 deletions(-) diff --git a/apps/app/src/server/routes/apiv3/admin-home.js b/apps/app/src/server/routes/apiv3/admin-home.js index db109231d9c..4a177922665 100644 --- a/apps/app/src/server/routes/apiv3/admin-home.js +++ b/apps/app/src/server/routes/apiv3/admin-home.js @@ -14,16 +14,34 @@ const router = express.Router(); * properties: * growiVersion: * type: string - * description: version of growi + * description: npm version or '-' + * example: 7.1.0-RC.0 * nodeVersion: * type: string - * description: version of node + * description: npm version or '-' + * example: 20.2.0 * npmVersion: * type: string - * description: version of npm + * description: npm version or '-' + * example: 9.6.6 * pnpmVersion: * type: string - * description: version of pnpm + * description: npm version or '-' + * example: 9.12.3 + * envVars: + * type: object + * description: npm version or '-' + * additionalProperties: + * type: string + * example: '{"FILE_UPLOAD":"mongodb","APP_SITE_URL":"http://localhost:3000","ELASTICSEARCH_URI":"http://elasticsearch:9200/growi","ELASTICSEARCH_REQUEST_TIMEOUT":15000,"ELASTICSEARCH_REJECT_UNAUTHORIZED":true,"OGP_URI":"http://ogp:8088","QUESTIONNAIRE_SERVER_ORIGIN":"http://host.docker.internal:3003"}' + * isV5Compatible: + * type: boolean + * description: This value is true if this GROWI is compatible v5. + * example: true + * isMaintenanceMode: + * type: boolean + * description: This value is true if this site is maintenance mode. + * example: false * InstalledPluginsParams: * type: object * properties: @@ -53,8 +71,7 @@ module.exports = (crowi) => { * schema: * properties: * adminHomeParams: - * type: object - * description: adminHome params + * $ref: "#/components/schemas/SystemInformationParams" */ router.get('/', loginRequiredStrictly, adminRequired, async(req, res) => { const adminHomeParams = { From fa7049bd84572356ab240a83a50b21fc49d928a0 Mon Sep 17 00:00:00 2001 From: Atsushi Nakatsugawa Date: Tue, 5 Nov 2024 12:03:20 +0000 Subject: [PATCH 2/5] =?UTF-8?q?description=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/app/src/server/routes/apiv3/admin-home.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/apps/app/src/server/routes/apiv3/admin-home.js b/apps/app/src/server/routes/apiv3/admin-home.js index 4a177922665..f2e3212f51f 100644 --- a/apps/app/src/server/routes/apiv3/admin-home.js +++ b/apps/app/src/server/routes/apiv3/admin-home.js @@ -14,11 +14,11 @@ const router = express.Router(); * properties: * growiVersion: * type: string - * description: npm version or '-' + * description: GROWI version or '-' * example: 7.1.0-RC.0 * nodeVersion: * type: string - * description: npm version or '-' + * description: node version or '-' * example: 20.2.0 * npmVersion: * type: string @@ -26,11 +26,11 @@ const router = express.Router(); * example: 9.6.6 * pnpmVersion: * type: string - * description: npm version or '-' + * description: pnpm version or '-' * example: 9.12.3 * envVars: * type: object - * description: npm version or '-' + * description: environment variables * additionalProperties: * type: string * example: '{"FILE_UPLOAD":"mongodb","APP_SITE_URL":"http://localhost:3000","ELASTICSEARCH_URI":"http://elasticsearch:9200/growi","ELASTICSEARCH_REQUEST_TIMEOUT":15000,"ELASTICSEARCH_REJECT_UNAUTHORIZED":true,"OGP_URI":"http://ogp:8088","QUESTIONNAIRE_SERVER_ORIGIN":"http://host.docker.internal:3003"}' From 80f56bb2a4543bdc304659a9b71b145c9869556b Mon Sep 17 00:00:00 2001 From: Atsushi Nakatsugawa Date: Tue, 5 Nov 2024 22:55:50 +0900 Subject: [PATCH 3/5] Add Cookie auth --- apps/app/src/server/routes/apiv3/admin-home.js | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/apps/app/src/server/routes/apiv3/admin-home.js b/apps/app/src/server/routes/apiv3/admin-home.js index f2e3212f51f..172a23cfe04 100644 --- a/apps/app/src/server/routes/apiv3/admin-home.js +++ b/apps/app/src/server/routes/apiv3/admin-home.js @@ -33,7 +33,16 @@ const router = express.Router(); * description: environment variables * additionalProperties: * type: string - * example: '{"FILE_UPLOAD":"mongodb","APP_SITE_URL":"http://localhost:3000","ELASTICSEARCH_URI":"http://elasticsearch:9200/growi","ELASTICSEARCH_REQUEST_TIMEOUT":15000,"ELASTICSEARCH_REJECT_UNAUTHORIZED":true,"OGP_URI":"http://ogp:8088","QUESTIONNAIRE_SERVER_ORIGIN":"http://host.docker.internal:3003"}' + * example: > + * '{ + * "FILE_UPLOAD":"mongodb", + * "APP_SITE_URL":"http://localhost:3000", + * "ELASTICSEARCH_URI":"http://elasticsearch:9200/growi", + * "ELASTICSEARCH_REQUEST_TIMEOUT":15000, + * "ELASTICSEARCH_REJECT_UNAUTHORIZED":true, + * "OGP_URI":"http://ogp:8088", + * "QUESTIONNAIRE_SERVER_ORIGIN":"http://host.docker.internal:3003" + * }' * isV5Compatible: * type: boolean * description: This value is true if this GROWI is compatible v5. @@ -59,9 +68,11 @@ module.exports = (crowi) => { * * /admin-home/: * get: - * tags: [Admin] + * tags: [AdminHome] * operationId: getAdminHome * summary: /admin-home + * security: + * - cookieAuth: [] * description: Get adminHome parameters * responses: * 200: From 37b1bc15c633960d800113780bedec9db350f4da Mon Sep 17 00:00:00 2001 From: Atsushi Nakatsugawa Date: Tue, 5 Nov 2024 23:01:00 +0900 Subject: [PATCH 4/5] Add AdminHome to definition-apiv3.js --- apps/app/bin/swagger-jsdoc/definition-apiv3.js | 1 + 1 file changed, 1 insertion(+) diff --git a/apps/app/bin/swagger-jsdoc/definition-apiv3.js b/apps/app/bin/swagger-jsdoc/definition-apiv3.js index 832174be25f..bfed1b4fe4a 100644 --- a/apps/app/bin/swagger-jsdoc/definition-apiv3.js +++ b/apps/app/bin/swagger-jsdoc/definition-apiv3.js @@ -57,6 +57,7 @@ module.exports = { name: 'System Management API', tags: [ 'Home', + 'AdminHome', 'AppSettings', 'SecuritySetting', 'MarkDownSetting', From 3395ae8130c9bc213251aef42c345459a076d778 Mon Sep 17 00:00:00 2001 From: Atsushi Nakatsugawa Date: Fri, 15 Nov 2024 02:18:03 +0000 Subject: [PATCH 5/5] Fix parameters description --- apps/app/src/server/routes/apiv3/admin-home.js | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/apps/app/src/server/routes/apiv3/admin-home.js b/apps/app/src/server/routes/apiv3/admin-home.js index 172a23cfe04..689ce487d63 100644 --- a/apps/app/src/server/routes/apiv3/admin-home.js +++ b/apps/app/src/server/routes/apiv3/admin-home.js @@ -33,16 +33,14 @@ const router = express.Router(); * description: environment variables * additionalProperties: * type: string - * example: > - * '{ - * "FILE_UPLOAD":"mongodb", - * "APP_SITE_URL":"http://localhost:3000", - * "ELASTICSEARCH_URI":"http://elasticsearch:9200/growi", - * "ELASTICSEARCH_REQUEST_TIMEOUT":15000, - * "ELASTICSEARCH_REJECT_UNAUTHORIZED":true, - * "OGP_URI":"http://ogp:8088", - * "QUESTIONNAIRE_SERVER_ORIGIN":"http://host.docker.internal:3003" - * }' + * example: + * "FILE_UPLOAD": "mongodb" + * "APP_SITE_URL": "http://localhost:3000" + * "ELASTICSEARCH_URI": "http://elasticsearch:9200/growi" + * "ELASTICSEARCH_REQUEST_TIMEOUT": 15000 + * "ELASTICSEARCH_REJECT_UNAUTHORIZED": true + * "OGP_URI": "http://ogp:8088" + * "QUESTIONNAIRE_SERVER_ORIGIN": "http://host.docker.internal:3003" * isV5Compatible: * type: boolean * description: This value is true if this GROWI is compatible v5.