Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 8068D200B9C for ; Mon, 5 Sep 2016 02:24:10 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 7EEC8160AB9; Mon, 5 Sep 2016 00:24:10 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id A4063160ACA for ; Mon, 5 Sep 2016 02:24:09 +0200 (CEST) Received: (qmail 9735 invoked by uid 500); 5 Sep 2016 00:24:08 -0000 Mailing-List: contact commits-help@couchdb.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@couchdb.apache.org Delivered-To: mailing list commits@couchdb.apache.org Received: (qmail 9406 invoked by uid 99); 5 Sep 2016 00:24:08 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 05 Sep 2016 00:24:08 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 6204DE08AE; Mon, 5 Sep 2016 00:24:08 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: robertkowalski@apache.org To: commits@couchdb.apache.org Date: Mon, 05 Sep 2016 00:24:10 -0000 Message-Id: <4eb2879dd69f4b8a9f51f80409c4c3aa@git.apache.org> In-Reply-To: <9be7dbf66a1e402b8f5e981ba9b56595@git.apache.org> References: <9be7dbf66a1e402b8f5e981ba9b56595@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [3/6] fauxton commit: updated refs/heads/fix-deps to e35eacf archived-at: Mon, 05 Sep 2016 00:24:10 -0000 cleanup Project: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/repo Commit: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/commit/959e465a Tree: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/tree/959e465a Diff: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/diff/959e465a Branch: refs/heads/fix-deps Commit: 959e465a32742fda87ab03681807a1c3d09e75eb Parents: 53caf70 Author: Robert Kowalski Authored: Mon Sep 5 01:26:55 2016 +0200 Committer: Robert Kowalski Committed: Mon Sep 5 01:40:59 2016 +0200 ---------------------------------------------------------------------- bin/fauxton | 31 ----------------- index.js | 100 ------------------------------------------------------ package.json | 67 ++++++++++++++++++------------------ 3 files changed, 33 insertions(+), 165 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/959e465a/bin/fauxton ---------------------------------------------------------------------- diff --git a/bin/fauxton b/bin/fauxton deleted file mode 100755 index 0d6e1f0..0000000 --- a/bin/fauxton +++ /dev/null @@ -1,31 +0,0 @@ -#!/usr/bin/env node - -var optimist = require('optimist') - .usage('Fauxton server \nUsage: $0') - .options('couchdb', { - alias : 'c', - default : 'http://localhost:5984', - describe: 'Url to your CouchDB instance' - }) - .options('port', { - alias : 'p', - default : 8000, - describe: 'Local port that Fauxton will run on' - }) - .options('help', { - alias : 'h', - describe: 'Show this message' - }) - .options('contentSecurityPolicy', { - alias : 'csp', - default : true, - describe: 'Configure the content security policy' - }); - -var argv = optimist.argv; - -if (argv.help || argv.h) { - return optimist.showHelp(console.log); -} - -var server = require('..')(argv); http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/959e465a/index.js ---------------------------------------------------------------------- diff --git a/index.js b/index.js deleted file mode 100644 index 5ad25fe..0000000 --- a/index.js +++ /dev/null @@ -1,100 +0,0 @@ -var path = require("path"); -var http = require("http"); -var httpProxy = require('http-proxy'); -var send = require('send'); -var urlLib = require('url'); -var _ = require('lodash'); -var dist_dir = process.env.DIST || __dirname + '/dist/release/'; - -module.exports = function (options) { - // Options - var setContentSecurityPolicy = options.contentSecurityPolicy; - var port = options.port; - var proxyUrl = options.couchdb; - - function sendFile (req, res, filePath) { - return send(req, filePath) - .on('error', function (err) { - if (err.status === 404) { - console.log('Could not locate', filePath); - } else { - console.log('ERROR', filePath, err); - } - - res.setHeader("Content-Type", "text/javascript"); - res.statusCode = 404; - res.end(JSON.stringify({error: err.message})); - }) - .pipe(res); - } - - var fileTypes = ['.js', '.css', '.png', '.swf', '.eot', '.woff', '.svg', '.ttf', '.swf']; - - function isFile (url) { - return _.contains(fileTypes, path.extname(url)); - } - - // create proxy to couch for all couch requests - var proxy = httpProxy.createServer({ - secure: false, - changeOrigin: true, - target: proxyUrl - }); - - http.createServer(function (req, res) { - var isDocLink = /_utils\/docs/.test(req.url); - var url = req.url.split(/\?v=|\?noCache/)[0].replace('_utils', ''); - var accept = []; - if (req.headers.accept) { - var accept = req.headers.accept.split(','); - } - if (setContentSecurityPolicy) { - var headerValue = "default-src 'self'; child-src 'self' data: blob:; img-src 'self' data:; font-src 'self'; " + - "script-src 'self' 'unsafe-eval'; style-src 'self' 'unsafe-inline';"; - res.setHeader('Content-Security-Policy', headerValue); - } - - if (url === '/' && accept[0] !== 'application/json') { - // serve main index file from here - return sendFile(req, res, path.join(dist_dir, 'index.html')); - } else if (isFile(url) && !isDocLink) { - return sendFile(req, res, path.join(dist_dir, url)); - } - - // This sets the Host header in the proxy so that one can use external - // CouchDB instances and not have the Host set to 'localhost' - var urlObj = urlLib.parse(req.url); - req.headers.host = urlObj.host; - - proxy.web(req, res); - }).listen(port, '0.0.0.0'); - - proxy.on('error', function (e) { - // don't explode on cancelled requests - }); - - //Remove Secure on the cookie if the proxy is communicating to a CouchDB instance - // via https. - proxy.on('proxyRes', function (proxyRes, req, res) { - if (proxyRes.headers['set-cookie']) { - proxyRes.headers['set-cookie'][0] = proxyRes.headers["set-cookie"][0].replace('Secure', ''); - } - }); - - var logo = [ - [""], - [" ______ _ "], - ["| ____| | | "], - ["| |__ __ _ _ _ __ __ | |_ ___ _ __ "], - ["| __| / _` | | | | | \\ \\/ / | __| / _ \\ | '_ \\ "], - ["| | | (_| | | |_| | > < | |_ | (_) | | | | |"], - ["|_| \\__,_| \\__,_| /_/\\_\\ \\__| \\___/ |_| |_|"], - [""] - ]; - - _.each(logo, function (line) { - console.log(line.toString()); - }); - - console.log('Listening on ' + port); -}; http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/959e465a/package.json ---------------------------------------------------------------------- diff --git a/package.json b/package.json index 03d45d3..8b12c23 100644 --- a/package.json +++ b/package.json @@ -14,8 +14,8 @@ "couchapp": "grunt couchapp_deploy", "dev": "node ./devserver.js", "nightwatch": "grunt nightwatch", - "start": "node ./bin/fauxton", - "start-debug": "DIST=./dist/debug node ./bin/fauxton", + "start": "fauxton", + "start-debug": "fauxton -d ./dist/debug", "preversion": "node version-check.js && grunt release", "test-before-publish": "npm run preversion && npm install . -g", "create:animaldb": "./bin/create-animal-db", @@ -29,17 +29,29 @@ "docker:down": "docker-compose -f ./docker/dc.selenium.yml down", "remove-test-dbs": "node ./bin/remove-test-dbs.js" }, - "devDependencies": { - "enzyme": "^2.4.1", - "es5-shim": "4.5.4", - "mocha": "^2.4.5", - "mocha-phantomjs": "git+https://github.com/garrensmith/mocha-phantomjs.git", - "nightwatch": "~0.9.0", - "phantomjs-prebuilt": "^2.1.7", - "react-addons-test-utils": "~15.0.1", - "sinon": "git+https://github.com/sinonjs/sinon.git" - }, "dependencies": { + "backbone": "^1.1.0", + "backbone.layoutmanager": "^0.9.5", + "brace": "^0.7.0", + "chai": "^3.5.0", + "d3": "^3.4.11", + "flux": "^2.1.1", + "jquery": "^2.2.0", + "jsondiffpatch": "^0.1.41", + "moment": "^2.8.4", + "pouchdb": "^5.3.1", + "react": "~15.0.1", + "react-addons-css-transition-group": "~15.0.1", + "react-bootstrap": "^0.28.5", + "react-dom": "~15.0.1", + "react-select": "^1.0.0-beta12", + "underscore": "~1.4.2", + "velocity-animate": "^1.2.3", + "velocity-react": "^1.1.4", + "visualizeRevTree": "git+https://github.com/neojski/visualizeRevTree.git#gh-pages", + "zeroclipboard": "^2.2.0" + }, + "devDependencies": { "async": "~0.2.6", "babel": "^6.3.26", "babel-cli": "^6.4.5", @@ -49,14 +61,17 @@ "babel-preset-es2015": "^6.3.13", "babel-preset-react": "^6.3.13", "babel-register": "^6.4.3", - "backbone": "^1.1.0", - "backbone.layoutmanager": "^0.9.5", - "brace": "^0.7.0", - "chai": "^3.5.0", + "enzyme": "^2.4.1", + "es5-shim": "4.5.4", + "mocha": "^2.4.5", + "mocha-phantomjs": "git+https://github.com/garrensmith/mocha-phantomjs.git", + "nightwatch": "~0.9.0", + "phantomjs-prebuilt": "^2.1.7", + "react-addons-test-utils": "~15.0.1", + "sinon": "git+https://github.com/sinonjs/sinon.git", "clean-css": "^3.4.9", "couchapp": "~0.11.0", "css-loader": "^0.23.1", - "d3": "^3.4.11", "eslint": "^2.0.0", "eslint-loader": "^1.3.0", "eslint-plugin-react": "^5.2.2", @@ -64,7 +79,6 @@ "expose-loader": "^0.7.1", "express": "^4.13.4", "file-loader": "^0.8.5", - "flux": "^2.1.1", "grunt": "~0.4.1", "grunt-chmod": "^1.0.3", "grunt-cli": "~0.1.6", @@ -79,35 +93,20 @@ "grunt-shell": "^1.1.1", "http-proxy": "^1.13.2", "imports-loader": "^0.6.5", - "jquery": "^2.2.0", - "jsondiffpatch": "^0.1.41", "less": "^2.3.1", "less-loader": "^2.2.3", "lodash": "^3.10.1", "mkdirp": "^0.5.1", - "moment": "^2.8.4", "nano": "~5.12.0", "optimist": "^0.6.1", - "pouchdb": "^5.3.1", - "react": "~15.0.1", - "react-addons-css-transition-group": "~15.0.1", - "react-bootstrap": "^0.28.5", - "react-dom": "~15.0.1", - "react-select": "^1.0.0-beta12", "request": "^2.54.0", "semver": "^5.1.0", "send": "^0.13.1", "style-loader": "^0.13.1", - "underscore": "~1.4.2", - "url": "~0.7.9", "url-loader": "^0.5.7", "urls": "~0.0.3", - "velocity-animate": "^1.2.3", - "velocity-react": "^1.1.4", - "visualizeRevTree": "git+https://github.com/neojski/visualizeRevTree.git#gh-pages", "webpack": "^1.12.12", - "webpack-dev-server": "^1.14.1", - "zeroclipboard": "^2.2.0" + "webpack-dev-server": "^1.14.1" }, "repository": { "type": "git",