Browse Source

feat: file resolvers + pull changes from master

NGPixel 7 năm trước cách đây
mục cha
commit
35cb56c694
10 tập tin đã thay đổi với 451 bổ sung313 xóa
  1. 11 0
      CHANGELOG.md
  2. 17 14
      README.md
  3. 23 23
      package.json
  4. 2 3
      server/modules/git.js
  5. 2 0
      server/modules/graphql.js
  6. 52 0
      server/schemas/resolvers-file.js
  7. 19 0
      server/schemas/types.graphql
  8. 1 1
      tools/docker-compose.yml
  9. 6 7
      wercker.yml
  10. 318 265
      yarn.lock

+ 11 - 0
CHANGELOG.md

@@ -2,6 +2,15 @@
 All notable changes to this project will be documented in this file.
 This project adheres to [Semantic Versioning](http://semver.org/).
 
+## [v1.0.8] - 2017-08-31
+### Changed
+- **Misc**: Updated dependencies
+
+## [v1.0.7] - 2017-08-29
+### Fixed
+- **Authentication**: Azure AD client Id is now referenced correctly ([#219](https://github.com/Requarks/wiki/issues/219))
+- **Git**: Git Branch is now referenced correctly ([#215](https://github.com/Requarks/wiki/issues/215))
+
 ## [v1.0.6] - 2017-08-10
 ### Fixed
 - **Authentication**: LDAP no longer cause the social login text to appear on the login screen.
@@ -208,6 +217,8 @@ This project adheres to [Semantic Versioning](http://semver.org/).
 ### Changed
 - Updated dependencies + snyk policy
 
+[v1.0.8]: https://github.com/Requarks/wiki/releases/tag/v1.0.8
+[v1.0.7]: https://github.com/Requarks/wiki/releases/tag/v1.0.7
 [v1.0.6]: https://github.com/Requarks/wiki/releases/tag/v1.0.6
 [v1.0.5]: https://github.com/Requarks/wiki/releases/tag/v1.0.5
 [v1.0.4]: https://github.com/Requarks/wiki/releases/tag/v1.0.4

+ 17 - 14
README.md

@@ -53,34 +53,37 @@ You can also use a Dockerfile ([see example](https://github.com/Requarks/wiki/bl
 
 Current and upcoming milestones *(major features only, see the [changelog](https://github.com/Requarks/wiki/blob/master/CHANGELOG.md) for complete list of features and bug fixes)*:
 
-### 1.0.0 - Beta 13
+### 1.0.8 - Stable
 ![Progress](http://progressed.io/bar/100)
 
-- [x] Color Themes
-- [x] Server-side TeX/MathML rendering
-- [x] Render line breaks by default (GitHub style)
-- [x] New Localization: German
-
-### 1.0.6 - Stable
-![Progress](http://progressed.io/bar/100)
-
-- [x] Bug fixes release
-- [x] New Localization: Dutch
+- [x] Fix: Azure AD client Id is now referenced correctly ([#219](https://github.com/Requarks/wiki/issues/219))
+- [x] Fix: Git Branch is now referenced correctly ([#215](https://github.com/Requarks/wiki/issues/215))
+- [x] Updated dependencies
 
 ### 2.0.0 - Dev
-![Progress](http://progressed.io/bar/20)
+![Progress](http://progressed.io/bar/25)
 
 **Breaking Changes**: MongoDB is being phased out in favor of PostgreSQL + Redis. An upgrade tool will be provided to migrate existing data to the new system.
 
-- [ ] GraphQL API
+- [x] GraphQL API
+  - [x] Comments
+  - [x] Documents
+  - [x] Files
+  - [x] Folders
+  - [x] Groups
+  - [x] Rights
+  - [x] Settings
+  - [x] Tags
+  - [x] Users
 - [x] Migrate to PostgreSQL + Redis datastore
+- [ ] New Login page
 - [ ] History / Revert to previous version
 - [ ] Optional Two-Steps Authentication (2FA)
 - [x] Docker support + Auto compile/publish to Docker Hub
 - [ ] Support sub-directory installations (e.g. example.com/wiki)
 - [ ] Persist system settings to database instead of file-based
 - [ ] User Groups + Better permissions management
-- [ ] Make use of all available CPU cores, distributed jobs queue
+- [x] Make use of all available CPU cores, distributed jobs queue
 - [ ] Tags per document / folder
 - [ ] Comments / Discussion per document
 - [ ] Profile page per user

+ 23 - 23
package.json

@@ -37,13 +37,13 @@
     "node": ">=6.11.1"
   },
   "dependencies": {
-    "apollo-server-express": "1.1.0",
+    "apollo-server-express": "1.1.2",
     "auto-load": "3.0.0",
     "axios": "0.16.2",
     "bcryptjs-then": "1.0.1",
     "bluebird": "3.5.0",
     "body-parser": "1.17.2",
-    "bull": "3.0.0-rc.7",
+    "bull": "3.0.0",
     "bunyan": "1.8.12",
     "cheerio": "1.0.0-rc.2",
     "child-process-promise": "2.2.1",
@@ -63,10 +63,10 @@
     "follow-redirects": "1.2.4",
     "fs-extra": "4.0.1",
     "git-wrapper2-promise": "0.2.9",
-    "graphql": "0.10.5",
-    "graphql-tools": "1.2.1",
+    "graphql": "0.11.2",
+    "graphql-tools": "1.2.2",
     "highlight.js": "9.12.0",
-    "i18next": "8.4.3",
+    "i18next": "9.0.0",
     "i18next-express-middleware": "1.0.5",
     "i18next-node-fs-backend": "1.0.0",
     "image-size": "0.6.1",
@@ -77,19 +77,19 @@
     "klaw": "2.1.0",
     "levelup": "1.3.9",
     "lodash": "4.17.4",
-    "markdown-it": "8.3.2",
+    "markdown-it": "8.4.0",
     "markdown-it-abbr": "1.0.4",
     "markdown-it-anchor": "4.0.0",
-    "markdown-it-attrs": "1.0.0",
+    "markdown-it-attrs": "1.1.0",
     "markdown-it-emoji": "1.4.0",
     "markdown-it-expand-tabs": "1.0.12",
     "markdown-it-external-links": "0.0.6",
     "markdown-it-footnote": "3.0.1",
     "markdown-it-mathjax": "2.0.0",
     "markdown-it-task-lists": "2.0.1",
-    "mathjax-node": "1.1.1",
+    "mathjax-node": "1.2.0",
     "memdown": "1.2.4",
-    "mime-types": "2.1.16",
+    "mime-types": "2.1.17",
     "moment": "2.18.1",
     "moment-timezone": "0.5.13",
     "multer": "1.3.0",
@@ -106,9 +106,9 @@
     "passport-slack": "0.0.7",
     "passport-windowslive": "1.0.2",
     "passport.socketio": "3.7.0",
-    "pg": "7.1.2",
+    "pg": "7.3.0",
     "pg-hstore": "2.3.2",
-    "pg-promise": "6.5.0",
+    "pg-promise": "6.5.1",
     "pm2": "2.6.1",
     "pug": "2.0.0-rc.3",
     "read-chunk": "2.1.0",
@@ -117,15 +117,15 @@
     "search-index-adder": "0.3.9",
     "search-index-searcher": "0.2.10",
     "semver": "5.4.1",
-    "sequelize": "4.5.0",
+    "sequelize": "4.8.0",
     "serve-favicon": "2.4.3",
     "simplemde": "1.11.2",
     "socket.io": "2.0.3",
     "stopword": "0.1.6",
     "stream-to-promise": "2.2.0",
-    "tar": "4.0.0",
+    "tar": "4.0.1",
     "through2": "2.0.3",
-    "validator": "8.0.0",
+    "validator": "8.1.0",
     "validator-as-promised": "1.0.2",
     "winston": "2.3.1",
     "yargs": "8.0.2"
@@ -134,21 +134,21 @@
     "@glimpse/glimpse": "0.22.15",
     "@panter/vue-i18next": "0.5.1",
     "babel-cli": "6.26.0",
-    "babel-jest": "20.0.3",
+    "babel-jest": "21.0.0",
     "babel-plugin-transform-object-assign": "6.22.0",
     "babel-preset-es2015": "6.24.1",
     "brace": "0.10.0",
     "colors": "1.1.2",
     "consolidate": "0.14.5",
-    "eslint": "4.4.1",
+    "eslint": "4.6.1",
     "eslint-config-standard": "10.2.1",
     "eslint-plugin-import": "2.7.0",
     "eslint-plugin-node": "5.1.1",
     "eslint-plugin-promise": "3.5.0",
     "eslint-plugin-standard": "3.0.1",
-    "fuse-box": "2.2.2",
+    "fuse-box": "2.2.3",
     "i18next-xhr-backend": "1.4.2",
-    "jest": "20.0.4",
+    "jest": "21.0.0",
     "jquery": "3.2.1",
     "jquery-contextmenu": "2.5.0",
     "jquery-simple-upload": "1.0.0",
@@ -158,18 +158,18 @@
     "lodash-es": "4.17.4",
     "node-sass": "4.5.3",
     "nodemon": "1.11.0",
-    "pug-lint": "2.4.0",
+    "pug-lint": "2.5.0",
     "twemoji-awesome": "1.0.6",
-    "typescript": "2.4.2",
-    "uglify-es": "3.0.27",
-    "vee-validate": "2.0.0-rc.13",
+    "typescript": "2.5.2",
+    "uglify-es": "3.0.28",
+    "vee-validate": "2.0.0-rc.14",
     "vue": "2.4.2",
     "vue-clipboards": "1.1.0",
     "vue-lodash": "1.0.3",
     "vue-resource": "1.3.4",
     "vue-template-compiler": "2.4.2",
     "vue-template-es2015-compiler": "1.5.3",
-    "vuex": "2.3.1"
+    "vuex": "2.4.0"
   },
   "jest": {
     "collectCoverage": false,

+ 2 - 3
server/modules/git.js

@@ -53,10 +53,9 @@ module.exports = {
 
     self.onReady = (wiki.IS_MASTER) ? self._initRepo() : Promise.resolve()
 
-    // Define signature
-
     if (wiki.config.git) {
-      self._signature.email = wiki.config.git.serverEmail || 'wiki@example.com'
+      self._repo.branch = appconfig.git.branch || 'master'
+      self._signature.email = appconfig.git.serverEmail || 'wiki@example.com'
     }
 
     return self

+ 2 - 0
server/modules/graphql.js

@@ -12,6 +12,7 @@ const typeDefs = fs.readFileSync(path.join(wiki.SERVERPATH, 'schemas/types.graph
 const DateScalar = require('../schemas/scalar-date')
 const CommentResolvers = require('../schemas/resolvers-comment')
 const DocumentResolvers = require('../schemas/resolvers-document')
+const FileResolvers = require('../schemas/resolvers-file')
 const FolderResolvers = require('../schemas/resolvers-folder')
 const GroupResolvers = require('../schemas/resolvers-group')
 const SettingResolvers = require('../schemas/resolvers-setting')
@@ -21,6 +22,7 @@ const UserResolvers = require('../schemas/resolvers-user')
 const resolvers = _.merge(
   CommentResolvers,
   DocumentResolvers,
+  FileResolvers,
   FolderResolvers,
   GroupResolvers,
   SettingResolvers,

+ 52 - 0
server/schemas/resolvers-file.js

@@ -0,0 +1,52 @@
+'use strict'
+
+/* global wiki */
+
+const gql = require('graphql')
+
+module.exports = {
+  Query: {
+    files(obj, args, context, info) {
+      return wiki.db.File.findAll({ where: args })
+    }
+  },
+  Mutation: {
+    uploadFile(obj, args) {
+      // todo
+      return wiki.db.File.create(args)
+    },
+    deleteFile(obj, args) {
+      return wiki.db.File.destroy({
+        where: {
+          id: args.id
+        },
+        limit: 1
+      })
+    },
+    renameFile(obj, args) {
+      return wiki.db.File.update({
+        filename: args.filename
+      }, {
+        where: { id: args.id }
+      })
+    },
+    moveFile(obj, args) {
+      return wiki.db.File.findById(args.fileId).then(fl => {
+        if (!fl) {
+          throw new gql.GraphQLError('Invalid File ID')
+        }
+        return wiki.db.Folder.findById(args.folderId).then(fld => {
+          if (!fld) {
+            throw new gql.GraphQLError('Invalid Folder ID')
+          }
+          return fl.setFolder(fld)
+        })
+      })
+    }
+  },
+  File: {
+    folder(fl) {
+      return fl.getFolder()
+    }
+  }
+}

+ 19 - 0
server/schemas/types.graphql

@@ -206,6 +206,10 @@ type Mutation {
     id: Int!
   ): OperationResult
 
+  deleteFile(
+    id: Int!
+  ): OperationResult
+
   deleteFolder(
     id: Int!
   ): OperationResult
@@ -255,6 +259,16 @@ type Mutation {
     path: String!
   ): OperationResult
 
+  moveFile(
+    id: Int!
+    folderId: Int!
+  ): OperationResult
+
+  renameFile(
+    id: Int!
+    name: String!
+  ): OperationResult
+
   renameFolder(
     id: Int!
     name: String!
@@ -297,4 +311,9 @@ type Mutation {
     id: Int!
     passwordRaw: String!
   ): OperationResult
+
+  uploadFile(
+    category: FileType!
+    filename: String!
+  ): File
 }

+ 1 - 1
tools/docker-compose.yml

@@ -14,6 +14,6 @@ services:
     ports:
       - '80:3000'
     environment:
-      - WIKI_ADMIN_EMAIL: admin@example.com
+      WIKI_ADMIN_EMAIL: admin@example.com
     volumes:
       - ./config.yml:/var/wiki/config.yml

+ 6 - 7
wercker.yml

@@ -33,7 +33,7 @@ deploy-docker-master:
       name: copy app files
       code: |
         mkdir -p /var/wiki
-        cp -LR assets node_modules server config.sample.yml package.json /var/wiki
+        cp -LR assets node_modules server config.sample.yml package.json LICENSE /var/wiki
         rm -rf /pipeline
     - internal/docker-push:
         username: $DOCKER_HUB_USERNAME
@@ -58,7 +58,7 @@ deploy-docker-dev:
       name: copy app files
       code: |
         mkdir -p /var/wiki
-        cp -LR assets node_modules server config.sample.yml package.json /var/wiki
+        cp -LR assets node_modules server config.sample.yml package.json LICENSE /var/wiki
         rm -rf /pipeline
     - internal/docker-push:
         username: $DOCKER_HUB_USERNAME
@@ -76,15 +76,14 @@ deploy-github:
     - script:
       name: package
       code: |
-        tar -chzfv wiki-js.tar.gz * -X .build/.deployexclude
-        tar -chzfv node_modules.tar.gz node_modules
-        SEMVER_LAST=`npm show wiki.js version`
-        chmod +x ./.build/semver_next.sh
-        SEMVER_NEXT=`./.build/semver_next.sh -p $SEMVER_LAST`
+        tar -chzf wiki-js.tar.gz assets server config.sample.yml package.json wiki.js LICENSE
+        tar -chzf node_modules.tar.gz node_modules
+        SEMVER_NEXT=`curl --request POST --url https://beta.requarks.io/api/version/increment --header "authorization: $WIKIJSORG_TOKEN" --header 'cache-control: no-cache' --header 'content-type: application/json' --data '{"channel": "stable"}'`
     - github-create-release:
       token: $GITHUB_TOKEN
       tag: "v${SEMVER_NEXT}"
       prerelease: true
+      title: "$SEMVER_NEXT Release"
     - github-upload-asset:
       token: $GITHUB_TOKEN
       file: wiki-js.tar.gz

Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 318 - 265
yarn.lock


Một số tệp đã không được hiển thị bởi vì quá nhiều tập tin thay đổi trong này khác