Browse Source

Merge branch 'master' into DepauMD

DepauMD
Davide Depau 1 year ago
parent
commit
d59212ea8b
Signed by: Depau <davide@depau.eu> GPG Key ID: C7D999B6A55EFE86
82 changed files with 2230 additions and 2043 deletions
  1. +1
    -1
      .babelrc
  2. +1
    -0
      .eslintrc.js
  3. +24
    -24
      .travis.yml
  4. +3
    -0
      README.md
  5. +1
    -1
      app.js
  6. +1
    -0
      docs/configuration-config-file.md
  7. +1
    -0
      docs/configuration-env-vars.md
  8. +50
    -0
      docs/guides/auth/keycloak.md
  9. +4
    -0
      docs/guides/migrations-and-breaking-changes.md
  10. +1
    -1
      docs/setup/docker.md
  11. +1
    -2
      docs/setup/manual-setup.md
  12. +2
    -0
      lib/config/default.js
  13. +2
    -1
      lib/config/environment.js
  14. +1
    -1
      lib/config/hackmdEnvironment.js
  15. +6
    -6
      lib/config/index.js
  16. +1
    -1
      lib/config/oldEnvironment.js
  17. +2
    -2
      lib/letter-avatars.js
  18. +1
    -1
      lib/logger.js
  19. +1
    -0
      lib/migrations/20150702001020-update-to-0_3_1.js
  20. +4
    -3
      lib/migrations/20160112220142-note-add-lastchange.js
  21. +1
    -0
      lib/migrations/20160420180355-note-add-alias.js
  22. +1
    -0
      lib/migrations/20160515114000-user-add-tokens.js
  23. +1
    -0
      lib/migrations/20160607060246-support-revision.js
  24. +1
    -0
      lib/migrations/20160703062241-support-authorship.js
  25. +1
    -0
      lib/migrations/20161009040430-support-delete-note.js
  26. +2
    -0
      lib/migrations/20161201050312-support-email-signin.js
  27. +8
    -8
      lib/migrations/20171009121200-longtext-for-mysql.js
  28. +4
    -4
      lib/migrations/20180209120907-longtext-of-authorship.js
  29. +2
    -2
      lib/migrations/20180306150303-fix-enum.js
  30. +8
    -8
      lib/models/index.js
  31. +32
    -14
      lib/models/user.js
  32. +11
    -11
      lib/response.js
  33. +1
    -1
      lib/web/auth/dropbox/index.js
  34. +10
    -4
      lib/web/auth/email/index.js
  35. +1
    -1
      lib/web/auth/facebook/index.js
  36. +1
    -1
      lib/web/auth/github/index.js
  37. +1
    -1
      lib/web/auth/gitlab/index.js
  38. +3
    -3
      lib/web/auth/google/index.js
  39. +2
    -2
      lib/web/auth/ldap/index.js
  40. +7
    -7
      lib/web/auth/mattermost/index.js
  41. +1
    -1
      lib/web/auth/oauth2/index.js
  42. +2
    -2
      lib/web/auth/openid/index.js
  43. +1
    -1
      lib/web/auth/saml/index.js
  44. +1
    -1
      lib/web/auth/twitter/index.js
  45. +1
    -1
      lib/web/historyRouter.js
  46. +8
    -8
      lib/web/imageRouter/imgur.js
  47. +1
    -1
      lib/web/imageRouter/minio.js
  48. +1
    -1
      lib/web/imageRouter/s3.js
  49. +3
    -0
      lib/web/middleware/tooBusy.js
  50. +1
    -1
      lib/web/noteRouter.js
  51. +1
    -1
      lib/web/statusRouter.js
  52. +1
    -1
      lib/web/userRouter.js
  53. +120
    -103
      locales/es.json
  54. +121
    -0
      locales/vi.json
  55. +11
    -9
      package.json
  56. +18
    -0
      public/css/extra.css
  57. +4
    -19
      public/css/index.css
  58. +61
    -0
      public/css/slide-preview.css
  59. +33
    -0
      public/css/ui/toolbar.css
  60. +74
    -1
      public/docs/release-notes.md
  61. +50
    -50
      public/js/cover.js
  62. +218
    -218
      public/js/extra.js
  63. +77
    -76
      public/js/history.js
  64. +560
    -554
      public/js/index.js
  65. +16
    -16
      public/js/lib/common/login.js
  66. +3
    -1
      public/js/lib/editor/index.js
  67. +17
    -17
      public/js/lib/editor/toolbar.html
  68. +7
    -7
      public/js/lib/editor/utils.js
  69. +2
    -2
      public/js/lib/syncscroll.js
  70. +24
    -24
      public/js/pretty.js
  71. +1
    -1
      public/js/render.js
  72. +5
    -5
      public/js/slide.js
  73. +1
    -21
      public/vendor/showup/showup.css
  74. +1
    -1
      public/views/codimd/foot.ejs
  75. +1
    -1
      public/views/html.hbs
  76. +3
    -2
      public/views/index/body.ejs
  77. +1
    -1
      public/views/index/foot.ejs
  78. +1
    -1
      public/views/pretty.ejs
  79. +1
    -1
      public/views/slide.ejs
  80. +64
    -0
      test/user.js
  81. +0
    -12
      webpack.common.js
  82. +507
    -770
      yarn.lock

+ 1
- 1
.babelrc View File

@@ -2,7 +2,7 @@
"presets": [
["env", {
"targets": {
"node": "6",
"node": "8",
"uglify": true
}
}]


+ 1
- 0
.eslintrc.js View File

@@ -10,6 +10,7 @@ module.exports = {
// wrong.
"import/first": ["warn"],
"indent": ["warn"],
"no-console": ["warn"],
"no-multiple-empty-lines": ["warn"],
"no-multi-spaces": ["warn"],
"object-curly-spacing": ["warn"],


+ 24
- 24
.travis.yml View File

@@ -1,40 +1,40 @@
language: node_js
dist: trusty
dist: xenial
cache: yarn
env:
global:
- CXX=g++-4.8
- YARN_VERSION=1.15.2

jobs:
include:
- env: task=npm-test
node_js:
- 6
before_install:
- curl -o- -L https://yarnpkg.com/install.sh | bash -s -- --version "$YARN_VERSION"
- export PATH="$HOME/.yarn/bin:$PATH"
- env: task=npm-test
node_js:
- 8
before_install:
- curl -o- -L https://yarnpkg.com/install.sh | bash -s -- --version "$YARN_VERSION"
- export PATH="$HOME/.yarn/bin:$PATH"
- env: task=npm-test
- stage: Static Tests
name: eslint
node_js:
- 10
before_install:
- curl -o- -L https://yarnpkg.com/install.sh | bash -s -- --version "$YARN_VERSION"
- export PATH="$HOME/.yarn/bin:$PATH"
- env: task=ShellCheck
script:
- yarn run eslint
- name: ShellCheck
script:
- shellcheck bin/heroku bin/setup
language: generic
- env: task=json-lint
- name: json-lint
addons:
apt:
packages:
- jq
script:
- npm run jsonlint
- yarn run jsonlint
language: generic
- stage: Dynamic Tests
name: Node.js 8
node_js:
- 8
script:
- yarn run mocha-suite
- name: Node.js 10
node_js:
- 10
script:
- yarn run mocha-suite
- name: Node.js 12
node_js:
- 12
script:
- yarn run mocha-suite

+ 3
- 0
README.md View File

@@ -5,6 +5,7 @@ CodiMD
[![build status][travis-image]][travis-url]
[![version][github-version-badge]][github-release-page]
[![POEditor][poeditor-image]][poeditor-url]
[![Mastodon][social-mastodon-image]][social-mastodon]

CodiMD lets you create real-time collaborative markdown notes. You can test-drive
it by visiting our [CodiMD demo server][codimd-demo].
@@ -98,3 +99,5 @@ Licensed under AGPLv3. For our list of contributors, see [AUTHORS](AUTHORS).
[codimd-demo-features]: https://demo.codimd.org/features
[codimd-community]: https://community.codimd.org
[codimd-community-calls]: https://community.codimd.org/t/codimd-community-call/19
[social-mastodon]: https://social.codimd.org/mastodon
[social-mastodon-image]: https://img.shields.io/badge/social-mastodon-3c99dc.svg

+ 1
- 1
app.js View File

@@ -113,7 +113,7 @@ if (config.csp.enable) {
}

i18n.configure({
locales: ['en', 'zh-CN', 'zh-TW', 'fr', 'de', 'ja', 'es', 'ca', 'el', 'pt', 'it', 'tr', 'ru', 'nl', 'hr', 'pl', 'uk', 'hi', 'sv', 'eo', 'da', 'ko', 'id', 'sr'],
locales: ['en', 'zh-CN', 'zh-TW', 'fr', 'de', 'ja', 'es', 'ca', 'el', 'pt', 'it', 'tr', 'ru', 'nl', 'hr', 'pl', 'uk', 'hi', 'sv', 'eo', 'da', 'ko', 'id', 'sr', 'vi'],
cookie: 'locale',
indent: ' ', // this is the style poeditor.com exports it, this creates less churn
directory: path.join(__dirname, '/locales'),


+ 1
- 0
docs/configuration-config-file.md View File

@@ -32,6 +32,7 @@ to `config.json` before filling in your own details.
| `imageUploadType` | `imgur`, `s3`, `minio`, `azure`, `lutim` or `filesystem`(default) | Where to upload images. For S3, see our Image Upload Guides for [S3](guides/s3-image-upload.md) or [Minio](guides/minio-image-upload.md)|
| `sourceURL` | `https://github.com/codimd/server/tree/<current commit>` | Provides the link to the source code of CodiMD on the entry page (Please, make sure you change this when you run a modified version) |
| `staticCacheTime` | `1 * 24 * 60 * 60 * 1000` | static file cache time |
| `tooBusyLag` | `70` | CPU time for one eventloop tick until node throttles connections. (milliseconds) |
| `heartbeatInterval` | `5000` | socket.io heartbeat interval |
| `heartbeatTimeout` | `10000` | socket.io heartbeat timeout |
| `documentMaxLength` | `100000` | note max length |


+ 1
- 0
docs/configuration-env-vars.md View File

@@ -35,6 +35,7 @@ defaultNotePath can't be set from env-vars
| `CMD_FORBIDDEN_NOTE_IDS` | `'robots.txt'` | disallow creation of notes, even if `CMD_ALLOW_FREEURL` is `true` |
| `CMD_IMAGE_UPLOAD_TYPE` | `imgur`, `s3`, `minio`, `lutim` or `filesystem` | Where to upload images. For S3, see our Image Upload Guides for [S3](guides/s3-image-upload.md) or [Minio](guides/minio-image-upload.md), also there's a whole section on their respective env vars below. |
| `CMD_SOURCE_URL` | `https://github.com/codimd/server/tree/<current commit>` | Provides the link to the source code of CodiMD on the entry page (Please, make sure you change this when you run a modified version) |
| `CMD_TOOBUSY_LAG` | `70` | CPU time for one eventloop tick until node throttles connections. (milliseconds) |


## CodiMD Location


+ 50
- 0
docs/guides/auth/keycloak.md View File

@@ -0,0 +1,50 @@
Keycloak/Red Hat SSO (self-hosted)
===

## Prerequisites

This guide assumes you have run and configured Keycloak. If you'd like to meet this prerequisite quickly, it can be achieved by running a `jboss/keycloak` container and attaching it to your network. Set the environment variables KEYCLOAK_USER and `KEYCLOAK_PASSWORD`, and expose port 8080.

Where HTTPS is specified throughout, use HTTP instead. You may also have to specify the exposed port, 8080.

## Steps

1. Sign in to the administration portal for your Keycloak instance at https://keycloak.example.com/auth/admin/master/console

You may note that a separate realm is specified throughout this tutorial. It is best practice not to use the master realm, as it normally contains the realm-management client that federates access using the policies and permissions you can create.

2. Navigate to the client management page at `https://keycloak.example.com/auth/admin/master/console/#/realms/your-realm/clients` (admin permissions required)
3. Click **Create** to create a new client and fill out the registration form. You should set the Root URL to the fully qualified public URL of your CodiMD instance.
4. Click **Save**
5. Set the **Access Type** of the client to `confidential`. This will make your client require a client secret upon authentication.

---

### Additional steps to circumvent generic OAuth2 issue:

1. Select Client Scopes from the sidebar, and begin to create a new client scope using the Create button.
2. Ensure that the **Name** field is set to `id`.
3. Create a new mapper under the Mappers tab. This should reference the User Property `id`. `Claim JSON Type` should be String and all switches below should be enabled. Save the mapper.
4. Go to the client you set up in the previous steps using the Clients page, then choose the Client Scopes tab. Apply the scope you've created. This should mitigate errors as seen in [codimd/server#56](https://github.com/codimd/server/issues/56), as the `/userinfo` endpoint should now bring back the user's ID under the `id` key as well as `sub`.

---

6. In the `docker-compose.yml` add the following environment variables to `app:` `environment:`

```
CMD_OAUTH2_USER_PROFILE_URL=https://keycloak.example.com/auth/realms/your-realm/protocol/openid-connect/userinfo
CMD_OAUTH2_USER_PROFILE_USERNAME_ATTR=preferred_username
CMD_OAUTH2_USER_PROFILE_DISPLAY_NAME_ATTR=name
CMD_OAUTH2_USER_PROFILE_EMAIL_ATTR=email
CMD_OAUTH2_TOKEN_URL=https://keycloak.example.com/auth/realms/your-realm/protocol/openid-connect/token
CMD_OAUTH2_AUTHORIZATION_URL=https://keycloak.example.com/auth/realms/your-realm/protocol/openid-connect/auth
CMD_OAUTH2_CLIENT_ID=<your client ID>
CMD_OAUTH2_CLIENT_SECRET=<your client secret, which you can find under the Credentials tab for your client>
CMD_OAUTH2_PROVIDERNAME=Keycloak
CMD_DOMAIN=<codimd.example.com>
CMD_PROTOCOL_USESSL=true
CMD_URL_ADDPORT=false
```

7. Run `docker-compose up -d` to apply your settings.
8. Sign in to your CodiMD using your Keycloak ID

+ 4
- 0
docs/guides/migrations-and-breaking-changes.md View File

@@ -1,6 +1,10 @@
Migrations and Notable Changes
===

## Migrating to 1.4.0

We dropped support for node 6 with this version. If you have any trouble running this version, please double check that you are running at least node 8!

## Migrating to 1.3.2

This is not a breaking change, but to stay up to date with the community


+ 1
- 1
docs/setup/docker.md View File

@@ -16,7 +16,7 @@ CodiMD by docker container
The easiest way to setup CodiMD using docker are using the following three commands:

```sh
git clone https://github.com/codimd/container.git
git clone https://github.com/codimd/container.git codimd-container
cd codimd-container
docker-compose up
```


+ 1
- 2
docs/setup/manual-setup.md View File

@@ -3,11 +3,10 @@ Manual Installation

## Requirements on your server

- Node.js 6.x or up (test up to 7.5.0) and <10.x
- Node.js 8.5 or up
- Database (PostgreSQL, MySQL, MariaDB, SQLite, MSSQL) use charset `utf8`
- npm (and its dependencies, [node-gyp](https://github.com/nodejs/node-gyp#installation))
- yarn
- `libssl-dev` for building scrypt (see [here](https://github.com/ml1nk/node-scrypt/blob/master/README.md#installation-instructions) for further information)
- Bash (for the setup script)
- For **building** CodiMD we recommend to use a machine with at least **2GB** RAM



+ 2
- 0
lib/config/default.js View File

@@ -56,6 +56,8 @@ module.exports = {
// socket.io
heartbeatInterval: 5000,
heartbeatTimeout: 10000,
// too busy timeout
tooBusyLag: 70,
// document
documentMaxLength: 100000,
// image upload setting, available options are imgur/s3/filesystem/azure/lutim


+ 2
- 1
lib/config/environment.js View File

@@ -1,6 +1,6 @@
'use strict'

const {toBooleanConfig, toArrayConfig, toIntegerConfig} = require('./utils')
const { toBooleanConfig, toArrayConfig, toIntegerConfig } = require('./utils')

module.exports = {
sourceURL: process.env.CMD_SOURCE_URL,
@@ -33,6 +33,7 @@ module.exports = {
dbURL: process.env.CMD_DB_URL,
sessionSecret: process.env.CMD_SESSION_SECRET,
sessionLife: toIntegerConfig(process.env.CMD_SESSION_LIFE),
tooBusyLag: toIntegerConfig(process.env.CMD_TOOBUSY_LAG),
imageUploadType: process.env.CMD_IMAGE_UPLOAD_TYPE,
imgur: {
clientID: process.env.CMD_IMGUR_CLIENTID


+ 1
- 1
lib/config/hackmdEnvironment.js View File

@@ -1,6 +1,6 @@
'use strict'

const {toBooleanConfig, toArrayConfig, toIntegerConfig} = require('./utils')
const { toBooleanConfig, toArrayConfig, toIntegerConfig } = require('./utils')

module.exports = {
domain: process.env.HMD_DOMAIN,


+ 6
- 6
lib/config/index.js View File

@@ -4,11 +4,11 @@
const crypto = require('crypto')
const fs = require('fs')
const path = require('path')
const {merge} = require('lodash')
const { merge } = require('lodash')
const deepFreeze = require('deep-freeze')
const {Environment, Permission} = require('./enum')
const { Environment, Permission } = require('./enum')
const logger = require('../logger')
const {getGitCommit, getGitHubURL} = require('./utils')
const { getGitCommit, getGitHubURL } = require('./utils')

const appRootPath = path.resolve(__dirname, '../../')
const env = process.env.NODE_ENV || Environment.development
@@ -17,7 +17,7 @@ const debugConfig = {
}

// Get version string from package.json
const {version, repository} = require(path.join(appRootPath, 'package.json'))
const { version, repository } = require(path.join(appRootPath, 'package.json'))

const commitID = getGitCommit(appRootPath)
const sourceURL = getGitHubURL(repository.url, commitID || version)
@@ -159,8 +159,8 @@ if (Object.keys(process.env).toString().indexOf('HMD_') !== -1) {
if (config.sessionSecret === 'secret') {
logger.warn('Session secret not set. Using random generated one. Please set `sessionSecret` in your config.js file. All users will be logged out.')
config.sessionSecret = crypto.randomBytes(Math.ceil(config.sessionSecretLen / 2)) // generate crypto graphic random number
.toString('hex') // convert to hexadecimal format
.slice(0, config.sessionSecretLen) // return required number of characters
.toString('hex') // convert to hexadecimal format
.slice(0, config.sessionSecretLen) // return required number of characters
}

// Validate upload upload providers


+ 1
- 1
lib/config/oldEnvironment.js View File

@@ -1,6 +1,6 @@
'use strict'

const {toBooleanConfig} = require('./utils')
const { toBooleanConfig } = require('./utils')

module.exports = {
debug: toBooleanConfig(process.env.DEBUG),


+ 2
- 2
lib/letter-avatars.js View File

@@ -30,14 +30,14 @@ exports.generateAvatarURL = function (name, email = '', big = true) {
if (typeof email !== 'string') {
email = '' + name + '@example.com'
}
name=encodeURIComponent(name)
name = encodeURIComponent(name)

let hash = crypto.createHash('md5')
hash.update(email.toLowerCase())
let hexDigest = hash.digest('hex')

if (email !== '' && config.allowGravatar) {
photo = 'https://cdn.libravatar.org/avatar/' + hexDigest;
photo = 'https://cdn.libravatar.org/avatar/' + hexDigest
if (big) {
photo += '?s=400'
} else {


+ 1
- 1
lib/logger.js View File

@@ -1,5 +1,5 @@
'use strict'
const {createLogger, format, transports} = require('winston')
const { createLogger, format, transports } = require('winston')

const logger = createLogger({
level: 'debug',


+ 1
- 0
lib/migrations/20150702001020-update-to-0_3_1.js View File

@@ -22,6 +22,7 @@ module.exports = {
})
}).catch(function (error) {
if (error.message === 'SQLITE_ERROR: duplicate column name: shortid' || error.message === "ER_DUP_FIELDNAME: Duplicate column name 'shortid'" || error.message === 'column "shortid" of relation "Notes" already exists') {
// eslint-disable-next-line no-console
console.log('Migration has already run… ignoring.')
} else {
throw error


+ 4
- 3
lib/migrations/20160112220142-note-add-lastchange.js View File

@@ -9,6 +9,7 @@ module.exports = {
})
}).catch(function (error) {
if (error.message === 'SQLITE_ERROR: duplicate column name: lastchangeuserId' || error.message === "ER_DUP_FIELDNAME: Duplicate column name 'lastchangeuserId'" || error.message === 'column "lastchangeuserId" of relation "Notes" already exists') {
// eslint-disable-next-line no-console
console.log('Migration has already run… ignoring.')
} else {
throw error
@@ -18,8 +19,8 @@ module.exports = {

down: function (queryInterface, Sequelize) {
return queryInterface.removeColumn('Notes', 'lastchangeAt')
.then(function () {
return queryInterface.removeColumn('Notes', 'lastchangeuserId')
})
.then(function () {
return queryInterface.removeColumn('Notes', 'lastchangeuserId')
})
}
}

+ 1
- 0
lib/migrations/20160420180355-note-add-alias.js View File

@@ -9,6 +9,7 @@ module.exports = {
})
}).catch(function (error) {
if (error.message === 'SQLITE_ERROR: duplicate column name: alias' || error.message === "ER_DUP_FIELDNAME: Duplicate column name 'alias'" || error.message === 'column "alias" of relation "Notes" already exists') {
// eslint-disable-next-line no-console
console.log('Migration has already run… ignoring.')
} else {
throw error


+ 1
- 0
lib/migrations/20160515114000-user-add-tokens.js View File

@@ -5,6 +5,7 @@ module.exports = {
return queryInterface.addColumn('Users', 'refreshToken', Sequelize.STRING)
}).catch(function (error) {
if (error.message === 'SQLITE_ERROR: duplicate column name: accessToken' || error.message === "ER_DUP_FIELDNAME: Duplicate column name 'accessToken'" || error.message === 'column "accessToken" of relation "Users" already exists') {
// eslint-disable-next-line no-console
console.log('Migration has already run… ignoring.')
} else {
throw error


+ 1
- 0
lib/migrations/20160607060246-support-revision.js View File

@@ -17,6 +17,7 @@ module.exports = {
})
}).catch(function (error) {
if (error.message === 'SQLITE_ERROR: duplicate column name: savedAt' | error.message === "ER_DUP_FIELDNAME: Duplicate column name 'savedAt'" || error.message === 'column "savedAt" of relation "Notes" already exists') {
// eslint-disable-next-line no-console
console.log('Migration has already run… ignoring.')
} else {
throw error


+ 1
- 0
lib/migrations/20160703062241-support-authorship.js View File

@@ -18,6 +18,7 @@ module.exports = {
})
}).catch(function (error) {
if (error.message === 'SQLITE_ERROR: duplicate column name: authorship' || error.message === "ER_DUP_FIELDNAME: Duplicate column name 'authorship'" || error.message === 'column "authorship" of relation "Notes" already exists') {
// eslint-disable-next-line no-console
console.log('Migration has already run… ignoring.')
} else {
throw error


+ 1
- 0
lib/migrations/20161009040430-support-delete-note.js View File

@@ -3,6 +3,7 @@ module.exports = {
up: function (queryInterface, Sequelize) {
return queryInterface.addColumn('Notes', 'deletedAt', Sequelize.DATE).catch(function (error) {
if (error.message === 'SQLITE_ERROR: duplicate column name: deletedAt' || error.message === "ER_DUP_FIELDNAME: Duplicate column name 'deletedAt'" || error.message === 'column "deletedAt" of relation "Notes" already exists') {
// eslint-disable-next-line no-console
console.log('Migration has already run… ignoring.')
} else {
throw error


+ 2
- 0
lib/migrations/20161201050312-support-email-signin.js View File

@@ -4,6 +4,7 @@ module.exports = {
return queryInterface.addColumn('Users', 'email', Sequelize.TEXT).then(function () {
return queryInterface.addColumn('Users', 'password', Sequelize.TEXT).catch(function (error) {
if (error.message === "ER_DUP_FIELDNAME: Duplicate column name 'password'" || error.message === 'column "password" of relation "Users" already exists') {
// eslint-disable-next-line no-console
console.log('Migration has already run… ignoring.')
} else {
throw error
@@ -11,6 +12,7 @@ module.exports = {
})
}).catch(function (error) {
if (error.message === 'SQLITE_ERROR: duplicate column name: email' || error.message === "ER_DUP_FIELDNAME: Duplicate column name 'email'" || error.message === 'column "email" of relation "Users" already exists') {
// eslint-disable-next-line no-console
console.log('Migration has already run… ignoring.')
} else {
throw error


+ 8
- 8
lib/migrations/20171009121200-longtext-for-mysql.js View File

@@ -1,16 +1,16 @@
'use strict'
module.exports = {
up: function (queryInterface, Sequelize) {
queryInterface.changeColumn('Notes', 'content', {type: Sequelize.TEXT('long')})
queryInterface.changeColumn('Revisions', 'patch', {type: Sequelize.TEXT('long')})
queryInterface.changeColumn('Revisions', 'content', {type: Sequelize.TEXT('long')})
queryInterface.changeColumn('Revisions', 'lastContent', {type: Sequelize.TEXT('long')})
queryInterface.changeColumn('Notes', 'content', { type: Sequelize.TEXT('long') })
queryInterface.changeColumn('Revisions', 'patch', { type: Sequelize.TEXT('long') })
queryInterface.changeColumn('Revisions', 'content', { type: Sequelize.TEXT('long') })
queryInterface.changeColumn('Revisions', 'lastContent', { type: Sequelize.TEXT('long') })
},

down: function (queryInterface, Sequelize) {
queryInterface.changeColumn('Notes', 'content', {type: Sequelize.TEXT})
queryInterface.changeColumn('Revisions', 'patch', {type: Sequelize.TEXT})
queryInterface.changeColumn('Revisions', 'content', {type: Sequelize.TEXT})
queryInterface.changeColumn('Revisions', 'lastContent', {type: Sequelize.TEXT})
queryInterface.changeColumn('Notes', 'content', { type: Sequelize.TEXT })
queryInterface.changeColumn('Revisions', 'patch', { type: Sequelize.TEXT })
queryInterface.changeColumn('Revisions', 'content', { type: Sequelize.TEXT })
queryInterface.changeColumn('Revisions', 'lastContent', { type: Sequelize.TEXT })
}
}

+ 4
- 4
lib/migrations/20180209120907-longtext-of-authorship.js View File

@@ -2,12 +2,12 @@

module.exports = {
up: function (queryInterface, Sequelize) {
queryInterface.changeColumn('Notes', 'authorship', {type: Sequelize.TEXT('long')})
queryInterface.changeColumn('Revisions', 'authorship', {type: Sequelize.TEXT('long')})
queryInterface.changeColumn('Notes', 'authorship', { type: Sequelize.TEXT('long') })
queryInterface.changeColumn('Revisions', 'authorship', { type: Sequelize.TEXT('long') })
},

down: function (queryInterface, Sequelize) {
queryInterface.changeColumn('Notes', 'authorship', {type: Sequelize.TEXT})
queryInterface.changeColumn('Revisions', 'authorship', {type: Sequelize.TEXT})
queryInterface.changeColumn('Notes', 'authorship', { type: Sequelize.TEXT })
queryInterface.changeColumn('Revisions', 'authorship', { type: Sequelize.TEXT })
}
}

+ 2
- 2
lib/migrations/20180306150303-fix-enum.js View File

@@ -2,10 +2,10 @@

module.exports = {
up: function (queryInterface, Sequelize) {
queryInterface.changeColumn('Notes', 'permission', {type: Sequelize.ENUM('freely', 'editable', 'limited', 'locked', 'protected', 'private')})
queryInterface.changeColumn('Notes', 'permission', { type: Sequelize.ENUM('freely', 'editable', 'limited', 'locked', 'protected', 'private') })
},

down: function (queryInterface, Sequelize) {
queryInterface.changeColumn('Notes', 'permission', {type: Sequelize.ENUM('freely', 'editable', 'locked', 'private')})
queryInterface.changeColumn('Notes', 'permission', { type: Sequelize.ENUM('freely', 'editable', 'locked', 'private') })
}
}

+ 8
- 8
lib/models/index.js View File

@@ -3,7 +3,7 @@
var fs = require('fs')
var path = require('path')
var Sequelize = require('sequelize')
const {cloneDeep} = require('lodash')
const { cloneDeep } = require('lodash')

// core
var config = require('../config')
@@ -39,13 +39,13 @@ sequelize.processData = processData
var db = {}

fs.readdirSync(__dirname)
.filter(function (file) {
return (file.indexOf('.') !== 0) && (file !== 'index.js')
})
.forEach(function (file) {
var model = sequelize.import(path.join(__dirname, file))
db[model.name] = model
})
.filter(function (file) {
return (file.indexOf('.') !== 0) && (file !== 'index.js')
})
.forEach(function (file) {
var model = sequelize.import(path.join(__dirname, file))
db[model.name] = model
})

Object.keys(db).forEach(function (modelName) {
if ('associate' in db[modelName]) {


+ 32
- 14
lib/models/user.js View File

@@ -1,11 +1,20 @@
'use strict'
// external modules
var Sequelize = require('sequelize')
var scrypt = require('scrypt')
const Sequelize = require('sequelize')
const crypto = require('crypto')
if (!crypto.scrypt) {
// polyfill for node.js 8.0, see https://github.com/chrisveness/scrypt-kdf#openssl-implementation
const scryptAsync = require('scrypt-async')
crypto.scrypt = function (password, salt, keylen, options, callback) {
const opt = Object.assign({}, options, { dkLen: keylen })
scryptAsync(password, salt, opt, (derivedKey) => callback(null, Buffer.from(derivedKey)))
}
}
const scrypt = require('scrypt-kdf')

// core
var logger = require('../logger')
var {generateAvatarURL} = require('../letter-avatars')
const logger = require('../logger')
const { generateAvatarURL } = require('../letter-avatars')

module.exports = function (sequelize, DataTypes) {
var User = sequelize.define('User', {
@@ -41,20 +50,12 @@ module.exports = function (sequelize, DataTypes) {
}
},
password: {
type: Sequelize.TEXT,
set: function (value) {
var hash = scrypt.kdfSync(value, scrypt.paramsSync(0.1)).toString('hex')
this.setDataValue('password', hash)
}
type: Sequelize.TEXT
}
}, {
instanceMethods: {
verifyPassword: function (attempt) {
if (scrypt.verifyKdfSync(Buffer.from(this.password, 'hex'), attempt)) {
return this
} else {
return false
}
return scrypt.verify(Buffer.from(this.password, 'hex'), attempt)
}
},
classMethods: {
@@ -140,6 +141,9 @@ module.exports = function (sequelize, DataTypes) {
case 'saml':
photo = generateAvatarURL(profile.username, profile.emails[0], bigger)
break
default:
photo = generateAvatarURL(profile.username)
break
}
return photo
},
@@ -153,5 +157,19 @@ module.exports = function (sequelize, DataTypes) {
}
})

function updatePasswordHashHook (user, options, done) {
// suggested way to hash passwords to be able to do this asynchronously:
// @see https://github.com/sequelize/sequelize/issues/1821#issuecomment-44265819
if (!user.changed('password')) { return done() }

scrypt.kdf(user.getDataValue('password'), { logN: 15 }).then(keyBuf => {
user.setDataValue('password', keyBuf.toString('hex'))
done()
})
}

User.beforeCreate(updatePasswordHashHook)
User.beforeUpdate(updatePasswordHashHook)

return User
}

+ 11
- 11
lib/response.js View File

@@ -18,7 +18,7 @@ var utils = require('./utils')
// public
var response = {
errorForbidden: function (res) {
const {req} = res
const { req } = res
if (req.user) {
responseError(res, '403', 'Forbidden', 'oh no.')
} else {
@@ -549,16 +549,16 @@ function gitlabActionProjects (req, res, note) {
ret.accesstoken = user.accessToken
ret.profileid = user.profileid
request(
config.gitlab.baseURL + '/api/' + config.gitlab.version + '/projects?membership=yes&per_page=100&access_token=' + user.accessToken,
function (error, httpResponse, body) {
if (!error && httpResponse.statusCode === 200) {
ret.projects = JSON.parse(body)
return res.send(ret)
} else {
return res.send(ret)
}
}
)
config.gitlab.baseURL + '/api/' + config.gitlab.version + '/projects?membership=yes&per_page=100&access_token=' + user.accessToken,
function (error, httpResponse, body) {
if (!error && httpResponse.statusCode === 200) {
ret.projects = JSON.parse(body)
return res.send(ret)
} else {
return res.send(ret)
}
}
)
}).catch(function (err) {
logger.error('gitlab action projects failed: ' + err)
return response.errorInternalError(res)


+ 1
- 1
lib/web/auth/dropbox/index.js View File

@@ -4,7 +4,7 @@ const Router = require('express').Router
const passport = require('passport')
const DropboxStrategy = require('passport-dropbox-oauth2').Strategy
const config = require('../../../config')
const {setReturnToFromReferer, passportGeneralCallback} = require('../utils')
const { setReturnToFromReferer, passportGeneralCallback } = require('../utils')

let dropboxAuth = module.exports = Router()



+ 10
- 4
lib/web/auth/email/index.js View File

@@ -7,8 +7,8 @@ const LocalStrategy = require('passport-local').Strategy
const config = require('../../../config')
const models = require('../../../models')
const logger = require('../../../logger')
const {setReturnToFromReferer} = require('../utils')
const {urlencodedParser} = require('../../utils')
const { setReturnToFromReferer } = require('../utils')
const { urlencodedParser } = require('../../utils')
const response = require('../../../response')

let emailAuth = module.exports = Router()
@@ -23,8 +23,14 @@ passport.use(new LocalStrategy({
}
}).then(function (user) {
if (!user) return done(null, false)
if (!user.verifyPassword(password)) return done(null, false)
return done(null, user)
user.verifyPassword(password).then(verified => {
if (verified) {
return done(null, user)
} else {
logger.warn('invalid password given for %s', user.email)
return done(null, false)
}
})
}).catch(function (err) {
logger.error(err)
return done(err)


+ 1
- 1
lib/web/auth/facebook/index.js View File

@@ -5,7 +5,7 @@ const passport = require('passport')
const FacebookStrategy = require('passport-facebook').Strategy

const config = require('../../../config')
const {setReturnToFromReferer, passportGeneralCallback} = require('../utils')
const { setReturnToFromReferer, passportGeneralCallback } = require('../utils')

let facebookAuth = module.exports = Router()



+ 1
- 1
lib/web/auth/github/index.js View File

@@ -5,7 +5,7 @@ const passport = require('passport')
const GithubStrategy = require('passport-github').Strategy
const config = require('../../../config')
const response = require('../../../response')
const {setReturnToFromReferer, passportGeneralCallback} = require('../utils')
const { setReturnToFromReferer, passportGeneralCallback } = require('../utils')

let githubAuth = module.exports = Router()



+ 1
- 1
lib/web/auth/gitlab/index.js View File

@@ -5,7 +5,7 @@ const passport = require('passport')
const GitlabStrategy = require('passport-gitlab2').Strategy
const config = require('../../../config')
const response = require('../../../response')
const {setReturnToFromReferer, passportGeneralCallback} = require('../utils')
const { setReturnToFromReferer, passportGeneralCallback } = require('../utils')

let gitlabAuth = module.exports = Router()



+ 3
- 3
lib/web/auth/google/index.js View File

@@ -4,7 +4,7 @@ const Router = require('express').Router
const passport = require('passport')
var GoogleStrategy = require('passport-google-oauth20').Strategy
const config = require('../../../config')
const {setReturnToFromReferer, passportGeneralCallback} = require('../utils')
const { setReturnToFromReferer, passportGeneralCallback } = require('../utils')

let googleAuth = module.exports = Router()

@@ -12,14 +12,14 @@ passport.use(new GoogleStrategy({
clientID: config.google.clientID,
clientSecret: config.google.clientSecret,
callbackURL: config.serverURL + '/auth/google/callback',
userProfileURL: "https://www.googleapis.com/oauth2/v3/userinfo"
userProfileURL: 'https://www.googleapis.com/oauth2/v3/userinfo'
}, passportGeneralCallback))

googleAuth.get('/auth/google', function (req, res, next) {
setReturnToFromReferer(req)
passport.authenticate('google', { scope: ['profile'] })(req, res, next)
})
// google auth callback
// google auth callback
googleAuth.get('/auth/google/callback',
passport.authenticate('google', {
successReturnToOrRedirect: config.serverURL + '/',


+ 2
- 2
lib/web/auth/ldap/index.js View File

@@ -6,8 +6,8 @@ const LDAPStrategy = require('passport-ldapauth')
const config = require('../../../config')
const models = require('../../../models')
const logger = require('../../../logger')
const {setReturnToFromReferer} = require('../utils')
const {urlencodedParser} = require('../../utils')
const { setReturnToFromReferer } = require('../utils')
const { urlencodedParser } = require('../../utils')
const response = require('../../../response')

let ldapAuth = module.exports = Router()


+ 7
- 7
lib/web/auth/mattermost/index.js View File

@@ -5,7 +5,7 @@ const passport = require('passport')
const Mattermost = require('mattermost')
const OAuthStrategy = require('passport-oauth2').Strategy
const config = require('../../../config')
const {setReturnToFromReferer, passportGeneralCallback} = require('../utils')
const { setReturnToFromReferer, passportGeneralCallback } = require('../utils')

const mattermost = new Mattermost.Client()

@@ -24,12 +24,12 @@ mattermostStrategy.userProfile = (accessToken, done) => {
mattermost.token = accessToken
mattermost.useHeaderToken()
mattermost.getMe(
(data) => {
done(null, data)
},
(err) => {
done(err)
}
(data) => {
done(null, data)
},
(err) => {
done(err)
}
)
}



+ 1
- 1
lib/web/auth/oauth2/index.js View File

@@ -4,7 +4,7 @@ const Router = require('express').Router
const passport = require('passport')
const { Strategy, InternalOAuthError } = require('passport-oauth2')
const config = require('../../../config')
const {setReturnToFromReferer, passportGeneralCallback} = require('../utils')
const { setReturnToFromReferer, passportGeneralCallback } = require('../utils')

let oauth2Auth = module.exports = Router()



+ 2
- 2
lib/web/auth/openid/index.js View File

@@ -6,8 +6,8 @@ const OpenIDStrategy = require('@passport-next/passport-openid').Strategy
const config = require('../../../config')
const models = require('../../../models')
const logger = require('../../../logger')
const {urlencodedParser} = require('../../utils')
const {setReturnToFromReferer} = require('../utils')
const { urlencodedParser } = require('../../utils')
const { setReturnToFromReferer } = require('../utils')

let openIDAuth = module.exports = Router()



+ 1
- 1
lib/web/auth/saml/index.js View File

@@ -6,7 +6,7 @@ const SamlStrategy = require('passport-saml').Strategy
const config = require('../../../config')
const models = require('../../../models')
const logger = require('../../../logger')
const {urlencodedParser} = require('../../utils')
const { urlencodedParser } = require('../../utils')
const fs = require('fs')
const intersection = function (array1, array2) { return array1.filter((n) => array2.includes(n)) }



+ 1
- 1
lib/web/auth/twitter/index.js View File

@@ -5,7 +5,7 @@ const passport = require('passport')
const TwitterStrategy = require('passport-twitter').Strategy

const config = require('../../../config')
const {setReturnToFromReferer, passportGeneralCallback} = require('../utils')
const { setReturnToFromReferer, passportGeneralCallback } = require('../utils')

let twitterAuth = module.exports = Router()



+ 1
- 1
lib/web/historyRouter.js View File

@@ -2,7 +2,7 @@

const Router = require('express').Router

const {urlencodedParser} = require('./utils')
const { urlencodedParser } = require('./utils')
const history = require('../history')
const historyRouter = module.exports = Router()



+ 8
- 8
lib/web/imageRouter/imgur.js View File

@@ -17,12 +17,12 @@ exports.uploadImage = function (imagePath, callback) {

imgur.setClientId(config.imgur.clientID)
imgur.uploadFile(imagePath)
.then(function (json) {
if (config.debug) {
logger.info('SERVER uploadimage success: ' + JSON.stringify(json))
}
callback(null, json.data.link.replace(/^http:\/\//i, 'https://'))
}).catch(function (err) {
callback(new Error(err), null)
})
.then(function (json) {
if (config.debug) {
logger.info('SERVER uploadimage success: ' + JSON.stringify(json))
}
callback(null, json.data.link.replace(/^http:\/\//i, 'https://'))
}).catch(function (err) {
callback(new Error(err), null)
})
}

+ 1
- 1
lib/web/imageRouter/minio.js View File

@@ -3,7 +3,7 @@ const fs = require('fs')
const path = require('path')

const config = require('../../config')
const {getImageMimeType} = require('../../utils')
const { getImageMimeType } = require('../../utils')
const logger = require('../../logger')

const Minio = require('minio')


+ 1
- 1
lib/web/imageRouter/s3.js View File

@@ -3,7 +3,7 @@ const fs = require('fs')
const path = require('path')

const config = require('../../config')
const {getImageMimeType} = require('../../utils')
const { getImageMimeType } = require('../../utils')
const logger = require('../../logger')

const AWS = require('aws-sdk')


+ 3
- 0
lib/web/middleware/tooBusy.js View File

@@ -3,6 +3,9 @@
const toobusy = require('toobusy-js')

const response = require('../../response')
const config = require('../../config')

toobusy.maxLag(config.tooBusyLag)

module.exports = function (req, res, next) {
if (toobusy()) {


+ 1
- 1
lib/web/noteRouter.js View File

@@ -4,7 +4,7 @@ const Router = require('express').Router

const response = require('../response')

const {markdownParser} = require('./utils')
const { markdownParser } = require('./utils')

const noteRouter = module.exports = Router()



+ 1
- 1
lib/web/statusRouter.js View File

@@ -8,7 +8,7 @@ const config = require('../config')
const models = require('../models')
const logger = require('../logger')

const {urlencodedParser} = require('./utils')
const { urlencodedParser } = require('./utils')

const statusRouter = module.exports = Router()



+ 1
- 1
lib/web/userRouter.js View File

@@ -8,7 +8,7 @@ const response = require('../response')
const config = require('../config')
const models = require('../models')
const logger = require('../logger')
const {generateAvatar} = require('../letter-avatars')
const { generateAvatar } = require('../letter-avatars')

const UserRouter = module.exports = Router()



+ 120
- 103
locales/es.json View File

@@ -1,104 +1,121 @@
{
"Collaborative markdown notes": "Notas colaborativas en Markdown",
"Realtime collaborative markdown notes on all platforms.": "Notas colaborativas en Markdown para todas las plataformas.",
"Best way to write and share your knowledge in markdown.": "La mejor forma de escribir y compartir tu conocimiento en Markdown.",
"Intro": "Introducción",
"History": "Historia",
"New guest note": "Nueva nota como invitado",
"Collaborate with URL": "Colaborar via URL",
"Support charts and MathJax": "Soporte para gráficos y MathJax",
"Support slide mode": "Soporte para diapositivas",
"Sign In": "Ingresar",
"Below is the history from browser": "A continuación se muestra el historial del navegador",
"Welcome!": "¡Bienvenido!",
"New note": "Nueva nota",
"or": "o",
"Sign Out": "Salir",
"Explore all features": "Explorar todas las funciones",
"Select tags...": "Seleccionar etiquetas...",
"Search keyword...": "Buscar palabras clave...",
"Sort by title": "Ordenar por título",
"Title": "Título",
"Sort by time": "Ordenar por fecha",
"Time": "Tiempo",
"Export history": "Exportar historial",
"Import history": "Importar historial",
"Clear history": "Borrar historial",
"Refresh history": "Actualizar historial",
"No history": "Ningún historial",
"Import from browser": "Importar del navegador",
"Releases": "Versiones",
"Are you sure?": "¿Estás seguro?",
"Cancel": "Cancelar",
"Yes, do it!": "Si, ¡hazlo!",
"Choose method": "Elegir método",
"Sign in via %s": "Ingresar via %s",
"New": "Nuevo",
"Publish": "Publicar",
"Extra": "Extra",
"Revision": "Revision",
"Slide Mode": "Modo presentación",
"Export": "Exportar",
"Import": "Importar",
"Clipboard": "Portapapeles",
"Download": "Descargar",
"Raw HTML": "HTML puro",
"Edit": "Editar",
"View": "Ver",
"Both": "Ambos",
"Help": "Ayuda",
"Upload Image": "Subir imagen",
"Menu": "Menú",
"This page need refresh": "Esta página necesita ser cargada de nuevo",
"You have an incompatible client version.": "Tienes una version del cliente incompatible.",
"Refresh to update.": "Cargar de nuevo para actualizar.",
"New version available!": "¡Nueva versión disponible!",
"See releases notes here": "Ver aquí las notas de publicación",
"Refresh to enjoy new features.": "Actualizar para usar las nuevas funciones.",
"Your user state has changed.": "El estado de tu usuario ha cambiado.",
"Refresh to load new user state.": "Recargar para actualizar el estado de tu usuario.",
"Refresh": "Recargar",
"Contacts": "Contactos",
"Report an issue": "Reportar un problema",
"Send us email": "Enviarnos un email",
"Documents": "Documentos",
"Features": "Funciones",
"YAML Metadata": "Metadatos en YAML",
"Slide Example": "Ejemplo de diapositiva",
"Cheatsheet": "Ayudamemorias",
"Example": "Ejemplo",
"Syntax": "Sintaxis",
"Header": "Cabecera",
"Unordered List": "Lista desordenada",
"Ordered List": "Lista ordenada",
"Todo List": "Lista de tareas",
"Blockquote": "Bloque de cita",
"Bold font": "Fuente negrita",
"Italics font": "Fuente itálica",
"Strikethrough": "Tachado",
"Inserted text": "Texto subrayado",
"Marked text": "Texto marcado",
"Link": "Enlace",
"Image": "Imagen",
"Code": "Código",
"Externals": "Externos",
"This is a alert area.": "Esto es un área de alerta.",
"Revert": "Revertir",
"Import from clipboard": "Importar del portapapeles",
"Paste your markdown or webpage here...": "Pega tu markdown o página web aquí...",
"Clear": "Limpiar",
"This note is locked": "Esta nota está bloqueada",
"Sorry, only owner can edit this note.": "Disculpa, solo el dueño puede editar esta nota.",
"OK": "OK",
"Reach the limit": "Haz alcanzado el límite",
"Sorry, you've reached the max length this note can be.": "Disculpa, haz alcanzado la longitud máxima que puede tener esta nota.",
"Please reduce the content or divide it to more notes, thank you!": "Por favor, reduce el contenido o dividela en mas notas, ¡gracias!",
"Import from Gist": "Importar de un Gist",
"Paste your gist url here...": "Pega el URL de tu Gist aquí...",
"Import from Snippet": "Importar de Snippet",
"Select From Available Projects": "Elegir de un proyecto disponible",
"Select From Available Snippets": "Elegir de un Snippet disponible",
"OR": "O",
"Export to Snippet": "Exportar a Snippet",
"Select Visibility Level": "Elegir el nivel de visibilidad"
}
"Collaborative markdown notes": "Notas colaborativas en Markdown",
"Realtime collaborative markdown notes on all platforms.": "Notas colaborativas en Markdown para todas las plataformas en tiempo real.",
"Best way to write and share your knowledge in markdown.": "La mejor forma de escribir y compartir tu conocimiento en Markdown.",
"Intro": "Introducción",
"History": "Historia",
"New guest note": "Nueva nota como invitado",
"Collaborate with URL": "Colaborar via URL",
"Support charts and MathJax": "Soporte para gráficos y MathJax",
"Support slide mode": "Soporte para diapositivas",
"Sign In": "Ingresar",
"Below is the history from browser": "A continuación se muestra el historial del navegador",
"Welcome!": "¡Bienvenido!",
"New note": "Nueva nota",
"or": "o",
"Sign Out": "Salir",
"Explore all features": "Explorar todas las funciones",
"Select tags...": "Seleccionar etiquetas...",
"Search keyword...": "Buscar palabras clave...",
"Sort by title": "Ordenar por título",
"Title": "Título",
"Sort by time": "Ordenar por fecha",
"Time": "Tiempo",
"Export history": "Exportar historial",
"Import history": "Importar historial",
"Clear history": "Borrar historial",
"Refresh history": "Actualizar historial",
"No history": "Ningún historial",
"Import from browser": "Importar del navegador",
"Releases": "Versiones",
"Are you sure?": "¿Estás seguro?",
"Do you really want to delete this note?": "¿Realmente quieres eliminar esta nota?",
"All users will lose their connection.": "Todos los usuarios perderán su conexión.",
"Cancel": "Cancelar",
"Yes, do it!": "Si, ¡hazlo!",
"Choose method": "Elegir método",
"Sign in via %s": "Ingresar via %s",
"New": "Nuevo",
"Publish": "Publicar",
"Extra": "Extra",
"Revision": "Revision",
"Slide Mode": "Modo presentación",
"Export": "Exportar",
"Import": "Importar",
"Clipboard": "Portapapeles",
"Download": "Descargar",
"Raw HTML": "HTML puro",
"Edit": "Editar",
"View": "Ver",
"Both": "Ambos",
"Help": "Ayuda",
"Upload Image": "Subir imagen",
"Menu": "Menú",
"This page need refresh": "Esta página necesita ser cargada de nuevo",
"You have an incompatible client version.": "Tienes una version del cliente incompatible.",
"Refresh to update.": "Cargar de nuevo para actualizar.",
"New version available!": "¡Nueva versión disponible!",
"See releases notes here": "Ver aquí las notas de publicación",
"Refresh to enjoy new features.": "Actualizar para usar las nuevas funciones.",
"Your user state has changed.": "El estado de tu usuario ha cambiado.",
"Refresh to load new user state.": "Recargar para actualizar el estado de tu usuario.",
"Refresh": "Recargar",
"Contacts": "Contactos",
"Report an issue": "Reportar un problema",
"Meet us on %s": "Encuéntranos en %s",
"Send us email": "Enviarnos un email",
"Documents": "Documentos",
"Features": "Funciones",
"YAML Metadata": "Metadatos en YAML",
"Slide Example": "Ejemplo de diapositiva",
"Cheatsheet": "Ayudamemorias",
"Example": "Ejemplo",
"Syntax": "Sintaxis",
"Header": "Cabecera",
"Unordered List": "Lista desordenada",
"Ordered List": "Lista ordenada",
"Todo List": "Lista de tareas",
"Blockquote": "Bloque de cita",
"Bold font": "Fuente negrita",
"Italics font": "Fuente itálica",
"Strikethrough": "Tachado",
"Inserted text": "Texto subrayado",
"Marked text": "Texto marcado",
"Link": "Enlace",
"Image": "Imagen",
"Code": "Código",
"Externals": "Externos",
"This is a alert area.": "Esto es un área de alerta.",
"Revert": "Revertir",
"Import from clipboard": "Importar del portapapeles",
"Paste your markdown or webpage here...": "Pega tu markdown o página web aquí...",
"Clear": "Limpiar",
"This note is locked": "Esta nota está bloqueada",
"Sorry, only owner can edit this note.": "Disculpa, solo el dueño puede editar esta nota.",
"OK": "OK",
"Reach the limit": "Haz alcanzado el límite",
"Sorry, you've reached the max length this note can be.": "Disculpa, haz alcanzado la longitud máxima que puede tener esta nota.",
"Please reduce the content or divide it to more notes, thank you!": "Por favor, reduce el contenido o dividela en mas notas, ¡gracias!",
"Import from Gist": "Importar de un Gist",
"Paste your gist url here...": "Pega el URL de tu Gist aquí...",
"Import from Snippet": "Importar de Snippet",
"Select From Available Projects": "Elegir de un proyecto disponible",
"Select From Available Snippets": "Elegir de un Snippet disponible",
"OR": "O",
"Export to Snippet": "Exportar a Snippet",
"Select Visibility Level": "Elegir el nivel de visibilidad",
"Night Theme": "Modo nocturno",
"Follow us on %s and %s.": "Síguenos en %s, y %s.",
"Privacy": "Privacidad",
"Terms of Use": "Términos de uso",
"Do you really want to delete your user account?": "¿Estás seguro que quieres eliminar tu cuenta de usuario?",
"This will delete your account, all notes that are owned by you and remove all references to your account from other notes.": "Esta acción eliminará tu cuenta, todas tus notas y las referencias a tu cuenta desde otras notas.",
"Delete user": "Eliminar usuario",
"Export user data": "Exportar información de usuario",
"Help us translating on %s": "Ayúdanos traduciendo en %s",
"Source Code": "Código fuente",
"Register": "Registrar",
"Powered by %s": "Desarrollado por %s.",
"Help us translating": "Ayúdanos traduciendo",
"Join the community": "Únete a la comunidad"
}

+ 121
- 0
locales/vi.json View File

@@ -0,0 +1,121 @@
{
"Collaborative markdown notes": "Cộng tác ghi chú markdown",
"Realtime collaborative markdown notes on all platforms.": "Cộng tác ghi chú markdown đa nền tảng thời gian thực",
"Best way to write and share your knowledge in markdown.": "Nền tảng tốt nhất để viết và chia sẻ markdown",
"Intro": "Giới thiệu",
"History": "Lịch sử",
"New guest note": "Khách mới",
"Collaborate with URL": "Cộng tác thời gian thực",
"Support charts and MathJax": "Làm việc với biểu đồ và MathJax",
"Support slide mode": "Hỗ trợ chế độ slide",
"Sign In": "Đăng nhập",
"Below is the history from browser": "Dưới đây là lịch sử của trình duyệt",
"Welcome!": "Chào mừng bạn!",
"New note": "Tạo mới ghi chú",
"or": "hoặc",
"Sign Out": "Đăng xuất",
"Explore all features": "Khám phá tất cả tính năng",
"Select tags...": "Chọn tag",
"Search keyword...": "Tìm kiếm",
"Sort by title": "Sắp xếp theo tiêu đề",
"Title": "Tiêu đề",
"Sort by time": "Sắp xếp theo thời gian",
"Time": "Thời gian",
"Export history": "Xuất lịch sử",
"Import history": "Nhập lịch sử",
"Clear history": "Xóa lịch sử",
"Refresh history": "Làm mới lịch sử",
"No history": "Không có lịch sử",
"Import from browser": "Nhập từ trình duyệt",
"Releases": "Xuất bản",
"Are you sure?": "Bạn có chắc chắn không ?",
"Do you really want to delete this note?": "Bạn có thực sự muốn xóa ghi chú này ?",
"All users will lose their connection.": "Tất cả người dùng sẽ mất liên kết này.",
"Cancel": "Hủy",
"Yes, do it!": "Đồng ý",
"Choose method": "Chọn phương thức",
"Sign in via %s": "Đăng nhấp với %s",
"New": "Mới",
"Publish": "Xuất bản",
"Extra": "Extra",
"Revision": "Sửa đổi",
"Slide Mode": "Chế độ slide",
"Export": "Xuất",
"Import": "Nhập",
"Clipboard": "Clipboard",
"Download": "Tải xuống",
"Raw HTML": "Raw HTML",
"Edit": "Sửa",
"View": "Hiện",
"Both": "Cả hai",
"Help": "Trợ giúp",
"Upload Image": "Tải ảnh lên",
"Menu": "Menu",
"This page need refresh": "Trang này cần được làm mới",
"You have an incompatible client version.": "Phiên bản của client không tương thích.",
"Refresh to update.": "Làm mới để cập nhập.",
"New version available!": "Phiên bản mới đã có sẵn.",
"See releases notes here": "Xem ghi chú xuất bản ở đây.",
"Refresh to enjoy new features.": "Làm mới để trải nghiệm tính năng mới.",
"Your user state has changed.": "Trạng thái người dùng bị thay đổi.",
"Refresh to load new user state.": "Làm mới để cập nhập trạng thái người dùng mới.",
"Refresh": "Làm mới",
"Contacts": "Liên Lạc",
"Report an issue": "Báo cáo vấn đề",
"Meet us on %s": "Gặp chúng tôi ở %s",
"Send us email": "Gửi email cho chúng tôi",
"Documents": "Tài liệu",
"Features": "Tính năng",
"YAML Metadata": "YAML Metadata",
"Slide Example": "Slide ví dụ",
"Cheatsheet": "Cheetsheet",
"Example": "Ví dụ",
"Syntax": "Cú pháp",
"Header": "Đầu đề",
"Unordered List": "Danh sách chưa sắp xếp",
"Ordered List": "Danh sách đã sắp xếp",
"Todo List": "Checklist",
"Blockquote": "Blockquote",
"Bold font": "Bôi đậm",
"Italics font": "In nghiêng",
"Strikethrough": "Gạch ngang",
"Inserted text": "Gạch chân",
"Marked text": "Hightlight",
"Link": "Liên kết",
"Image": "Ảnh",
"Code": "Code",
"Externals": "Externals",
"This is a alert area.": "Đây là khu vực cảnh báo",
"Revert": "Trở lại như cũ",
"Import from clipboard": "Thêm từ clipboard",
"Paste your markdown or webpage here...": "Dán markdown hoặc webpage ở đây ...",
"Clear": "Xóa",
"This note is locked": "Ghi chú này bị khóa.",
"Sorry, only owner can edit this note.": "Xin lỗi, chỉ chủ sở hữu có thể xóa note.",
"OK": "Đồng ý",
"Reach the limit": "Đạt giới hạn",
"Sorry, you've reached the max length this note can be.": "Rất tiếc, bạn đã đạt tới độ dài tối đa ",
"Please reduce the content or divide it to more notes, thank you!": "Vui lòng rút ngắn ghi chú",
"Import from Gist": "Nhập từ Gist",
"Paste your gist url here...": "Dán liên kết gist vào đây ...",
"Import from Snippet": "Thêm từ Snippet",
"Select From Available Projects": "Chọn từ Project có sẵn",
"Select From Available Snippets": "Chọn từ Snippets có sẵn",
"OR": "HOẶC",
"Export to Snippet": "Xuất ra Snippet",
"Select Visibility Level": "Chọn cấp độ hiển thị",
"Night Theme": "Giao diện tối",
"Follow us on %s and %s.": "Cho phép chúng tôi %s, và %s.",
"Privacy": "Quyền riêng tư.",
"Terms of Use": "Điều khoản sử dụng.",
"Do you really want to delete your user account?": "Bạn có thực sự muốn xóa tài khoản ?",
"This will delete your account, all notes that are owned by you and remove all references to your account from other notes.": "Điều này sẽ xóa tài khoản của bạn, tất cả các ghi chú thuộc sở hữu của bạn và xóa tất cả các liên kết đến tài khoản của bạn khỏi các ghi chú khác.",
"Delete user": "Xóa người dùng",
"Export user data": "Xuất dữ liệu người dùng",
"Help us translating on %s": "Giúp chúng tôi dịch trên %s",
"Source Code": "Mã nguồn",
"Register": "Đăng ký",
"Powered by %s": "Cung cấp bởi %s",
"Help us translating": "Giúp chúng tôi dịch",
"Join the community": "Tham gia vào cộng đồng"
}

+ 11
- 9
package.json View File

@@ -1,13 +1,14 @@
{
"name": "CodiMD",
"version": "1.3.2",
"version": "1.4.0",
"description": "Realtime collaborative markdown notes on all platforms.",
"main": "app.js",
"license": "AGPL-3.0",
"scripts": {
"test": "npm run-script eslint && npm run-script jsonlint && mocha",
"eslint": "node_modules/.bin/eslint lib public test app.js",
"test": "npm run-script eslint && npm run-script jsonlint && npm run-script mocha-suite",
"eslint": "node_modules/.bin/eslint --max-warnings 0 lib public test app.js",
"jsonlint": "find . -not -path './node_modules/*' -type f -name '*.json' -o -type f -name '*.json.example' | while read json; do echo $json ; jq . $json; done",
"mocha-suite": "NODE_ENV=test CMD_DB_URL=\"sqlite::memory:\" mocha --exit",
"standard": "echo 'standard is no longer being used, use `npm run eslint` instead!' && exit 1",
"dev": "webpack --config webpack.dev.js --progress --colors --watch",
"heroku-prebuild": "bin/heroku",
@@ -15,7 +16,6 @@
"start": "sequelize db:migrate && node app.js"
},
"dependencies": {
"@hackmd/js-sequence-diagrams": "^0.0.1-alpha.2",
"@passport-next/passport-openid": "^1.0.0",
"Idle.Js": "git+https://github.com/shawnmclean/Idle.js",
"archiver": "^2.1.1",
@@ -53,7 +53,7 @@
"i18n": "^0.8.3",
"imgur": "git+https://github.com/hackmdio/node-imgur.git",
"ionicons": "~2.0.1",
"jquery": "^3.1.1",
"jquery": "^3.4.1",
"jquery-mousewheel": "^3.1.13",
"jquery-ui": "^1.12.1",
"js-cookie": "^2.1.3",
@@ -82,7 +82,7 @@
"markdown-pdf": "^9.0.0",
"mathjax": "~2.7.0",
"mattermost": "^3.4.0",
"mermaid": "~8.0.0",
"mermaid": "~7.1.0",
"meta-marked": "git+https://github.com/codimd/meta-marked#semver:^0.4.2",
"method-override": "^2.3.7",
"minimist": "^1.2.0",
@@ -111,7 +111,8 @@
"readline-sync": "^1.4.7",
"request": "^2.88.0",
"reveal.js": "~3.7.0",
"scrypt": "^6.0.3",
"scrypt-async": "^2.0.1",
"scrypt-kdf": "^2.0.1",
"select2": "^3.5.2-browserify",
"sequelize": "^3.28.0",
"sequelize-cli": "^2.5.1",
@@ -119,7 +120,7 @@
"socket.io": "~2.1.1",
"socket.io-client": "~2.1.1",
"spin.js": "^2.3.2",
"sqlite3": "^4.0.1",
"sqlite3": "^4.0.7",
"store": "^2.0.12",
"string": "^3.3.3",
"tedious": "^1.14.0",
@@ -132,6 +133,7 @@
"viz.js": "^1.7.0",
"winston": "^3.1.0",
"ws": "^6.0.0",
"wurl": "^2.5.3",
"xss": "^1.0.3"
},
"resolutions": {
@@ -140,7 +142,7 @@
"**/request": "^2.88.0"
},
"engines": {
"node": ">=6.x"
"node": ">=8.x"
},
"bugs": "https://github.com/codimd/server/issues",
"keywords": [


+ 18
- 0
public/css/extra.css View File

@@ -384,6 +384,24 @@ small .dropdown a:focus, small .dropdown a:hover {
color: #eee;
}


/* Prevent linked heading from being hidden underneath navbar.
* Example: http://localhost:3000/features#Editor-Modes would open and
* hide the headline "Editor Modes" underneath the navbar without this CSS rule.
*/
.markdown-body h1[id]:before,
.markdown-body h2[id]:before,
.markdown-body h3[id]:before,
.markdown-body h4[id]:before,
.markdown-body h5[id]:before,
.markdown-body h6[id]:before {
display: block;
content: " ";
margin-top: -55px;
height: 55px;
visibility: hidden;
}

@media print {
div, table, img, pre, blockquote {
page-break-inside: avoid !important;


+ 4
- 19
public/css/index.css View File

@@ -20,24 +20,6 @@ body.night{
background: #333 !important;
}

.toolbar {
background-color: #1c1c1e;
border: 1px solid #343434;
}

.toolbar > .btn-toolbar > .btn-group > .btn {
background-color: #1c1c1e;
padding: 5px;
font-size: 1em;
}

.toolbar > .btn-toolbar > .btn-group > .btn:hover {
background-color: #383a3e;

padding: 5px;
}


.CodeMirror {
font-family: "Source Code Pro", Consolas, monaco, monospace;
letter-spacing: 0.025em;
@@ -124,7 +106,10 @@ body.night{
color: #78B2F2 !important;
}
.CodeMirror-sizer {
margin-bottom: 0px !important;
/* Make sure CodeMirror doesn't hide text under the status bar
* 26px is the height of the status bar.
*/
margin-bottom: 26px !important;
}
.CodeMirror-insert-match {
background: lawngreen;


+ 61
- 0
public/css/slide-preview.css View File

@@ -56,3 +56,64 @@
height: 1.5em;
border: 3px solid #777;
}

.markdown-body.slides aside.notes {
display: none;
}

.markdown-body.slides ul, .markdown-body.slides ol {
display: inline-block;
text-align: left;
margin: 0 0 0 1em;
padding: 0;
}

.markdown-body.slides table {
width: 50%;
margin: 0 auto;
border-collapse: collapse;
border-spacing: 0;
display: table;
}

.markdown-body.slides table th, .markdown-body.slides table td {
text-align: left;
padding: 0.2em 0.5em 0.2em 0.5em;
border:none;
border-bottom: 1px solid;
}

.markdown-body.slides table tr {
border-top: 0;
background-color: #fff;
}

.markdown-body.slides table tr:nth-child(2n) {
background-color: inherit;
}

.markdown-body.slides table tbody tr:last-child th, .markdown-body.slides table tbody tr:last-child td {
border-bottom: none;
}

.markdown-body.slides h1, .markdown-body.slides h2 {
border-bottom: 0;
}

.night .markdown-body.slides h1,
.night .markdown-body.slides h2,
.night .markdown-body.slides h3,
.night .markdown-body.slides h4,
.night .markdown-body.slides h5,
.night .markdown-body.slides h6 {
color: black;
}

.markdown-body section > section:last-child {
margin-bottom: 1.5em !important;
}

/* slides previews get a black background, controlled by js */
.ui-view-area.black {
background-color: black !important;;
}

+ 33
- 0
public/css/ui/toolbar.css View File

@@ -0,0 +1,33 @@
.toolbar {
background-color: #fafafa;
border: 1px solid #ededed;
}

.toolbar > .btn-toolbar > .btn-group > .btn {
background-color: #fafafa;
padding: 5px;
font-size: 1em;
color: #555;
}

.toolbar > .btn-toolbar > .btn-group > .btn:hover {
background-color: #e1e1e1;
padding: 5px;
}

body.night .toolbar {
background-color: #1c1c1e;
border: 1px solid #353538;
}

body.night .toolbar > .btn-toolbar > .btn-group > .btn {
background-color: #1c1c1e;
padding: 5px;
font-size: 1em;
color: #5EB7E0;
}

body.night .toolbar > .btn-toolbar > .btn-group > .btn:hover {
background-color: #37373b;
padding: 5px;
}

+ 74
- 1
public/docs/release-notes.md View File

@@ -1,6 +1,79 @@
Release Notes
===

<i class="fa fa-tag"></i> 1.4.0 <i class="fa fa-clock-o"></i> 2019-05-31 00:00
---

### Announcements
* CodiMD now has a [Mastodon account](https://social.codimd.org/mastodon)
* CodiMD now has a [community forum](https://community.codimd.org)
* With CodiMD 1.4.0 we're dropping node 6 support. That version of node.js is discontinued and no longer receives any security updates. We would like to encourage you to upgrade node 8 or later. Node 8 will continue to be supported at least until its end-of-life in January 2020.

### Enhancements
* Use libravatar instead of Gravatar
* Fix language description capitalization
* Move upload button into the toolbar
* Clean up Heroku configurations
* Add new screenshot to README and index page
* Add link to community call to README
* Update languages (pl, sr, zh-CN, fr, it, ja, zh-TW, de, sv, es)
* Change edit link to `both` view
* Hide minio default ports
* Add missing passport-saml configuration
* Add lutim support
* Update dependencies
* Add documentation for keycloak
* Add tests for user model
* Add Mastodon link
* Add config for toobusy middleware
* Add vietnamese language

### Fixes
* Fix missing space in footer
* Fix various possible security vulnerabilities in dependencies
* Fix broken dependency js-sequence-diagrams
* Fix XSS in graphviz error message rendering
* Fix toolbar night mode
* Fix hidden header on scroll
* Fix missing pictures for OpenID
* Fix statusbar hiding text in edit view

### Refactors
* Refactor README and documentation
* Integrate the old wiki into documentation section
* Refactor headers on Features page
* Replace js-url with wurl
* Refactor scrypt integration

### Removals
* Remove sass-loader

### Contributors
* [Amolith](https://github.com/Amolith)
* CasperS (translator)
* Cedric.couralet (translator)
* [Claudius Coenen (ccoenen)](https://github.com/ccoenen)
* Daniel (translator)
* Deluxghost (translator)
* [Dylan Dervaux (Dylanderv)](https://github.com/Dylanderv)
* [Emmanuel Ormancey (nopap)](https://github.com/nopap)
* Grzegorz (translator)
* [Henrik Hüttemann (HerHde)](https://github.com/HerHde)
* Hồng (translator)
* [Mauricio Robayo (archemiro)](https://github.com/archemiro)
* [Max Wu (jackycute)](https://github.com/jackycute)
* [naimo](https://github.com/naimo)
* [Pedro Ferreira (pferreir)](https://github.com/pferreir)
* [Simon Fish (boardfish)](https://github.com/boardfish)
* [Stéphane Guillou (stragu)](https://github.com/stragu)
* Sylke Vicious (translator)
* [Thor77](https://github.com/Thor77)
* veracosta (translator)
* Vladan (translator)
* War (translator)
* Zhai233 (translator)


<i class="fa fa-tag"></i> 1.3.2 <i class="fa fa-clock-o"></i> 2019-03-28 00:00
---

@@ -101,7 +174,7 @@ Release Notes
* Refactor handling of template variables
* Refactor linting to use eslint

### Removes
### Removals
* Remove no longer working Octicons
* Remove links to our old Gitter channel
* Remove unused library node-uuid


+ 50
- 50
public/js/cover.js View File

@@ -1,37 +1,37 @@
/* eslint-env browser, jquery */
/* global moment, serverurl */

require('./locale')

require('../css/cover.css')
require('../css/site.css')

import {
checkIfAuth,
clearLoginState,
getLoginState,
resetCheckAuth,
setloginStateChangeEvent
checkIfAuth,
clearLoginState,
getLoginState,
resetCheckAuth,
setloginStateChangeEvent
} from './lib/common/login'

import {
clearDuplicatedHistory,
deleteServerHistory,
getHistory,
getStorageHistory,
parseHistory,
parseServerToHistory,
parseStorageToHistory,
postHistoryToServer,
removeHistory,
saveHistory,
saveStorageHistoryToServer
clearDuplicatedHistory,
deleteServerHistory,
getHistory,
getStorageHistory,
parseHistory,
parseServerToHistory,
parseStorageToHistory,
postHistoryToServer,
removeHistory,
saveHistory,
saveStorageHistoryToServer
} from './history'

import { saveAs } from 'file-saver'
import List from 'list.js'
import S from 'string'

require('./locale')

require('../css/cover.css')
require('../css/site.css')

const options = {
valueNames: ['id', 'text', 'timestamp', 'fromNow', 'time', 'tags', 'pinned'],
item: `<li class="col-xs-12 col-sm-6 col-md-6 col-lg-4">
@@ -67,27 +67,27 @@ pageInit()

function pageInit () {
checkIfAuth(
data => {
$('.ui-signin').hide()
$('.ui-or').hide()
$('.ui-welcome').show()
if (data.photo) $('.ui-avatar').prop('src', data.photo).show()
else $('.ui-avatar').prop('src', '').hide()
$('.ui-name').html(data.name)
$('.ui-signout').show()
$('.ui-history').click()
parseServerToHistory(historyList, parseHistoryCallback)
},
() => {
$('.ui-signin').show()
$('.ui-or').show()
$('.ui-welcome').hide()
$('.ui-avatar').prop('src', '').hide()
$('.ui-name').html('')
$('.ui-signout').hide()
parseStorageToHistory(historyList, parseHistoryCallback)
}
)
data => {
$('.ui-signin').hide()
$('.ui-or').hide()
$('.ui-welcome').show()
if (data.photo) $('.ui-avatar').prop('src', data.photo).show()
else $('.ui-avatar').prop('src', '').hide()
$('.ui-name').html(data.name)
$('.ui-signout').show()
$('.ui-history').click()
parseServerToHistory(historyList, parseHistoryCallback)
},
() => {
$('.ui-signin').show()
$('.ui-or').show()
$('.ui-welcome').hide()
$('.ui-avatar').prop('src', '').hide()
$('.ui-name').html('')
$('.ui-signout').hide()
parseStorageToHistory(historyList, parseHistoryCallback)
}
)
}

$('.masthead-nav li').click(function () {
@@ -132,7 +132,7 @@ function checkHistoryList () {

function parseHistoryCallback (list, notehistory) {
checkHistoryList()
// sort by pinned then timestamp
// sort by pinned then timestamp
list.sort('', {
sortFunction (a, b) {
const notea = a.values()
@@ -152,13 +152,13 @@ function parseHistoryCallback (list, notehistory) {
}
}
})
// parse filter tags
// parse filter tags
const filtertags = []
for (let i = 0, l = list.items.length; i < l; i++) {
const tags = list.items[i]._values.tags
if (tags && tags.length > 0) {
for (let j = 0; j < tags.length; j++) {
// push info filtertags if not found
// push info filtertags if not found
let found = false
if (filtertags.includes(tags[j])) { found = true }
if (!found) { filtertags.push(tags[j]) }
@@ -178,20 +178,20 @@ historyList.on('updated', e => {
const a = itemEl.find('a')
const pin = itemEl.find('.ui-history-pin')
const tagsEl = itemEl.find('.tags')
// parse link to element a
// parse link to element a
a.attr('href', `${serverurl}/${values.id}`)
// parse pinned
// parse pinned
if (values.pinned) {
pin.addClass('active')
} else {
pin.removeClass('active')
}
// parse tags
// parse tags
const tags = values.tags
if (tags && tags.length > 0 && tagsEl.children().length <= 0) {
const labels = []
for (let j = 0; j < tags.length; j++) {
// push into the item label
// push into the item label
labels.push(`<span class='label label-default'>${tags[j]}</span>`)
}
tagsEl.html(labels.join(' '))
@@ -328,7 +328,7 @@ $('.ui-open-history').bind('change', e => {
const reader = new FileReader()
reader.onload = () => {
const notehistory = JSON.parse(reader.result)
// console.log(notehistory);
// console.log(notehistory);
if (!reader.result) return
getHistory(data => {
let mergedata = data.concat(notehistory)


+ 218
- 218
public/js/extra.js View File

@@ -1,6 +1,22 @@
/* eslint-env browser, jquery */
/* eslint no-console: ["error", { allow: ["warn", "error"] }] */
/* global moment, serverurl */

import Prism from 'prismjs'
import hljs from 'highlight.js'
import PDFObject from 'pdfobject'
import S from 'string'
import { saveAs } from 'file-saver'
import escapeHTML from 'escape-html'

import getUIElements from './lib/editor/ui-elements'

import markdownit from 'markdown-it'
import markdownitContainer from 'markdown-it-container'

/* Defined regex markdown it plugins */
import Plugin from 'markdown-it-regexp'

require('prismjs/themes/prism.css')
require('prismjs/components/prism-wiki')
require('prismjs/components/prism-haskell')
@@ -10,18 +26,9 @@ require('prismjs/components/prism-jsx')
require('prismjs/components/prism-makefile')
require('prismjs/components/prism-gherkin')

import Prism from 'prismjs'