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

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

zahmis 4 лет назад
Родитель
Сommit
0603f14f3c

+ 0 - 2
.github/workflows/release-rc.yml

@@ -28,8 +28,6 @@ jobs:
           --tag growi \
           --platform linux/amd64 \
           --load \
-          --cache-from=type=registry,ref=$CACHE_REF \
-          --cache-to=type=registry,ref=$CACHE_REF,mode=max \
           --file ./docker/Dockerfile .
 
     - name: Get SemVer

+ 19 - 1
CHANGES.md

@@ -1,7 +1,24 @@
 # CHANGES
 
-## v4.2.21-RC
+## v4.3.0-RC
 
+### BREAKING CHANGES
+
+None.
+
+Upgrading Guide: <https://docs.growi.org/en/admin-guide/upgrading/43x.html>
+
+### Updates
+
+* Feature: New Slack Integration with Slack Bot
+    * Searching GROWI pages from Slack
+    * Creating GROWI pages from Slack
+        * Easy record conversations
+
+## v4.2.21
+
+* Improvement: Headers style on built-in editor
+* Improvement: Codemirror is now scrollable one editor height of empty space into view at the bottom of the editor
 * Improvement: Upgrade mongodb driver to fix [NODE-2784](https://jira.mongodb.org/browse/NODE-2784)
 * Support: Upgrade libs
     * connect-mongo
@@ -13,6 +30,7 @@
     * ws
     * nodemailer
     * i18next-express-middleware
+    * growi-commons
 
 ## v4.2.20
 

+ 2 - 2
bin/github-actions/update-readme.sh

@@ -2,5 +2,5 @@
 
 cd docker
 
-sed -i -e "s/^\([*] \[\`\)[^\`]\+\(\`, \`4\.2\`, .\+\]\)\(.\+\/blob\/v\).\+\(\/docker\/Dockerfile.\+\)$/\1${RELEASE_VERSION}\2\3${RELEASE_VERSION}\4/" README.md
-sed -i -e "s/^\([*] \[\`\)[^\`]\+\(\`, \`4\.2-nocdn\`, .\+\]\)\(.\+\/blob\/v\).\+\(\/docker\/Dockerfile.\+\)$/\1${RELEASE_VERSION}-nocdn\2\3${RELEASE_VERSION}\4/" README.md
+sed -i -e "s/^\([*] \[\`\)[^\`]\+\(\`, \`4\.3\`, .\+\]\)\(.\+\/blob\/v\).\+\(\/docker\/Dockerfile.\+\)$/\1${RELEASE_VERSION}\2\3${RELEASE_VERSION}\4/" README.md
+sed -i -e "s/^\([*] \[\`\)[^\`]\+\(\`, \`4\.3-nocdn\`, .\+\]\)\(.\+\/blob\/v\).\+\(\/docker\/Dockerfile.\+\)$/\1${RELEASE_VERSION}-nocdn\2\3${RELEASE_VERSION}\4/" README.md

+ 1 - 1
docker/Dockerfile

@@ -99,7 +99,7 @@ COPY packages/slack packages/slack
 COPY packages/app packages/app
 
 # build
-RUN yarn build:prod
+RUN yarn lerna run build
 
 # make artifacts
 RUN tar cf packages.tar \

+ 4 - 6
docker/README.md

@@ -10,12 +10,10 @@ GROWI Official docker image
 Supported tags and respective Dockerfile links
 ------------------------------------------------
 
-* [`4.2.0`, `4.2`, `4`, `latest` (Dockerfile)](https://github.com/weseek/growi/blob/v4.2.0/docker/Dockerfile)
-* [`4.2.0-nocdn`, `4.2-nocdn`, `4-nocdn`, `latest-nocdn` (Dockerfile)](https://github.com/weseek/growi/blob/v4.2.0/docker/Dockerfile)
-* [`4.1.10`, `4.1` (Dockerfile)](https://github.com/weseek/growi/blob/v4.1.10/docker/Dockerfile)
-* [`4.1.10-nocdn`, `4.1-nocdn` (Dockerfile)](https://github.com/weseek/growi/blob/v4.1.10/docker/Dockerfile)
-* [`3.8.0`, `3.8`, `3` (Dockerfile)](https://github.com/weseek/growi/blob/v3.8.0/docker/Dockerfile)
-* [`3.8.0-nocdn`, `3.8-nocdn`, `3-nocdn` (Dockerfile)](https://github.com/weseek/growi/blob/v3.8.0/docker/Dockerfile)
+* [`4.3.0`, `4.3`, `4`, `latest` (Dockerfile)](https://github.com/weseek/growi/blob/v4.3.0/docker/Dockerfile)
+* [`4.3.0-nocdn`, `4.3-nocdn`, `4-nocdn`, `latest-nocdn` (Dockerfile)](https://github.com/weseek/growi/blob/v4.3.0/docker/Dockerfile)
+* [`4.2.0`, `4.2` (Dockerfile)](https://github.com/weseek/growi/blob/v4.2.0/docker/Dockerfile)
+* [`4.2.0-nocdn`, `4.2-nocdn` (Dockerfile)](https://github.com/weseek/growi/blob/v4.2.0/docker/Dockerfile)
 
 
 What is GROWI?

+ 1 - 1
package.json

@@ -1,6 +1,6 @@
 {
   "name": "growi",
-  "version": "4.2.21-RC",
+  "version": "4.3.0-RC",
   "description": "Team collaboration software using markdown",
   "tags": [
     "wiki",

+ 1 - 1
packages/app/package.json

@@ -51,7 +51,7 @@
     "express-validator": "^6.1.1",
     "express-webpack-assets": "^0.1.0",
     "graceful-fs": "^4.1.11",
-    "growi-commons": "^5.0.3",
+    "growi-commons": "^5.0.4",
     "growi-plugin-attachment-refs": "^2.0.1",
     "growi-plugin-lsx": "^4.0.2",
     "growi-plugin-pukiwiki-like-linker": "^3.1.0",

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

@@ -18,6 +18,7 @@ import { createTerminus } from '@godaddy/terminus';
 
 import swaggerSettingsForDev from '~/config/swagger/config.dev';
 import swaggerSettingsForProd from '~/config/swagger/config.prod';
+import './filters/ResourceNotFoundFilter';
 import loggerFactory from '~/utils/logger';
 
 export const rootDir = __dirname;

+ 22 - 0
packages/slackbot-proxy/src/filters/ResourceNotFoundFilter.ts

@@ -0,0 +1,22 @@
+import {
+  Catch, ExceptionFilterMethods, PlatformContext, PlatformResponse, ResourceNotFound,
+} from '@tsed/common';
+
+@Catch(ResourceNotFound)
+export class ResourceNotFoundFilter implements ExceptionFilterMethods {
+
+  async catch(exception: ResourceNotFound, ctx: PlatformContext): Promise<PlatformResponse<any>> {
+    const { response } = ctx;
+
+    const obj = {
+      status: exception.status,
+      message: exception.message,
+      url: exception.url,
+    };
+
+    return response
+      .status(exception.status)
+      .body(obj);
+  }
+
+}

+ 11 - 9
src/client/js/components/Admin/SlackIntegration/CustomBotWithProxySettings.jsx

@@ -127,15 +127,17 @@ const CustomBotWithProxySettings = (props) => {
             </React.Fragment>
           );
         })}
-        <div className="row justify-content-center my-5">
-          <button
-            type="button"
-            className="btn btn-outline-primary"
-            onClick={addSlackAppIntegrationHandler}
-          >
-            {`+ ${t('admin:slack_integration.accordion.add_slack_workspace')}`}
-          </button>
-        </div>
+        {slackAppIntegrations.length < 10 && (
+          <div className="row justify-content-center my-5">
+            <button
+              type="button"
+              className="btn btn-outline-primary"
+              onClick={addSlackAppIntegrationHandler}
+            >
+              {`+ ${t('admin:slack_integration.accordion.add_slack_workspace')}`}
+            </button>
+          </div>
+        )}
       </div>
       <DeleteSlackBotSettingsModal
         isResetAll={false}

+ 2 - 4
src/client/js/components/Page/RevisionRenderer.jsx

@@ -3,7 +3,6 @@ import PropTypes from 'prop-types';
 
 import { withUnstatedContainers } from '../UnstatedUtils';
 import AppContainer from '../../services/AppContainer';
-import PageContainer from '../../services/PageContainer';
 import NavigationContainer from '../../services/NavigationContainer';
 import GrowiRenderer from '../../util/GrowiRenderer';
 
@@ -25,7 +24,7 @@ class RevisionRenderer extends React.PureComponent {
   initCurrentRenderingContext() {
     this.currentRenderingContext = {
       markdown: this.props.markdown,
-      currentPagePath: this.props.pageContainer.state.path,
+      currentPagePath: decodeURIComponent(window.location.pathname),
     };
   }
 
@@ -121,11 +120,10 @@ class RevisionRenderer extends React.PureComponent {
 /**
  * Wrapper component for using unstated
  */
-const RevisionRendererWrapper = withUnstatedContainers(RevisionRenderer, [AppContainer, PageContainer, NavigationContainer]);
+const RevisionRendererWrapper = withUnstatedContainers(RevisionRenderer, [AppContainer, NavigationContainer]);
 
 RevisionRenderer.propTypes = {
   appContainer: PropTypes.instanceOf(AppContainer).isRequired,
-  pageContainer: PropTypes.instanceOf(PageContainer).isRequired,
   navigationContainer: PropTypes.instanceOf(NavigationContainer).isRequired,
   growiRenderer: PropTypes.instanceOf(GrowiRenderer).isRequired,
   markdown: PropTypes.string.isRequired,

+ 2 - 0
src/client/js/components/PageEditor/CodeMirrorEditor.jsx

@@ -47,6 +47,7 @@ require('codemirror/addon/search/searchcursor');
 require('codemirror/addon/search/match-highlighter');
 require('codemirror/addon/selection/active-line');
 require('codemirror/addon/scroll/annotatescrollbar');
+require('codemirror/addon/scroll/scrollpastend');
 require('codemirror/addon/fold/foldcode');
 require('codemirror/addon/fold/foldgutter');
 require('codemirror/addon/fold/foldgutter.css');
@@ -845,6 +846,7 @@ export default class CodeMirrorEditor extends AbstractEditor {
             tabSize: 4,
             indentUnit: this.props.indentSize,
             lineWrapping: true,
+            scrollPastEnd: true,
             autoRefresh: { force: true }, // force option is enabled by autorefresh.ext.js -- Yuki Takei
             autoCloseTags: true,
             placeholder,

+ 0 - 21
src/client/styles/scss/_on-edit.scss

@@ -187,17 +187,6 @@ body.on-edit {
     .page-editor-editor-container {
       border-right: 1px solid transparent;
 
-      // override CodeMirror styles
-      .CodeMirror {
-        .cm-matchhighlight {
-          background-color: cyan;
-        }
-
-        .CodeMirror-selection-highlight-scrollbar {
-          background-color: darkcyan;
-        }
-      }
-
       // add icon on cursor
       .markdown-table-activated,
       .markdown-link-activated {
@@ -313,11 +302,6 @@ body.on-edit {
   }
 }
 
-// overwrite .CodeMirror pre
-.CodeMirror pre.CodeMirror-line {
-  font-family: $font-family-monospace;
-}
-
 // overwrite .CodeMirror-hints
 .CodeMirror-hints {
   max-height: 30em !important;
@@ -342,11 +326,6 @@ body.on-edit {
   }
 }
 
-// overwrite .CodeMirror-placeholder
-.CodeMirror pre.CodeMirror-placeholder {
-  color: $text-muted;
-}
-
 #tag-edit-button-tooltip {
   .tooltip-inner {
     color: black;

+ 36 - 0
src/client/styles/scss/_override-codemirror.scss

@@ -0,0 +1,36 @@
+.CodeMirror {
+  .cm-header-1 {
+    font-size: 1.8em;
+  }
+  .cm-header-2 {
+    font-size: 1.4em;
+  }
+  .cm-header-3 {
+    font-size: 1.2em;
+  }
+  .cm-header-4 {
+    font-size: 1.1em;
+  }
+  .cm-header-5 {
+    font-size: 1.05em;
+  }
+
+  .cm-matchhighlight {
+    color: $gray-900;
+    background-color: cyan;
+  }
+
+  .CodeMirror-selection-highlight-scrollbar {
+    background-color: darkcyan;
+  }
+
+  // overwrite .CodeMirror-placeholder
+  pre.CodeMirror-placeholder {
+    color: $text-muted;
+  }
+
+  // overwrite .CodeMirror pre
+  pre.CodeMirror-line {
+    font-family: $font-family-monospace;
+  }
+}

+ 3 - 0
src/client/styles/scss/style-app.scss

@@ -10,6 +10,9 @@
 // override bootstrap
 @import 'override-bootstrap';
 
+// override codemirror
+@import 'override-codemirror';
+
 // override react-bootstrap-typeahead styles
 @import 'override-rbt';
 

+ 5 - 3
src/server/models/slack-app-integration.js

@@ -5,14 +5,16 @@ const schema = new mongoose.Schema({
   tokenGtoP: { type: String, required: true, unique: true },
   tokenPtoG: { type: String, required: true, unique: true },
 });
+
 class SlackAppIntegration {
 
   static generateAccessTokens() {
+    const now = new Date().getTime();
     const hasher1 = crypto.createHash('sha512');
     const hasher2 = crypto.createHash('sha512');
-    const tokenGtoP = hasher1.update(new Date().getTime().toString() + process.env.SALT_FOR_GTOP_TOKEN);
-    const tokenPtoG = hasher2.update(new Date().getTime().toString() + process.env.SALT_FOR_PTOG_TOKEN);
-    return [tokenGtoP.digest('base64'), tokenPtoG.digest('base64')];
+    const tokenGtoP = hasher1.update(`gtop${now.toString()}${process.env.SALT_FOR_GTOP_TOKEN}`).digest('base64');
+    const tokenPtoG = hasher2.update(`ptog${now.toString()}${process.env.SALT_FOR_PTOG_TOKEN}`).digest('base64');
+    return [tokenGtoP, tokenPtoG];
   }
 
   static async generateUniqueAccessTokens() {

+ 1 - 1
src/server/plugins/plugin-utils.js

@@ -57,7 +57,7 @@ class PluginUtils {
    * @memberOf PluginService
    */
   listPlugins(rootDir) {
-    const packagePath = path.join(rootDir, 'package.json');
+    const packagePath = path.join(rootDir, 'packages/app/package.json');
 
     // Make sure package.json exists
     if (!fs.existsSync(packagePath)) {

+ 5 - 0
yarn.lock

@@ -9228,6 +9228,11 @@ growi-commons@^5.0.2, growi-commons@^5.0.3:
   resolved "https://registry.yarnpkg.com/growi-commons/-/growi-commons-5.0.3.tgz#8ec745dcb2d3d003e3acd7d6fbec85cf0967354b"
   integrity sha512-lV2jmqxWPiuzuVaetSY1uq7viwgRCNwLMnU78GaYix4jfXNcYzdrfedTlU3ZRiVIjLggSFb87EhYqtM/4RfjmA==
 
+growi-commons@^5.0.4:
+  version "5.0.4"
+  resolved "https://registry.yarnpkg.com/growi-commons/-/growi-commons-5.0.4.tgz#1235b7955a3f492803e8c714fef5c4a797e442b7"
+  integrity sha512-K282Pe97SnJgbZWAuMz9pNDTmvmw4JYPf/oYQaPmBsUjaxG4FDwd7+p5UFc5GqZUWcLwXvtJZQZMZEH/xpg+nA==
+
 growi-plugin-attachment-refs@^2.0.1:
   version "2.0.1"
   resolved "https://registry.yarnpkg.com/growi-plugin-attachment-refs/-/growi-plugin-attachment-refs-2.0.1.tgz#118c4928a6df93afd0c5fab7a7eab569977dcd55"