|
@@ -18,8 +18,8 @@ const router = express.Router();
|
|
|
*
|
|
*
|
|
|
* components:
|
|
* components:
|
|
|
* schemas:
|
|
* schemas:
|
|
|
- * CustomBotNonProxy:
|
|
|
|
|
- * description: CustomBotNonProxy
|
|
|
|
|
|
|
+ * CustomBotWithoutProxy:
|
|
|
|
|
+ * description: CustomBotWithoutProxy
|
|
|
* type: object
|
|
* type: object
|
|
|
* properties:
|
|
* properties:
|
|
|
* slackSigningSecret:
|
|
* slackSigningSecret:
|
|
@@ -40,7 +40,7 @@ module.exports = (crowi) => {
|
|
|
|
|
|
|
|
|
|
|
|
|
const validator = {
|
|
const validator = {
|
|
|
- CusotmBotNonProxy: [
|
|
|
|
|
|
|
+ CusotmBotWithoutProxy: [
|
|
|
body('slackSigningSecret').isString(),
|
|
body('slackSigningSecret').isString(),
|
|
|
body('slackBotToken').isString(),
|
|
body('slackBotToken').isString(),
|
|
|
body('botType').isString(),
|
|
body('botType').isString(),
|
|
@@ -75,7 +75,7 @@ module.exports = (crowi) => {
|
|
|
// TODO impl this after GW-4939
|
|
// TODO impl this after GW-4939
|
|
|
// AccessToken: "tempaccessdatahogehoge",
|
|
// AccessToken: "tempaccessdatahogehoge",
|
|
|
},
|
|
},
|
|
|
- customBotNonProxySettings: {
|
|
|
|
|
|
|
+ customBotWithoutProxySettings: {
|
|
|
// TODO impl this after GW-4939
|
|
// TODO impl this after GW-4939
|
|
|
// AccessToken: "tempaccessdatahogehoge",
|
|
// AccessToken: "tempaccessdatahogehoge",
|
|
|
slackSigningSecretEnvVars: crowi.configManager.getConfigFromEnvVars('crowi', 'slackbot:signingSecret'),
|
|
slackSigningSecretEnvVars: crowi.configManager.getConfigFromEnvVars('crowi', 'slackbot:signingSecret'),
|
|
@@ -95,24 +95,24 @@ module.exports = (crowi) => {
|
|
|
/**
|
|
/**
|
|
|
* @swagger
|
|
* @swagger
|
|
|
*
|
|
*
|
|
|
- * /slack-integration/custom-bot-non-proxy/:
|
|
|
|
|
|
|
+ * /slack-integration/custom-bot-without-proxy/:
|
|
|
* put:
|
|
* put:
|
|
|
- * tags: [CustomBotNonProxy]
|
|
|
|
|
- * operationId: putCustomBotNonProxy
|
|
|
|
|
- * summary: /slack-integration/custom-bot-non-proxy
|
|
|
|
|
- * description: Put customBotNonProxy setting.
|
|
|
|
|
|
|
+ * tags: [CustomBotWithoutProxy]
|
|
|
|
|
+ * operationId: putCustomBotWithoutProxy
|
|
|
|
|
+ * summary: /slack-integration/custom-bot-without-proxy
|
|
|
|
|
+ * description: Put customBotWithoutProxy setting.
|
|
|
* requestBody:
|
|
* requestBody:
|
|
|
* required: true
|
|
* required: true
|
|
|
* content:
|
|
* content:
|
|
|
* application/json:
|
|
* application/json:
|
|
|
* schema:
|
|
* schema:
|
|
|
- * $ref: '#/components/schemas/CustomBotNonProxy'
|
|
|
|
|
|
|
+ * $ref: '#/components/schemas/CustomBotWithoutProxy'
|
|
|
* responses:
|
|
* responses:
|
|
|
* 200:
|
|
* 200:
|
|
|
- * description: Succeeded to put CustomBotNonProxy setting.
|
|
|
|
|
|
|
+ * description: Succeeded to put CustomBotWithoutProxy setting.
|
|
|
*/
|
|
*/
|
|
|
- router.put('/custom-bot-non-proxy',
|
|
|
|
|
- accessTokenParser, loginRequiredStrictly, adminRequired, csrf, validator.CusotmBotNonProxy, apiV3FormValidator, async(req, res) => {
|
|
|
|
|
|
|
+ router.put('/custom-bot-without-proxy',
|
|
|
|
|
+ accessTokenParser, loginRequiredStrictly, adminRequired, csrf, validator.CusotmBotWithoutProxy, apiV3FormValidator, async(req, res) => {
|
|
|
const { slackSigningSecret, slackBotToken, botType } = req.body;
|
|
const { slackSigningSecret, slackBotToken, botType } = req.body;
|
|
|
|
|
|
|
|
const requestParams = {
|
|
const requestParams = {
|
|
@@ -124,12 +124,12 @@ module.exports = (crowi) => {
|
|
|
try {
|
|
try {
|
|
|
await updateSlackBotSettings(requestParams);
|
|
await updateSlackBotSettings(requestParams);
|
|
|
// TODO Impl to delete AccessToken both of Proxy and GROWI when botType changes.
|
|
// TODO Impl to delete AccessToken both of Proxy and GROWI when botType changes.
|
|
|
- const customBotNonProxySettingParams = {
|
|
|
|
|
|
|
+ const customBotWithoutProxySettingParams = {
|
|
|
slackSigningSecret: crowi.configManager.getConfig('crowi', 'slackbot:signingSecret'),
|
|
slackSigningSecret: crowi.configManager.getConfig('crowi', 'slackbot:signingSecret'),
|
|
|
slackBotToken: crowi.configManager.getConfig('crowi', 'slackbot:token'),
|
|
slackBotToken: crowi.configManager.getConfig('crowi', 'slackbot:token'),
|
|
|
slackBotType: crowi.configManager.getConfig('crowi', 'slackbot:type'),
|
|
slackBotType: crowi.configManager.getConfig('crowi', 'slackbot:type'),
|
|
|
};
|
|
};
|
|
|
- return res.apiv3({ customBotNonProxySettingParams });
|
|
|
|
|
|
|
+ return res.apiv3({ customBotWithoutProxySettingParams });
|
|
|
}
|
|
}
|
|
|
catch (error) {
|
|
catch (error) {
|
|
|
const msg = 'Error occured in updating Custom bot setting';
|
|
const msg = 'Error occured in updating Custom bot setting';
|