summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/config/index.js15
-rw-r--r--lib/csp.js4
-rw-r--r--public/js/lib/editor/utils.js11
3 files changed, 20 insertions, 10 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]
}
diff --git a/lib/csp.js b/lib/csp.js
index 108f2a22..08efdd79 100644
--- a/lib/csp.js
+++ b/lib/csp.js
@@ -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/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 })
}