diff --git a/Gruntfile.js b/Gruntfile.js index 55c15596a..7dd557a52 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -4,14 +4,15 @@ module.exports = function (grunt) { // middleware for grunt.connect var middleware = function (connect, options, middlewares) { // inject a custom middleware into the array of default middlewares for proxy page + var bodyParser = require('body-parser'); var proxypage = require('proxypage'); var proxyRe = /\/proxy\/proxy.ashx/i; var enableCORS = function (req, res, next) { - res.setHeader('Access-Control-Allow-Origin', req.headers.origin); + res.setHeader('Access-Control-Allow-Origin', req.headers.origin || '*'); res.setHeader('Access-Control-Allow-Credentials', true); res.setHeader('Access-Control-Allow-Methods', 'GET,HEAD,PUT,PATCH,POST,DELETE'); - res.setHeader('Access-Control-Allow-Headers', req.headers['access-control-request-headers']); + res.setHeader('Access-Control-Allow-Headers', req.headers['access-control-request-headers'] || 'Origin, X-Requested-With, Content-Type, Accept'); return next(); }; @@ -24,8 +25,8 @@ module.exports = function (grunt) { middlewares.unshift(proxyMiddleware); middlewares.unshift(enableCORS); - middlewares.unshift(connect.json()); //body parser, see https://github.com/senchalabs/connect/wiki/Connect-3.0 - middlewares.unshift(connect.urlencoded()); //body parser + middlewares.unshift(bodyParser.json()); //body parser, see https://github.com/senchalabs/connect/wiki/Connect-3.0 + middlewares.unshift(bodyParser.urlencoded({extended: true})); //body parser return middlewares; }; @@ -124,6 +125,8 @@ module.exports = function (grunt) { port: 3000, base: 'viewer', hostname: '*', + protocol: 'https', + keepalive: true, middleware: middleware } }, @@ -132,16 +135,18 @@ module.exports = function (grunt) { port: 3001, base: 'dist/viewer', hostname: '*', + protocol: 'https', + keepalive: true, middleware: middleware } } }, open: { 'dev_browser': { - path: 'http://localhost:3000/index.html' + path: 'https://localhost:3000/index.html' }, 'build_browser': { - path: 'http://localhost:3001/index.html' + path: 'https://localhost:3001/index.html' } }, compress: { diff --git a/package.json b/package.json index 59520732c..905f125b3 100644 --- a/package.json +++ b/package.json @@ -3,26 +3,27 @@ "version": "2.0.0-beta.1", "author": "cmv.io - https://github.com/cmv/", "license": "MIT", - "year": "2016", - "homepage": "http://cmv.io/", + "year": "2017", + "homepage": "https://cmv.io/", "repository": "https://github.com/cmv/cmv-app/", "dependencies": { - "babel-eslint": "6.1.x", + "babel-eslint": "~7.1.1", "csslint": "1.0.x", "eslint": "3.5.x", "grunt": "1.0.x", "grunt-contrib-clean": "1.0.x", - "grunt-contrib-compress": "1.3.x", + "grunt-contrib-compress": "~1.4.1", "grunt-contrib-connect": "1.0.x", "grunt-contrib-copy": "1.0.x", - "grunt-contrib-csslint": "1.0.x", + "grunt-contrib-csslint": "~2.0.x", "grunt-contrib-cssmin": "1.0.x", - "grunt-contrib-uglify": "2.0.x", + "grunt-contrib-uglify": "2.1.x", "grunt-contrib-watch": "1.0.x", "grunt-eslint": "19.0.x", "grunt-newer": "1.2.x", "grunt-open": "0.2.x", "grunt-postcss": "0.8.x", + "body-parser": "1.16.x", "proxypage": "*" }, "engine": "node >= 4",