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

Merge branch 'master' into imprv/set-proxy-uri-in-case-of-official

Yuki Takei 4 лет назад
Родитель
Сommit
b859ed2801

+ 24 - 30
.github/workflows/release-rc.yml

@@ -14,34 +14,24 @@ jobs:
     steps:
     - uses: actions/checkout@v2
 
-    - name: Set up Docker Buildx
-      uses: docker/setup-buildx-action@v1
-
-    - name: Login to docker.io registry
-      run: |
-        echo ${{ secrets. DOCKER_REGISTRY_PASSWORD }} | docker login --username wsmoogle --password-stdin
-
-    - name: Build Docker Image
-      run: |
-        CACHE_REF=weseek/growi-cache:4
-        docker buildx build \
-          --tag growi \
-          --platform linux/amd64 \
-          --load \
-          --file ./docker/Dockerfile .
-
-    - name: Get SemVer
+    - name: Setup semver
+      id: semver
       run: |
         semver=`npm run version --silent`
-        echo "SEMVER=$semver" >> $GITHUB_ENV
+        echo "::set-output name=SEMVER::$semver"
 
-    - name: Docker Tags by SemVer
-      uses: weseek/ghaction-docker-tags-by-semver@v1.0.3
+    - name: Docker meta
+      id: meta
+      uses: docker/metadata-action@v3
       with:
-        source: growi
-        target: weseek/growi
-        semver: ${{ env.SEMVER }}
-        publish: true
+        images: weseek/growi,ghcr.io/weseek/growi
+        tags: |
+          type=raw,value=${{ steps.semver.outputs.SEMVER }}
+          type=raw,value=${{ steps.semver.outputs.SEMVER }}.{{sha}}
+
+    - name: Login to docker.io registry
+      run: |
+        echo ${{ secrets. DOCKER_REGISTRY_PASSWORD }} | docker login --username wsmoogle --password-stdin
 
     - name: Login to GitHub Container Registry
       uses: docker/login-action@v1
@@ -50,13 +40,17 @@ jobs:
         username: wsmoogle
         password: ${{ secrets.DOCKER_REGISTRY_ON_GITHUB_PASSWORD }}
 
-    - name: Docker Tags by SemVer in Github Container Registry
-      uses: weseek/ghaction-docker-tags-by-semver@v1.0.3
+    - name: Set up Docker Buildx
+      uses: docker/setup-buildx-action@v1
+
+    - name: Build and push
+      uses: docker/build-push-action@v2
       with:
-        source: growi
-        target: ghcr.io/weseek/growi
-        semver: ${{ env.SEMVER }}
-        publish: true
+        context: .
+        file: ./docker/Dockerfile
+        platforms: linux/amd64
+        push: true
+        tags: ${{ steps.meta.outputs.tags }}
 
     - name: Check whether workspace is clean
       run: |

+ 32 - 38
.github/workflows/release.yml

@@ -67,36 +67,47 @@ jobs:
         git fetch --tags
         git checkout refs/tags/v${{ needs.github-release.outputs.RELEASE_VERSION }}
 
-    - name: Determine suffix
+    - name: Setup suffix
+      id: suffix
       run: |
         [[ ${{ matrix.flavor }} = "nocdn" ]] && suffix="-nocdn" || suffix=""
-        echo "SUFFIX=$suffix" >> $GITHUB_ENV
+        echo "::set-output name=SUFFIX::$suffix"
 
-    - name: Set up Docker Buildx
-      uses: docker/setup-buildx-action@v1
+    - name: Docker meta
+      id: meta
+      uses: docker/metadata-action@v3
+      with:
+        images: weseek/growi,ghcr.io/weseek/growi
+        flavor: |
+          suffix=${{ steps.suffix.outputs.SUFFIX }}
+        tags: |
+          type=raw,value=latest
+          type=semver,value=${{ needs.github-release.outputs.RELEASE_VERSION }},pattern={{major}}
+          type=semver,value=${{ needs.github-release.outputs.RELEASE_VERSION }},pattern={{major}}.{{minor}}
+          type=semver,value=${{ needs.github-release.outputs.RELEASE_VERSION }},pattern={{major}}.{{minor}}.{{patch}}
 
     - name: Login to docker.io registry
       run: |
         echo ${{ secrets. DOCKER_REGISTRY_PASSWORD }} | docker login --username wsmoogle --password-stdin
 
-    - name: Build Docker Image
-      run: |
-        docker buildx build \
-          --tag growi${{ env.SUFFIX }} \
-          --build-arg flavor=${{ matrix.flavor }} \
-          --platform linux/amd64 \
-          --load \
-          --file ./docker/Dockerfile .
-
-    - name: Docker Tags by SemVer
-      uses: weseek/ghaction-docker-tags-by-semver@v1.0.5
+    - name: Login to GitHub Container Registry
+      uses: docker/login-action@v1
       with:
-        source: growi${{ env.SUFFIX }}
-        target: weseek/growi
-        semver: ${{ needs.github-release.outputs.RELEASE_VERSION }}
-        suffix: ${{ env.SUFFIX }}
-        additional-tags: 'latest'
-        publish: true
+        registry: ghcr.io
+        username: wsmoogle
+        password: ${{ secrets.DOCKER_REGISTRY_ON_GITHUB_PASSWORD }}
+
+    - name: Set up Docker Buildx
+      uses: docker/setup-buildx-action@v1
+
+    - name: Build and push
+      uses: docker/build-push-action@v2
+      with:
+        context: .
+        file: ./docker/Dockerfile
+        platforms: linux/amd64
+        push: true
+        tags: ${{ steps.meta.outputs.tags }}
 
     - name: Update Docker Hub Description
       uses: peter-evans/dockerhub-description@v2
@@ -106,23 +117,6 @@ jobs:
         repository: weseek/growi
         readme-filepath: ./docker/README.md
 
-    - name: Login to GitHub Container Registry
-      uses: docker/login-action@v1
-      with:
-        registry: ghcr.io
-        username: wsmoogle
-        password: ${{ secrets.DOCKER_REGISTRY_ON_GITHUB_PASSWORD }}
-
-    - name: Docker Tags by SemVer in Github Container Registry
-      uses: weseek/ghaction-docker-tags-by-semver@v1.0.3
-      with:
-        source: growi${{ env.SUFFIX }}
-        target: ghcr.io/weseek/growi
-        semver: ${{ needs.github-release.outputs.RELEASE_VERSION }}
-        suffix: ${{ env.SUFFIX }}
-        additional-tags: 'latest'
-        publish: true
-
     - name: Slack Notification
       uses: weseek/ghaction-release-slack-notification@master
       with:

+ 3 - 0
CHANGES.md

@@ -2,6 +2,9 @@
 
 ## v4.3.0-RC
 
+* Support: Upgrade libs
+    * striptags
+
 ### BREAKING CHANGES
 
 None.

+ 1 - 0
docker/Dockerfile

@@ -109,6 +109,7 @@ RUN tar cf packages.tar \
   resource \
   src \
   tmp \
+  packages/app/package.json \
   packages/slack/package.json \
   packages/slack/dist
 

+ 1 - 0
packages/slackbot-proxy/package.json

@@ -34,6 +34,7 @@
     "@tsed/swagger": "^6.43.0",
     "@tsed/typeorm": "^6.43.0",
     "axios": "^0.21.1",
+    "bootstrap": "^5.0.2",
     "browser-bunyan": "^1.6.3",
     "bunyan": "^1.8.15",
     "compression": "^1.7.4",

+ 10 - 0
packages/slackbot-proxy/src/Server.ts

@@ -103,6 +103,16 @@ const helmetOptions = isProduction ? {} : {
         root: `${rootDir}/public`,
       },
     ],
+    '/css': [
+      {
+        root: `${rootDir}/../node_modules/bootstrap/dist/css`,
+      },
+    ],
+    '/js': [
+      {
+        root: `${rootDir}/../node_modules/bootstrap/dist/js`,
+      },
+    ],
   },
 })
 export class Server {

+ 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>

+ 42 - 14
packages/slackbot-proxy/src/views/top.ejs

@@ -1,20 +1,48 @@
 <head>
   <meta name="viewport" content="width=device-width,initial-scale=1">
+  <link href="./css/bootstrap.min.css" rel="stylesheet" >
 </head>
 
-<body style="padding-top:100px; text-align:center;">
-  <h1 >GROWI Bot</h1>
-  <div>
-    <img height="300" width="300" alt="GROWi Bot" src="/images/growi-bot.png" />
-  </div>
-  <div style="display:flex; justify-content: space-around; max-width: 500px; margin:30px auto;">
-    <a href=<%- url %>>
-      <img alt="Add to Slack" height="40" width="139" src="/images/add-to-slack.png"/>
-    </a>
-    <% if (isOfficialMode) { %>
-      <a href="/privacy">
-        Privacy Policy
-      </a>
-    <% } %>
+<body class="pt-3">
+  <div class="container border p-5">
+    <div class="text-center">
+      <h1>GROWI Bot</h1>
+      <h4>GROWI is a wiki that can be written in Markdown and easy to share information with everyone.</h4>
+
+      <div>
+        <img height="300" width="300" alt="GROWi Bot" src="/images/growi-bot.png" />
+      </div>
+      <div class="m-3">
+        <a href=<%- url %>>
+          <img alt="Add to Slack" height="40" width="139" src="/images/add-to-slack.png"/>
+        </a>
+      </div>
+      <div class="d-flex justify-content-evenly my-3">
+        <% if (isOfficialMode) { %>
+          <a href="/privacy">
+            Privacy Policy
+          </a>
+          <a href="/term">
+            Term of Service
+          </a>
+        <% } %>
+      </div>
+    </div>
+    <div class="m-3">
+      <div class="d-flex flex-column align-items-center justify-content-center">
+          <ul>
+            With GROWI for Slack, you can:
+            <ul>
+              <li>Search pages for multiple GROWI apps.</li>
+              <li>Create pages easily.</li>
+            </ul>
+            </li>
+          </ul>
+        <div class="mt-3">
+          GROWI is open-source software developed by WESEEK, Inc and we are looking for contributors who can work with us.<br>
+          Please <a href="https://growi-slackin.weseek.co.jp/">join</a> Slack and feel free to talk to WESEEK members!
+        </div>
+      </div>
+    </div>
   </div>
 </body>

+ 2 - 2
src/client/js/components/Admin/Common/AdminNavigation.jsx

@@ -28,8 +28,8 @@ const AdminNavigation = (props) => {
       case 'importer':                 return <><i className="icon-fw icon-cloud-upload"></i>    { t('Import Data') }</>;
       case 'export':                   return <><i className="icon-fw icon-cloud-download"></i>  { t('Export Archive Data') }</>;
       case 'notification':             return <><i className="icon-fw icon-bell"></i>            { t('External_Notification')}</>;
-      case 'slack-integration-legacy': return <><i className="fa fa-slack mr-2"></i>             { t('Legacy_Slack_Integration')}</>;
-      case 'slack-integration':        return <><i className="fa fa-slack mr-2"></i>             { t('slack_integration') }</>;
+      case 'slack-integration':        return <><i className="icon-fw icon-shuffle"></i>         { t('slack_integration') }</>;
+      case 'slack-integration-legacy': return <><i className="icon-fw icon-shuffle"></i>         { t('Legacy_Slack_Integration')}</>;
       case 'users':                    return <><i className="icon-fw icon-user"></i>            { t('User_Management') }</>;
       case 'user-groups':              return <><i className="icon-fw icon-people"></i>          { t('UserGroup Management') }</>;
       case 'search':                   return <><i className="icon-fw icon-magnifier"></i>       { t('Full Text Search Management') }</>;

+ 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: {

+ 8 - 3
yarn.lock

@@ -4634,6 +4634,11 @@ bootstrap@^4.5.0:
   resolved "https://registry.yarnpkg.com/bootstrap/-/bootstrap-4.5.0.tgz#97d9dbcb5a8972f8722c9962483543b907d9b9ec"
   integrity sha512-Z93QoXvodoVslA+PWNdk23Hze4RBYIkpb5h8I2HY2Tu2h7A0LpAgLcyrhrSUyo2/Oxm2l1fRZPs1e5hnxnliXA==
 
+bootstrap@^5.0.2:
+  version "5.0.2"
+  resolved "https://registry.yarnpkg.com/bootstrap/-/bootstrap-5.0.2.tgz#aff23d5e0e03c31255ad437530ee6556e78e728e"
+  integrity sha512-1Ge963tyEQWJJ+8qtXFU6wgmAVj9gweEjibUdbmcCEYsn38tVwRk8107rk2vzt6cfQcRr3SlZ8aQBqaD8aqf+Q==
+
 bowser@^1.7.3:
   version "1.9.4"
   resolved "https://registry.yarnpkg.com/bowser/-/bowser-1.9.4.tgz#890c58a2813a9d3243704334fa81b96a5c150c9a"
@@ -18007,9 +18012,9 @@ strip-json-comments@^2.0.0, strip-json-comments@^2.0.1, strip-json-comments@~2.0
   integrity sha1-PFMZQukIwml8DsNEhYwobHygpgo=
 
 striptags@>=3.1.1:
-  version "3.1.1"
-  resolved "https://registry.yarnpkg.com/striptags/-/striptags-3.1.1.tgz#c8c3e7fdd6fb4bb3a32a3b752e5b5e3e38093ebd"
-  integrity sha1-yMPn/db7S7OjKjt1LltePjgJPr0=
+  version "3.2.0"
+  resolved "https://registry.yarnpkg.com/striptags/-/striptags-3.2.0.tgz#cc74a137db2de8b0b9a370006334161f7dd67052"
+  integrity sha512-g45ZOGzHDMe2bdYMdIvdAfCQkCTDMGBazSw1ypMowwGIee7ZQ5dU0rBJ8Jqgl+jAKIv4dbeE1jscZq9wid1Tkw==
 
 strong-log-transformer@^2.1.0:
   version "2.1.0"