Просмотр исходного кода

Merge remote-tracking branch 'origin/HEAD' into imprv/create-lp-2

zahmis 4 лет назад
Родитель
Сommit
657ab3f4a0

+ 20 - 0
packages/slackbot-proxy/src/controllers/term.ts

@@ -0,0 +1,20 @@
+import { Controller, PlatformRouter } from '@tsed/common';
+import { Request, Response } from 'express';
+
+const isOfficialMode = process.env.OFFICIAL_MODE === 'true';
+
+@Controller('/term')
+export class TermCtrl {
+
+  constructor(router: PlatformRouter) {
+    if (isOfficialMode) {
+      router.get('/', this.getTerm);
+    }
+  }
+
+  // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
+  getTerm(req: Request, res: Response): string|void {
+    res.render('term.ejs');
+  }
+
+}

+ 7 - 0
packages/slackbot-proxy/src/views/term.ejs

@@ -0,0 +1,7 @@
+<head>
+  <meta name="viewport" content="width=device-width,initial-scale=1">
+</head>
+
+<body style="max-width: 600px; padding-top:100px; margin: 0 auto;">
+  <h1 style="text-align:center;">Terms of Service </h1>
+</body>

+ 3 - 0
packages/slackbot-proxy/src/views/top.ejs

@@ -21,6 +21,9 @@
           <a href="/privacy">
             Privacy Policy
           </a>
+          <a href="/term">
+            Term of Service
+          </a>
         <% } %>
       </div>
     </div>

+ 2 - 2
src/client/js/components/Admin/SlackIntegration/WithProxyAccordions.jsx

@@ -169,8 +169,8 @@ const GeneratingTokensAndRegisteringProxyServiceProcess = withUnstatedContainers
                 // eslint-disable-next-line react/no-danger
               dangerouslySetInnerHTML={{ __html: t('admin:slack_integration.accordion.paste_growi_url') }}
             />
-            <div className="input-group align-items-center ml-2 mb-3">
-              <div className="input-group-prepend mx-1">
+            <div className="input-group align-items-center pl-2 mb-3">
+              <div className="input-group-prepend w-75">
                 <input className="form-control" type="text" value={props.growiUrl} readOnly />
                 <CopyToClipboard text={props.growiUrl} onCopy={() => toastSuccess(t('admin:slack_integration.copied_to_clipboard'))}>
                   <div className="btn input-group-text">

+ 3 - 0
src/server/routes/apiv3/slack-integration-settings.js

@@ -107,6 +107,9 @@ module.exports = (crowi) => {
 
   async function postRelationTest(token) {
     const proxyUri = crowi.configManager.getConfig('crowi', 'slackbot:proxyServerUri');
+    if (proxyUri == null) {
+      throw new Error('Proxy URL is not registered');
+    }
 
     const result = await axios.get(urljoin(proxyUri, '/g2s/relation-test'), {
       headers: {