diff options
-rw-r--r-- | lib/config/index.js | 15 | ||||
-rw-r--r-- | lib/csp.js | 4 | ||||
-rw-r--r-- | package.json | 2 | ||||
-rw-r--r-- | public/js/lib/editor/utils.js | 11 | ||||
-rw-r--r-- | yarn.lock | 41 |
5 files changed, 41 insertions, 32 deletions
diff --git a/lib/config/index.js b/lib/config/index.js index 48e61b6c..bdbdfea9 100644 --- a/lib/config/index.js +++ b/lib/config/index.js @@ -1,4 +1,3 @@ - 'use strict' const crypto = require('crypto') @@ -31,7 +30,7 @@ const packageConfig = { } const configFilePath = path.resolve(appRootPath, process.env.CMD_CONFIG_FILE || -'config.json') + 'config.json') const fileConfig = fs.existsSync(configFilePath) ? require(configFilePath)[env] : undefined let config = require('./default') @@ -88,6 +87,14 @@ config.isStandardHTTPPort = (function isStandardHTTPPort () { return !config.useSSL && config.port === 80 })() +// Use HTTPS protocol if the internal TLS server is enabled +if (config.useSSL === true) { + if (config.protocolUseSSL === false) { + logger.warn('Overriding protocolUseSSL to \'true\' as useSSL is enabled.') + } + config.protocolUseSSL = true +} + // cache serverURL config.serverURL = (function getserverurl () { let url = '' @@ -147,8 +154,8 @@ for (let i = keys.length; i--;) { // and the config with uppercase is not set // we set the new config using the old key. if (uppercase.test(keys[i]) && - config[lowercaseKey] !== undefined && - fileConfig[keys[i]] === undefined) { + config[lowercaseKey] !== undefined && + fileConfig[keys[i]] === undefined) { logger.warn('config.json contains deprecated lowercase setting for ' + keys[i] + '. Please change your config.json file to replace ' + lowercaseKey + ' with ' + keys[i]) config[keys[i]] = config[lowercaseKey] } @@ -85,9 +85,9 @@ function getCspNonce (req, res) { function addUpgradeUnsafeRequestsOptionTo (directives) { if (config.csp.upgradeInsecureRequests === 'auto' && config.useSSL) { - directives.upgradeInsecureRequests = true + directives.upgradeInsecureRequests = [] } else if (config.csp.upgradeInsecureRequests === true) { - directives.upgradeInsecureRequests = true + directives.upgradeInsecureRequests = [] } } diff --git a/package.json b/package.json index a558a4dc..f7dd5eba 100644 --- a/package.json +++ b/package.json @@ -201,7 +201,7 @@ "visibilityjs": "^2.0.0", "viz.js": "^1.7.0", "webpack": "4.46.0", - "webpack-cli": "4.6.0", + "webpack-cli": "4.7.0", "webpack-merge": "5.7.3", "wurl": "^2.5.3" }, diff --git a/public/js/lib/editor/utils.js b/public/js/lib/editor/utils.js index 70428b28..3d799267 100644 --- a/public/js/lib/editor/utils.js +++ b/public/js/lib/editor/utils.js @@ -1,4 +1,5 @@ const wrapSymbols = ['*', '_', '~', '^', '+', '='] + export function wrapTextWith (editor, cm, symbol) { if (!cm.getSelection()) { return CodeMirror.Pass @@ -106,12 +107,14 @@ export function insertOnStartOfLines (cm, symbol) { for (let i = 0; i < ranges.length; i++) { const range = ranges[i] if (!range.empty()) { - const from = range.from() - const to = range.to() - let selection = cm.getRange({ line: from.line, ch: 0 }, to) + const cursorFrom = range.from() + const cursorTo = range.to() + const firstLineStart = { line: cursorFrom.line, ch: 0 } + const lastLineEnd = { line: cursorTo.line, ch: cm.getLine(cursorTo.line).length } + let selection = cm.getRange(firstLineStart, lastLineEnd) selection = selection.replace(/\n/g, '\n' + symbol) selection = symbol + selection - cm.replaceRange(selection, from, to) + cm.replaceRange(selection, firstLineStart, lastLineEnd) } else { cm.replaceRange(symbol, { line: cursor.line, ch: 0 }, { line: cursor.line, ch: 0 }) } @@ -539,22 +539,22 @@ "@webassemblyjs/wast-parser" "1.9.0" "@xtuc/long" "4.2.2" -"@webpack-cli/configtest@^1.0.2": - version "1.0.2" - resolved "https://registry.yarnpkg.com/@webpack-cli/configtest/-/configtest-1.0.2.tgz#2a20812bfb3a2ebb0b27ee26a52eeb3e3f000836" - integrity sha512-3OBzV2fBGZ5TBfdW50cha1lHDVf9vlvRXnjpVbJBa20pSZQaSkMJZiwA8V2vD9ogyeXn8nU5s5A6mHyf5jhMzA== +"@webpack-cli/configtest@^1.0.3": + version "1.0.3" + resolved "https://registry.yarnpkg.com/@webpack-cli/configtest/-/configtest-1.0.3.tgz#204bcff87cda3ea4810881f7ea96e5f5321b87b9" + integrity sha512-WQs0ep98FXX2XBAfQpRbY0Ma6ADw8JR6xoIkaIiJIzClGOMqVRvPCWqndTxf28DgFopWan0EKtHtg/5W1h0Zkw== -"@webpack-cli/info@^1.2.3": - version "1.2.3" - resolved "https://registry.yarnpkg.com/@webpack-cli/info/-/info-1.2.3.tgz#ef819d10ace2976b6d134c7c823a3e79ee31a92c" - integrity sha512-lLek3/T7u40lTqzCGpC6CAbY6+vXhdhmwFRxZLMnRm6/sIF/7qMpT8MocXCRQfz0JAh63wpbXLMnsQ5162WS7Q== +"@webpack-cli/info@^1.2.4": + version "1.2.4" + resolved "https://registry.yarnpkg.com/@webpack-cli/info/-/info-1.2.4.tgz#7381fd41c9577b2d8f6c2594fad397ef49ad5573" + integrity sha512-ogE2T4+pLhTTPS/8MM3IjHn0IYplKM4HbVNMCWA9N4NrdPzunwenpCsqKEXyejMfRu6K8mhauIPYf8ZxWG5O6g== dependencies: envinfo "^7.7.3" -"@webpack-cli/serve@^1.3.1": - version "1.3.1" - resolved "https://registry.yarnpkg.com/@webpack-cli/serve/-/serve-1.3.1.tgz#911d1b3ff4a843304b9c3bacf67bb34672418441" - integrity sha512-0qXvpeYO6vaNoRBI52/UsbcaBydJCggoBBnIo/ovQQdn6fug0BgwsjorV1hVS7fMqGVTZGcVxv8334gjmbj5hw== +"@webpack-cli/serve@^1.4.0": + version "1.4.0" + resolved "https://registry.yarnpkg.com/@webpack-cli/serve/-/serve-1.4.0.tgz#f84fd07bcacefe56ce762925798871092f0f228e" + integrity sha512-xgT/HqJ+uLWGX+Mzufusl3cgjAcnqYYskaB7o0vRcwOEfuu6hMzSILQpnIzFMGsTaeaX4Nnekl+6fadLbl1/Vg== "@xtuc/ieee754@^1.2.0": version "1.2.0" @@ -3603,7 +3603,7 @@ enhanced-resolve@^4.5.0: memory-fs "^0.5.0" tapable "^1.0.0" -enquirer@^2.3.5, enquirer@^2.3.6: +enquirer@^2.3.5: version "2.3.6" resolved "https://registry.yarnpkg.com/enquirer/-/enquirer-2.3.6.tgz#2a7fe5dd634a1e4125a975ec994ff5456dc3734d" integrity sha512-yjNnPr315/FjS4zIsUxYguYUPP2e1NK4d7E7ZOLiyYCcbFBiTMyID+2wvm2w6+pZ/odMA7cRkjhsPbltwBOrLg== @@ -11059,18 +11059,17 @@ webfontloader@~1.6.x: resolved "https://registry.yarnpkg.com/webfontloader/-/webfontloader-1.6.28.tgz#db786129253cb6e8eae54c2fb05f870af6675bae" integrity sha1-23hhKSU8tujq5UwvsF+HCvZnW64= -webpack-cli@4.6.0: - version "4.6.0" - resolved "https://registry.yarnpkg.com/webpack-cli/-/webpack-cli-4.6.0.tgz#27ae86bfaec0cf393fcfd58abdc5a229ad32fd16" - integrity sha512-9YV+qTcGMjQFiY7Nb1kmnupvb1x40lfpj8pwdO/bom+sQiP4OBMKjHq29YQrlDWDPZO9r/qWaRRywKaRDKqBTA== +webpack-cli@4.7.0: + version "4.7.0" + resolved "https://registry.yarnpkg.com/webpack-cli/-/webpack-cli-4.7.0.tgz#3195a777f1f802ecda732f6c95d24c0004bc5a35" + integrity sha512-7bKr9182/sGfjFm+xdZSwgQuFjgEcy0iCTIBxRUeteJ2Kr8/Wz0qNJX+jw60LU36jApt4nmMkep6+W5AKhok6g== dependencies: "@discoveryjs/json-ext" "^0.5.0" - "@webpack-cli/configtest" "^1.0.2" - "@webpack-cli/info" "^1.2.3" - "@webpack-cli/serve" "^1.3.1" + "@webpack-cli/configtest" "^1.0.3" + "@webpack-cli/info" "^1.2.4" + "@webpack-cli/serve" "^1.4.0" colorette "^1.2.1" commander "^7.0.0" - enquirer "^2.3.6" execa "^5.0.0" fastest-levenshtein "^1.0.12" import-local "^3.0.2" |