diff options
-rw-r--r-- | app.js | 3 | ||||
-rw-r--r-- | lib/config/environment.js | 2 | ||||
-rw-r--r-- | lib/config/index.js | 20 | ||||
-rw-r--r-- | locales/de.json | 3 | ||||
-rw-r--r-- | locales/en.json | 3 | ||||
-rw-r--r-- | locales/zh-CN.json | 3 | ||||
-rw-r--r-- | public/js/extra.js | 4 | ||||
-rw-r--r-- | public/js/lib/common/constant.ejs | 4 | ||||
-rw-r--r-- | public/vendor/inlineAttachment/inline-attachment.js | 13 | ||||
-rw-r--r-- | public/views/index/body.ejs | 12 | ||||
-rw-r--r-- | yarn.lock | 57 |
11 files changed, 94 insertions, 30 deletions
@@ -35,7 +35,8 @@ var data = { version: config.version, GOOGLE_API_KEY: config.google.clientSecret, GOOGLE_CLIENT_ID: config.google.clientID, - DROPBOX_APP_KEY: config.dropbox.appKey + DROPBOX_APP_KEY: config.dropbox.appKey, + allowedUploadMimeTypes: config.allowedUploadMimeTypes } ejs.renderFile(constpath, data, {}, function (err, str) { diff --git a/lib/config/environment.js b/lib/config/environment.js index 932363da..e2112b6a 100644 --- a/lib/config/environment.js +++ b/lib/config/environment.js @@ -39,7 +39,7 @@ module.exports = { secretKey: process.env.HMD_MINIO_SECRET_KEY, endPoint: process.env.HMD_MINIO_ENDPOINT, secure: toBooleanConfig(process.env.HMD_MINIO_SECURE), - port: parseInt(process.env.HMD_MINIO_PORT) + port: process.env.HMD_MINIO_PORT }, s3bucket: process.env.HMD_S3_BUCKET, facebook: { diff --git a/lib/config/index.js b/lib/config/index.js index 3d22c3c3..4f6b4b6a 100644 --- a/lib/config/index.js +++ b/lib/config/index.js @@ -97,6 +97,26 @@ config.isLDAPEnable = config.ldap.url config.isSAMLEnable = config.saml.idpSsoUrl config.isPDFExportEnable = config.allowpdfexport +// figure out mime types for image uploads +switch (config.imageUploadType) { + case 'imgur': + config.allowedUploadMimeTypes = [ + 'image/jpeg', + 'image/png', + 'image/jpg', + 'image/gif' + ] + break + default: + config.allowedUploadMimeTypes = [ + 'image/jpeg', + 'image/png', + 'image/jpg', + 'image/gif', + 'image/svg+xml' + ] +} + // generate correct path config.sslcapath.forEach(function (capath, i, array) { array[i] = path.resolve(appRootPath, capath) diff --git a/locales/de.json b/locales/de.json index 73ffe0e6..c416a684 100644 --- a/locales/de.json +++ b/locales/de.json @@ -104,5 +104,6 @@ "OR": "Oder", "Export to Snippet": "Zu Snippet exportieren", "Select Visibility Level": "Sichtbarkeit bestimmen", - "Night Theme": "Nachtmodus" + "Night Theme": "Nachtmodus", + "Follow us on %s and %s.": "Folge uns auf %s und %s." } diff --git a/locales/en.json b/locales/en.json index e6a966d7..0b44732d 100644 --- a/locales/en.json +++ b/locales/en.json @@ -104,5 +104,6 @@ "OR": "OR", "Export to Snippet": "Export to Snippet", "Select Visibility Level": "Select Visibility Level", - "Night Theme": "Night Theme" + "Night Theme": "Night Theme", + "Follow us on %s and %s.": "Follow us on %s, and %s." } diff --git a/locales/zh-CN.json b/locales/zh-CN.json index da0e029c..6e0c11e9 100644 --- a/locales/zh-CN.json +++ b/locales/zh-CN.json @@ -104,5 +104,6 @@ "Select Visibility Level": "选择可见层级", "Night Theme": "夜间主题", "Do you really want to delete this note?": "确定要删除这个文件吗?", - "All users will lose their connection.": "所有用户将失去连接" + "All users will lose their connection.": "所有用户将失去连接", + "Follow us on %s and %s.": "在%s和%s上关注我们" } diff --git a/public/js/extra.js b/public/js/extra.js index ec7d39da..dbb0f458 100644 --- a/public/js/extra.js +++ b/public/js/extra.js @@ -713,11 +713,11 @@ $.fn.sortByDepth = function () { function toggleTodoEvent (e) { const startline = $(this).closest('li').attr('data-startline') - 1 const line = window.editor.getLine(startline) - const matches = line.match(/^[>\s]*[-+*]\s\[([x ])\]/) + const matches = line.match(/^[>\s-]*[-+*]\s\[([x ])\]/) if (matches && matches.length >= 2) { let checked = null if (matches[1] === 'x') { checked = true } else if (matches[1] === ' ') { checked = false } - const replacements = matches[0].match(/(^[>\s]*[-+*]\s\[)([x ])(\])/) + const replacements = matches[0].match(/(^[>\s-]*[-+*]\s\[)([x ])(\])/) window.editor.replaceRange(checked ? ' ' : 'x', { line: startline, ch: replacements[1].length diff --git a/public/js/lib/common/constant.ejs b/public/js/lib/common/constant.ejs index e4a1cf0a..c0963635 100644 --- a/public/js/lib/common/constant.ejs +++ b/public/js/lib/common/constant.ejs @@ -3,6 +3,8 @@ window.urlpath = '<%- urlpath %>' window.debug = <%- debug %> window.version = '<%- version %>' +window.allowedUploadMimeTypes = <%- JSON.stringify(allowedUploadMimeTypes) %> + window.GOOGLE_API_KEY = '<%- GOOGLE_API_KEY %>' window.GOOGLE_CLIENT_ID = '<%- GOOGLE_CLIENT_ID %>' -window.DROPBOX_APP_KEY = '<%- DROPBOX_APP_KEY %>'
\ No newline at end of file +window.DROPBOX_APP_KEY = '<%- DROPBOX_APP_KEY %>' diff --git a/public/vendor/inlineAttachment/inline-attachment.js b/public/vendor/inlineAttachment/inline-attachment.js index 0ffd3f9f..d9503d62 100644 --- a/public/vendor/inlineAttachment/inline-attachment.js +++ b/public/vendor/inlineAttachment/inline-attachment.js @@ -141,12 +141,7 @@ /** * Allowed MIME types */ - allowedTypes: [ - 'image/jpeg', - 'image/png', - 'image/jpg', - 'image/gif' - ], + allowedTypes: window.allowedUploadMimeTypes, /** * Text which will be inserted when dropping or pasting a file. @@ -304,7 +299,7 @@ if (this.settings.onFileUploadResponse.call(this, xhr) !== false) { var result = JSON.parse(xhr.responseText), filename = result[this.settings.jsonFieldName]; - + if (result && filename) { var replacements = []; var string = this.settings.progressText.replace(this.filenameTag, id); @@ -415,7 +410,7 @@ // <http://wiki.ecmascript.org/doku.php?id=strawman:names>. // // The goals of this function are twofold: -// +// // * Provide a way to generate a string guaranteed to be unique when compared // to other strings generated by this function. // * Make the string complex enough that it is highly unlikely to be @@ -432,4 +427,4 @@ var ID = function () { // Convert it to base 36 (numbers + letters), and grab the first 9 characters // after the decimal. return '_' + Math.random().toString(36).substr(2, 9); -};
\ No newline at end of file +}; diff --git a/public/views/index/body.ejs b/public/views/index/body.ejs index 82d83f02..d8766fec 100644 --- a/public/views/index/body.ejs +++ b/public/views/index/body.ejs @@ -123,12 +123,6 @@ <div class="mastfoot"> <div class="inner"> - <h6 class="social-foot"> - <iframe src="//ghbtns.com/github-btn.html?user=hackmdio&repo=hackmd&type=star&count=true" frameborder="0" scrolling="0" width="104px" height="20px"></iframe> - </h6> - <p> - © 2018 <a href="https://www.facebook.com/hackmdio" target="_blank"><i class="fa fa-facebook-square"></i> HackMD</a> | <a href="<%- url %>/s/release-notes" target="_blank"><%= __('Releases') %></a> - </p> <select class="ui-locale"> <option value="en">English</option> <option value="zh-CN">简体中文</option> @@ -152,6 +146,12 @@ <option value="eo">Esperanto</option> <option value="da">dansk</option> </select> + <p> + © 2018 <a href="https://hackmd.io">HackMD</a> | <a href="<%- url %>/s/release-notes" target="_blank"><%= __('Releases') %></a> + </p> + <h6 class="social-foot"> + <%- __('Follow us on %s and %s.', '<a href="https://github.com/hackmdio/HackMD" target="_blank"><i class="fa fa-github"></i> GitHub</a>, <a href="https://twitter.com/hackmdio" target="_blank"><i class="fa fa-twitter"></i> Twitter</a>', '<a href="https://www.facebook.com/hackmdio" target="_blank"><i class="fa fa-facebook-square"></i> Facebook</a>') %> + </h6> </div> </div> </div> @@ -877,6 +877,14 @@ block-elements@^1.0.0: version "1.2.0" resolved "https://registry.yarnpkg.com/block-elements/-/block-elements-1.2.0.tgz#8e04ccab638c7e2596f5065fb6c1c7518c905a5d" +block-stream2@^1.0.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/block-stream2/-/block-stream2-1.1.0.tgz#c738e3a91ba977ebb5e1fef431e13ca11d8639e2" + dependencies: + defined "^1.0.0" + inherits "^2.0.1" + readable-stream "^2.0.4" + block-stream@*: version "0.0.9" resolved "https://registry.yarnpkg.com/block-stream/-/block-stream-0.0.9.tgz#13ebfe778a03205cfe03751481ebb4b3300c126a" @@ -1378,7 +1386,7 @@ concat-map@0.0.1: version "0.0.1" resolved "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b" -concat-stream@1.6.0, concat-stream@^1.4.1, concat-stream@^1.4.7, concat-stream@^1.5.2: +concat-stream@1.6.0, concat-stream@^1.4.1, concat-stream@^1.4.7, concat-stream@^1.4.8, concat-stream@^1.5.2: version "1.6.0" resolved "https://registry.yarnpkg.com/concat-stream/-/concat-stream-1.6.0.tgz#0aac662fd52be78964d5532f694784e70110acf7" dependencies: @@ -2100,6 +2108,10 @@ es5-ext@^0.10.12, es5-ext@^0.10.14, es5-ext@^0.10.30, es5-ext@^0.10.9, es5-ext@~ es6-iterator "2" es6-symbol "~3.1" +es6-error@^2.0.2: + version "2.1.1" + resolved "https://registry.yarnpkg.com/es6-error/-/es6-error-2.1.1.tgz#91384301ec5ed1c9a7247d1128247216f03547cd" + es6-iterator@2, es6-iterator@^2.0.1, es6-iterator@~2.0.1: version "2.0.1" resolved "https://registry.yarnpkg.com/es6-iterator/-/es6-iterator-2.0.1.tgz#8e319c9f0453bf575d374940a655920e59ca5512" @@ -3864,6 +3876,10 @@ json-stable-stringify@^1.0.0, json-stable-stringify@^1.0.1: dependencies: jsonify "~0.0.0" +json-stream@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/json-stream/-/json-stream-1.0.0.tgz#1a3854e28d2bbeeab31cc7ddf683d2ddc5652708" + json-stringify-safe@~5.0.1: version "5.0.1" resolved "https://registry.yarnpkg.com/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz#1296a2d58fd45f19a0f6ce01d65701e2c735b6eb" @@ -4244,7 +4260,7 @@ lodash@^3.6.0: version "3.10.1" resolved "https://registry.yarnpkg.com/lodash/-/lodash-3.10.1.tgz#5bf45e8e49ba4189e17d482789dfd15bd140b7b6" -lodash@^4.0.0, lodash@^4.11.1, lodash@^4.14.0, lodash@^4.17.0, lodash@^4.17.3, lodash@^4.17.4, lodash@^4.3.0: +lodash@^4.0.0, lodash@^4.11.1, lodash@^4.14.0, lodash@^4.14.2, lodash@^4.17.0, lodash@^4.17.3, lodash@^4.17.4, lodash@^4.3.0: version "4.17.4" resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.4.tgz#78203a4d1c328ae1d86dca6460e369b57f4055ae" @@ -4566,7 +4582,7 @@ micromatch@^2.1.5, micromatch@^2.3.7: version "1.30.0" resolved "https://registry.yarnpkg.com/mime-db/-/mime-db-1.30.0.tgz#74c643da2dd9d6a45399963465b26d5ca7d71f01" -mime-types@^2.1.12, mime-types@^2.1.3, mime-types@~2.1.11, mime-types@~2.1.15, mime-types@~2.1.16, mime-types@~2.1.7: +mime-types@^2.1.12, mime-types@^2.1.14, mime-types@^2.1.3, mime-types@~2.1.11, mime-types@~2.1.15, mime-types@~2.1.16, mime-types@~2.1.7: version "2.1.17" resolved "https://registry.yarnpkg.com/mime-types/-/mime-types-2.1.17.tgz#09d7a393f03e995a79f8af857b70a9e0ab16557a" dependencies: @@ -4619,6 +4635,25 @@ minimist@~0.0.1: version "0.0.10" resolved "https://registry.yarnpkg.com/minimist/-/minimist-0.0.10.tgz#de3f98543dbf96082be48ad1a0c7cda836301dcf" +minio@^3.1.3: + version "3.2.3" + resolved "https://registry.yarnpkg.com/minio/-/minio-3.2.3.tgz#00a2ec46cba41596cf73fca162192718d0197c49" + dependencies: + async "^1.5.2" + block-stream2 "^1.0.0" + concat-stream "^1.4.8" + es6-error "^2.0.2" + json-stream "^1.0.0" + lodash "^4.14.2" + mime-types "^2.1.14" + mkdirp "^0.5.1" + querystring "0.2.0" + source-map-support "^0.4.12" + through2 "^0.6.5" + uuid "^3.1.0" + xml "^1.0.0" + xml2js "^0.4.15" + mkdirp@0.5.0: version "0.5.0" resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-0.5.0.tgz#1d73076a6df986cd9344e15e71fcc05a4c9abf12" @@ -5915,7 +5950,7 @@ readable-stream@1.1, readable-stream@~1.1.9: isarray "0.0.1" string_decoder "~0.10.x" -readable-stream@2.3.3, readable-stream@^2.0.1, readable-stream@^2.0.2, readable-stream@^2.0.5, readable-stream@^2.0.6, readable-stream@^2.1.4, readable-stream@^2.1.5, readable-stream@^2.2.2, readable-stream@^2.2.6: +readable-stream@2.3.3, readable-stream@^2.0.1, readable-stream@^2.0.2, readable-stream@^2.0.4, readable-stream@^2.0.5, readable-stream@^2.0.6, readable-stream@^2.1.4, readable-stream@^2.1.5, readable-stream@^2.2.2, readable-stream@^2.2.6: version "2.3.3" resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-2.3.3.tgz#368f2512d79f9d46fdfc71349ae7878bbc1eb95c" dependencies: @@ -6515,7 +6550,7 @@ source-list-map@^0.1.7, source-list-map@~0.1.7: version "0.1.8" resolved "https://registry.yarnpkg.com/source-list-map/-/source-list-map-0.1.8.tgz#c550b2ab5427f6b3f21f5afead88c4f5587b2106" -source-map-support@^0.4.0, source-map-support@^0.4.15: +source-map-support@^0.4.0, source-map-support@^0.4.12, source-map-support@^0.4.15: version "0.4.18" resolved "https://registry.yarnpkg.com/source-map-support/-/source-map-support-0.4.18.tgz#0286a6de8be42641338594e97ccea75f0a2c585f" dependencies: @@ -6906,7 +6941,7 @@ throttleit@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/throttleit/-/throttleit-1.0.0.tgz#9e785836daf46743145a5984b6268d828528ac6c" -through2@^0.6.1: +through2@^0.6.1, through2@^0.6.5: version "0.6.5" resolved "https://registry.yarnpkg.com/through2/-/through2-0.6.5.tgz#41ab9c67b29d57209071410e1d7a7a968cd3ad48" dependencies: @@ -7296,6 +7331,10 @@ uuid@3.0.1, uuid@^3.0.0: version "3.0.1" resolved "https://registry.yarnpkg.com/uuid/-/uuid-3.0.1.tgz#6544bba2dfda8c1cf17e629a3a305e2bb1fee6c1" +uuid@^3.1.0: + version "3.2.1" + resolved "https://registry.yarnpkg.com/uuid/-/uuid-3.2.1.tgz#12c528bb9d58d0b9265d9a2f6f0fe8be17ff1f14" + uws@~0.14.1: version "0.14.5" resolved "https://registry.yarnpkg.com/uws/-/uws-0.14.5.tgz#67aaf33c46b2a587a5f6666d00f7691328f149dc" @@ -7619,13 +7658,17 @@ xml2js@0.4.17: sax ">=0.6.0" xmlbuilder "^4.1.0" -xml2js@0.4.x: +xml2js@0.4.x, xml2js@^0.4.15: version "0.4.19" resolved "https://registry.yarnpkg.com/xml2js/-/xml2js-0.4.19.tgz#686c20f213209e94abf0d1bcf1efaa291c7827a7" dependencies: sax ">=0.6.0" xmlbuilder "~9.0.1" +xml@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/xml/-/xml-1.0.1.tgz#78ba72020029c5bc87b8a81a3cfcd74b4a2fc1e5" + xmlbuilder@4.2.1, xmlbuilder@^4.1.0: version "4.2.1" resolved "https://registry.yarnpkg.com/xmlbuilder/-/xmlbuilder-4.2.1.tgz#aa58a3041a066f90eaa16c2f5389ff19f3f461a5" |