summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README.md9
-rw-r--r--docs/guides/minio-image-upload.md4
-rw-r--r--docs/guides/s3-image-upload.md2
-rw-r--r--lib/config/default.js4
-rw-r--r--lib/config/environment.js2
-rw-r--r--lib/config/index.js10
-rw-r--r--lib/web/imageRouter.js4
-rw-r--r--package.json2
-rw-r--r--public/views/slide.ejs9
9 files changed, 27 insertions, 19 deletions
diff --git a/README.md b/README.md
index b2ce691e..8b8b584f 100644
--- a/README.md
+++ b/README.md
@@ -57,6 +57,7 @@ Thanks for using! :smile:
- Node.js 6.x or up (test up to 7.5.0)
- Database (PostgreSQL, MySQL, MariaDB, SQLite, MSSQL) use charset `utf8`
- npm (and its dependencies, especially [uWebSockets](https://github.com/uWebSockets/uWebSockets#nodejs-developers), [node-gyp](https://github.com/nodejs/node-gyp#installation))
+- For **building** HackMD we recommend to use a machine with at least **2GB** RAM
### Instructions
@@ -246,10 +247,10 @@ There are some configs you need to change in the files below
| documentmaxlength | `100000` | note max length |
| email | `true` or `false` | set to allow email signin |
| allowemailregister | `true` or `false` | set to allow email register (only applied when email is set, default is `true`) |
-| imageUploadType | `imgur`(default), `s3`, `minio` or `filesystem` | Where to upload image
-| minio | `{ "accessKey": "YOUR_MINIO_ACCESS_KEY", "secretKey": "YOUR_MINIO_SECRET_KEY", "endpoint": "YOUR_MINIO_HOST", port: 9000, secure: true }` | When `imageUploadType` is set to `minio`, you need to set this key. Also checkout our [Minio Image Upload Guide](docs/guides/minio-image-upload.md) |
-| s3 | `{ "accessKeyId": "YOUR_S3_ACCESS_KEY_ID", "secretAccessKey": "YOUR_S3_ACCESS_KEY", "region": "YOUR_S3_REGION" }` | When `imageUploadType` be set to `s3`, you would also need to setup this key, check our [S3 Image Upload Guide](docs/guides/s3-image-upload.md) |
-| s3bucket | `YOUR_S3_BUCKET_NAME` | bucket name when `imageUploadType` is set to `s3` or `minio` |
+| imageuploadtype | `imgur`(default), `s3`, `minio` or `filesystem` | Where to upload image
+| minio | `{ "accessKey": "YOUR_MINIO_ACCESS_KEY", "secretKey": "YOUR_MINIO_SECRET_KEY", "endpoint": "YOUR_MINIO_HOST", port: 9000, secure: true }` | When `imageuploadtype` is set to `minio`, you need to set this key. Also checkout our [Minio Image Upload Guide](docs/guides/minio-image-upload.md) |
+| s3 | `{ "accessKeyId": "YOUR_S3_ACCESS_KEY_ID", "secretAccessKey": "YOUR_S3_ACCESS_KEY", "region": "YOUR_S3_REGION" }` | When `imageuploadtype` be set to `s3`, you would also need to setup this key, check our [S3 Image Upload Guide](docs/guides/s3-image-upload.md) |
+| s3bucket | `YOUR_S3_BUCKET_NAME` | bucket name when `imageuploadtype` is set to `s3` or `minio` |
## Third-party integration api key settings
diff --git a/docs/guides/minio-image-upload.md b/docs/guides/minio-image-upload.md
index 273bd8eb..c2ba25b5 100644
--- a/docs/guides/minio-image-upload.md
+++ b/docs/guides/minio-image-upload.md
@@ -62,7 +62,7 @@ Minio Guide for HackMD
8. Set upload type.
```JSON
- "imageUploadType": "minio"
+ "imageuploadtype": "minio"
```
9. Review your config.
@@ -78,6 +78,6 @@ Minio Guide for HackMD
"secure": false
},
"s3bucket": "hackmd",
- "imageUploadType": "minio"
+ "imageuploadtype": "minio"
}
```
diff --git a/docs/guides/s3-image-upload.md b/docs/guides/s3-image-upload.md
index dbbef474..ff9598a2 100644
--- a/docs/guides/s3-image-upload.md
+++ b/docs/guides/s3-image-upload.md
@@ -63,7 +63,7 @@
{
"production": {
...
- "imageUploadType": "s3",
+ "imageuploadtype": "s3",
"s3": {
"accessKeyId": "YOUR_S3_ACCESS_KEY_ID",
"secretAccessKey": "YOUR_S3_ACCESS_KEY",
diff --git a/lib/config/default.js b/lib/config/default.js
index 28f4490c..38dc21a4 100644
--- a/lib/config/default.js
+++ b/lib/config/default.js
@@ -53,7 +53,9 @@ module.exports = {
// document
documentmaxlength: 100000,
// image upload setting, available options are imgur/s3/filesystem
- imageUploadType: 'filesystem',
+ imageuploadtype: 'filesystem',
+ // legacy variable name for imageuploadtype
+ imageUploadType: undefined,
imgur: {
clientID: undefined
},
diff --git a/lib/config/environment.js b/lib/config/environment.js
index e2112b6a..640f9e07 100644
--- a/lib/config/environment.js
+++ b/lib/config/environment.js
@@ -25,7 +25,7 @@ module.exports = {
allowfreeurl: toBooleanConfig(process.env.HMD_ALLOW_FREEURL),
defaultpermission: process.env.HMD_DEFAULT_PERMISSION,
dburl: process.env.HMD_DB_URL,
- imageUploadType: process.env.HMD_IMAGE_UPLOAD_TYPE,
+ imageuploadtype: process.env.HMD_IMAGE_UPLOAD_TYPE,
imgur: {
clientID: process.env.HMD_IMGUR_CLIENTID
},
diff --git a/lib/config/index.js b/lib/config/index.js
index 4f6b4b6a..0051e485 100644
--- a/lib/config/index.js
+++ b/lib/config/index.js
@@ -13,6 +13,7 @@ const debugConfig = {
debug: (env === Environment.development)
}
+// Get version string from package.json
const {version} = require(path.join(appRootPath, 'package.json'))
const packageConfig = {
@@ -20,7 +21,7 @@ const packageConfig = {
minimumCompatibleVersion: '0.5.0'
}
-const configFilePath = path.join(__dirname, '../../config.json')
+const configFilePath = path.join(appRootPath, 'config.json')
const fileConfig = fs.existsSync(configFilePath) ? require(configFilePath)[env] : undefined
let config = require('./default')
@@ -97,8 +98,13 @@ config.isLDAPEnable = config.ldap.url
config.isSAMLEnable = config.saml.idpSsoUrl
config.isPDFExportEnable = config.allowpdfexport
+// merge legacy values
+if (config.imageUploadType && !config.imageuploadtype) {
+ config.imageuploadtype = config.imageUploadType
+}
+
// figure out mime types for image uploads
-switch (config.imageUploadType) {
+switch (config.imageuploadtype) {
case 'imgur':
config.allowedUploadMimeTypes = [
'image/jpeg',
diff --git a/lib/web/imageRouter.js b/lib/web/imageRouter.js
index b17cccbd..483be64b 100644
--- a/lib/web/imageRouter.js
+++ b/lib/web/imageRouter.js
@@ -19,7 +19,7 @@ imageRouter.post('/uploadimage', function (req, res) {
form.keepExtensions = true
- if (config.imageUploadType === 'filesystem') {
+ if (config.imageuploadtype === 'filesystem') {
form.uploadDir = 'public/uploads'
}
@@ -30,7 +30,7 @@ imageRouter.post('/uploadimage', function (req, res) {
if (config.debug) { logger.info('SERVER received uploadimage: ' + JSON.stringify(files.image)) }
try {
- switch (config.imageUploadType) {
+ switch (config.imageuploadtype) {
case 'filesystem':
res.send({
link: url.resolve(config.serverurl + '/', files.image.path.match(/^public\/(.+$)/)[1])
diff --git a/package.json b/package.json
index 94107783..165fc7ee 100644
--- a/package.json
+++ b/package.json
@@ -104,7 +104,7 @@
"randomcolor": "^0.4.4",
"raphael": "git+https://github.com/dmitrybaranovskiy/raphael",
"request": "^2.79.0",
- "reveal.js": "^3.3.0",
+ "reveal.js": "~3.6.0",
"scrypt": "^6.0.3",
"select2": "^3.5.2-browserify",
"sequelize": "^3.28.0",
diff --git a/public/views/slide.ejs b/public/views/slide.ejs
index 942add4f..a9d2b708 100644
--- a/public/views/slide.ejs
+++ b/public/views/slide.ejs
@@ -15,16 +15,15 @@
<link rel="icon" type="image/png" href="<%- url %>/favicon.png">
<link rel="apple-touch-icon" href="<%- url %>/apple-touch-icon.png">
- <!-- For reveal.js -->
- <link rel="stylesheet" href="<%- url %>/build/reveal.js/css/reveal.css">
-
<% if(useCDN) { %>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css" integrity="sha256-eZrrJcwDc/3uDhsdt61sL2oOBY362qM3lon1gyExkL0=" crossorigin="anonymous" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/ionicons/2.0.1/css/ionicons.min.css" integrity="sha256-3iu9jgsy9TpTwXKb7bNQzqWekRX7pPK+2OLj3R922fo=" crossorigin="anonymous" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/octicons/3.5.0/octicons.min.css" integrity="sha256-QiWfLIsCT02Sdwkogf6YMiQlj4NE84MKkzEMkZnMGdg=" crossorigin="anonymous" />
+ <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/reveal.js/3.6.0/css/reveal.min.css" integrity="sha256-ol2N5Xr80jdDqxK0lte3orKGb9Ja3sOnpAUV7TTADmg=" crossorigin="anonymous" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/emojify.js/1.1.0/css/basic/emojify.min.css" integrity="sha256-UOrvMOsSDSrW6szVLe8ZDZezBxh5IoIfgTwdNDgTjiU=" crossorigin="anonymous" />
<%- include build/slide-header %>
<% } else { %>
+ <link rel="stylesheet" href="<%- url %>/build/reveal.js/css/reveal.css">
<link rel="stylesheet" href='<%- url %>/build/emojify.js/dist/css/basic/emojify.min.css'>
<%- include build/slide-pack-header %>
<% } %>
@@ -91,8 +90,8 @@
<script src="<%= url %>/js/mathjax-config-extra.js"></script>
<% if(useCDN) { %>
- <script src="https://cdnjs.cloudflare.com/ajax/libs/reveal.js/3.3.0/lib/js/head.min.js" integrity="sha256-+09kLhwACKXFPDvqo4xMMvi4+uXFsRZ2uYGbeN1U8sI=" crossorigin="anonymous"></script>
- <script src="https://cdnjs.cloudflare.com/ajax/libs/reveal.js/3.3.0/js/reveal.min.js" integrity="sha256-lvaInSKflJWLPqf5N5oHr/UZFwXKD6gckerdwoHqECY=" crossorigin="anonymous"></script>
+ <script src="https://cdnjs.cloudflare.com/ajax/libs/reveal.js/3.6.0/lib/js/head.min.js" integrity="sha256-+09kLhwACKXFPDvqo4xMMvi4+uXFsRZ2uYGbeN1U8sI=" crossorigin="anonymous"></script>
+ <script src="https://cdnjs.cloudflare.com/ajax/libs/reveal.js/3.6.0/js/reveal.min.js" integrity="sha256-ixSKHrWAL2k0mqVSRju9+to2/uZSEK9+kJRfdNBolG8=" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.1/jquery.min.js" integrity="sha256-hVVnYaiADRTO2PzUGmuLJr8BLUSjGIZsDYGmIJLv2b8=" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/velocity/1.4.0/velocity.min.js" integrity="sha256-bhm0lgEt6ITaZCDzZpkr/VXVrLa5RP4u9v2AYsbzSUk=" crossorigin="anonymous" defer></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery-mousewheel/3.1.13/jquery.mousewheel.min.js" integrity="sha256-jnOjDTXIPqall8M0MyTSt98JetJuZ7Yu+1Jm7hLTF7U=" crossorigin="anonymous" defer></script>