mirror of
https://github.com/arnaucube/socketioMEANseed.git
synced 2026-02-07 03:36:47 +01:00
init
This commit is contained in:
1
www/node_modules/.bin/ecstatic
generated
vendored
Symbolic link
1
www/node_modules/.bin/ecstatic
generated
vendored
Symbolic link
@@ -0,0 +1 @@
|
||||
../ecstatic/lib/ecstatic.js
|
||||
1
www/node_modules/.bin/he
generated
vendored
Symbolic link
1
www/node_modules/.bin/he
generated
vendored
Symbolic link
@@ -0,0 +1 @@
|
||||
../he/bin/he
|
||||
1
www/node_modules/.bin/hs
generated
vendored
Symbolic link
1
www/node_modules/.bin/hs
generated
vendored
Symbolic link
@@ -0,0 +1 @@
|
||||
../http-server/bin/http-server
|
||||
1
www/node_modules/.bin/http-server
generated
vendored
Symbolic link
1
www/node_modules/.bin/http-server
generated
vendored
Symbolic link
@@ -0,0 +1 @@
|
||||
../http-server/bin/http-server
|
||||
1
www/node_modules/.bin/mime
generated
vendored
Symbolic link
1
www/node_modules/.bin/mime
generated
vendored
Symbolic link
@@ -0,0 +1 @@
|
||||
../mime/cli.js
|
||||
1
www/node_modules/.bin/mkdirp
generated
vendored
Symbolic link
1
www/node_modules/.bin/mkdirp
generated
vendored
Symbolic link
@@ -0,0 +1 @@
|
||||
../mkdirp/bin/cmd.js
|
||||
1
www/node_modules/.bin/opener
generated
vendored
Symbolic link
1
www/node_modules/.bin/opener
generated
vendored
Symbolic link
@@ -0,0 +1 @@
|
||||
../opener/opener.js
|
||||
3
www/node_modules/async/.travis.yml
generated
vendored
Normal file
3
www/node_modules/async/.travis.yml
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
language: node_js
|
||||
node_js:
|
||||
- "0.10"
|
||||
19
www/node_modules/async/LICENSE
generated
vendored
Normal file
19
www/node_modules/async/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
Copyright (c) 2010-2014 Caolan McMahon
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
1646
www/node_modules/async/README.md
generated
vendored
Normal file
1646
www/node_modules/async/README.md
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
11
www/node_modules/async/component.json
generated
vendored
Normal file
11
www/node_modules/async/component.json
generated
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"name": "async",
|
||||
"repo": "caolan/async",
|
||||
"description": "Higher-order functions and common patterns for asynchronous code",
|
||||
"version": "0.1.23",
|
||||
"keywords": [],
|
||||
"dependencies": {},
|
||||
"development": {},
|
||||
"main": "lib/async.js",
|
||||
"scripts": [ "lib/async.js" ]
|
||||
}
|
||||
1123
www/node_modules/async/lib/async.js
generated
vendored
Executable file
1123
www/node_modules/async/lib/async.js
generated
vendored
Executable file
File diff suppressed because it is too large
Load Diff
94
www/node_modules/async/package.json
generated
vendored
Normal file
94
www/node_modules/async/package.json
generated
vendored
Normal file
@@ -0,0 +1,94 @@
|
||||
{
|
||||
"_args": [
|
||||
[
|
||||
{
|
||||
"raw": "async@0.9.0",
|
||||
"scope": null,
|
||||
"escapedName": "async",
|
||||
"name": "async",
|
||||
"rawSpec": "0.9.0",
|
||||
"spec": "0.9.0",
|
||||
"type": "version"
|
||||
},
|
||||
"/home/nau/MEGA/CODI/githubRepos/colspace/www/node_modules/portfinder"
|
||||
]
|
||||
],
|
||||
"_from": "async@0.9.0",
|
||||
"_id": "async@0.9.0",
|
||||
"_inCache": true,
|
||||
"_location": "/async",
|
||||
"_npmUser": {
|
||||
"name": "caolan",
|
||||
"email": "caolan.mcmahon@gmail.com"
|
||||
},
|
||||
"_npmVersion": "1.4.3",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"raw": "async@0.9.0",
|
||||
"scope": null,
|
||||
"escapedName": "async",
|
||||
"name": "async",
|
||||
"rawSpec": "0.9.0",
|
||||
"spec": "0.9.0",
|
||||
"type": "version"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/portfinder"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/async/-/async-0.9.0.tgz",
|
||||
"_shasum": "ac3613b1da9bed1b47510bb4651b8931e47146c7",
|
||||
"_shrinkwrap": null,
|
||||
"_spec": "async@0.9.0",
|
||||
"_where": "/home/nau/MEGA/CODI/githubRepos/colspace/www/node_modules/portfinder",
|
||||
"author": {
|
||||
"name": "Caolan McMahon"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/caolan/async/issues"
|
||||
},
|
||||
"dependencies": {},
|
||||
"description": "Higher-order functions and common patterns for asynchronous code",
|
||||
"devDependencies": {
|
||||
"nodelint": ">0.0.0",
|
||||
"nodeunit": ">0.0.0",
|
||||
"uglify-js": "1.2.x"
|
||||
},
|
||||
"directories": {},
|
||||
"dist": {
|
||||
"shasum": "ac3613b1da9bed1b47510bb4651b8931e47146c7",
|
||||
"tarball": "https://registry.npmjs.org/async/-/async-0.9.0.tgz"
|
||||
},
|
||||
"homepage": "https://github.com/caolan/async",
|
||||
"jam": {
|
||||
"main": "lib/async.js",
|
||||
"include": [
|
||||
"lib/async.js",
|
||||
"README.md",
|
||||
"LICENSE"
|
||||
]
|
||||
},
|
||||
"licenses": [
|
||||
{
|
||||
"type": "MIT",
|
||||
"url": "https://github.com/caolan/async/raw/master/LICENSE"
|
||||
}
|
||||
],
|
||||
"main": "./lib/async",
|
||||
"maintainers": [
|
||||
{
|
||||
"name": "caolan",
|
||||
"email": "caolan@caolanmcmahon.com"
|
||||
}
|
||||
],
|
||||
"name": "async",
|
||||
"optionalDependencies": {},
|
||||
"readme": "ERROR: No README data found!",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/caolan/async.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "nodeunit test/test-async.js"
|
||||
},
|
||||
"version": "0.9.0"
|
||||
}
|
||||
6
www/node_modules/colors/.travis.yml
generated
vendored
Normal file
6
www/node_modules/colors/.travis.yml
generated
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
language: node_js
|
||||
node_js:
|
||||
- "0.11"
|
||||
- "0.10"
|
||||
- "0.8"
|
||||
- "0.6"
|
||||
23
www/node_modules/colors/MIT-LICENSE.txt
generated
vendored
Normal file
23
www/node_modules/colors/MIT-LICENSE.txt
generated
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
Original Library
|
||||
- Copyright (c) Marak Squires
|
||||
|
||||
Additional Functionality
|
||||
- Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
167
www/node_modules/colors/ReadMe.md
generated
vendored
Normal file
167
www/node_modules/colors/ReadMe.md
generated
vendored
Normal file
@@ -0,0 +1,167 @@
|
||||
# colors.js
|
||||
|
||||
## get color and style in your node.js console
|
||||
|
||||
<img src="https://github.com/Marak/colors.js/raw/master/screenshots/colors.png"/>
|
||||
|
||||
## Installation
|
||||
|
||||
npm install colors
|
||||
|
||||
## colors and styles!
|
||||
|
||||
### text colors
|
||||
|
||||
- black
|
||||
- red
|
||||
- green
|
||||
- yellow
|
||||
- blue
|
||||
- magenta
|
||||
- cyan
|
||||
- white
|
||||
- gray
|
||||
- grey
|
||||
|
||||
### background colors
|
||||
|
||||
|
||||
|
||||
- bgBlack
|
||||
- bgRed
|
||||
- bgGreen
|
||||
- bgYellow
|
||||
- bgBlue
|
||||
- bgMagenta
|
||||
- bgCyan
|
||||
- bgWhite
|
||||
|
||||
### styles
|
||||
|
||||
- reset
|
||||
- bold
|
||||
- dim
|
||||
- italic
|
||||
- underline
|
||||
- inverse
|
||||
- hidden
|
||||
- strikethrough
|
||||
|
||||
### extras
|
||||
|
||||
- rainbow
|
||||
- zebra
|
||||
- america
|
||||
- trap
|
||||
- random
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
By popular demand, `colors` now ships with two types of usages!
|
||||
|
||||
The super nifty way
|
||||
|
||||
```js
|
||||
var colors = require('colors');
|
||||
|
||||
console.log('hello'.green); // outputs green text
|
||||
console.log('i like cake and pies'.underline.red) // outputs red underlined text
|
||||
console.log('inverse the color'.inverse); // inverses the color
|
||||
console.log('OMG Rainbows!'.rainbow); // rainbow
|
||||
console.log('Run the trap'.trap); // Drops the bass
|
||||
|
||||
```
|
||||
|
||||
or a slightly less nifty way which doesn't extend `String.prototype`
|
||||
|
||||
```js
|
||||
var colors = require('colors/safe');
|
||||
|
||||
console.log(colors.green('hello')); // outputs green text
|
||||
console.log(colors.red.underline('i like cake and pies')) // outputs red underlined text
|
||||
console.log(colors.inverse('inverse the color')); // inverses the color
|
||||
console.log(colors.rainbow('OMG Rainbows!')); // rainbow
|
||||
console.log(colors.trap('Run the trap')); // Drops the bass
|
||||
|
||||
```
|
||||
|
||||
I prefer the first way. Some people seem to be afraid of extending `String.prototype` and prefer the second way.
|
||||
|
||||
If you are writing good code you will never have an issue with the first approach. If you really don't want to touch `String.prototype`, the second usage will not touch `String` native object.
|
||||
|
||||
## Disabling Colors
|
||||
|
||||
To disable colors you can pass the following arguments in the command line to your application:
|
||||
|
||||
```bash
|
||||
node myapp.js --no-color
|
||||
```
|
||||
|
||||
## Console.log [string substitution](http://nodejs.org/docs/latest/api/console.html#console_console_log_data)
|
||||
|
||||
```js
|
||||
var name = 'Marak';
|
||||
console.log(colors.green('Hello %s'), name);
|
||||
// outputs -> 'Hello Marak'
|
||||
```
|
||||
|
||||
## Custom themes
|
||||
|
||||
### Using standard API
|
||||
|
||||
```js
|
||||
|
||||
var colors = require('colors');
|
||||
|
||||
colors.setTheme({
|
||||
silly: 'rainbow',
|
||||
input: 'grey',
|
||||
verbose: 'cyan',
|
||||
prompt: 'grey',
|
||||
info: 'green',
|
||||
data: 'grey',
|
||||
help: 'cyan',
|
||||
warn: 'yellow',
|
||||
debug: 'blue',
|
||||
error: 'red'
|
||||
});
|
||||
|
||||
// outputs red text
|
||||
console.log("this is an error".error);
|
||||
|
||||
// outputs yellow text
|
||||
console.log("this is a warning".warn);
|
||||
```
|
||||
|
||||
### Using string safe API
|
||||
|
||||
```js
|
||||
var colors = require('colors/safe');
|
||||
|
||||
// set single property
|
||||
var error = colors.red;
|
||||
error('this is red');
|
||||
|
||||
// set theme
|
||||
colors.setTheme({
|
||||
silly: 'rainbow',
|
||||
input: 'grey',
|
||||
verbose: 'cyan',
|
||||
prompt: 'grey',
|
||||
info: 'green',
|
||||
data: 'grey',
|
||||
help: 'cyan',
|
||||
warn: 'yellow',
|
||||
debug: 'blue',
|
||||
error: 'red'
|
||||
});
|
||||
|
||||
// outputs red text
|
||||
console.log(colors.error("this is an error"));
|
||||
|
||||
// outputs yellow text
|
||||
console.log(colors.warn("this is a warning"));
|
||||
```
|
||||
|
||||
*Protip: There is a secret undocumented style in `colors`. If you find the style you can summon him.*
|
||||
74
www/node_modules/colors/examples/normal-usage.js
generated
vendored
Normal file
74
www/node_modules/colors/examples/normal-usage.js
generated
vendored
Normal file
@@ -0,0 +1,74 @@
|
||||
var colors = require('../lib/index');
|
||||
|
||||
console.log("First some yellow text".yellow);
|
||||
|
||||
console.log("Underline that text".yellow.underline);
|
||||
|
||||
console.log("Make it bold and red".red.bold);
|
||||
|
||||
console.log(("Double Raindows All Day Long").rainbow)
|
||||
|
||||
console.log("Drop the bass".trap)
|
||||
|
||||
console.log("DROP THE RAINBOW BASS".trap.rainbow)
|
||||
|
||||
|
||||
console.log('Chains are also cool.'.bold.italic.underline.red); // styles not widely supported
|
||||
|
||||
console.log('So '.green + 'are'.underline + ' ' + 'inverse'.inverse + ' styles! '.yellow.bold); // styles not widely supported
|
||||
console.log("Zebras are so fun!".zebra);
|
||||
|
||||
//
|
||||
// Remark: .strikethrough may not work with Mac OS Terminal App
|
||||
//
|
||||
console.log("This is " + "not".strikethrough + " fun.");
|
||||
|
||||
console.log('Background color attack!'.black.bgWhite)
|
||||
console.log('Use random styles on everything!'.random)
|
||||
console.log('America, Heck Yeah!'.america)
|
||||
|
||||
|
||||
console.log('Setting themes is useful')
|
||||
|
||||
//
|
||||
// Custom themes
|
||||
//
|
||||
console.log('Generic logging theme as JSON'.green.bold.underline);
|
||||
// Load theme with JSON literal
|
||||
colors.setTheme({
|
||||
silly: 'rainbow',
|
||||
input: 'grey',
|
||||
verbose: 'cyan',
|
||||
prompt: 'grey',
|
||||
info: 'green',
|
||||
data: 'grey',
|
||||
help: 'cyan',
|
||||
warn: 'yellow',
|
||||
debug: 'blue',
|
||||
error: 'red'
|
||||
});
|
||||
|
||||
// outputs red text
|
||||
console.log("this is an error".error);
|
||||
|
||||
// outputs yellow text
|
||||
console.log("this is a warning".warn);
|
||||
|
||||
// outputs grey text
|
||||
console.log("this is an input".input);
|
||||
|
||||
console.log('Generic logging theme as file'.green.bold.underline);
|
||||
|
||||
// Load a theme from file
|
||||
colors.setTheme(__dirname + '/../themes/generic-logging.js');
|
||||
|
||||
// outputs red text
|
||||
console.log("this is an error".error);
|
||||
|
||||
// outputs yellow text
|
||||
console.log("this is a warning".warn);
|
||||
|
||||
// outputs grey text
|
||||
console.log("this is an input".input);
|
||||
|
||||
//console.log("Don't summon".zalgo)
|
||||
76
www/node_modules/colors/examples/safe-string.js
generated
vendored
Normal file
76
www/node_modules/colors/examples/safe-string.js
generated
vendored
Normal file
@@ -0,0 +1,76 @@
|
||||
var colors = require('../safe');
|
||||
|
||||
console.log(colors.yellow("First some yellow text"));
|
||||
|
||||
console.log(colors.yellow.underline("Underline that text"));
|
||||
|
||||
console.log(colors.red.bold("Make it bold and red"));
|
||||
|
||||
console.log(colors.rainbow("Double Raindows All Day Long"))
|
||||
|
||||
console.log(colors.trap("Drop the bass"))
|
||||
|
||||
console.log(colors.rainbow(colors.trap("DROP THE RAINBOW BASS")));
|
||||
|
||||
console.log(colors.bold.italic.underline.red('Chains are also cool.')); // styles not widely supported
|
||||
|
||||
|
||||
console.log(colors.green('So ') + colors.underline('are') + ' ' + colors.inverse('inverse') + colors.yellow.bold(' styles! ')); // styles not widely supported
|
||||
|
||||
console.log(colors.zebra("Zebras are so fun!"));
|
||||
|
||||
console.log("This is " + colors.strikethrough("not") + " fun.");
|
||||
|
||||
|
||||
console.log(colors.black.bgWhite('Background color attack!'));
|
||||
console.log(colors.random('Use random styles on everything!'))
|
||||
console.log(colors.america('America, Heck Yeah!'));
|
||||
|
||||
console.log('Setting themes is useful')
|
||||
|
||||
//
|
||||
// Custom themes
|
||||
//
|
||||
//console.log('Generic logging theme as JSON'.green.bold.underline);
|
||||
// Load theme with JSON literal
|
||||
colors.setTheme({
|
||||
silly: 'rainbow',
|
||||
input: 'grey',
|
||||
verbose: 'cyan',
|
||||
prompt: 'grey',
|
||||
info: 'green',
|
||||
data: 'grey',
|
||||
help: 'cyan',
|
||||
warn: 'yellow',
|
||||
debug: 'blue',
|
||||
error: 'red'
|
||||
});
|
||||
|
||||
// outputs red text
|
||||
console.log(colors.error("this is an error"));
|
||||
|
||||
// outputs yellow text
|
||||
console.log(colors.warn("this is a warning"));
|
||||
|
||||
// outputs grey text
|
||||
console.log(colors.input("this is an input"));
|
||||
|
||||
|
||||
// console.log('Generic logging theme as file'.green.bold.underline);
|
||||
|
||||
// Load a theme from file
|
||||
colors.setTheme(__dirname + '/../themes/generic-logging.js');
|
||||
|
||||
// outputs red text
|
||||
console.log(colors.error("this is an error"));
|
||||
|
||||
// outputs yellow text
|
||||
console.log(colors.warn("this is a warning"));
|
||||
|
||||
// outputs grey text
|
||||
console.log(colors.input("this is an input"));
|
||||
|
||||
// console.log(colors.zalgo("Don't summon him"))
|
||||
|
||||
|
||||
|
||||
176
www/node_modules/colors/lib/colors.js
generated
vendored
Normal file
176
www/node_modules/colors/lib/colors.js
generated
vendored
Normal file
@@ -0,0 +1,176 @@
|
||||
/*
|
||||
|
||||
The MIT License (MIT)
|
||||
|
||||
Original Library
|
||||
- Copyright (c) Marak Squires
|
||||
|
||||
Additional functionality
|
||||
- Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
|
||||
*/
|
||||
|
||||
var colors = {};
|
||||
module['exports'] = colors;
|
||||
|
||||
colors.themes = {};
|
||||
|
||||
var ansiStyles = colors.styles = require('./styles');
|
||||
var defineProps = Object.defineProperties;
|
||||
|
||||
colors.supportsColor = require('./system/supports-colors');
|
||||
|
||||
if (typeof colors.enabled === "undefined") {
|
||||
colors.enabled = colors.supportsColor;
|
||||
}
|
||||
|
||||
colors.stripColors = colors.strip = function(str){
|
||||
return ("" + str).replace(/\x1B\[\d+m/g, '');
|
||||
};
|
||||
|
||||
|
||||
var stylize = colors.stylize = function stylize (str, style) {
|
||||
return ansiStyles[style].open + str + ansiStyles[style].close;
|
||||
}
|
||||
|
||||
var matchOperatorsRe = /[|\\{}()[\]^$+*?.]/g;
|
||||
var escapeStringRegexp = function (str) {
|
||||
if (typeof str !== 'string') {
|
||||
throw new TypeError('Expected a string');
|
||||
}
|
||||
return str.replace(matchOperatorsRe, '\\$&');
|
||||
}
|
||||
|
||||
function build(_styles) {
|
||||
var builder = function builder() {
|
||||
return applyStyle.apply(builder, arguments);
|
||||
};
|
||||
builder._styles = _styles;
|
||||
// __proto__ is used because we must return a function, but there is
|
||||
// no way to create a function with a different prototype.
|
||||
builder.__proto__ = proto;
|
||||
return builder;
|
||||
}
|
||||
|
||||
var styles = (function () {
|
||||
var ret = {};
|
||||
ansiStyles.grey = ansiStyles.gray;
|
||||
Object.keys(ansiStyles).forEach(function (key) {
|
||||
ansiStyles[key].closeRe = new RegExp(escapeStringRegexp(ansiStyles[key].close), 'g');
|
||||
ret[key] = {
|
||||
get: function () {
|
||||
return build(this._styles.concat(key));
|
||||
}
|
||||
};
|
||||
});
|
||||
return ret;
|
||||
})();
|
||||
|
||||
var proto = defineProps(function colors() {}, styles);
|
||||
|
||||
function applyStyle() {
|
||||
var args = arguments;
|
||||
var argsLen = args.length;
|
||||
var str = argsLen !== 0 && String(arguments[0]);
|
||||
if (argsLen > 1) {
|
||||
for (var a = 1; a < argsLen; a++) {
|
||||
str += ' ' + args[a];
|
||||
}
|
||||
}
|
||||
|
||||
if (!colors.enabled || !str) {
|
||||
return str;
|
||||
}
|
||||
|
||||
var nestedStyles = this._styles;
|
||||
|
||||
var i = nestedStyles.length;
|
||||
while (i--) {
|
||||
var code = ansiStyles[nestedStyles[i]];
|
||||
str = code.open + str.replace(code.closeRe, code.open) + code.close;
|
||||
}
|
||||
|
||||
return str;
|
||||
}
|
||||
|
||||
function applyTheme (theme) {
|
||||
for (var style in theme) {
|
||||
(function(style){
|
||||
colors[style] = function(str){
|
||||
return colors[theme[style]](str);
|
||||
};
|
||||
})(style)
|
||||
}
|
||||
}
|
||||
|
||||
colors.setTheme = function (theme) {
|
||||
if (typeof theme === 'string') {
|
||||
try {
|
||||
colors.themes[theme] = require(theme);
|
||||
applyTheme(colors.themes[theme]);
|
||||
return colors.themes[theme];
|
||||
} catch (err) {
|
||||
console.log(err);
|
||||
return err;
|
||||
}
|
||||
} else {
|
||||
applyTheme(theme);
|
||||
}
|
||||
};
|
||||
|
||||
function init() {
|
||||
var ret = {};
|
||||
Object.keys(styles).forEach(function (name) {
|
||||
ret[name] = {
|
||||
get: function () {
|
||||
return build([name]);
|
||||
}
|
||||
};
|
||||
});
|
||||
return ret;
|
||||
}
|
||||
|
||||
var sequencer = function sequencer (map, str) {
|
||||
var exploded = str.split(""), i = 0;
|
||||
exploded = exploded.map(map);
|
||||
return exploded.join("");
|
||||
};
|
||||
|
||||
// custom formatter methods
|
||||
colors.trap = require('./custom/trap');
|
||||
colors.zalgo = require('./custom/zalgo');
|
||||
|
||||
// maps
|
||||
colors.maps = {};
|
||||
colors.maps.america = require('./maps/america');
|
||||
colors.maps.zebra = require('./maps/zebra');
|
||||
colors.maps.rainbow = require('./maps/rainbow');
|
||||
colors.maps.random = require('./maps/random')
|
||||
|
||||
for (var map in colors.maps) {
|
||||
(function(map){
|
||||
colors[map] = function (str) {
|
||||
return sequencer(colors.maps[map], str);
|
||||
}
|
||||
})(map)
|
||||
}
|
||||
|
||||
defineProps(colors, init());
|
||||
45
www/node_modules/colors/lib/custom/trap.js
generated
vendored
Normal file
45
www/node_modules/colors/lib/custom/trap.js
generated
vendored
Normal file
@@ -0,0 +1,45 @@
|
||||
module['exports'] = function runTheTrap (text, options) {
|
||||
var result = "";
|
||||
text = text || "Run the trap, drop the bass";
|
||||
text = text.split('');
|
||||
var trap = {
|
||||
a: ["\u0040", "\u0104", "\u023a", "\u0245", "\u0394", "\u039b", "\u0414"],
|
||||
b: ["\u00df", "\u0181", "\u0243", "\u026e", "\u03b2", "\u0e3f"],
|
||||
c: ["\u00a9", "\u023b", "\u03fe"],
|
||||
d: ["\u00d0", "\u018a", "\u0500" , "\u0501" ,"\u0502", "\u0503"],
|
||||
e: ["\u00cb", "\u0115", "\u018e", "\u0258", "\u03a3", "\u03be", "\u04bc", "\u0a6c"],
|
||||
f: ["\u04fa"],
|
||||
g: ["\u0262"],
|
||||
h: ["\u0126", "\u0195", "\u04a2", "\u04ba", "\u04c7", "\u050a"],
|
||||
i: ["\u0f0f"],
|
||||
j: ["\u0134"],
|
||||
k: ["\u0138", "\u04a0", "\u04c3", "\u051e"],
|
||||
l: ["\u0139"],
|
||||
m: ["\u028d", "\u04cd", "\u04ce", "\u0520", "\u0521", "\u0d69"],
|
||||
n: ["\u00d1", "\u014b", "\u019d", "\u0376", "\u03a0", "\u048a"],
|
||||
o: ["\u00d8", "\u00f5", "\u00f8", "\u01fe", "\u0298", "\u047a", "\u05dd", "\u06dd", "\u0e4f"],
|
||||
p: ["\u01f7", "\u048e"],
|
||||
q: ["\u09cd"],
|
||||
r: ["\u00ae", "\u01a6", "\u0210", "\u024c", "\u0280", "\u042f"],
|
||||
s: ["\u00a7", "\u03de", "\u03df", "\u03e8"],
|
||||
t: ["\u0141", "\u0166", "\u0373"],
|
||||
u: ["\u01b1", "\u054d"],
|
||||
v: ["\u05d8"],
|
||||
w: ["\u0428", "\u0460", "\u047c", "\u0d70"],
|
||||
x: ["\u04b2", "\u04fe", "\u04fc", "\u04fd"],
|
||||
y: ["\u00a5", "\u04b0", "\u04cb"],
|
||||
z: ["\u01b5", "\u0240"]
|
||||
}
|
||||
text.forEach(function(c){
|
||||
c = c.toLowerCase();
|
||||
var chars = trap[c] || [" "];
|
||||
var rand = Math.floor(Math.random() * chars.length);
|
||||
if (typeof trap[c] !== "undefined") {
|
||||
result += trap[c][rand];
|
||||
} else {
|
||||
result += c;
|
||||
}
|
||||
});
|
||||
return result;
|
||||
|
||||
}
|
||||
104
www/node_modules/colors/lib/custom/zalgo.js
generated
vendored
Normal file
104
www/node_modules/colors/lib/custom/zalgo.js
generated
vendored
Normal file
@@ -0,0 +1,104 @@
|
||||
// please no
|
||||
module['exports'] = function zalgo(text, options) {
|
||||
text = text || " he is here ";
|
||||
var soul = {
|
||||
"up" : [
|
||||
'̍', '̎', '̄', '̅',
|
||||
'̿', '̑', '̆', '̐',
|
||||
'͒', '͗', '͑', '̇',
|
||||
'̈', '̊', '͂', '̓',
|
||||
'̈', '͊', '͋', '͌',
|
||||
'̃', '̂', '̌', '͐',
|
||||
'̀', '́', '̋', '̏',
|
||||
'̒', '̓', '̔', '̽',
|
||||
'̉', 'ͣ', 'ͤ', 'ͥ',
|
||||
'ͦ', 'ͧ', 'ͨ', 'ͩ',
|
||||
'ͪ', 'ͫ', 'ͬ', 'ͭ',
|
||||
'ͮ', 'ͯ', '̾', '͛',
|
||||
'͆', '̚'
|
||||
],
|
||||
"down" : [
|
||||
'̖', '̗', '̘', '̙',
|
||||
'̜', '̝', '̞', '̟',
|
||||
'̠', '̤', '̥', '̦',
|
||||
'̩', '̪', '̫', '̬',
|
||||
'̭', '̮', '̯', '̰',
|
||||
'̱', '̲', '̳', '̹',
|
||||
'̺', '̻', '̼', 'ͅ',
|
||||
'͇', '͈', '͉', '͍',
|
||||
'͎', '͓', '͔', '͕',
|
||||
'͖', '͙', '͚', '̣'
|
||||
],
|
||||
"mid" : [
|
||||
'̕', '̛', '̀', '́',
|
||||
'͘', '̡', '̢', '̧',
|
||||
'̨', '̴', '̵', '̶',
|
||||
'͜', '͝', '͞',
|
||||
'͟', '͠', '͢', '̸',
|
||||
'̷', '͡', ' ҉'
|
||||
]
|
||||
},
|
||||
all = [].concat(soul.up, soul.down, soul.mid),
|
||||
zalgo = {};
|
||||
|
||||
function randomNumber(range) {
|
||||
var r = Math.floor(Math.random() * range);
|
||||
return r;
|
||||
}
|
||||
|
||||
function is_char(character) {
|
||||
var bool = false;
|
||||
all.filter(function (i) {
|
||||
bool = (i === character);
|
||||
});
|
||||
return bool;
|
||||
}
|
||||
|
||||
|
||||
function heComes(text, options) {
|
||||
var result = '', counts, l;
|
||||
options = options || {};
|
||||
options["up"] = options["up"] || true;
|
||||
options["mid"] = options["mid"] || true;
|
||||
options["down"] = options["down"] || true;
|
||||
options["size"] = options["size"] || "maxi";
|
||||
text = text.split('');
|
||||
for (l in text) {
|
||||
if (is_char(l)) {
|
||||
continue;
|
||||
}
|
||||
result = result + text[l];
|
||||
counts = {"up" : 0, "down" : 0, "mid" : 0};
|
||||
switch (options.size) {
|
||||
case 'mini':
|
||||
counts.up = randomNumber(8);
|
||||
counts.min = randomNumber(2);
|
||||
counts.down = randomNumber(8);
|
||||
break;
|
||||
case 'maxi':
|
||||
counts.up = randomNumber(16) + 3;
|
||||
counts.min = randomNumber(4) + 1;
|
||||
counts.down = randomNumber(64) + 3;
|
||||
break;
|
||||
default:
|
||||
counts.up = randomNumber(8) + 1;
|
||||
counts.mid = randomNumber(6) / 2;
|
||||
counts.down = randomNumber(8) + 1;
|
||||
break;
|
||||
}
|
||||
|
||||
var arr = ["up", "mid", "down"];
|
||||
for (var d in arr) {
|
||||
var index = arr[d];
|
||||
for (var i = 0 ; i <= counts[index]; i++) {
|
||||
if (options[index]) {
|
||||
result = result + soul[index][randomNumber(soul[index].length)];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
// don't summon him
|
||||
return heComes(text);
|
||||
}
|
||||
118
www/node_modules/colors/lib/extendStringPrototype.js
generated
vendored
Normal file
118
www/node_modules/colors/lib/extendStringPrototype.js
generated
vendored
Normal file
@@ -0,0 +1,118 @@
|
||||
var colors = require('./colors'),
|
||||
styles = require('./styles');
|
||||
|
||||
module['exports'] = function () {
|
||||
|
||||
//
|
||||
// Extends prototype of native string object to allow for "foo".red syntax
|
||||
//
|
||||
var addProperty = function (color, func) {
|
||||
String.prototype.__defineGetter__(color, func);
|
||||
};
|
||||
|
||||
var sequencer = function sequencer (map, str) {
|
||||
return function () {
|
||||
var exploded = this.split(""), i = 0;
|
||||
exploded = exploded.map(map);
|
||||
return exploded.join("");
|
||||
}
|
||||
};
|
||||
|
||||
var stylize = function stylize (str, style) {
|
||||
return styles[style].open + str + styles[style].close;
|
||||
}
|
||||
|
||||
addProperty('strip', function () {
|
||||
return colors.strip(this);
|
||||
});
|
||||
|
||||
addProperty('stripColors', function () {
|
||||
return colors.strip(this);
|
||||
});
|
||||
|
||||
addProperty("trap", function(){
|
||||
return colors.trap(this);
|
||||
});
|
||||
|
||||
addProperty("zalgo", function(){
|
||||
return colors.zalgo(this);
|
||||
});
|
||||
|
||||
addProperty("zebra", function(){
|
||||
return colors.zebra(this);
|
||||
});
|
||||
|
||||
addProperty("rainbow", function(){
|
||||
return colors.rainbow(this);
|
||||
});
|
||||
|
||||
addProperty("random", function(){
|
||||
return colors.random(this);
|
||||
});
|
||||
|
||||
addProperty("america", function(){
|
||||
return colors.america(this);
|
||||
});
|
||||
|
||||
//
|
||||
// Iterate through all default styles and colors
|
||||
//
|
||||
var x = Object.keys(colors.styles);
|
||||
x.forEach(function (style) {
|
||||
addProperty(style, function () {
|
||||
return stylize(this, style);
|
||||
});
|
||||
});
|
||||
|
||||
function applyTheme(theme) {
|
||||
//
|
||||
// Remark: This is a list of methods that exist
|
||||
// on String that you should not overwrite.
|
||||
//
|
||||
var stringPrototypeBlacklist = [
|
||||
'__defineGetter__', '__defineSetter__', '__lookupGetter__', '__lookupSetter__', 'charAt', 'constructor',
|
||||
'hasOwnProperty', 'isPrototypeOf', 'propertyIsEnumerable', 'toLocaleString', 'toString', 'valueOf', 'charCodeAt',
|
||||
'indexOf', 'lastIndexof', 'length', 'localeCompare', 'match', 'replace', 'search', 'slice', 'split', 'substring',
|
||||
'toLocaleLowerCase', 'toLocaleUpperCase', 'toLowerCase', 'toUpperCase', 'trim', 'trimLeft', 'trimRight'
|
||||
];
|
||||
|
||||
Object.keys(theme).forEach(function (prop) {
|
||||
if (stringPrototypeBlacklist.indexOf(prop) !== -1) {
|
||||
console.log('warn: '.red + ('String.prototype' + prop).magenta + ' is probably something you don\'t want to override. Ignoring style name');
|
||||
}
|
||||
else {
|
||||
if (typeof(theme[prop]) === 'string') {
|
||||
colors[prop] = colors[theme[prop]];
|
||||
addProperty(prop, function () {
|
||||
return colors[theme[prop]](this);
|
||||
});
|
||||
}
|
||||
else {
|
||||
addProperty(prop, function () {
|
||||
var ret = this;
|
||||
for (var t = 0; t < theme[prop].length; t++) {
|
||||
ret = exports[theme[prop][t]](ret);
|
||||
}
|
||||
return ret;
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
colors.setTheme = function (theme) {
|
||||
if (typeof theme === 'string') {
|
||||
try {
|
||||
colors.themes[theme] = require(theme);
|
||||
applyTheme(colors.themes[theme]);
|
||||
return colors.themes[theme];
|
||||
} catch (err) {
|
||||
console.log(err);
|
||||
return err;
|
||||
}
|
||||
} else {
|
||||
applyTheme(theme);
|
||||
}
|
||||
};
|
||||
|
||||
};
|
||||
12
www/node_modules/colors/lib/index.js
generated
vendored
Normal file
12
www/node_modules/colors/lib/index.js
generated
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
var colors = require('./colors');
|
||||
module['exports'] = colors;
|
||||
|
||||
// Remark: By default, colors will add style properties to String.prototype
|
||||
//
|
||||
// If you don't wish to extend String.prototype you can do this instead and native String will not be touched
|
||||
//
|
||||
// var colors = require('colors/safe);
|
||||
// colors.red("foo")
|
||||
//
|
||||
//
|
||||
var extendStringPrototype = require('./extendStringPrototype')();
|
||||
12
www/node_modules/colors/lib/maps/america.js
generated
vendored
Normal file
12
www/node_modules/colors/lib/maps/america.js
generated
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
var colors = require('../colors');
|
||||
|
||||
module['exports'] = (function() {
|
||||
return function (letter, i, exploded) {
|
||||
if(letter === " ") return letter;
|
||||
switch(i%3) {
|
||||
case 0: return colors.red(letter);
|
||||
case 1: return colors.white(letter)
|
||||
case 2: return colors.blue(letter)
|
||||
}
|
||||
}
|
||||
})();
|
||||
13
www/node_modules/colors/lib/maps/rainbow.js
generated
vendored
Normal file
13
www/node_modules/colors/lib/maps/rainbow.js
generated
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
var colors = require('../colors');
|
||||
|
||||
module['exports'] = (function () {
|
||||
var rainbowColors = ['red', 'yellow', 'green', 'blue', 'magenta']; //RoY G BiV
|
||||
return function (letter, i, exploded) {
|
||||
if (letter === " ") {
|
||||
return letter;
|
||||
} else {
|
||||
return colors[rainbowColors[i++ % rainbowColors.length]](letter);
|
||||
}
|
||||
};
|
||||
})();
|
||||
|
||||
8
www/node_modules/colors/lib/maps/random.js
generated
vendored
Normal file
8
www/node_modules/colors/lib/maps/random.js
generated
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
var colors = require('../colors');
|
||||
|
||||
module['exports'] = (function () {
|
||||
var available = ['underline', 'inverse', 'grey', 'yellow', 'red', 'green', 'blue', 'white', 'cyan', 'magenta'];
|
||||
return function(letter, i, exploded) {
|
||||
return letter === " " ? letter : colors[available[Math.round(Math.random() * (available.length - 1))]](letter);
|
||||
};
|
||||
})();
|
||||
5
www/node_modules/colors/lib/maps/zebra.js
generated
vendored
Normal file
5
www/node_modules/colors/lib/maps/zebra.js
generated
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
var colors = require('../colors');
|
||||
|
||||
module['exports'] = function (letter, i, exploded) {
|
||||
return i % 2 === 0 ? letter : colors.inverse(letter);
|
||||
};
|
||||
77
www/node_modules/colors/lib/styles.js
generated
vendored
Normal file
77
www/node_modules/colors/lib/styles.js
generated
vendored
Normal file
@@ -0,0 +1,77 @@
|
||||
/*
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
|
||||
*/
|
||||
|
||||
var styles = {};
|
||||
module['exports'] = styles;
|
||||
|
||||
var codes = {
|
||||
reset: [0, 0],
|
||||
|
||||
bold: [1, 22],
|
||||
dim: [2, 22],
|
||||
italic: [3, 23],
|
||||
underline: [4, 24],
|
||||
inverse: [7, 27],
|
||||
hidden: [8, 28],
|
||||
strikethrough: [9, 29],
|
||||
|
||||
black: [30, 39],
|
||||
red: [31, 39],
|
||||
green: [32, 39],
|
||||
yellow: [33, 39],
|
||||
blue: [34, 39],
|
||||
magenta: [35, 39],
|
||||
cyan: [36, 39],
|
||||
white: [37, 39],
|
||||
gray: [90, 39],
|
||||
grey: [90, 39],
|
||||
|
||||
bgBlack: [40, 49],
|
||||
bgRed: [41, 49],
|
||||
bgGreen: [42, 49],
|
||||
bgYellow: [43, 49],
|
||||
bgBlue: [44, 49],
|
||||
bgMagenta: [45, 49],
|
||||
bgCyan: [46, 49],
|
||||
bgWhite: [47, 49],
|
||||
|
||||
// legacy styles for colors pre v1.0.0
|
||||
blackBG: [40, 49],
|
||||
redBG: [41, 49],
|
||||
greenBG: [42, 49],
|
||||
yellowBG: [43, 49],
|
||||
blueBG: [44, 49],
|
||||
magentaBG: [45, 49],
|
||||
cyanBG: [46, 49],
|
||||
whiteBG: [47, 49]
|
||||
|
||||
};
|
||||
|
||||
Object.keys(codes).forEach(function (key) {
|
||||
var val = codes[key];
|
||||
var style = styles[key] = [];
|
||||
style.open = '\u001b[' + val[0] + 'm';
|
||||
style.close = '\u001b[' + val[1] + 'm';
|
||||
});
|
||||
61
www/node_modules/colors/lib/system/supports-colors.js
generated
vendored
Normal file
61
www/node_modules/colors/lib/system/supports-colors.js
generated
vendored
Normal file
@@ -0,0 +1,61 @@
|
||||
/*
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
|
||||
*/
|
||||
|
||||
var argv = process.argv;
|
||||
|
||||
module.exports = (function () {
|
||||
if (argv.indexOf('--no-color') !== -1 ||
|
||||
argv.indexOf('--color=false') !== -1) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (argv.indexOf('--color') !== -1 ||
|
||||
argv.indexOf('--color=true') !== -1 ||
|
||||
argv.indexOf('--color=always') !== -1) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (process.stdout && !process.stdout.isTTY) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (process.platform === 'win32') {
|
||||
return true;
|
||||
}
|
||||
|
||||
if ('COLORTERM' in process.env) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (process.env.TERM === 'dumb') {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (/^screen|^xterm|^vt100|color|ansi|cygwin|linux/i.test(process.env.TERM)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
})();
|
||||
87
www/node_modules/colors/package.json
generated
vendored
Normal file
87
www/node_modules/colors/package.json
generated
vendored
Normal file
@@ -0,0 +1,87 @@
|
||||
{
|
||||
"_args": [
|
||||
[
|
||||
{
|
||||
"raw": "colors@1.0.3",
|
||||
"scope": null,
|
||||
"escapedName": "colors",
|
||||
"name": "colors",
|
||||
"rawSpec": "1.0.3",
|
||||
"spec": "1.0.3",
|
||||
"type": "version"
|
||||
},
|
||||
"/home/nau/MEGA/CODI/githubRepos/colspace/www/node_modules/http-server"
|
||||
]
|
||||
],
|
||||
"_from": "colors@1.0.3",
|
||||
"_id": "colors@1.0.3",
|
||||
"_inCache": true,
|
||||
"_location": "/colors",
|
||||
"_nodeVersion": "0.11.13",
|
||||
"_npmUser": {
|
||||
"name": "marak",
|
||||
"email": "marak.squires@gmail.com"
|
||||
},
|
||||
"_npmVersion": "2.0.2",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"raw": "colors@1.0.3",
|
||||
"scope": null,
|
||||
"escapedName": "colors",
|
||||
"name": "colors",
|
||||
"rawSpec": "1.0.3",
|
||||
"spec": "1.0.3",
|
||||
"type": "version"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/http-server"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/colors/-/colors-1.0.3.tgz",
|
||||
"_shasum": "0433f44d809680fdeb60ed260f1b0c262e82a40b",
|
||||
"_shrinkwrap": null,
|
||||
"_spec": "colors@1.0.3",
|
||||
"_where": "/home/nau/MEGA/CODI/githubRepos/colspace/www/node_modules/http-server",
|
||||
"author": {
|
||||
"name": "Marak Squires"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/Marak/colors.js/issues"
|
||||
},
|
||||
"dependencies": {},
|
||||
"description": "get colors in your node.js console",
|
||||
"devDependencies": {},
|
||||
"directories": {},
|
||||
"dist": {
|
||||
"shasum": "0433f44d809680fdeb60ed260f1b0c262e82a40b",
|
||||
"tarball": "https://registry.npmjs.org/colors/-/colors-1.0.3.tgz"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.1.90"
|
||||
},
|
||||
"gitHead": "e9e6557cc0fa26dba1a20b0d45e92de982f4047c",
|
||||
"homepage": "https://github.com/Marak/colors.js",
|
||||
"keywords": [
|
||||
"ansi",
|
||||
"terminal",
|
||||
"colors"
|
||||
],
|
||||
"license": "MIT",
|
||||
"main": "./lib/index",
|
||||
"maintainers": [
|
||||
{
|
||||
"name": "marak",
|
||||
"email": "marak.squires@gmail.com"
|
||||
}
|
||||
],
|
||||
"name": "colors",
|
||||
"optionalDependencies": {},
|
||||
"readme": "ERROR: No README data found!",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+ssh://git@github.com/Marak/colors.js.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "node tests/basic-test.js && node tests/safe-test.js"
|
||||
},
|
||||
"version": "1.0.3"
|
||||
}
|
||||
9
www/node_modules/colors/safe.js
generated
vendored
Normal file
9
www/node_modules/colors/safe.js
generated
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
//
|
||||
// Remark: Requiring this file will use the "safe" colors API which will not touch String.prototype
|
||||
//
|
||||
// var colors = require('colors/safe);
|
||||
// colors.red("foo")
|
||||
//
|
||||
//
|
||||
var colors = require('./lib/colors');
|
||||
module['exports'] = colors;
|
||||
BIN
www/node_modules/colors/screenshots/colors.png
generated
vendored
Normal file
BIN
www/node_modules/colors/screenshots/colors.png
generated
vendored
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 78 KiB |
50
www/node_modules/colors/tests/basic-test.js
generated
vendored
Normal file
50
www/node_modules/colors/tests/basic-test.js
generated
vendored
Normal file
@@ -0,0 +1,50 @@
|
||||
var assert = require('assert'),
|
||||
colors = require('../lib/index');
|
||||
|
||||
var s = 'string';
|
||||
|
||||
function a(s, code) {
|
||||
return '\x1B[' + code.toString() + 'm' + s + '\x1B[39m';
|
||||
}
|
||||
|
||||
function aE(s, color, code) {
|
||||
assert.equal(s[color], a(s, code));
|
||||
assert.equal(colors[color](s), a(s, code));
|
||||
assert.equal(s[color], colors[color](s));
|
||||
assert.equal(s[color].strip, s);
|
||||
assert.equal(s[color].strip, colors.strip(s));
|
||||
}
|
||||
|
||||
function h(s, color) {
|
||||
return '<span style="color:' + color + ';">' + s + '</span>';
|
||||
}
|
||||
|
||||
var stylesColors = ['white', 'black', 'blue', 'cyan', 'green', 'magenta', 'red', 'yellow'];
|
||||
var stylesAll = stylesColors.concat(['bold', 'italic', 'underline', 'inverse', 'rainbow']);
|
||||
|
||||
colors.mode = 'console';
|
||||
assert.equal(s.bold, '\x1B[1m' + s + '\x1B[22m');
|
||||
assert.equal(s.italic, '\x1B[3m' + s + '\x1B[23m');
|
||||
assert.equal(s.underline, '\x1B[4m' + s + '\x1B[24m');
|
||||
assert.equal(s.strikethrough, '\x1B[9m' + s + '\x1B[29m');
|
||||
assert.equal(s.inverse, '\x1B[7m' + s + '\x1B[27m');
|
||||
|
||||
assert.ok(s.rainbow);
|
||||
|
||||
aE(s, 'white', 37);
|
||||
aE(s, 'grey', 90);
|
||||
aE(s, 'black', 30);
|
||||
aE(s, 'blue', 34);
|
||||
aE(s, 'cyan', 36);
|
||||
aE(s, 'green', 32);
|
||||
aE(s, 'magenta', 35);
|
||||
aE(s, 'red', 31);
|
||||
aE(s, 'yellow', 33);
|
||||
|
||||
assert.equal(s, 'string');
|
||||
|
||||
colors.setTheme({error:'red'});
|
||||
|
||||
assert.equal(typeof("astring".red),'string');
|
||||
assert.equal(typeof("astring".error),'string');
|
||||
|
||||
45
www/node_modules/colors/tests/safe-test.js
generated
vendored
Normal file
45
www/node_modules/colors/tests/safe-test.js
generated
vendored
Normal file
@@ -0,0 +1,45 @@
|
||||
var assert = require('assert'),
|
||||
colors = require('../safe');
|
||||
|
||||
var s = 'string';
|
||||
|
||||
function a(s, code) {
|
||||
return '\x1B[' + code.toString() + 'm' + s + '\x1B[39m';
|
||||
}
|
||||
|
||||
function aE(s, color, code) {
|
||||
assert.equal(colors[color](s), a(s, code));
|
||||
assert.equal(colors.strip(s), s);
|
||||
}
|
||||
|
||||
function h(s, color) {
|
||||
return '<span style="color:' + color + ';">' + s + '</span>';
|
||||
}
|
||||
|
||||
var stylesColors = ['white', 'black', 'blue', 'cyan', 'green', 'magenta', 'red', 'yellow'];
|
||||
var stylesAll = stylesColors.concat(['bold', 'italic', 'underline', 'inverse', 'rainbow']);
|
||||
|
||||
colors.mode = 'console';
|
||||
assert.equal(colors.bold(s), '\x1B[1m' + s + '\x1B[22m');
|
||||
assert.equal(colors.italic(s), '\x1B[3m' + s + '\x1B[23m');
|
||||
assert.equal(colors.underline(s), '\x1B[4m' + s + '\x1B[24m');
|
||||
assert.equal(colors.strikethrough(s), '\x1B[9m' + s + '\x1B[29m');
|
||||
assert.equal(colors.inverse(s), '\x1B[7m' + s + '\x1B[27m');
|
||||
|
||||
assert.ok(colors.rainbow);
|
||||
|
||||
aE(s, 'white', 37);
|
||||
aE(s, 'grey', 90);
|
||||
aE(s, 'black', 30);
|
||||
aE(s, 'blue', 34);
|
||||
aE(s, 'cyan', 36);
|
||||
aE(s, 'green', 32);
|
||||
aE(s, 'magenta', 35);
|
||||
aE(s, 'red', 31);
|
||||
aE(s, 'yellow', 33);
|
||||
|
||||
assert.equal(s, 'string');
|
||||
colors.setTheme({error:'red'});
|
||||
|
||||
assert.equal(typeof(colors.red("astring")), 'string');
|
||||
assert.equal(typeof(colors.error("astring")), 'string');
|
||||
12
www/node_modules/colors/themes/generic-logging.js
generated
vendored
Normal file
12
www/node_modules/colors/themes/generic-logging.js
generated
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
module['exports'] = {
|
||||
silly: 'rainbow',
|
||||
input: 'grey',
|
||||
verbose: 'cyan',
|
||||
prompt: 'grey',
|
||||
info: 'green',
|
||||
data: 'grey',
|
||||
help: 'cyan',
|
||||
warn: 'yellow',
|
||||
debug: 'blue',
|
||||
error: 'red'
|
||||
};
|
||||
2
www/node_modules/corser/.npmignore
generated
vendored
Normal file
2
www/node_modules/corser/.npmignore
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
example/
|
||||
test/
|
||||
4
www/node_modules/corser/.travis.yml
generated
vendored
Normal file
4
www/node_modules/corser/.travis.yml
generated
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
language: node_js
|
||||
node_js:
|
||||
- "node"
|
||||
sudo: false
|
||||
19
www/node_modules/corser/LICENSE
generated
vendored
Normal file
19
www/node_modules/corser/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
Copyright (C) 2012 Alexander Grüneberg
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
this software and associated documentation files (the "Software"), to deal in
|
||||
the Software without restriction, including without limitation the rights to
|
||||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
||||
of the Software, and to permit persons to whom the Software is furnished to do
|
||||
so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
202
www/node_modules/corser/README.md
generated
vendored
Normal file
202
www/node_modules/corser/README.md
generated
vendored
Normal file
@@ -0,0 +1,202 @@
|
||||
Corser
|
||||
=======
|
||||
|
||||
[](http://www.repostatus.org/#active)
|
||||
[](http://travis-ci.org/agrueneberg/Corser)
|
||||
|
||||
A highly configurable, middleware compatible implementation of [CORS](http://www.w3.org/TR/cors/) for [Node.js](http://nodejs.org/).
|
||||
|
||||
|
||||
Changelog
|
||||
---------
|
||||
|
||||
### 2.0.1 (August 16, 2016)
|
||||
|
||||
* Add workaround for [Chrome 52 sending empty `Access-Control-Request-Headers` header](https://bugs.chromium.org/p/chromium/issues/detail?id=633729).
|
||||
|
||||
### 2.0.0 (March 22, 2014)
|
||||
|
||||
* Preflight requests are automatically closed. If there is a need for handling `OPTIONS` requests, check the `endPreflightRequests` option.
|
||||
* The parameters of the callback function in dynamic origin checking are now `(err, matches)` instead of just `(matches)`.
|
||||
|
||||
|
||||
Examples
|
||||
--------
|
||||
|
||||
### How to use Corser as a middleware in Express
|
||||
|
||||
See `example/express/` for a working example.
|
||||
|
||||
var express, corser, app;
|
||||
|
||||
express = require("express");
|
||||
corser = require("corser");
|
||||
|
||||
app = express();
|
||||
|
||||
app.use(corser.create());
|
||||
|
||||
app.get("/", function (req, res) {
|
||||
res.writeHead(200);
|
||||
res.end("Nice weather today, huh?");
|
||||
});
|
||||
|
||||
app.listen(1337);
|
||||
|
||||
### How to use Corser as a middleware in Connect
|
||||
|
||||
See `example/connect/` for a working example.
|
||||
|
||||
var connect, corser, app;
|
||||
|
||||
connect = require("connect");
|
||||
corser = require("corser");
|
||||
|
||||
app = connect();
|
||||
|
||||
app.use(corser.create());
|
||||
|
||||
app.use(function (req, res) {
|
||||
res.writeHead(200);
|
||||
res.end("Nice weather today, huh?");
|
||||
});
|
||||
|
||||
app.listen(1337);
|
||||
|
||||
### How to use Corser with plain `http`
|
||||
|
||||
var http, corser, corserRequestListener;
|
||||
|
||||
http = require("http");
|
||||
corser = require("corser");
|
||||
|
||||
// Create Corser request listener.
|
||||
corserRequestListener = corser.create();
|
||||
|
||||
http.createServer(function (req, res) {
|
||||
// Route req and res through the request listener.
|
||||
corserRequestListener(req, res, function () {
|
||||
res.writeHead(200);
|
||||
res.end("Nice weather today, huh?");
|
||||
});
|
||||
}).listen(1337);
|
||||
|
||||
|
||||
API
|
||||
---
|
||||
|
||||
### Creating a Corser request listener
|
||||
|
||||
Creating a Corser request listener that generates the appropriate response headers to enable CORS is as simple as:
|
||||
|
||||
corser.create()
|
||||
|
||||
This is the equivalent of setting a response header of `Access-Control-Allow-Origin: *`. If you want to restrict the origins, or allow more sophisticated request or response headers, you have to pass a configuration object to `corser.create`.
|
||||
|
||||
Corser will automatically end preflight requests for you. A preflight request is a special `OPTIONS` request that the browser sends under certain conditions to negotiate with the server what methods, request headers and response headers are allowed for a CORS request. If you need to use the `OPTIONS` method for other stuff, just set `endPreflightRequests` to `false` and terminate those requests yourself:
|
||||
|
||||
var corserRequestListener;
|
||||
|
||||
corserRequestListener = corser.create({
|
||||
endPreflightRequests: false
|
||||
});
|
||||
|
||||
corserRequestListener(req, res, function () {
|
||||
if (req.method === "OPTIONS") {
|
||||
// End CORS preflight request.
|
||||
res.writeHead(204);
|
||||
res.end();
|
||||
} else {
|
||||
// Implement other HTTP methods.
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
#### Configuration Object
|
||||
|
||||
A configuration object with the following properties can be passed to `corser.create`.
|
||||
|
||||
##### `origins`
|
||||
|
||||
A case-sensitive whitelist of origins. Unless unbound, if the request comes from an origin that is not in this list, it will not be handled by CORS.
|
||||
|
||||
To allow for dynamic origin checking, a function `(origin, callback)` can be passed instead of an array. `origin` is the Origin header, `callback` is a function `(err, matches)`, where `matches` is a boolean flag that indicates whether the given Origin header matches or not.
|
||||
|
||||
Default: unbound, i.e. every origin is accepted.
|
||||
|
||||
##### `methods`
|
||||
|
||||
An uppercase whitelist of methods. If the request uses a method that is not in this list, it will not be handled by CORS.
|
||||
|
||||
Setting a value here will overwrite the list of default simple methods. To not lose them, concat the methods you want to add with `corser.simpleMethods`: `corser.simpleMethods.concat(["PUT", "DELETE"])`.
|
||||
|
||||
Default: simple methods (`GET`, `HEAD`, `POST`).
|
||||
|
||||
##### `requestHeaders`
|
||||
|
||||
A case-insensitive whitelist of request headers. If the request uses a request header that is not in this list, it will not be handled by CORS.
|
||||
|
||||
Setting a value here will overwrite the list of default simple request headers. To not lose them, concat the request headers you want to add with `corser.simpleRequestHeaders`: `corser.simpleRequestHeaders.concat(["Authorization"])`.
|
||||
|
||||
Default: simple request headers (`Accept`, `Accept-Language`, `Content-Language`, `Content-Type`, `Last-Event-ID`).
|
||||
|
||||
##### `responseHeaders`
|
||||
|
||||
A case-insensitive whitelist of response headers. Any response header that is not in this list will be filtered out by the user-agent (the browser).
|
||||
|
||||
Setting a value here will overwrite the list of default simple response headers. To not lose them, concat the response headers you want to add with `corser.simpleResponseHeaders`: `corser.simpleResponseHeaders.concat(["ETag"])`.
|
||||
|
||||
Default: simple response headers (`Cache-Control`, `Content-Language`, `Content-Type`, `Expires`, `Last-Modified`, `Pragma`).
|
||||
|
||||
##### `supportsCredentials`
|
||||
|
||||
A boolean that indicates if cookie credentials can be transferred as part of a CORS request. Currently, only a few HTML5 elements can benefit from this setting.
|
||||
|
||||
Default: `false`.
|
||||
|
||||
##### `maxAge`
|
||||
|
||||
An integer that indicates the maximum amount of time in seconds that a preflight request is kept in the client-side preflight result cache.
|
||||
|
||||
Default: not set.
|
||||
|
||||
##### `endPreflightRequests`
|
||||
|
||||
A boolean that indicates if CORS preflight requests should be automatically closed.
|
||||
|
||||
Default: `true`.
|
||||
|
||||
|
||||
FAQ
|
||||
---
|
||||
|
||||
### Ajax call returns `Origin X is not allowed by Access-Control-Allow-Origin`
|
||||
|
||||
Check if the `Origin` header of your request matches one of the origins provided in the `origins` property of the configuration object. If you didn't set any `origins` property, jump to the next question.
|
||||
|
||||
|
||||
### Ajax call still returns `Origin X is not allowed by Access-Control-Allow-Origin`
|
||||
|
||||
Your request might use a non-simple method or one or more non-simple headers. According to the specification, the set of simple methods is `GET`, `HEAD`, and `POST`, and the set of simple request headers is `Accept`, `Accept-Language`, `Content-Language`, `Content-Type`, and `Last-Event-ID`. If your request uses **any** other method or header, you have to explicitly list them in the `methods` or `requestHeaders` property of the configuration object.
|
||||
|
||||
|
||||
#### Example
|
||||
|
||||
You want to allow requests that use an `X-Requested-With` header. Pass the following configuration object to `corser.create`:
|
||||
|
||||
corser.create({
|
||||
requestHeaders: corser.simpleRequestHeaders.concat(["X-Requested-With"])
|
||||
});
|
||||
|
||||
|
||||
### Getting a response header returns `Refused to get unsafe header "X"`
|
||||
|
||||
Your browser blocks every non-simple response headers that was not explicitly allowed in the preflight request. The set of simple response headers is `Cache-Control`, `Content-Language`, `Content-Type`, `Expires`, `Last-Modified`, `Pragma`. If you want to access **any** other response header, you have to explicitly list them in the `responseHeaders` property of the configuration object.
|
||||
|
||||
#### Example
|
||||
|
||||
You want to allow clients to read the `ETag` header of a response. Pass the following configuration object to `corser.create`:
|
||||
|
||||
corser.create({
|
||||
responseHeaders: corser.simpleResponseHeaders.concat(["ETag"])
|
||||
});
|
||||
228
www/node_modules/corser/lib/corser.js
generated
vendored
Normal file
228
www/node_modules/corser/lib/corser.js
generated
vendored
Normal file
@@ -0,0 +1,228 @@
|
||||
/**
|
||||
* Specification: http://www.w3.org/TR/2012/WD-cors-20120403/
|
||||
* W3C Working Draft 3 April 2012
|
||||
*/
|
||||
"use strict";
|
||||
|
||||
/*jshint node:true */
|
||||
|
||||
var simpleMethods, simpleRequestHeaders, simpleResponseHeaders, toLowerCase, checkOriginMatch;
|
||||
|
||||
// A method is said to be a simple method if it is a case-sensitive match for one of the following:
|
||||
Object.defineProperty(exports, "simpleMethods", {
|
||||
get: function () {
|
||||
return [
|
||||
"GET",
|
||||
"HEAD",
|
||||
"POST"
|
||||
];
|
||||
}
|
||||
});
|
||||
simpleMethods = exports.simpleMethods;
|
||||
|
||||
// A header is said to be a simple header if the header field name is an ASCII case-insensitive match for one of
|
||||
// the following:
|
||||
Object.defineProperty(exports, "simpleRequestHeaders", {
|
||||
get: function () {
|
||||
return [
|
||||
"accept",
|
||||
"accept-language",
|
||||
"content-language",
|
||||
"content-type"
|
||||
];
|
||||
}
|
||||
});
|
||||
simpleRequestHeaders = exports.simpleRequestHeaders;
|
||||
|
||||
// A header is said to be a simple response header if the header field name is an ASCII case-insensitive
|
||||
// match for one of the following:
|
||||
Object.defineProperty(exports, "simpleResponseHeaders", {
|
||||
get: function () {
|
||||
return [
|
||||
"cache-control",
|
||||
"content-language",
|
||||
"content-type",
|
||||
"expires",
|
||||
"last-modified",
|
||||
"pragma"
|
||||
];
|
||||
}
|
||||
});
|
||||
simpleResponseHeaders = exports.simpleResponseHeaders;
|
||||
|
||||
toLowerCase = function (array) {
|
||||
return array.map(function (el) {
|
||||
return el.toLowerCase();
|
||||
});
|
||||
};
|
||||
|
||||
checkOriginMatch = function (originHeader, origins, callback) {
|
||||
if (typeof origins === "function") {
|
||||
origins(originHeader, function (err, allow) {
|
||||
callback(err, allow);
|
||||
});
|
||||
} else if (origins.length > 0) {
|
||||
callback(null, origins.some(function (origin) {
|
||||
return origin === originHeader;
|
||||
}));
|
||||
} else {
|
||||
// Always matching is acceptable since the list of origins can be unbounded.
|
||||
callback(null, true);
|
||||
}
|
||||
};
|
||||
|
||||
exports.create = function (options) {
|
||||
options = options || {};
|
||||
options.origins = options.origins || [];
|
||||
options.methods = options.methods || simpleMethods;
|
||||
if (options.hasOwnProperty("requestHeaders") === true) {
|
||||
options.requestHeaders = toLowerCase(options.requestHeaders);
|
||||
} else {
|
||||
options.requestHeaders = simpleRequestHeaders;
|
||||
}
|
||||
if (options.hasOwnProperty("responseHeaders") === true) {
|
||||
options.responseHeaders = toLowerCase(options.responseHeaders);
|
||||
} else {
|
||||
options.responseHeaders = simpleResponseHeaders;
|
||||
}
|
||||
options.maxAge = options.maxAge || null;
|
||||
options.supportsCredentials = options.supportsCredentials || false;
|
||||
if (options.hasOwnProperty("endPreflightRequests") === false) {
|
||||
options.endPreflightRequests = true;
|
||||
}
|
||||
return function (req, res, next) {
|
||||
var methodMatches, headersMatch, requestMethod, requestHeaders, exposedHeaders, endPreflight;
|
||||
// If the Origin header is not present terminate this set of steps.
|
||||
if (!req.headers.hasOwnProperty("origin")) {
|
||||
// The request is outside the scope of the CORS specification. If there is no Origin header,
|
||||
// it could be a same-origin request. Let's let the user-agent handle this situation.
|
||||
next();
|
||||
} else {
|
||||
// If the value of the Origin header is not a case-sensitive match for any of the values in
|
||||
// list of origins, do not set any additional headers and terminate this set of steps.
|
||||
checkOriginMatch(req.headers.origin, options.origins, function (err, originMatches) {
|
||||
if (err !== null) {
|
||||
next(err);
|
||||
} else {
|
||||
if (typeof originMatches !== "boolean" || originMatches === false) {
|
||||
next();
|
||||
} else {
|
||||
// Respond to preflight request.
|
||||
if (req.method === "OPTIONS") {
|
||||
endPreflight = function () {
|
||||
if (options.endPreflightRequests === true) {
|
||||
res.writeHead(204);
|
||||
res.end();
|
||||
} else {
|
||||
next();
|
||||
}
|
||||
};
|
||||
// If there is no Access-Control-Request-Method header or if parsing failed, do not set
|
||||
// any additional headers and terminate this set of steps.
|
||||
if (!req.headers.hasOwnProperty("access-control-request-method")) {
|
||||
endPreflight();
|
||||
} else {
|
||||
requestMethod = req.headers["access-control-request-method"];
|
||||
// If there are no Access-Control-Request-Headers headers let header field-names be the
|
||||
// empty list. If parsing failed do not set any additional headers and terminate this set
|
||||
// of steps.
|
||||
// Checking for an empty header is a workaround for a bug Chrome 52:
|
||||
// https://bugs.chromium.org/p/chromium/issues/detail?id=633729
|
||||
if (req.headers.hasOwnProperty("access-control-request-headers") && req.headers["access-control-request-headers"] !== "") {
|
||||
requestHeaders = toLowerCase(req.headers["access-control-request-headers"].split(/,\s*/));
|
||||
} else {
|
||||
requestHeaders = [];
|
||||
}
|
||||
// If method is not a case-sensitive match for any of the values in list of methods do not
|
||||
// set any additional headers and terminate this set of steps.
|
||||
methodMatches = options.methods.indexOf(requestMethod) !== -1;
|
||||
if (methodMatches === false) {
|
||||
endPreflight();
|
||||
} else {
|
||||
// If any of the header field-names is not a ASCII case-insensitive match for any of
|
||||
// the values in list of headers do not set any additional headers and terminate this
|
||||
// set of steps.
|
||||
headersMatch = requestHeaders.every(function (requestHeader) {
|
||||
// Browsers automatically add Origin to Access-Control-Request-Headers. However,
|
||||
// Origin is not one of the simple request headers. Therefore, the header is
|
||||
// accepted even if it is not in the list of request headers because CORS would
|
||||
// not work without it.
|
||||
if (requestHeader === "origin") {
|
||||
return true;
|
||||
} else {
|
||||
if (options.requestHeaders.indexOf(requestHeader) !== -1) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
});
|
||||
if (headersMatch === false) {
|
||||
endPreflight();
|
||||
} else {
|
||||
if (options.supportsCredentials === true) {
|
||||
// If the resource supports credentials add a single Access-Control-Allow-Origin
|
||||
// header, with the value of the Origin header as value, and add a single
|
||||
// Access-Control-Allow-Credentials header with the literal string "true"
|
||||
// as value.
|
||||
res.setHeader("Access-Control-Allow-Origin", req.headers.origin);
|
||||
res.setHeader("Access-Control-Allow-Credentials", "true");
|
||||
} else {
|
||||
// Otherwise, add a single Access-Control-Allow-Origin header, with either the
|
||||
// value of the Origin header or the string "*" as value.
|
||||
if (options.origins.length > 0 || typeof options.origins === "function") {
|
||||
res.setHeader("Access-Control-Allow-Origin", req.headers.origin);
|
||||
} else {
|
||||
res.setHeader("Access-Control-Allow-Origin", "*");
|
||||
}
|
||||
}
|
||||
// Optionally add a single Access-Control-Max-Age header with as value the amount
|
||||
// of seconds the user agent is allowed to cache the result of the request.
|
||||
if (options.maxAge !== null) {
|
||||
res.setHeader("Access-Control-Max-Age", options.maxAge);
|
||||
}
|
||||
// Add one or more Access-Control-Allow-Methods headers consisting of (a subset
|
||||
// of) the list of methods.
|
||||
res.setHeader("Access-Control-Allow-Methods", options.methods.join(","));
|
||||
// Add one or more Access-Control-Allow-Headers headers consisting of (a subset
|
||||
// of) the list of headers.
|
||||
res.setHeader("Access-Control-Allow-Headers", options.requestHeaders.join(","));
|
||||
// And out.
|
||||
endPreflight();
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (options.supportsCredentials === true) {
|
||||
// If the resource supports credentials add a single Access-Control-Allow-Origin header,
|
||||
// with the value of the Origin header as value, and add a single
|
||||
// Access-Control-Allow-Credentials header with the literal string "true" as value.
|
||||
res.setHeader("Access-Control-Allow-Origin", req.headers.origin);
|
||||
res.setHeader("Access-Control-Allow-Credentials", "true");
|
||||
} else {
|
||||
// Otherwise, add a single Access-Control-Allow-Origin header, with either the value of
|
||||
// the Origin header or the literal string "*" as value.
|
||||
// If the list of origins is empty, use "*" as value.
|
||||
if (options.origins.length > 0 || typeof options.origins === "function") {
|
||||
res.setHeader("Access-Control-Allow-Origin", req.headers.origin);
|
||||
} else {
|
||||
res.setHeader("Access-Control-Allow-Origin", "*");
|
||||
}
|
||||
}
|
||||
// If the list of exposed headers is not empty add one or more Access-Control-Expose-Headers
|
||||
// headers, with as values the header field names given in the list of exposed headers.
|
||||
exposedHeaders = options.responseHeaders.filter(function (optionsResponseHeader) {
|
||||
return simpleResponseHeaders.indexOf(optionsResponseHeader) === -1;
|
||||
});
|
||||
if (exposedHeaders.length > 0) {
|
||||
res.setHeader("Access-Control-Expose-Headers", exposedHeaders.join(","));
|
||||
}
|
||||
// And out.
|
||||
next();
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
};
|
||||
97
www/node_modules/corser/package.json
generated
vendored
Normal file
97
www/node_modules/corser/package.json
generated
vendored
Normal file
@@ -0,0 +1,97 @@
|
||||
{
|
||||
"_args": [
|
||||
[
|
||||
{
|
||||
"raw": "corser@~2.0.0",
|
||||
"scope": null,
|
||||
"escapedName": "corser",
|
||||
"name": "corser",
|
||||
"rawSpec": "~2.0.0",
|
||||
"spec": ">=2.0.0 <2.1.0",
|
||||
"type": "range"
|
||||
},
|
||||
"/home/nau/MEGA/CODI/githubRepos/colspace/www/node_modules/http-server"
|
||||
]
|
||||
],
|
||||
"_from": "corser@>=2.0.0 <2.1.0",
|
||||
"_id": "corser@2.0.1",
|
||||
"_inCache": true,
|
||||
"_location": "/corser",
|
||||
"_nodeVersion": "6.3.1",
|
||||
"_npmOperationalInternal": {
|
||||
"host": "packages-16-east.internal.npmjs.com",
|
||||
"tmp": "tmp/corser-2.0.1.tgz_1471373999376_0.5666255787946284"
|
||||
},
|
||||
"_npmUser": {
|
||||
"name": "agrueneberg",
|
||||
"email": "alexander.grueneberg@googlemail.com"
|
||||
},
|
||||
"_npmVersion": "3.10.6",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"raw": "corser@~2.0.0",
|
||||
"scope": null,
|
||||
"escapedName": "corser",
|
||||
"name": "corser",
|
||||
"rawSpec": "~2.0.0",
|
||||
"spec": ">=2.0.0 <2.1.0",
|
||||
"type": "range"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/http-server"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/corser/-/corser-2.0.1.tgz",
|
||||
"_shasum": "8eda252ecaab5840dcd975ceb90d9370c819ff87",
|
||||
"_shrinkwrap": null,
|
||||
"_spec": "corser@~2.0.0",
|
||||
"_where": "/home/nau/MEGA/CODI/githubRepos/colspace/www/node_modules/http-server",
|
||||
"author": {
|
||||
"name": "Alexander Grüneberg",
|
||||
"email": "alexander.grueneberg@googlemail.com"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/agrueneberg/Corser/issues"
|
||||
},
|
||||
"dependencies": {},
|
||||
"description": "A highly configurable, middleware compatible implementation of CORS.",
|
||||
"devDependencies": {
|
||||
"expect.js": "0.1.x",
|
||||
"mocha": "1.3.x"
|
||||
},
|
||||
"directories": {},
|
||||
"dist": {
|
||||
"shasum": "8eda252ecaab5840dcd975ceb90d9370c819ff87",
|
||||
"tarball": "https://registry.npmjs.org/corser/-/corser-2.0.1.tgz"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.4.0"
|
||||
},
|
||||
"gitHead": "ba612c30145eb0245957a135cdb26bf2f2734164",
|
||||
"homepage": "https://github.com/agrueneberg/Corser#readme",
|
||||
"keywords": [
|
||||
"cors",
|
||||
"cross-origin resource sharing",
|
||||
"connect",
|
||||
"express",
|
||||
"middleware"
|
||||
],
|
||||
"license": "MIT",
|
||||
"main": "./lib/corser.js",
|
||||
"maintainers": [
|
||||
{
|
||||
"name": "agrueneberg",
|
||||
"email": "alexander.grueneberg@googlemail.com"
|
||||
}
|
||||
],
|
||||
"name": "corser",
|
||||
"optionalDependencies": {},
|
||||
"readme": "ERROR: No README data found!",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/agrueneberg/Corser.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "mocha"
|
||||
},
|
||||
"version": "2.0.1"
|
||||
}
|
||||
19
www/node_modules/ecstatic/.npmignore
generated
vendored
Normal file
19
www/node_modules/ecstatic/.npmignore
generated
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
lib-cov
|
||||
*.seed
|
||||
*.log
|
||||
*.csv
|
||||
*.dat
|
||||
*.out
|
||||
*.pid
|
||||
*.gz
|
||||
|
||||
pids
|
||||
logs
|
||||
results
|
||||
|
||||
node_modules
|
||||
npm-debug.log
|
||||
|
||||
# Unicode filenames cause jenkins to barf when cleaning up workspaces
|
||||
# See: https://github.com/jfhbrook/node-ecstatic/issues/128
|
||||
test
|
||||
8
www/node_modules/ecstatic/.travis.yml
generated
vendored
Normal file
8
www/node_modules/ecstatic/.travis.yml
generated
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
language: node_js
|
||||
sudo: false
|
||||
node_js:
|
||||
- 0.12
|
||||
- 0.10
|
||||
- 4.0
|
||||
- 4.1
|
||||
- 4.2
|
||||
84
www/node_modules/ecstatic/CHANGELOG.md
generated
vendored
Normal file
84
www/node_modules/ecstatic/CHANGELOG.md
generated
vendored
Normal file
@@ -0,0 +1,84 @@
|
||||
2015/05/10 Version 1.4.1
|
||||
- Compare if-modified-since header against server-generated last-modified header rather than raw mtime
|
||||
|
||||
2015/12/22 Version 1.4.0
|
||||
- Add ability to specify custom mimetypes via a JSON blob (on the CLI)
|
||||
- Started test suite around CLI options parsing
|
||||
- Workaround for egregious v8 bug around date parsing throwing during modified-since checks
|
||||
|
||||
2015/11/15 Version 1.3.1
|
||||
- Add recent contributors to CONTRIBUTORS.md
|
||||
- Document showDotFiles in main options example
|
||||
|
||||
2015/11/14 Version 1.3.0
|
||||
- opts.showDotFiles allows hiding dot files
|
||||
|
||||
2015/11/03 Version 1.2.0
|
||||
- opts.cache supports function argument
|
||||
|
||||
2015/10/03 Version 1.1.3
|
||||
- Add CORS=false to defaults
|
||||
|
||||
2015/10/02 Version 1.1.2
|
||||
- Properly handle defaults in CLI args
|
||||
|
||||
2015/10/02 Version 1.1.1
|
||||
- Properly handle boolean CLI args
|
||||
|
||||
2015/10/01 Version 1.1.0
|
||||
- Adds support for responding to OPTIONS headers
|
||||
- Adds support for setting custom headers
|
||||
- Adds cors convenience setting
|
||||
|
||||
2015/09/22 Version 1.0.1
|
||||
- Use encodeURIComponent when creating links in showdir
|
||||
|
||||
2015/09/14 Version 1.0.0
|
||||
- Optional support for weak Etags and weak Etag *comparison*, useful for cases
|
||||
where one is running ecstatic with gzip behind an nginx proxy (these will
|
||||
likely be turned ON by default in a following major version)
|
||||
- As a bin, respects process.env.PORT when binding to a port
|
||||
- Directory listings encode pathnames, etc
|
||||
- Default status pages return html instead of text/plain
|
||||
- Contributors are listed in CONTRIBUTORS.md, referenced by LICENSE.txt
|
||||
|
||||
2015/05/22 Version 0.8.0
|
||||
- Add ability to define custom mime-types, inline or with Apache .types file
|
||||
- Test against express ^4.12.3 and union ^0.4.4
|
||||
- Run tests with tap ^1.0.3
|
||||
- Fix newline asserts to work with windows
|
||||
- Add license attribute to package.json
|
||||
- Elaborate contribution guidelines
|
||||
|
||||
2015/05/09 Version 0.7.6
|
||||
- Fix double encoding in directory listings
|
||||
|
||||
2015/05/07 Version 0.7.5
|
||||
- Fix HTML reflection vulnerability in certain error handlers
|
||||
|
||||
2015/04/17 Version 0.7.4
|
||||
- Fix sort ordering in directory listings
|
||||
|
||||
2015/04/13 Version 0.7.3
|
||||
- Close fstream if/when res closes, fixes potential fd leak
|
||||
|
||||
2015/04/05 Version 0.7.2
|
||||
- Correctly handle req.statusCode in recursive calls; do not inherit upstream res.statusCode
|
||||
|
||||
2015/03/27 Version 0.7.1
|
||||
- Treat ENOTDIR as 404 (same as ENOENT)
|
||||
|
||||
2015/03/18 Version 0.7.0
|
||||
- Add support for specifying default content-type (as an alternative to application/octet-stream)
|
||||
- Use url-join for autoIndex route, fixes windows problems
|
||||
|
||||
2015/03/01 Version 0.6.1
|
||||
- Fix handleError fall-through with directory listings
|
||||
|
||||
2015/02/16 Version 0.6.0
|
||||
- Fix for pathname decoding in windows
|
||||
- Fix for hrefs in directory listings
|
||||
- Add ability to turn off setting of Server header
|
||||
- Remove extraneous call to res.end (handled by stream pipe)
|
||||
- Remove tests from npm package due to jenkins bug
|
||||
- Start a ChangeLog.md
|
||||
86
www/node_modules/ecstatic/CONTRIBUTING.md
generated
vendored
Normal file
86
www/node_modules/ecstatic/CONTRIBUTING.md
generated
vendored
Normal file
@@ -0,0 +1,86 @@
|
||||
# Contributing Guidelines
|
||||
|
||||
## Code of Conduct
|
||||
|
||||
This is probably way overkill, but this is by far my most active project in
|
||||
terms of contributions, and somewhere along the way I was convinced that it
|
||||
was a good idea to have this in place sooner rather than later:
|
||||
|
||||
I want to provide a safe, healthy environment for all contributors/participants
|
||||
regardless of gender, sexual orientation, disability, race, religion, etc.
|
||||
As such, I don't tolerate harassment of participants in any form. In particular
|
||||
this applies to my issues tracker, but also to any other means of communication
|
||||
associated with this project that might come up. Anyone who violates these
|
||||
basic rules may be sanctioned/banned/have-their-comments-deleted/etc by my
|
||||
discretion.
|
||||
|
||||
Glad we cleared that up.
|
||||
|
||||
## Branching
|
||||
|
||||
Before working on your fix/feature/whatever, you should create a new branch to
|
||||
work on. Do something like:
|
||||
|
||||
```sh
|
||||
$ git checkout -b 'my-sweet-new-pull-request'
|
||||
```
|
||||
|
||||
## Please Please Please Start With A Test
|
||||
|
||||
ecstatic has some pretty gnarly branching/logic underneath. Tests are extremely
|
||||
important because they (a) prove that your feature/fix works, and (b) avoid
|
||||
regressions in the future. Even if your patch is problematic enough to not be
|
||||
merged, a test will still be very helpful for confirming any future fix.
|
||||
|
||||
I won't reject your patch outright if it's missing new tests, but it sure
|
||||
helps!
|
||||
|
||||
## Code Style
|
||||
|
||||
Ecstatic's code base follows a relatively consistent style. The closer your
|
||||
patch blends in with the status quo, the better.
|
||||
|
||||
A few PROTIPS off the top of my head:
|
||||
|
||||
1. Variables don't need to all be declared at the top, BUT variable *blocks*
|
||||
should do the whole one-var, tons-of-commas thing.
|
||||
2. Look at how spacing is done around conditionals and functions. Do it like
|
||||
that.
|
||||
3. `else`'s and similar should be on the line *after* the preceding bracket.
|
||||
|
||||
We can refine this as the need arises.
|
||||
|
||||
## A Few Other Minor Guidelines
|
||||
|
||||
1. Keep your pull requests on-topic. A pull request purporting to tackle A
|
||||
shouldn't also have commits changing B and C. Feel free to make separate pull
|
||||
requests. For instance: A pull request should generally only update
|
||||
dependencies when doing so is required to add the feature or fix the bug. This
|
||||
feature can, of course, consist of updating dependencies.
|
||||
2. I prefer maintaining the changelog and package.json version myself. This is
|
||||
because I try to make a single commit for a tagged release contain all
|
||||
changelog additions and the version bump, and this breaks down when there are
|
||||
interstitial commits making updates to either.
|
||||
3. In case you were wondering about dependencies, you may find this helpful:
|
||||
[](https://david-dm.org/jfhbrook/node-ecstatic)
|
||||
4. Please add yourself to CONTRIBUTORS.md if you haven't done so! Fill in as
|
||||
much as makes you comfortable.
|
||||
|
||||
## Pull Request
|
||||
|
||||
Make a pull request against master with your new branch. Explain briefly what
|
||||
the patch does to the code, along with any concerns.
|
||||
|
||||
(If you don't have a description, it's hard for me to put the changes in
|
||||
context. That makes it more difficult for me to merge!)
|
||||
|
||||
## Keep It Moving
|
||||
|
||||
I don't always notice new PRs, and sometimes I will forget to follow up on
|
||||
them. If this happens to you, you can bump the PR thread or find me on
|
||||
IRC or twitter.
|
||||
|
||||
## LAST RULE
|
||||
|
||||
HAVE FUN :v :v
|
||||
|
||||
57
www/node_modules/ecstatic/CONTRIBUTORS.md
generated
vendored
Normal file
57
www/node_modules/ecstatic/CONTRIBUTORS.md
generated
vendored
Normal file
@@ -0,0 +1,57 @@
|
||||
General format is: contributor, github handle, email. In some cases, the
|
||||
contributor field is an organization instead of an actual person---this is for
|
||||
cases where the work was done on behalf of the organization, ie as part of
|
||||
their job. In others, no contributor field and/or email is shown---this is
|
||||
because this list was partially (mostly) reconstructed from github commit
|
||||
information and the person's real life name and email are unknown.
|
||||
|
||||
Listed in no particular order:
|
||||
|
||||
* Joshua Holbrook @jfhbrook <josh.holbrook@gmail.com>
|
||||
* Jon Ege Ronnenberg @dotnetCarpenter <jon.ronnenberg@gmail.com>
|
||||
* James Halliday @substack <substack@gmail.com>
|
||||
* Jonah Ruiz @jonahoffline <jonah@pixelhipsters.com>
|
||||
* Jacob Burden @jekrb <Jacob.JW.Burden@gmail.com>
|
||||
* @leesei
|
||||
* @SirAnthony
|
||||
* Frank Mecklenburg @yfr <mecklenburg@ubilabs.net>
|
||||
* @curimit <curimit@gmail.com>
|
||||
* Dominic Tarr @dominictarr
|
||||
* Chew Choon Keat @choonkeat <choonkeat@gmail.com>
|
||||
* Lars Kappert @webpro <lars@webpro.nl>
|
||||
* Alan Reyes @KuttKatrea <kutt@katrea.net>
|
||||
* Colin Fallon @colinf
|
||||
* Charlie Robbins @indexzero
|
||||
* Ville Salonen @VilleSalonen
|
||||
* Tom Steele @tomsteele <thomasjsteele@gmail.com>
|
||||
* Maciej Małecki @mmalecki <me@mmalecki.com>
|
||||
* Chris Bannister @Zariel <c.bannister@gmail.com>
|
||||
* Shinnosuke Watanabe @shinnn <snnskwtnb@gmail.com>
|
||||
* Adam Brady @SomeoneWeird <adam@boxxen.org>
|
||||
* Christian Howe @coderarity
|
||||
* Arnaud @amelon
|
||||
* Gilad Peleg @pgilad <giladp007@gmail.com>
|
||||
* Brad Dunbar @braddunbar <dunbarb2@gmail.com>
|
||||
* Google Inc. via Jeremy Banks @jre-g <jre@google.com>
|
||||
* @sundippatel
|
||||
* Arjan van Wijk @ThaNarie <thanarie@gmail.com>
|
||||
* Mathias Buus @mafintosh <mathiasbuus@gmail.com>
|
||||
* Farrin Reid @blakmatrix <blakmatrix@gmail.com>
|
||||
* Tõnis Tiigi @tonistiigi <tonistiigi@gmail.com>
|
||||
* Maksim Lin @maks <maks@manichord.com>
|
||||
* Jan Nicklas @jantimon
|
||||
* David Cox @losttime <losttime.shuffle@gmail.com>
|
||||
* Bill Ticehurst @billti <billti@hotmail.com>
|
||||
* Vincent Voyer @vvo <vincent.voyer@gmail.com>
|
||||
* @helloyou2012 <helloyou2012@gmail.com>
|
||||
* Domenic Denicola @domenic <d@domenic.me>
|
||||
* Maxim Ivanov @redbaron <ivanov.maxim@gmail.com>
|
||||
* Oliver Joseph Ash @OliverJAsh <oliverjash@gmail.com>
|
||||
* Benjamin Tan @d10 <demoneaux@gmail.com>
|
||||
* D Scott Boyce @scobo
|
||||
* Zach Bruggerman @remixz <mail@bruggie.com>
|
||||
* Mathias Bynens @mathiasbynens
|
||||
* Chris Lee @clee <clee@mg8.org>
|
||||
* Josh Duff @TehShrike
|
||||
* Cam Wiegert @camwiegert <cam@camwiegert.com>
|
||||
* Josh Gillies @joshgillies <github@joshgilli.es>
|
||||
22
www/node_modules/ecstatic/LICENSE.txt
generated
vendored
Normal file
22
www/node_modules/ecstatic/LICENSE.txt
generated
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2013-2015 Joshua Holbrook and contributors
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
|
||||
220
www/node_modules/ecstatic/README.md
generated
vendored
Normal file
220
www/node_modules/ecstatic/README.md
generated
vendored
Normal file
@@ -0,0 +1,220 @@
|
||||
# Ecstatic [](http://travis-ci.org/jfhbrook/node-ecstatic)
|
||||
|
||||

|
||||
|
||||
A simple static file server middleware. Use it with a raw http server or
|
||||
express/connect!
|
||||
|
||||
# Examples:
|
||||
|
||||
## express 3.0.x
|
||||
|
||||
``` js
|
||||
var http = require('http');
|
||||
var express = require('express');
|
||||
var ecstatic = require('ecstatic');
|
||||
|
||||
var app = express();
|
||||
app.use(ecstatic({ root: __dirname + '/public' }));
|
||||
http.createServer(app).listen(8080);
|
||||
|
||||
console.log('Listening on :8080');
|
||||
```
|
||||
|
||||
## stock http server
|
||||
|
||||
``` js
|
||||
var http = require('http');
|
||||
var ecstatic = require('ecstatic');
|
||||
|
||||
http.createServer(
|
||||
ecstatic({ root: __dirname + '/public' })
|
||||
).listen(8080);
|
||||
|
||||
console.log('Listening on :8080');
|
||||
```
|
||||
### fall through
|
||||
To allow fall through to your custom routes:
|
||||
|
||||
```js
|
||||
ecstatic({ root: __dirname + '/public', handleError: false })
|
||||
```
|
||||
|
||||
# API:
|
||||
|
||||
## ecstatic(opts);
|
||||
|
||||
Pass ecstatic an options hash, and it will return your middleware!
|
||||
|
||||
```js
|
||||
var opts = {
|
||||
root : __dirname + '/public',
|
||||
port : 8000,
|
||||
baseDir : '/',
|
||||
cache : 3600,
|
||||
showDir : true,
|
||||
showDotfiles : true,
|
||||
autoIndex : false,
|
||||
humanReadable : true,
|
||||
headers : {},
|
||||
si : false,
|
||||
defaultExt : 'html',
|
||||
gzip : false,
|
||||
serverHeader : true,
|
||||
contentType : 'application/octet-stream',
|
||||
mimeTypes : undefined,
|
||||
handleOptionsMethod: false
|
||||
}
|
||||
```
|
||||
|
||||
If `opts` is a string, the string is assigned to the root folder and all other
|
||||
options are set to their defaults.
|
||||
|
||||
### `opts.root`
|
||||
|
||||
`opts.root` is the directory you want to serve up.
|
||||
|
||||
### `opts.port`
|
||||
|
||||
`opts.port` is the port you want ecstatic to listen to. Defaults to 8000.
|
||||
|
||||
### `opts.baseDir`
|
||||
|
||||
`opts.baseDir` is `/` by default, but can be changed to allow your static files
|
||||
to be served off a specific route. For example, if `opts.baseDir === "blog"`
|
||||
and `opts.root = "./public"`, requests for `localhost:8080/blog/index.html` will
|
||||
resolve to `./public/index.html`.
|
||||
|
||||
### `opts.cache`
|
||||
|
||||
Customize cache control with `opts.cache` , if it is a number then it will set max-age in seconds.
|
||||
Other wise it will pass through directly to cache-control. Time defaults to 3600 s (ie, 1 hour).
|
||||
|
||||
If it is a function, it will be executed on every request, and passed the pathname. Whatever it returns, string or number, will be used as the cache control header like above.
|
||||
|
||||
### `opts.showDir`
|
||||
|
||||
Turn **off** directory listings with `opts.showDir === false`. Defaults to **true**.
|
||||
|
||||
### `opts.showDotfiles`
|
||||
|
||||
Exclude dotfiles from directory listings with `opts.showDotfiles === false`. Defaults to **true**.
|
||||
|
||||
### `opts.humanReadable`
|
||||
|
||||
If showDir is enabled, add human-readable file sizes. Defaults to **true**.
|
||||
Aliases are `humanreadable` and `human-readable`.
|
||||
|
||||
### `opts.headers`
|
||||
|
||||
Set headers on every response. `opts.headers` can be an object mapping string
|
||||
header names to string header values, a colon (:) separated string, or an array
|
||||
of colon separated strings.
|
||||
|
||||
`opts.H` and `opts.header` are aliased to `opts.headers` so that you can use
|
||||
`-H` and `--header` options to set headers on the command-line like curl:
|
||||
|
||||
``` sh
|
||||
$ ecstatic ./public -p 5000 -H 'Access-Control-Allow-Origin: *'
|
||||
```
|
||||
|
||||
### `opts.si`
|
||||
|
||||
If showDir and humanReadable are enabled, print file sizes with base 1000 instead
|
||||
of base 1024. Name is inferred from cli options for `ls`. Aliased to `index`, the
|
||||
equivalent option in Apache.
|
||||
|
||||
### `opts.autoIndex`
|
||||
|
||||
Serve `/path/index.html` when `/path/` is requested.
|
||||
Turn **off** autoIndexing with `opts.autoIndex === false`. Defaults to **true**.
|
||||
|
||||
### `opts.defaultExt`
|
||||
|
||||
Turn on default file extensions with `opts.defaultExt`. If `opts.defaultExt` is
|
||||
true, it will default to `html`. For example if you want a request to `/a-file`
|
||||
to resolve to `./public/a-file.html`, set this to `true`. If you want
|
||||
`/a-file` to resolve to `./public/a-file.json` instead, set `opts.defaultExt` to
|
||||
`json`.
|
||||
|
||||
### `opts.gzip`
|
||||
|
||||
Set `opts.gzip === true` in order to turn on "gzip mode," wherein ecstatic will
|
||||
serve `./public/some-file.js.gz` in place of `./public/some-file.js` when the
|
||||
gzipped version exists and ecstatic determines that the behavior is appropriate.
|
||||
|
||||
### `opts.serverHeader`
|
||||
|
||||
Set `opts.serverHeader` to false in order to turn off setting the `Server` header
|
||||
on all responses served by ecstatic.
|
||||
|
||||
### `opts.contentType`
|
||||
|
||||
Set `opts.contentType` in order to change default Content-Type header value.
|
||||
Defaults to **application/octet-stream**.
|
||||
|
||||
### `opts.mimeTypes`
|
||||
|
||||
Add new or override one or more mime-types. This affects the HTTP Content-Type header.
|
||||
Can either be a path to a [`.types`](http://svn.apache.org/repos/asf/httpd/httpd/trunk/docs/conf/mime.types) file or an object hash of type(s).
|
||||
|
||||
ecstatic({ mimeType: { 'mime-type': ['file_extension', 'file_extension'] } })
|
||||
|
||||
### `opts.handleError`
|
||||
|
||||
Turn **off** handleErrors to allow fall-through with `opts.handleError === false`, Defaults to **true**.
|
||||
|
||||
### `opts.weakEtags`
|
||||
|
||||
Set `opts.weakEtags` to true in order to generate weak etags instead of strong etags. Defaults to **false**. See `opts.weakCompare` as well.
|
||||
|
||||
### `opts.weakCompare`
|
||||
|
||||
Turn **on** weakCompare to allow the weak comparison function for etag validation. Defaults to **false**.
|
||||
See https://www.ietf.org/rfc/rfc2616.txt Section 13.3.3 for more details.
|
||||
|
||||
### `opts.handleOptionsMethod`
|
||||
|
||||
Set handleOptionsMethod to true in order to respond to 'OPTIONS' calls with any standard/set headers. Defaults to **false**. Useful for hacking up CORS support.
|
||||
|
||||
### `opts.cors`
|
||||
|
||||
This is a **convenience** setting which turns on `handleOptionsMethod` and sets the headers **Access-Control-Allow-Origin: \*** and **Access-Control-Allow-Headers: Authorization, Content-Type, If-Match, If-Modified-Since, If-None-Match, If-Unmodified-Since**. This *should* be enough to quickly make cross-origin resource sharing work between development APIs. More advanced usage can come either from overriding these headers with the headers argument, or by using the `handleOptionsMethod` flag and then setting headers "manually." Alternately, just do it in your app using separate middlewares/abstractions.
|
||||
|
||||
Defaults to **false**.
|
||||
|
||||
## middleware(req, res, next);
|
||||
|
||||
This works more or less as you'd expect.
|
||||
|
||||
### ecstatic.showDir(folder);
|
||||
|
||||
This returns another middleware which will attempt to show a directory view. Turning on auto-indexing is roughly equivalent to adding this middleware after an ecstatic middleware with autoindexing disabled.
|
||||
|
||||
### `ecstatic` command
|
||||
|
||||
to start a standalone static http server,
|
||||
run `npm install -g ecstatic` and then run `ecstatic [dir?] [options] --port PORT`
|
||||
all options work as above, passed in [optimist](https://github.com/substack/node-optimist) style.
|
||||
`port` defaults to `8000`. If a `dir` or `--root dir` argument is not passed, ecsatic will
|
||||
serve the current dir. Ecstatic also respects the PORT environment variable.
|
||||
|
||||
# Tests:
|
||||
|
||||
Ecstatic has a fairly extensive test suite. You can run it with:
|
||||
|
||||
```sh
|
||||
$ npm test
|
||||
```
|
||||
|
||||
# Contribute:
|
||||
|
||||
Without outside contributions, ecstatic would wither and die! Before
|
||||
contributing, take a quick look at the contributing guidelines in
|
||||
[./CONTRIBUTING.md](./CONTRIBUTING.md) . They're relatively painless, I promise.
|
||||
For Windows users, it is especially important to read the [./CONTRIBUTING.md](./CONTRIBUTING.md)
|
||||
section as you can **not** clone ecstatic without changing some settings in git.
|
||||
|
||||
# License:
|
||||
|
||||
MIT. See LICENSE.txt. For contributors, see CONTRIBUTORS.md
|
||||
10
www/node_modules/ecstatic/example/core.js
generated
vendored
Normal file
10
www/node_modules/ecstatic/example/core.js
generated
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
var http = require('http');
|
||||
var ecstatic = require('../lib/ecstatic')({
|
||||
root: __dirname + '/public',
|
||||
showDir: true,
|
||||
autoIndex: true
|
||||
});
|
||||
|
||||
http.createServer(ecstatic).listen(8080);
|
||||
|
||||
console.log('Listening on :8080');
|
||||
12
www/node_modules/ecstatic/example/express.js
generated
vendored
Normal file
12
www/node_modules/ecstatic/example/express.js
generated
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
var express = require('express');
|
||||
var ecstatic = require('../lib/ecstatic');
|
||||
var http = require('http');
|
||||
|
||||
var app = express();
|
||||
app.use(ecstatic({
|
||||
root: __dirname + '/public',
|
||||
showdir : true
|
||||
}));
|
||||
http.createServer(app).listen(8080);
|
||||
|
||||
console.log('Listening on :8080');
|
||||
1
www/node_modules/ecstatic/example/public/beep/index.html
generated
vendored
Normal file
1
www/node_modules/ecstatic/example/public/beep/index.html
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
<b>boop!</b>
|
||||
1
www/node_modules/ecstatic/example/public/hello.txt
generated
vendored
Normal file
1
www/node_modules/ecstatic/example/public/hello.txt
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
Hello world!
|
||||
1
www/node_modules/ecstatic/example/public/subdir/world.txt
generated
vendored
Normal file
1
www/node_modules/ecstatic/example/public/subdir/world.txt
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
hello cruel world!
|
||||
BIN
www/node_modules/ecstatic/example/public/turtle.png
generated
vendored
Normal file
BIN
www/node_modules/ecstatic/example/public/turtle.png
generated
vendored
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 191 KiB |
10
www/node_modules/ecstatic/example/union.js
generated
vendored
Normal file
10
www/node_modules/ecstatic/example/union.js
generated
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
var union = require('union');
|
||||
var ecstatic = require('../');
|
||||
|
||||
union.createServer({
|
||||
before: [
|
||||
ecstatic(__dirname + '/public')
|
||||
]
|
||||
}).listen(8080);
|
||||
|
||||
console.log('Listening on :8080');
|
||||
371
www/node_modules/ecstatic/lib/ecstatic.js
generated
vendored
Executable file
371
www/node_modules/ecstatic/lib/ecstatic.js
generated
vendored
Executable file
@@ -0,0 +1,371 @@
|
||||
#! /usr/bin/env node
|
||||
|
||||
var path = require('path'),
|
||||
fs = require('fs'),
|
||||
url = require('url'),
|
||||
mime = require('mime'),
|
||||
urlJoin = require('url-join'),
|
||||
showDir = require('./ecstatic/showdir'),
|
||||
version = JSON.parse(
|
||||
fs.readFileSync(__dirname + '/../package.json').toString()
|
||||
).version,
|
||||
status = require('./ecstatic/status-handlers'),
|
||||
generateEtag = require('./ecstatic/etag'),
|
||||
optsParser = require('./ecstatic/opts');
|
||||
|
||||
var ecstatic = module.exports = function (dir, options) {
|
||||
if (typeof dir !== 'string') {
|
||||
options = dir;
|
||||
dir = options.root;
|
||||
}
|
||||
|
||||
var root = path.join(path.resolve(dir), '/'),
|
||||
opts = optsParser(options),
|
||||
cache = opts.cache,
|
||||
autoIndex = opts.autoIndex,
|
||||
baseDir = opts.baseDir,
|
||||
defaultExt = opts.defaultExt,
|
||||
handleError = opts.handleError,
|
||||
headers = opts.headers,
|
||||
serverHeader = opts.serverHeader,
|
||||
weakEtags = opts.weakEtags,
|
||||
handleOptionsMethod = opts.handleOptionsMethod;
|
||||
|
||||
opts.root = dir;
|
||||
if (defaultExt && /^\./.test(defaultExt)) defaultExt = defaultExt.replace(/^\./, '');
|
||||
|
||||
// Support hashes and .types files in mimeTypes @since 0.8
|
||||
if (opts.mimeTypes) {
|
||||
try {
|
||||
// You can pass a JSON blob here---useful for CLI use
|
||||
opts.mimeTypes = JSON.parse(opts.mimeTypes);
|
||||
} catch (e) {}
|
||||
if (typeof opts.mimeTypes === 'string') {
|
||||
mime.load(opts.mimeTypes);
|
||||
}
|
||||
else if (typeof opts.mimeTypes === 'object') {
|
||||
mime.define(opts.mimeTypes);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return function middleware (req, res, next) {
|
||||
|
||||
// Strip any null bytes from the url
|
||||
while(req.url.indexOf('%00') !== -1) {
|
||||
req.url = req.url.replace(/\%00/g, '');
|
||||
}
|
||||
// Figure out the path for the file from the given url
|
||||
var parsed = url.parse(req.url);
|
||||
try {
|
||||
decodeURIComponent(req.url); // check validity of url
|
||||
var pathname = decodePathname(parsed.pathname);
|
||||
}
|
||||
catch (err) {
|
||||
return status[400](res, next, { error: err });
|
||||
}
|
||||
|
||||
var file = path.normalize(
|
||||
path.join(root,
|
||||
path.relative(
|
||||
path.join('/', baseDir),
|
||||
pathname
|
||||
)
|
||||
)
|
||||
),
|
||||
gzipped = file + '.gz';
|
||||
|
||||
if(serverHeader !== false) {
|
||||
// Set common headers.
|
||||
res.setHeader('server', 'ecstatic-'+version);
|
||||
}
|
||||
Object.keys(headers).forEach(function (key) {
|
||||
res.setHeader(key, headers[key])
|
||||
})
|
||||
|
||||
if (req.method === 'OPTIONS' && handleOptionsMethod) {
|
||||
return res.end();
|
||||
}
|
||||
|
||||
// TODO: This check is broken, which causes the 403 on the
|
||||
// expected 404.
|
||||
if (file.slice(0, root.length) !== root) {
|
||||
return status[403](res, next);
|
||||
}
|
||||
|
||||
if (req.method && (req.method !== 'GET' && req.method !== 'HEAD' )) {
|
||||
return status[405](res, next);
|
||||
}
|
||||
|
||||
function statFile() {
|
||||
fs.stat(file, function (err, stat) {
|
||||
if (err && (err.code === 'ENOENT' || err.code === 'ENOTDIR')) {
|
||||
if (req.statusCode == 404) {
|
||||
// This means we're already trying ./404.html and can not find it.
|
||||
// So send plain text response with 404 status code
|
||||
status[404](res, next);
|
||||
}
|
||||
else if (!path.extname(parsed.pathname).length && defaultExt) {
|
||||
// If there is no file extension in the path and we have a default
|
||||
// extension try filename and default extension combination before rendering 404.html.
|
||||
middleware({
|
||||
url: parsed.pathname + '.' + defaultExt + ((parsed.search)? parsed.search:'')
|
||||
}, res, next);
|
||||
}
|
||||
else {
|
||||
// Try to serve default ./404.html
|
||||
middleware({
|
||||
url: (handleError ? ('/' + path.join(baseDir, '404.' + defaultExt)) : req.url),
|
||||
statusCode: 404
|
||||
}, res, next);
|
||||
}
|
||||
}
|
||||
else if (err) {
|
||||
status[500](res, next, { error: err });
|
||||
}
|
||||
else if (stat.isDirectory()) {
|
||||
// 302 to / if necessary
|
||||
if (!parsed.pathname.match(/\/$/)) {
|
||||
res.statusCode = 302;
|
||||
res.setHeader('location', parsed.pathname + '/' +
|
||||
(parsed.query? ('?' + parsed.query):'')
|
||||
);
|
||||
return res.end();
|
||||
}
|
||||
|
||||
if (autoIndex) {
|
||||
return middleware({
|
||||
url: urlJoin(encodeURIComponent(pathname), '/index.' + defaultExt)
|
||||
}, res, function (err) {
|
||||
if (err) {
|
||||
return status[500](res, next, { error: err });
|
||||
}
|
||||
if (opts.showDir) {
|
||||
return showDir(opts, stat)(req, res);
|
||||
}
|
||||
|
||||
return status[403](res, next);
|
||||
});
|
||||
}
|
||||
|
||||
if (opts.showDir) {
|
||||
return showDir(opts, stat)(req, res);
|
||||
}
|
||||
|
||||
status[404](res, next);
|
||||
|
||||
}
|
||||
else {
|
||||
serve(stat);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// Look for a gzipped file if this is turned on
|
||||
if (opts.gzip && shouldCompress(req)) {
|
||||
fs.stat(gzipped, function (err, stat) {
|
||||
if (!err && stat.isFile()) {
|
||||
file = gzipped;
|
||||
return serve(stat);
|
||||
} else {
|
||||
statFile();
|
||||
}
|
||||
});
|
||||
} else {
|
||||
statFile();
|
||||
}
|
||||
|
||||
function serve(stat) {
|
||||
// Do a MIME lookup, fall back to octet-stream and handle gzip
|
||||
// special case.
|
||||
var defaultType = opts.contentType || 'application/octet-stream',
|
||||
contentType = mime.lookup(file, defaultType),
|
||||
charSet;
|
||||
|
||||
if (contentType) {
|
||||
charSet = mime.charsets.lookup(contentType, 'utf-8');
|
||||
if (charSet) {
|
||||
contentType += '; charset=' + charSet;
|
||||
}
|
||||
}
|
||||
|
||||
if (path.extname(file) === '.gz') {
|
||||
res.setHeader('Content-Encoding', 'gzip');
|
||||
|
||||
// strip gz ending and lookup mime type
|
||||
contentType = mime.lookup(path.basename(file, ".gz"), defaultType);
|
||||
}
|
||||
|
||||
var range = (req.headers && req.headers['range']);
|
||||
if (range) {
|
||||
var total = stat.size;
|
||||
var parts = range.replace(/bytes=/, "").split("-");
|
||||
var partialstart = parts[0];
|
||||
var partialend = parts[1];
|
||||
var start = parseInt(partialstart, 10);
|
||||
var end = Math.min(total-1, partialend ? parseInt(partialend, 10) : total-1);
|
||||
var chunksize = (end-start)+1;
|
||||
if (start > end || isNaN(start) || isNaN(end)) {
|
||||
return status['416'](res, next);
|
||||
}
|
||||
var fstream = fs.createReadStream(file, {start: start, end: end});
|
||||
fstream.on('error', function (err) {
|
||||
status['500'](res, next, { error: err });
|
||||
});
|
||||
res.on('close', function () {
|
||||
fstream.destroy();
|
||||
});
|
||||
res.writeHead(206, {
|
||||
'Content-Range': 'bytes ' + start + '-' + end + '/' + total,
|
||||
'Accept-Ranges': 'bytes',
|
||||
'Content-Length': chunksize,
|
||||
'Content-Type': contentType
|
||||
});
|
||||
fstream.pipe(res);
|
||||
return;
|
||||
}
|
||||
|
||||
// TODO: Helper for this, with default headers.
|
||||
var lastModified = (new Date(stat.mtime)).toUTCString(),
|
||||
etag = generateEtag(stat, weakEtags);
|
||||
res.setHeader('last-modified', lastModified);
|
||||
res.setHeader('etag', etag);
|
||||
|
||||
if (typeof cache === 'function') {
|
||||
var requestSpecificCache = cache(pathname);
|
||||
if (typeof requestSpecificCache === 'number') {
|
||||
requestSpecificCache = 'max-age=' + requestSpecificCache;
|
||||
}
|
||||
res.setHeader('cache-control', requestSpecificCache);
|
||||
} else {
|
||||
res.setHeader('cache-control', cache);
|
||||
}
|
||||
|
||||
// Return a 304 if necessary
|
||||
if (shouldReturn304(req, lastModified, etag)) {
|
||||
return status[304](res, next);
|
||||
}
|
||||
|
||||
res.setHeader('content-length', stat.size);
|
||||
res.setHeader('content-type', contentType);
|
||||
|
||||
// set the response statusCode if we have a request statusCode.
|
||||
// This only can happen if we have a 404 with some kind of 404.html
|
||||
// In all other cases where we have a file we serve the 200
|
||||
res.statusCode = req.statusCode || 200;
|
||||
|
||||
if (req.method === "HEAD") {
|
||||
return res.end();
|
||||
}
|
||||
|
||||
var stream = fs.createReadStream(file);
|
||||
|
||||
stream.pipe(res);
|
||||
stream.on('error', function (err) {
|
||||
status['500'](res, next, { error: err });
|
||||
});
|
||||
}
|
||||
|
||||
function shouldReturn304(req, serverLastModified, serverEtag) {
|
||||
if (!req || !req.headers) {
|
||||
return false;
|
||||
}
|
||||
|
||||
var clientModifiedSince = req.headers['if-modified-since'],
|
||||
clientEtag = req.headers['if-none-match'];
|
||||
|
||||
if (!clientModifiedSince && !clientEtag) {
|
||||
// Client did not provide any conditional caching headers
|
||||
return false;
|
||||
}
|
||||
|
||||
if (clientModifiedSince) {
|
||||
// Catch "illegal access" dates that will crash v8
|
||||
// https://github.com/jfhbrook/node-ecstatic/pull/179
|
||||
try {
|
||||
var clientModifiedDate = new Date(Date.parse(clientModifiedSince));
|
||||
}
|
||||
catch (err) { return false }
|
||||
|
||||
if (clientModifiedDate.toString() === 'Invalid Date') {
|
||||
return false;
|
||||
}
|
||||
// If the client's copy is older than the server's, don't return 304
|
||||
if (clientModifiedDate < new Date(serverLastModified)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (clientEtag) {
|
||||
// Do a strong or weak etag comparison based on setting
|
||||
// https://www.ietf.org/rfc/rfc2616.txt Section 13.3.3
|
||||
if (opts.weakCompare && clientEtag !== serverEtag
|
||||
&& clientEtag !== ('W/' + serverEtag) && ('W/' + clientEtag) !== serverEtag) {
|
||||
return false;
|
||||
} else if (!opts.weakCompare && (clientEtag !== serverEtag || clientEtag.indexOf('W/') === 0)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
ecstatic.version = version;
|
||||
ecstatic.showDir = showDir;
|
||||
|
||||
// Check to see if we should try to compress a file with gzip.
|
||||
function shouldCompress(req) {
|
||||
var headers = req.headers;
|
||||
|
||||
return headers && headers['accept-encoding'] &&
|
||||
headers['accept-encoding']
|
||||
.split(",")
|
||||
.some(function (el) {
|
||||
return ['*','compress', 'gzip', 'deflate'].indexOf(el) != -1;
|
||||
})
|
||||
;
|
||||
}
|
||||
|
||||
// See: https://github.com/jesusabdullah/node-ecstatic/issues/109
|
||||
function decodePathname(pathname) {
|
||||
var pieces = pathname.replace(/\\/g,"/").split('/');
|
||||
|
||||
return pieces.map(function (piece) {
|
||||
piece = decodeURIComponent(piece);
|
||||
|
||||
if (process.platform === 'win32' && /\\/.test(piece)) {
|
||||
throw new Error('Invalid forward slash character');
|
||||
}
|
||||
|
||||
return piece;
|
||||
}).join('/');
|
||||
}
|
||||
|
||||
if (!module.parent) {
|
||||
var defaults = require('./ecstatic/defaults.json')
|
||||
var http = require('http'),
|
||||
opts = require('minimist')(process.argv.slice(2), {
|
||||
alias: require('./ecstatic/aliases.json'),
|
||||
default: defaults,
|
||||
boolean: Object.keys(defaults).filter(function (key) {
|
||||
return typeof defaults[key] === 'boolean'
|
||||
})
|
||||
}),
|
||||
envPORT = parseInt(process.env.PORT, 10),
|
||||
port = envPORT > 1024 && envPORT <= 65536 ? envPORT : opts.port || opts.p || 8000,
|
||||
dir = opts.root || opts._[0] || process.cwd();
|
||||
|
||||
if (opts.help || opts.h) {
|
||||
var u = console.error;
|
||||
u('usage: ecstatic [dir] {options} --port PORT');
|
||||
u('see https://npm.im/ecstatic for more docs');
|
||||
return;
|
||||
}
|
||||
|
||||
http.createServer(ecstatic(dir, opts))
|
||||
.listen(port, function () {
|
||||
console.log('ecstatic serving ' + dir + ' at http://0.0.0.0:' + port);
|
||||
});
|
||||
}
|
||||
34
www/node_modules/ecstatic/lib/ecstatic/aliases.json
generated
vendored
Normal file
34
www/node_modules/ecstatic/lib/ecstatic/aliases.json
generated
vendored
Normal file
@@ -0,0 +1,34 @@
|
||||
{
|
||||
"autoIndex": [ "autoIndex", "autoindex" ],
|
||||
"showDir": [ "showDir", "showdir" ],
|
||||
"showDotfiles": ["showDotfiles", "showdotfiles"],
|
||||
"humanReadable": [ "humanReadable", "humanreadable", "human-readable" ],
|
||||
"si": [ "si", "index" ],
|
||||
"handleError": [ "handleError", "handleerror" ],
|
||||
"cors": [ "cors", "CORS" ],
|
||||
"headers": [ "H", "header", "headers" ],
|
||||
"serverHeader": [ "serverHeader", "serverheader", "server-header" ],
|
||||
"contentType": [ "contentType", "contenttype", "content-type" ],
|
||||
"mimeType": [
|
||||
"mimetype",
|
||||
"mimetypes",
|
||||
"mimeType",
|
||||
"mimeTypes",
|
||||
"mime-type",
|
||||
"mime-types",
|
||||
"mime-Type",
|
||||
"mime-Types"
|
||||
],
|
||||
"weakEtags": [ "weakEtags", "weaketags", "weak-etags" ],
|
||||
"weakCompare": [
|
||||
"weakcompare",
|
||||
"weakCompare",
|
||||
"weak-compare",
|
||||
"weak-Compare"
|
||||
],
|
||||
"handleOptionsMethod": [
|
||||
"handleOptionsMethod",
|
||||
"handleoptionsmethod",
|
||||
"handle-options-method"
|
||||
]
|
||||
}
|
||||
17
www/node_modules/ecstatic/lib/ecstatic/defaults.json
generated
vendored
Normal file
17
www/node_modules/ecstatic/lib/ecstatic/defaults.json
generated
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
{
|
||||
"autoIndex": true,
|
||||
"showDir": true,
|
||||
"showDotfiles": true,
|
||||
"humanReadable": true,
|
||||
"si": false,
|
||||
"cache": "max-age=3600",
|
||||
"cors": false,
|
||||
"gzip": false,
|
||||
"defaultExt": ".html",
|
||||
"handleError": true,
|
||||
"serverHeader": true,
|
||||
"contentType": "application/octet-stream",
|
||||
"weakEtags": false,
|
||||
"weakCompare": false,
|
||||
"handleOptionsMethod": false
|
||||
}
|
||||
7
www/node_modules/ecstatic/lib/ecstatic/etag.js
generated
vendored
Normal file
7
www/node_modules/ecstatic/lib/ecstatic/etag.js
generated
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
module.exports = function (stat, weakEtag) {
|
||||
var etag = '"' + [stat.ino, stat.size, JSON.stringify(stat.mtime)].join('-') + '"';
|
||||
if (weakEtag) {
|
||||
etag = 'W/' + etag;
|
||||
}
|
||||
return etag;
|
||||
}
|
||||
180
www/node_modules/ecstatic/lib/ecstatic/opts.js
generated
vendored
Normal file
180
www/node_modules/ecstatic/lib/ecstatic/opts.js
generated
vendored
Normal file
@@ -0,0 +1,180 @@
|
||||
// This is so you can have options aliasing and defaults in one place.
|
||||
|
||||
var defaults = require('./defaults.json');
|
||||
var aliases = require('./aliases.json')
|
||||
|
||||
module.exports = function (opts) {
|
||||
var autoIndex = defaults.autoIndex,
|
||||
showDir = defaults.showDir,
|
||||
showDotfiles = defaults.showDotfiles,
|
||||
humanReadable = defaults.humanReadable,
|
||||
si = defaults.si,
|
||||
cache = defaults.cache,
|
||||
gzip = defaults.gzip,
|
||||
defaultExt = defaults.defaultExt,
|
||||
handleError = defaults.handleError,
|
||||
headers = {},
|
||||
serverHeader = defaults.serverHeader,
|
||||
contentType = defaults.contentType,
|
||||
mimeTypes,
|
||||
weakEtags = defaults.weakEtags,
|
||||
weakCompare = defaults.weakCompare,
|
||||
handleOptionsMethod = defaults.handleOptionsMethod;
|
||||
|
||||
function isDeclared(k) {
|
||||
return typeof opts[k] !== 'undefined' && opts[k] !== null;
|
||||
}
|
||||
|
||||
if (opts) {
|
||||
aliases.autoIndex.some(function (k) {
|
||||
if (isDeclared(k)) {
|
||||
autoIndex = opts[k];
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
||||
aliases.showDir.some(function (k) {
|
||||
if (isDeclared(k)) {
|
||||
showDir = opts[k];
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
||||
aliases.showDotfiles.some(function (k) {
|
||||
if (isDeclared(k)) {
|
||||
showDotfiles = opts[k];
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
||||
aliases.humanReadable.some(function (k) {
|
||||
if (isDeclared(k)) {
|
||||
humanReadable = opts[k];
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
||||
aliases.si.some(function (k) {
|
||||
if (isDeclared(k)) {
|
||||
si = opts[k];
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
||||
if (opts.defaultExt && typeof opts.defaultExt === 'string') {
|
||||
defaultExt = opts.defaultExt;
|
||||
}
|
||||
|
||||
if (typeof opts.cache !== 'undefined' && opts.cache !== null) {
|
||||
if (typeof opts.cache === 'string') {
|
||||
cache = opts.cache;
|
||||
}
|
||||
else if (typeof opts.cache === 'number') {
|
||||
cache = 'max-age=' + opts.cache;
|
||||
}
|
||||
else if (typeof opts.cache === 'function') {
|
||||
cache = opts.cache
|
||||
}
|
||||
}
|
||||
|
||||
if (typeof opts.gzip !== 'undefined' && opts.gzip !== null) {
|
||||
gzip = opts.gzip;
|
||||
}
|
||||
|
||||
aliases.handleError.some(function (k) {
|
||||
if (isDeclared(k)) {
|
||||
handleError = opts[k];
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
||||
aliases.cors.forEach(function(k) {
|
||||
if (isDeclared(k) && k) {
|
||||
handleOptionsMethod = true;
|
||||
headers['Access-Control-Allow-Origin'] = '*';
|
||||
headers['Access-Control-Allow-Headers'] = 'Authorization, Content-Type, If-Match, If-Modified-Since, If-None-Match, If-Unmodified-Since';
|
||||
}
|
||||
});
|
||||
|
||||
aliases.headers.forEach(function (k) {
|
||||
if (!isDeclared(k)) return;
|
||||
if (Array.isArray(opts[k])) {
|
||||
opts[k].forEach(setHeader);
|
||||
}
|
||||
else if (opts[k] && typeof opts[k] === 'object') {
|
||||
Object.keys(opts[k]).forEach(function (key) {
|
||||
headers[key] = opts[k][key];
|
||||
});
|
||||
}
|
||||
else setHeader(opts[k]);
|
||||
|
||||
function setHeader (str) {
|
||||
var m = /^(.+?)\s*:\s*(.*)$/.exec(str)
|
||||
if (!m) headers[str] = true
|
||||
else headers[m[1]] = m[2]
|
||||
}
|
||||
});
|
||||
|
||||
aliases.serverHeader.some(function (k) {
|
||||
if (isDeclared(k)) {
|
||||
serverHeader = opts[k];
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
||||
aliases.contentType.some(function (k) {
|
||||
if (isDeclared(k)) {
|
||||
contentType = opts[k];
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
||||
aliases.mimeType.some(function (k) {
|
||||
if (isDeclared(k)) {
|
||||
mimeTypes = opts[k];
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
||||
aliases.weakEtags.some(function (k) {
|
||||
if (isDeclared(k)) {
|
||||
weakEtags = opts[k];
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
||||
aliases.weakCompare.some(function (k) {
|
||||
if (isDeclared(k)) {
|
||||
weakCompare = opts[k];
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
||||
aliases.handleOptionsMethod.some(function (k) {
|
||||
if (isDeclared(k)) {
|
||||
handleOptionsMethod = handleOptionsMethod || opts[k];
|
||||
return true;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
return {
|
||||
cache: cache,
|
||||
autoIndex: autoIndex,
|
||||
showDir: showDir,
|
||||
showDotfiles: showDotfiles,
|
||||
humanReadable: humanReadable,
|
||||
si: si,
|
||||
defaultExt: defaultExt,
|
||||
baseDir: (opts && opts.baseDir) || '/',
|
||||
gzip: gzip,
|
||||
handleError: handleError,
|
||||
headers: headers,
|
||||
serverHeader: serverHeader,
|
||||
contentType: contentType,
|
||||
mimeTypes: mimeTypes,
|
||||
weakEtags: weakEtags,
|
||||
weakCompare: weakCompare,
|
||||
handleOptionsMethod: handleOptionsMethod
|
||||
};
|
||||
};
|
||||
224
www/node_modules/ecstatic/lib/ecstatic/showdir.js
generated
vendored
Normal file
224
www/node_modules/ecstatic/lib/ecstatic/showdir.js
generated
vendored
Normal file
@@ -0,0 +1,224 @@
|
||||
var ecstatic = require('../ecstatic'),
|
||||
fs = require('fs'),
|
||||
path = require('path'),
|
||||
he = require('he'),
|
||||
etag = require('./etag'),
|
||||
url = require('url'),
|
||||
status = require('./status-handlers');
|
||||
|
||||
module.exports = function (opts, stat) {
|
||||
// opts are parsed by opts.js, defaults already applied
|
||||
var cache = opts.cache,
|
||||
root = path.resolve(opts.root),
|
||||
baseDir = opts.baseDir,
|
||||
humanReadable = opts.humanReadable,
|
||||
handleError = opts.handleError,
|
||||
showDotfiles = opts.showDotfiles,
|
||||
si = opts.si,
|
||||
weakEtags = opts.weakEtags;
|
||||
|
||||
return function middleware (req, res, next) {
|
||||
|
||||
// Figure out the path for the file from the given url
|
||||
var parsed = url.parse(req.url),
|
||||
pathname = decodeURIComponent(parsed.pathname),
|
||||
dir = path.normalize(
|
||||
path.join(root,
|
||||
path.relative(
|
||||
path.join('/', baseDir),
|
||||
pathname
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
fs.stat(dir, function (err, stat) {
|
||||
if (err) {
|
||||
return handleError ? status[500](res, next, { error: err }) : next();
|
||||
}
|
||||
|
||||
// files are the listing of dir
|
||||
fs.readdir(dir, function (err, files) {
|
||||
if (err) {
|
||||
return handleError ? status[500](res, next, { error: err }) : next();
|
||||
}
|
||||
|
||||
// Optionally exclude dotfiles from directory listing.
|
||||
if (!showDotfiles) {
|
||||
files = files.filter(function(filename){
|
||||
return filename.slice(0,1) !== '.';
|
||||
});
|
||||
}
|
||||
|
||||
res.setHeader('content-type', 'text/html');
|
||||
res.setHeader('etag', etag(stat, weakEtags));
|
||||
res.setHeader('last-modified', (new Date(stat.mtime)).toUTCString());
|
||||
res.setHeader('cache-control', cache);
|
||||
|
||||
sortByIsDirectory(files, function (lolwuts, dirs, files) {
|
||||
// It's possible to get stat errors for all sorts of reasons here.
|
||||
// Unfortunately, our two choices are to either bail completely,
|
||||
// or just truck along as though everything's cool. In this case,
|
||||
// I decided to just tack them on as "??!?" items along with dirs
|
||||
// and files.
|
||||
//
|
||||
// Whatever.
|
||||
|
||||
// if it makes sense to, add a .. link
|
||||
if (path.resolve(dir, '..').slice(0, root.length) == root) {
|
||||
return fs.stat(path.join(dir, '..'), function (err, s) {
|
||||
if (err) {
|
||||
return handleError ? status[500](res, next, { error: err }) : next();
|
||||
}
|
||||
dirs.unshift([ '..', s ]);
|
||||
render(dirs, files, lolwuts);
|
||||
});
|
||||
}
|
||||
render(dirs, files, lolwuts);
|
||||
});
|
||||
|
||||
function sortByIsDirectory(paths, cb) {
|
||||
// take the listing file names in `dir`
|
||||
// returns directory and file array, each entry is
|
||||
// of the array a [name, stat] tuple
|
||||
var pending = paths.length,
|
||||
errs = [],
|
||||
dirs = [],
|
||||
files = [];
|
||||
|
||||
if (!pending) {
|
||||
return cb(errs, dirs, files);
|
||||
}
|
||||
|
||||
paths.forEach(function (file) {
|
||||
fs.stat(path.join(dir, file), function (err, s) {
|
||||
if (err) {
|
||||
errs.push([file, err]);
|
||||
}
|
||||
else if (s.isDirectory()) {
|
||||
dirs.push([file, s]);
|
||||
}
|
||||
else {
|
||||
files.push([file, s]);
|
||||
}
|
||||
|
||||
if (--pending === 0) {
|
||||
cb(errs, dirs, files);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function render(dirs, files, lolwuts) {
|
||||
// each entry in the array is a [name, stat] tuple
|
||||
|
||||
// TODO: use stylessheets?
|
||||
var html = [
|
||||
'<!doctype html>',
|
||||
'<html>',
|
||||
' <head>',
|
||||
' <meta charset="utf-8">',
|
||||
' <meta name="viewport" content="width=device-width">',
|
||||
' <title>Index of ' + he.encode(pathname) +'</title>',
|
||||
' </head>',
|
||||
' <body>',
|
||||
'<h1>Index of ' + he.encode(pathname) + '</h1>'
|
||||
].join('\n') + '\n';
|
||||
|
||||
html += '<table>';
|
||||
|
||||
var failed = false;
|
||||
var writeRow = function (file, i) {
|
||||
// render a row given a [name, stat] tuple
|
||||
var isDir = file[1].isDirectory && file[1].isDirectory();
|
||||
var href = parsed.pathname.replace(/\/$/, '') + '/' + encodeURIComponent(file[0]);
|
||||
|
||||
// append trailing slash and query for dir entry
|
||||
if (isDir) {
|
||||
href += '/' + he.encode((parsed.search)? parsed.search:'');
|
||||
}
|
||||
|
||||
var displayName = he.encode(file[0]) + ((isDir)? '/':'');
|
||||
|
||||
// TODO: use stylessheets?
|
||||
html += '<tr>' +
|
||||
'<td><code>(' + permsToString(file[1]) + ')</code></td>' +
|
||||
'<td style="text-align: right; padding-left: 1em"><code>' + sizeToString(file[1], humanReadable, si) + '</code></td>' +
|
||||
'<td style="padding-left: 1em"><a href="' + href + '">' + displayName + '</a></td>' +
|
||||
'</tr>\n';
|
||||
};
|
||||
|
||||
dirs.sort(function (a, b) { return a[0].toString().localeCompare(b[0].toString()); }).forEach(writeRow);
|
||||
files.sort(function (a, b) { return a.toString().localeCompare(b.toString()); }).forEach(writeRow);
|
||||
lolwuts.sort(function (a, b) { return a[0].toString().localeCompare(b[0].toString()); }).forEach(writeRow);
|
||||
|
||||
html += '</table>\n';
|
||||
html += '<br><address>Node.js ' +
|
||||
process.version +
|
||||
'/ <a href="https://github.com/jfhbrook/node-ecstatic">ecstatic</a> ' +
|
||||
'server running @ ' +
|
||||
he.encode(req.headers.host || '') + '</address>\n' +
|
||||
'</body></html>'
|
||||
;
|
||||
|
||||
if (!failed) {
|
||||
res.writeHead(200, { "Content-Type": "text/html" });
|
||||
res.end(html);
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
};
|
||||
};
|
||||
|
||||
function permsToString(stat) {
|
||||
|
||||
if (!stat.isDirectory || !stat.mode) {
|
||||
return '???!!!???';
|
||||
}
|
||||
|
||||
var dir = stat.isDirectory() ? 'd' : '-',
|
||||
mode = stat.mode.toString(8);
|
||||
|
||||
return dir + mode.slice(-3).split('').map(function (n) {
|
||||
return [
|
||||
'---',
|
||||
'--x',
|
||||
'-w-',
|
||||
'-wx',
|
||||
'r--',
|
||||
'r-x',
|
||||
'rw-',
|
||||
'rwx'
|
||||
][parseInt(n, 10)];
|
||||
}).join('');
|
||||
}
|
||||
|
||||
// given a file's stat, return the size of it in string
|
||||
// humanReadable: (boolean) whether to result is human readable
|
||||
// si: (boolean) whether to use si (1k = 1000), otherwise 1k = 1024
|
||||
// adopted from http://stackoverflow.com/a/14919494/665507
|
||||
function sizeToString(stat, humanReadable, si) {
|
||||
if (stat.isDirectory && stat.isDirectory()) {
|
||||
return '';
|
||||
}
|
||||
|
||||
var sizeString = '';
|
||||
var bytes = stat.size;
|
||||
var threshold = si ? 1000 : 1024;
|
||||
|
||||
if (!humanReadable || bytes < threshold) {
|
||||
return bytes + 'B';
|
||||
}
|
||||
|
||||
var units = [ 'k','M','G','T','P','E','Z','Y' ];
|
||||
var u = -1;
|
||||
do {
|
||||
bytes /= threshold;
|
||||
++u;
|
||||
} while (bytes >= threshold);
|
||||
|
||||
var b = bytes.toFixed(1);
|
||||
if (isNaN(b)) b = '??';
|
||||
|
||||
return b + units[u];
|
||||
}
|
||||
104
www/node_modules/ecstatic/lib/ecstatic/status-handlers.js
generated
vendored
Normal file
104
www/node_modules/ecstatic/lib/ecstatic/status-handlers.js
generated
vendored
Normal file
@@ -0,0 +1,104 @@
|
||||
var he = require('he');
|
||||
|
||||
// not modified
|
||||
exports['304'] = function (res, next) {
|
||||
res.statusCode = 304;
|
||||
res.end();
|
||||
};
|
||||
|
||||
// access denied
|
||||
exports['403'] = function (res, next) {
|
||||
res.statusCode = 403;
|
||||
if (typeof next === "function") {
|
||||
next();
|
||||
}
|
||||
else {
|
||||
if (res.writable) {
|
||||
res.setHeader('content-type', 'text/plain');
|
||||
res.end('ACCESS DENIED');
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// disallowed method
|
||||
exports['405'] = function (res, next, opts) {
|
||||
res.statusCode = 405;
|
||||
if (typeof next === "function") {
|
||||
next();
|
||||
}
|
||||
else {
|
||||
res.setHeader('allow', (opts && opts.allow) || 'GET, HEAD');
|
||||
res.end();
|
||||
}
|
||||
};
|
||||
|
||||
// not found
|
||||
exports['404'] = function (res, next) {
|
||||
res.statusCode = 404;
|
||||
if (typeof next === "function") {
|
||||
next();
|
||||
}
|
||||
else {
|
||||
if (res.writable) {
|
||||
res.setHeader('content-type', 'text/plain');
|
||||
res.end('File not found. :(');
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
exports['416'] = function (res, next) {
|
||||
res.statusCode = 416;
|
||||
if (typeof next === "function") {
|
||||
next();
|
||||
}
|
||||
else {
|
||||
if (res.writable) {
|
||||
res.setHeader('content-type', 'text/plain');
|
||||
res.end('Requested range not satisfiable');
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// flagrant error
|
||||
exports['500'] = function (res, next, opts) {
|
||||
res.statusCode = 500;
|
||||
res.setHeader('content-type', 'text/html');
|
||||
var error = String(opts.error.stack || opts.error || "No specified error"),
|
||||
html = [
|
||||
'<!doctype html>',
|
||||
'<html>',
|
||||
' <head>',
|
||||
' <meta charset="utf-8">',
|
||||
' <title>500 Internal Server Error</title>',
|
||||
' </head>',
|
||||
' <body>',
|
||||
' <p>',
|
||||
' ' + he.encode(error),
|
||||
' </p>',
|
||||
' </body>',
|
||||
'</html>'
|
||||
].join('\n') + '\n';
|
||||
res.end(html);
|
||||
};
|
||||
|
||||
// bad request
|
||||
exports['400'] = function (res, next, opts) {
|
||||
res.statusCode = 400;
|
||||
res.setHeader('content-type', 'text/html');
|
||||
var error = opts && opts.error ? String(opts.error) : 'Malformed request.',
|
||||
html = [
|
||||
'<!doctype html>',
|
||||
'<html>',
|
||||
' <head>',
|
||||
' <meta charset="utf-8">',
|
||||
' <title>400 Bad Request</title>',
|
||||
' </head>',
|
||||
' <body>',
|
||||
' <p>',
|
||||
' ' + he.encode(error),
|
||||
' </p>',
|
||||
' </body>',
|
||||
'</html>'
|
||||
].join('\n') + '\n';
|
||||
res.end(html);
|
||||
};
|
||||
111
www/node_modules/ecstatic/package.json
generated
vendored
Normal file
111
www/node_modules/ecstatic/package.json
generated
vendored
Normal file
@@ -0,0 +1,111 @@
|
||||
{
|
||||
"_args": [
|
||||
[
|
||||
{
|
||||
"raw": "ecstatic@^1.4.0",
|
||||
"scope": null,
|
||||
"escapedName": "ecstatic",
|
||||
"name": "ecstatic",
|
||||
"rawSpec": "^1.4.0",
|
||||
"spec": ">=1.4.0 <2.0.0",
|
||||
"type": "range"
|
||||
},
|
||||
"/home/nau/MEGA/CODI/githubRepos/colspace/www/node_modules/http-server"
|
||||
]
|
||||
],
|
||||
"_from": "ecstatic@>=1.4.0 <2.0.0",
|
||||
"_id": "ecstatic@1.4.1",
|
||||
"_inCache": true,
|
||||
"_location": "/ecstatic",
|
||||
"_nodeVersion": "4.2.1",
|
||||
"_npmOperationalInternal": {
|
||||
"host": "packages-16-east.internal.npmjs.com",
|
||||
"tmp": "tmp/ecstatic-1.4.1.tgz_1462924279598_0.48026969679631293"
|
||||
},
|
||||
"_npmUser": {
|
||||
"name": "jfhbrook",
|
||||
"email": "josh.holbrook@gmail.com"
|
||||
},
|
||||
"_npmVersion": "2.14.16",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"raw": "ecstatic@^1.4.0",
|
||||
"scope": null,
|
||||
"escapedName": "ecstatic",
|
||||
"name": "ecstatic",
|
||||
"rawSpec": "^1.4.0",
|
||||
"spec": ">=1.4.0 <2.0.0",
|
||||
"type": "range"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/http-server"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/ecstatic/-/ecstatic-1.4.1.tgz",
|
||||
"_shasum": "32cb7b6fa2e290d58668674d115e8f0c3d567d6a",
|
||||
"_shrinkwrap": null,
|
||||
"_spec": "ecstatic@^1.4.0",
|
||||
"_where": "/home/nau/MEGA/CODI/githubRepos/colspace/www/node_modules/http-server",
|
||||
"author": {
|
||||
"name": "Joshua Holbrook",
|
||||
"email": "josh@nodejitsu.com",
|
||||
"url": "http://jesusabdullah.net"
|
||||
},
|
||||
"bin": {
|
||||
"ecstatic": "./lib/ecstatic.js"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/jfhbrook/node-ecstatic/issues"
|
||||
},
|
||||
"dependencies": {
|
||||
"he": "^0.5.0",
|
||||
"mime": "^1.2.11",
|
||||
"minimist": "^1.1.0",
|
||||
"url-join": "^1.0.0"
|
||||
},
|
||||
"description": "A simple static file server middleware that works with both Express and Flatiron",
|
||||
"devDependencies": {
|
||||
"eol": "^0.2.0",
|
||||
"express": "^4.12.3",
|
||||
"mkdirp": "^0.5.0",
|
||||
"request": "^2.49.0",
|
||||
"tap": "^5.7.0"
|
||||
},
|
||||
"directories": {},
|
||||
"dist": {
|
||||
"shasum": "32cb7b6fa2e290d58668674d115e8f0c3d567d6a",
|
||||
"tarball": "https://registry.npmjs.org/ecstatic/-/ecstatic-1.4.1.tgz"
|
||||
},
|
||||
"gitHead": "70751198635509a156ad1564296625fc753af89f",
|
||||
"homepage": "https://github.com/jfhbrook/node-ecstatic",
|
||||
"keywords": [
|
||||
"static",
|
||||
"web",
|
||||
"server",
|
||||
"files",
|
||||
"mime",
|
||||
"middleware"
|
||||
],
|
||||
"license": "MIT",
|
||||
"main": "./lib/ecstatic.js",
|
||||
"maintainers": [
|
||||
{
|
||||
"name": "jesusabdullah",
|
||||
"email": "josh.holbrook@gmail.com"
|
||||
},
|
||||
{
|
||||
"name": "jfhbrook",
|
||||
"email": "josh.holbrook@gmail.com"
|
||||
}
|
||||
],
|
||||
"name": "ecstatic",
|
||||
"optionalDependencies": {},
|
||||
"readme": "ERROR: No README data found!",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+ssh://git@github.com/jfhbrook/node-ecstatic.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "tap test/*.js"
|
||||
},
|
||||
"version": "1.4.1"
|
||||
}
|
||||
7
www/node_modules/ecstatic/test.js
generated
vendored
Normal file
7
www/node_modules/ecstatic/test.js
generated
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
var fs = require('fs');
|
||||
|
||||
var stat = fs.statSync('./package.json'); // or some other file
|
||||
|
||||
console.log(stat.mtime);
|
||||
console.log('' + stat.mtime);
|
||||
console.log(JSON.stringify(stat.mtime));
|
||||
21
www/node_modules/eventemitter3/LICENSE
generated
vendored
Normal file
21
www/node_modules/eventemitter3/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2014 Arnout Kazemier
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
89
www/node_modules/eventemitter3/README.md
generated
vendored
Normal file
89
www/node_modules/eventemitter3/README.md
generated
vendored
Normal file
@@ -0,0 +1,89 @@
|
||||
# EventEmitter3
|
||||
|
||||
[](http://browsenpm.org/package/eventemitter3)[](https://travis-ci.org/primus/eventemitter3)[](https://david-dm.org/primus/eventemitter3)[](https://coveralls.io/r/primus/eventemitter3?branch=master)[](https://webchat.freenode.net/?channels=primus)
|
||||
|
||||
[](https://saucelabs.com/u/eventemitter3)
|
||||
|
||||
EventEmitter3 is a high performance EventEmitter. It has been micro-optimized
|
||||
for various of code paths making this, one of, if not the fastest EventEmitter
|
||||
available for Node.js and browsers. The module is API compatible with the
|
||||
EventEmitter that ships by default with Node.js but there are some slight
|
||||
differences:
|
||||
|
||||
- Domain support has been removed.
|
||||
- We do not `throw` an error when you emit an `error` event and nobody is
|
||||
listening.
|
||||
- The `newListener` event is removed as the use-cases for this functionality are
|
||||
really just edge cases.
|
||||
- No `setMaxListeners` and it's pointless memory leak warnings. If you want to
|
||||
add `end` listeners you should be able to do that without modules complaining.
|
||||
- No `listenerCount` function. Use `EE.listeners(event).length` instead.
|
||||
- Support for custom context for events so there is no need to use `fn.bind`.
|
||||
- `listeners` method can do existence checking instead of returning only arrays.
|
||||
|
||||
It's a drop in replacement for existing EventEmitters, but just faster. Free
|
||||
performance, who wouldn't want that? The EventEmitter is written in EcmaScript 3
|
||||
so it will work in the oldest browsers and node versions that you need to
|
||||
support.
|
||||
|
||||
## Installation
|
||||
|
||||
```bash
|
||||
$ npm install --save eventemitter3 # npm
|
||||
$ component install primus/eventemitter3 # Component
|
||||
$ bower install eventemitter3 # Bower
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
After installation the only thing you need to do is require the module:
|
||||
|
||||
```js
|
||||
var EventEmitter = require('eventemitter3');
|
||||
```
|
||||
|
||||
And you're ready to create your own EventEmitter instances. For the API
|
||||
documentation, please follow the official Node.js documentation:
|
||||
|
||||
http://nodejs.org/api/events.html
|
||||
|
||||
### Contextual emits
|
||||
|
||||
We've upgraded the API of the `EventEmitter.on`, `EventEmitter.once` and
|
||||
`EventEmitter.removeListener` to accept an extra argument which is the `context`
|
||||
or `this` value that should be set for the emitted events. This means you no
|
||||
longer have the overhead of an event that required `fn.bind` in order to get a
|
||||
custom `this` value.
|
||||
|
||||
```js
|
||||
var EE = new EventEmitter()
|
||||
, context = { foo: 'bar' };
|
||||
|
||||
function emitted() {
|
||||
console.log(this === context); // true
|
||||
}
|
||||
|
||||
EE.once('event-name', emitted, context);
|
||||
EE.on('another-event', emitted, context);
|
||||
EE.removeListener('another-event', emitted, context);
|
||||
```
|
||||
|
||||
### Existence
|
||||
|
||||
To check if there is already a listener for a given event you can supply the
|
||||
`listeners` method with an extra boolean argument. This will transform the
|
||||
output from an array, to a boolean value which indicates if there are listeners
|
||||
in place for the given event:
|
||||
|
||||
```js
|
||||
var EE = new EventEmitter();
|
||||
EE.once('event-name', function () {});
|
||||
EE.on('another-event', function () {});
|
||||
|
||||
EE.listeners('event-name', true); // returns true
|
||||
EE.listeners('unknown-name', true); // returns false
|
||||
```
|
||||
|
||||
## License
|
||||
|
||||
[MIT](LICENSE)
|
||||
289
www/node_modules/eventemitter3/index.js
generated
vendored
Normal file
289
www/node_modules/eventemitter3/index.js
generated
vendored
Normal file
@@ -0,0 +1,289 @@
|
||||
'use strict';
|
||||
|
||||
var has = Object.prototype.hasOwnProperty;
|
||||
|
||||
//
|
||||
// We store our EE objects in a plain object whose properties are event names.
|
||||
// If `Object.create(null)` is not supported we prefix the event names with a
|
||||
// `~` to make sure that the built-in object properties are not overridden or
|
||||
// used as an attack vector.
|
||||
// We also assume that `Object.create(null)` is available when the event name
|
||||
// is an ES6 Symbol.
|
||||
//
|
||||
var prefix = typeof Object.create !== 'function' ? '~' : false;
|
||||
|
||||
/**
|
||||
* Representation of a single EventEmitter function.
|
||||
*
|
||||
* @param {Function} fn Event handler to be called.
|
||||
* @param {Mixed} context Context for function execution.
|
||||
* @param {Boolean} [once=false] Only emit once
|
||||
* @api private
|
||||
*/
|
||||
function EE(fn, context, once) {
|
||||
this.fn = fn;
|
||||
this.context = context;
|
||||
this.once = once || false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Minimal EventEmitter interface that is molded against the Node.js
|
||||
* EventEmitter interface.
|
||||
*
|
||||
* @constructor
|
||||
* @api public
|
||||
*/
|
||||
function EventEmitter() { /* Nothing to set */ }
|
||||
|
||||
/**
|
||||
* Hold the assigned EventEmitters by name.
|
||||
*
|
||||
* @type {Object}
|
||||
* @private
|
||||
*/
|
||||
EventEmitter.prototype._events = undefined;
|
||||
|
||||
/**
|
||||
* Return an array listing the events for which the emitter has registered
|
||||
* listeners.
|
||||
*
|
||||
* @returns {Array}
|
||||
* @api public
|
||||
*/
|
||||
EventEmitter.prototype.eventNames = function eventNames() {
|
||||
var events = this._events
|
||||
, names = []
|
||||
, name;
|
||||
|
||||
if (!events) return names;
|
||||
|
||||
for (name in events) {
|
||||
if (has.call(events, name)) names.push(prefix ? name.slice(1) : name);
|
||||
}
|
||||
|
||||
if (Object.getOwnPropertySymbols) {
|
||||
return names.concat(Object.getOwnPropertySymbols(events));
|
||||
}
|
||||
|
||||
return names;
|
||||
};
|
||||
|
||||
/**
|
||||
* Return a list of assigned event listeners.
|
||||
*
|
||||
* @param {String} event The events that should be listed.
|
||||
* @param {Boolean} exists We only need to know if there are listeners.
|
||||
* @returns {Array|Boolean}
|
||||
* @api public
|
||||
*/
|
||||
EventEmitter.prototype.listeners = function listeners(event, exists) {
|
||||
var evt = prefix ? prefix + event : event
|
||||
, available = this._events && this._events[evt];
|
||||
|
||||
if (exists) return !!available;
|
||||
if (!available) return [];
|
||||
if (available.fn) return [available.fn];
|
||||
|
||||
for (var i = 0, l = available.length, ee = new Array(l); i < l; i++) {
|
||||
ee[i] = available[i].fn;
|
||||
}
|
||||
|
||||
return ee;
|
||||
};
|
||||
|
||||
/**
|
||||
* Emit an event to all registered event listeners.
|
||||
*
|
||||
* @param {String} event The name of the event.
|
||||
* @returns {Boolean} Indication if we've emitted an event.
|
||||
* @api public
|
||||
*/
|
||||
EventEmitter.prototype.emit = function emit(event, a1, a2, a3, a4, a5) {
|
||||
var evt = prefix ? prefix + event : event;
|
||||
|
||||
if (!this._events || !this._events[evt]) return false;
|
||||
|
||||
var listeners = this._events[evt]
|
||||
, len = arguments.length
|
||||
, args
|
||||
, i;
|
||||
|
||||
if ('function' === typeof listeners.fn) {
|
||||
if (listeners.once) this.removeListener(event, listeners.fn, undefined, true);
|
||||
|
||||
switch (len) {
|
||||
case 1: return listeners.fn.call(listeners.context), true;
|
||||
case 2: return listeners.fn.call(listeners.context, a1), true;
|
||||
case 3: return listeners.fn.call(listeners.context, a1, a2), true;
|
||||
case 4: return listeners.fn.call(listeners.context, a1, a2, a3), true;
|
||||
case 5: return listeners.fn.call(listeners.context, a1, a2, a3, a4), true;
|
||||
case 6: return listeners.fn.call(listeners.context, a1, a2, a3, a4, a5), true;
|
||||
}
|
||||
|
||||
for (i = 1, args = new Array(len -1); i < len; i++) {
|
||||
args[i - 1] = arguments[i];
|
||||
}
|
||||
|
||||
listeners.fn.apply(listeners.context, args);
|
||||
} else {
|
||||
var length = listeners.length
|
||||
, j;
|
||||
|
||||
for (i = 0; i < length; i++) {
|
||||
if (listeners[i].once) this.removeListener(event, listeners[i].fn, undefined, true);
|
||||
|
||||
switch (len) {
|
||||
case 1: listeners[i].fn.call(listeners[i].context); break;
|
||||
case 2: listeners[i].fn.call(listeners[i].context, a1); break;
|
||||
case 3: listeners[i].fn.call(listeners[i].context, a1, a2); break;
|
||||
default:
|
||||
if (!args) for (j = 1, args = new Array(len -1); j < len; j++) {
|
||||
args[j - 1] = arguments[j];
|
||||
}
|
||||
|
||||
listeners[i].fn.apply(listeners[i].context, args);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
};
|
||||
|
||||
/**
|
||||
* Register a new EventListener for the given event.
|
||||
*
|
||||
* @param {String} event Name of the event.
|
||||
* @param {Function} fn Callback function.
|
||||
* @param {Mixed} [context=this] The context of the function.
|
||||
* @api public
|
||||
*/
|
||||
EventEmitter.prototype.on = function on(event, fn, context) {
|
||||
var listener = new EE(fn, context || this)
|
||||
, evt = prefix ? prefix + event : event;
|
||||
|
||||
if (!this._events) this._events = prefix ? {} : Object.create(null);
|
||||
if (!this._events[evt]) this._events[evt] = listener;
|
||||
else {
|
||||
if (!this._events[evt].fn) this._events[evt].push(listener);
|
||||
else this._events[evt] = [
|
||||
this._events[evt], listener
|
||||
];
|
||||
}
|
||||
|
||||
return this;
|
||||
};
|
||||
|
||||
/**
|
||||
* Add an EventListener that's only called once.
|
||||
*
|
||||
* @param {String} event Name of the event.
|
||||
* @param {Function} fn Callback function.
|
||||
* @param {Mixed} [context=this] The context of the function.
|
||||
* @api public
|
||||
*/
|
||||
EventEmitter.prototype.once = function once(event, fn, context) {
|
||||
var listener = new EE(fn, context || this, true)
|
||||
, evt = prefix ? prefix + event : event;
|
||||
|
||||
if (!this._events) this._events = prefix ? {} : Object.create(null);
|
||||
if (!this._events[evt]) this._events[evt] = listener;
|
||||
else {
|
||||
if (!this._events[evt].fn) this._events[evt].push(listener);
|
||||
else this._events[evt] = [
|
||||
this._events[evt], listener
|
||||
];
|
||||
}
|
||||
|
||||
return this;
|
||||
};
|
||||
|
||||
/**
|
||||
* Remove event listeners.
|
||||
*
|
||||
* @param {String} event The event we want to remove.
|
||||
* @param {Function} fn The listener that we need to find.
|
||||
* @param {Mixed} context Only remove listeners matching this context.
|
||||
* @param {Boolean} once Only remove once listeners.
|
||||
* @api public
|
||||
*/
|
||||
EventEmitter.prototype.removeListener = function removeListener(event, fn, context, once) {
|
||||
var evt = prefix ? prefix + event : event;
|
||||
|
||||
if (!this._events || !this._events[evt]) return this;
|
||||
|
||||
var listeners = this._events[evt]
|
||||
, events = [];
|
||||
|
||||
if (fn) {
|
||||
if (listeners.fn) {
|
||||
if (
|
||||
listeners.fn !== fn
|
||||
|| (once && !listeners.once)
|
||||
|| (context && listeners.context !== context)
|
||||
) {
|
||||
events.push(listeners);
|
||||
}
|
||||
} else {
|
||||
for (var i = 0, length = listeners.length; i < length; i++) {
|
||||
if (
|
||||
listeners[i].fn !== fn
|
||||
|| (once && !listeners[i].once)
|
||||
|| (context && listeners[i].context !== context)
|
||||
) {
|
||||
events.push(listeners[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Reset the array, or remove it completely if we have no more listeners.
|
||||
//
|
||||
if (events.length) {
|
||||
this._events[evt] = events.length === 1 ? events[0] : events;
|
||||
} else {
|
||||
delete this._events[evt];
|
||||
}
|
||||
|
||||
return this;
|
||||
};
|
||||
|
||||
/**
|
||||
* Remove all listeners or only the listeners for the specified event.
|
||||
*
|
||||
* @param {String} event The event want to remove all listeners for.
|
||||
* @api public
|
||||
*/
|
||||
EventEmitter.prototype.removeAllListeners = function removeAllListeners(event) {
|
||||
if (!this._events) return this;
|
||||
|
||||
if (event) delete this._events[prefix ? prefix + event : event];
|
||||
else this._events = prefix ? {} : Object.create(null);
|
||||
|
||||
return this;
|
||||
};
|
||||
|
||||
//
|
||||
// Alias methods names because people roll like that.
|
||||
//
|
||||
EventEmitter.prototype.off = EventEmitter.prototype.removeListener;
|
||||
EventEmitter.prototype.addListener = EventEmitter.prototype.on;
|
||||
|
||||
//
|
||||
// This function doesn't apply anymore.
|
||||
//
|
||||
EventEmitter.prototype.setMaxListeners = function setMaxListeners() {
|
||||
return this;
|
||||
};
|
||||
|
||||
//
|
||||
// Expose the prefix.
|
||||
//
|
||||
EventEmitter.prefixed = prefix;
|
||||
|
||||
//
|
||||
// Expose the module.
|
||||
//
|
||||
if ('undefined' !== typeof module) {
|
||||
module.exports = EventEmitter;
|
||||
}
|
||||
119
www/node_modules/eventemitter3/package.json
generated
vendored
Normal file
119
www/node_modules/eventemitter3/package.json
generated
vendored
Normal file
@@ -0,0 +1,119 @@
|
||||
{
|
||||
"_args": [
|
||||
[
|
||||
{
|
||||
"raw": "eventemitter3@1.x.x",
|
||||
"scope": null,
|
||||
"escapedName": "eventemitter3",
|
||||
"name": "eventemitter3",
|
||||
"rawSpec": "1.x.x",
|
||||
"spec": ">=1.0.0 <2.0.0",
|
||||
"type": "range"
|
||||
},
|
||||
"/home/nau/MEGA/CODI/githubRepos/colspace/www/node_modules/http-proxy"
|
||||
]
|
||||
],
|
||||
"_from": "eventemitter3@>=1.0.0 <2.0.0",
|
||||
"_id": "eventemitter3@1.2.0",
|
||||
"_inCache": true,
|
||||
"_location": "/eventemitter3",
|
||||
"_nodeVersion": "4.3.1",
|
||||
"_npmOperationalInternal": {
|
||||
"host": "packages-12-west.internal.npmjs.com",
|
||||
"tmp": "tmp/eventemitter3-1.2.0.tgz_1458148661717_0.1867425285745412"
|
||||
},
|
||||
"_npmUser": {
|
||||
"name": "3rdeden",
|
||||
"email": "npm@3rd-Eden.com"
|
||||
},
|
||||
"_npmVersion": "3.8.0",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"raw": "eventemitter3@1.x.x",
|
||||
"scope": null,
|
||||
"escapedName": "eventemitter3",
|
||||
"name": "eventemitter3",
|
||||
"rawSpec": "1.x.x",
|
||||
"spec": ">=1.0.0 <2.0.0",
|
||||
"type": "range"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/http-proxy"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-1.2.0.tgz",
|
||||
"_shasum": "1c86991d816ad1e504750e73874224ecf3bec508",
|
||||
"_shrinkwrap": null,
|
||||
"_spec": "eventemitter3@1.x.x",
|
||||
"_where": "/home/nau/MEGA/CODI/githubRepos/colspace/www/node_modules/http-proxy",
|
||||
"author": {
|
||||
"name": "Arnout Kazemier"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/primus/eventemitter3/issues"
|
||||
},
|
||||
"dependencies": {},
|
||||
"description": "EventEmitter3 focuses on performance while maintaining a Node.js AND browser compatible interface.",
|
||||
"devDependencies": {
|
||||
"assume": "1.3.x",
|
||||
"istanbul": "0.4.x",
|
||||
"mocha": "2.4.x",
|
||||
"pre-commit": "1.1.x",
|
||||
"zuul": "3.10.x"
|
||||
},
|
||||
"directories": {},
|
||||
"dist": {
|
||||
"shasum": "1c86991d816ad1e504750e73874224ecf3bec508",
|
||||
"tarball": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-1.2.0.tgz"
|
||||
},
|
||||
"gitHead": "c78d597fed80952c259b916c0a1f4dca91d940e4",
|
||||
"homepage": "https://github.com/primus/eventemitter3#readme",
|
||||
"keywords": [
|
||||
"EventEmitter",
|
||||
"EventEmitter2",
|
||||
"EventEmitter3",
|
||||
"Events",
|
||||
"addEventListener",
|
||||
"addListener",
|
||||
"emit",
|
||||
"emits",
|
||||
"emitter",
|
||||
"event",
|
||||
"once",
|
||||
"pub/sub",
|
||||
"publish",
|
||||
"reactor",
|
||||
"subscribe"
|
||||
],
|
||||
"license": "MIT",
|
||||
"main": "index.js",
|
||||
"maintainers": [
|
||||
{
|
||||
"name": "v1",
|
||||
"email": "npm@3rd-Eden.com"
|
||||
},
|
||||
{
|
||||
"name": "3rdeden",
|
||||
"email": "npm@3rd-Eden.com"
|
||||
},
|
||||
{
|
||||
"name": "lpinca",
|
||||
"email": "luigipinca@gmail.com"
|
||||
}
|
||||
],
|
||||
"name": "eventemitter3",
|
||||
"optionalDependencies": {},
|
||||
"pre-commit": "sync, test",
|
||||
"readme": "ERROR: No README data found!",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/primus/eventemitter3.git"
|
||||
},
|
||||
"scripts": {
|
||||
"coverage": "istanbul cover _mocha -- test.js",
|
||||
"sync": "node versions.js",
|
||||
"test": "mocha test.js",
|
||||
"test-browser": "zuul -- test.js",
|
||||
"test-node": "istanbul cover _mocha --report lcovonly -- test.js"
|
||||
},
|
||||
"version": "1.2.0"
|
||||
}
|
||||
20
www/node_modules/he/LICENSE-MIT.txt
generated
vendored
Normal file
20
www/node_modules/he/LICENSE-MIT.txt
generated
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
Copyright Mathias Bynens <https://mathiasbynens.be/>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
"Software"), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sublicense, and/or sell copies of the Software, and to
|
||||
permit persons to whom the Software is furnished to do so, subject to
|
||||
the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
336
www/node_modules/he/README.md
generated
vendored
Normal file
336
www/node_modules/he/README.md
generated
vendored
Normal file
@@ -0,0 +1,336 @@
|
||||
# he [](https://travis-ci.org/mathiasbynens/he) [](https://coveralls.io/r/mathiasbynens/he) [](https://gemnasium.com/mathiasbynens/he)
|
||||
|
||||
_he_ (for “HTML entities”) is a robust HTML entity encoder/decoder written in JavaScript. It supports [all standardized named character references as per HTML](http://www.whatwg.org/specs/web-apps/current-work/multipage/named-character-references.html), handles [ambiguous ampersands](https://mathiasbynens.be/notes/ambiguous-ampersands) and other edge cases [just like a browser would](http://www.whatwg.org/specs/web-apps/current-work/multipage/tokenization.html#tokenizing-character-references), has an extensive test suite, and — contrary to many other JavaScript solutions — _he_ handles astral Unicode symbols just fine. [An online demo is available.](http://mothereff.in/html-entities)
|
||||
|
||||
## Installation
|
||||
|
||||
Via [npm](http://npmjs.org/):
|
||||
|
||||
```bash
|
||||
npm install he
|
||||
```
|
||||
|
||||
Via [Bower](http://bower.io/):
|
||||
|
||||
```bash
|
||||
bower install he
|
||||
```
|
||||
|
||||
Via [Component](https://github.com/component/component):
|
||||
|
||||
```bash
|
||||
component install mathiasbynens/he
|
||||
```
|
||||
|
||||
In a browser:
|
||||
|
||||
```html
|
||||
<script src="he.js"></script>
|
||||
```
|
||||
|
||||
In [Narwhal](http://narwhaljs.org/), [Node.js](http://nodejs.org/), and [RingoJS](http://ringojs.org/):
|
||||
|
||||
```js
|
||||
var he = require('he');
|
||||
```
|
||||
|
||||
In [Rhino](http://www.mozilla.org/rhino/):
|
||||
|
||||
```js
|
||||
load('he.js');
|
||||
```
|
||||
|
||||
Using an AMD loader like [RequireJS](http://requirejs.org/):
|
||||
|
||||
```js
|
||||
require(
|
||||
{
|
||||
'paths': {
|
||||
'he': 'path/to/he'
|
||||
}
|
||||
},
|
||||
['he'],
|
||||
function(he) {
|
||||
console.log(he);
|
||||
}
|
||||
);
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
### `he.version`
|
||||
|
||||
A string representing the semantic version number.
|
||||
|
||||
### `he.encode(text, options)`
|
||||
|
||||
This function takes a string of text and encodes (by default) any symbols that aren’t printable ASCII symbols and `&`, `<`, `>`, `"`, `'`, and `` ` ``, replacing them with character references.
|
||||
|
||||
```js
|
||||
he.encode('foo © bar ≠ baz 𝌆 qux');
|
||||
// → 'foo © bar ≠ baz 𝌆 qux'
|
||||
```
|
||||
|
||||
As long as the input string contains [allowed code points](http://www.whatwg.org/specs/web-apps/current-work/multipage/parsing.html#preprocessing-the-input-stream) only, the return value of this function is always valid HTML. Any [(invalid) code points that cannot be represented using a character reference](http://www.whatwg.org/specs/web-apps/current-work/multipage/tokenization.html#table-charref-overrides) in the input are not encoded.
|
||||
|
||||
```js
|
||||
he.encode('foo \0 bar');
|
||||
// → 'foo \0 bar'
|
||||
```
|
||||
|
||||
The `options` object is optional. It recognizes the following properties:
|
||||
|
||||
#### `useNamedReferences`
|
||||
|
||||
The default value for the `useNamedReferences` option is `false`. This means that `encode()` will not use any named character references (e.g. `©`) in the output — hexadecimal escapes (e.g. `©`) will be used instead. Set it to `true` to enable the use of named references.
|
||||
|
||||
**Note that if compatibility with older browsers is a concern, this option should remain disabled.**
|
||||
|
||||
```js
|
||||
// Using the global default setting (defaults to `false`):
|
||||
he.encode('foo © bar ≠ baz 𝌆 qux');
|
||||
// → 'foo © bar ≠ baz 𝌆 qux'
|
||||
|
||||
// Passing an `options` object to `encode`, to explicitly disallow named references:
|
||||
he.encode('foo © bar ≠ baz 𝌆 qux', {
|
||||
'useNamedReferences': false
|
||||
});
|
||||
// → 'foo © bar ≠ baz 𝌆 qux'
|
||||
|
||||
// Passing an `options` object to `encode`, to explicitly allow named references:
|
||||
he.encode('foo © bar ≠ baz 𝌆 qux', {
|
||||
'useNamedReferences': true
|
||||
});
|
||||
// → 'foo © bar ≠ baz 𝌆 qux'
|
||||
```
|
||||
|
||||
#### `encodeEverything`
|
||||
|
||||
The default value for the `encodeEverything` option is `false`. This means that `encode()` will not use any character references for printable ASCII symbols that don’t need escaping. Set it to `true` to encode every symbol in the input string. When set to `true`, this option takes precedence over `allowUnsafeSymbols` (i.e. setting the latter to `true` in such a case has no effect).
|
||||
|
||||
```js
|
||||
// Using the global default setting (defaults to `false`):
|
||||
he.encode('foo © bar ≠ baz 𝌆 qux');
|
||||
// → 'foo © bar ≠ baz 𝌆 qux'
|
||||
|
||||
// Passing an `options` object to `encode`, to explicitly encode all symbols:
|
||||
he.encode('foo © bar ≠ baz 𝌆 qux', {
|
||||
'encodeEverything': true
|
||||
});
|
||||
// → 'foo © bar ≠ baz 𝌆 qux'
|
||||
|
||||
// This setting can be combined with the `useNamedReferences` option:
|
||||
he.encode('foo © bar ≠ baz 𝌆 qux', {
|
||||
'encodeEverything': true,
|
||||
'useNamedReferences': true
|
||||
});
|
||||
// → 'foo © bar ≠ baz 𝌆 qux'
|
||||
```
|
||||
|
||||
#### `strict`
|
||||
|
||||
The default value for the `strict` option is `false`. This means that `encode()` will encode any HTML text content you feed it, even if it contains any symbols that cause [parse errors](http://www.whatwg.org/specs/web-apps/current-work/multipage/parsing.html#preprocessing-the-input-stream). To throw an error when such invalid HTML is encountered, set the `strict` option to `true`. This option makes it possible to use _he_ as part of HTML parsers and HTML validators.
|
||||
|
||||
```js
|
||||
// Using the global default setting (defaults to `false`, i.e. error-tolerant mode):
|
||||
he.encode('\x01');
|
||||
// → ''
|
||||
|
||||
// Passing an `options` object to `encode`, to explicitly enable error-tolerant mode:
|
||||
he.encode('\x01', {
|
||||
'strict': false
|
||||
});
|
||||
// → ''
|
||||
|
||||
// Passing an `options` object to `encode`, to explicitly enable strict mode:
|
||||
he.encode('\x01', {
|
||||
'strict': true
|
||||
});
|
||||
// → Parse error
|
||||
```
|
||||
|
||||
#### `allowUnsafeSymbols`
|
||||
|
||||
The default value for the `allowUnsafeSymbols` option is `false`. This means that characters that are unsafe for use in HTML content (`&`, `<`, `>`, `"`, `'`, and `` ` ``) will be encoded. When set to `true`, only non-ASCII characters will be encoded. If the `encodeEverything` option is set to `true`, this option will be ignored.
|
||||
|
||||
```js
|
||||
he.encode('foo © and & ampersand', {
|
||||
'allowUnsafeSymbols': true
|
||||
});
|
||||
// → 'foo © and & ampersand'
|
||||
```
|
||||
|
||||
#### Overriding default `encode` options globally
|
||||
|
||||
The global default setting can be overridden by modifying the `he.encode.options` object. This saves you from passing in an `options` object for every call to `encode` if you want to use the non-default setting.
|
||||
|
||||
```js
|
||||
// Read the global default setting:
|
||||
he.encode.options.useNamedReferences;
|
||||
// → `false` by default
|
||||
|
||||
// Override the global default setting:
|
||||
he.encode.options.useNamedReferences = true;
|
||||
|
||||
// Using the global default setting, which is now `true`:
|
||||
he.encode('foo © bar ≠ baz 𝌆 qux');
|
||||
// → 'foo © bar ≠ baz 𝌆 qux'
|
||||
```
|
||||
|
||||
### `he.decode(html, options)`
|
||||
|
||||
This function takes a string of HTML and decodes any named and numerical character references in it using [the algorithm described in section 12.2.4.69 of the HTML spec](http://www.whatwg.org/specs/web-apps/current-work/multipage/tokenization.html#tokenizing-character-references).
|
||||
|
||||
```js
|
||||
he.decode('foo © bar ≠ baz 𝌆 qux');
|
||||
// → 'foo © bar ≠ baz 𝌆 qux'
|
||||
```
|
||||
|
||||
The `options` object is optional. It recognizes the following properties:
|
||||
|
||||
#### `isAttributeValue`
|
||||
|
||||
The default value for the `isAttributeValue` option is `false`. This means that `decode()` will decode the string as if it were used in [a text context in an HTML document](http://www.whatwg.org/specs/web-apps/current-work/multipage/tokenization.html#data-state). HTML has different rules for [parsing character references in attribute values](http://www.whatwg.org/specs/web-apps/current-work/multipage/tokenization.html#character-reference-in-attribute-value-state) — set this option to `true` to treat the input string as if it were used as an attribute value.
|
||||
|
||||
```js
|
||||
// Using the global default setting (defaults to `false`, i.e. HTML text context):
|
||||
he.decode('foo&bar');
|
||||
// → 'foo&bar'
|
||||
|
||||
// Passing an `options` object to `decode`, to explicitly assume an HTML text context:
|
||||
he.decode('foo&bar', {
|
||||
'isAttributeValue': false
|
||||
});
|
||||
// → 'foo&bar'
|
||||
|
||||
// Passing an `options` object to `decode`, to explicitly assume an HTML attribute value context:
|
||||
he.decode('foo&bar', {
|
||||
'isAttributeValue': true
|
||||
});
|
||||
// → 'foo&bar'
|
||||
```
|
||||
|
||||
#### `strict`
|
||||
|
||||
The default value for the `strict` option is `false`. This means that `decode()` will decode any HTML text content you feed it, even if it contains any entities that cause [parse errors](http://www.whatwg.org/specs/web-apps/current-work/multipage/tokenization.html#tokenizing-character-references). To throw an error when such invalid HTML is encountered, set the `strict` option to `true`. This option makes it possible to use _he_ as part of HTML parsers and HTML validators.
|
||||
|
||||
```js
|
||||
// Using the global default setting (defaults to `false`, i.e. error-tolerant mode):
|
||||
he.decode('foo&bar');
|
||||
// → 'foo&bar'
|
||||
|
||||
// Passing an `options` object to `decode`, to explicitly enable error-tolerant mode:
|
||||
he.decode('foo&bar', {
|
||||
'strict': false
|
||||
});
|
||||
// → 'foo&bar'
|
||||
|
||||
// Passing an `options` object to `decode`, to explicitly enable strict mode:
|
||||
he.decode('foo&bar', {
|
||||
'strict': true
|
||||
});
|
||||
// → Parse error
|
||||
```
|
||||
|
||||
#### Overriding default `decode` options globally
|
||||
|
||||
The global default settings for the `decode` function can be overridden by modifying the `he.decode.options` object. This saves you from passing in an `options` object for every call to `decode` if you want to use a non-default setting.
|
||||
|
||||
```js
|
||||
// Read the global default setting:
|
||||
he.decode.options.isAttributeValue;
|
||||
// → `false` by default
|
||||
|
||||
// Override the global default setting:
|
||||
he.decode.options.isAttributeValue = true;
|
||||
|
||||
// Using the global default setting, which is now `true`:
|
||||
he.decode('foo&bar');
|
||||
// → 'foo&bar'
|
||||
```
|
||||
|
||||
### `he.escape(text)`
|
||||
|
||||
This function takes a string of text and escapes it for use in text contexts in XML or HTML documents. Only the following characters are escaped: `&`, `<`, `>`, `"`, `'`, and `` ` ``.
|
||||
|
||||
```js
|
||||
he.escape('<img src=\'x\' onerror="prompt(1)">');
|
||||
// → '<img src='x' onerror="prompt(1)">'
|
||||
```
|
||||
|
||||
### `he.unescape(html, options)`
|
||||
|
||||
`he.unescape` is an alias for `he.decode`. It takes a string of HTML and decodes any named and numerical character references in it.
|
||||
|
||||
### Using the `he` binary
|
||||
|
||||
To use the `he` binary in your shell, simply install _he_ globally using npm:
|
||||
|
||||
```bash
|
||||
npm install -g he
|
||||
```
|
||||
|
||||
After that you will be able to encode/decode HTML entities from the command line:
|
||||
|
||||
```bash
|
||||
$ he --encode 'föo ♥ bår 𝌆 baz'
|
||||
föo ♥ bår 𝌆 baz
|
||||
|
||||
$ he --encode --use-named-refs 'föo ♥ bår 𝌆 baz'
|
||||
föo ♥ bår 𝌆 baz
|
||||
|
||||
$ he --decode 'föo ♥ bår 𝌆 baz'
|
||||
föo ♥ bår 𝌆 baz
|
||||
```
|
||||
|
||||
Read a local text file, encode it for use in an HTML text context, and save the result to a new file:
|
||||
|
||||
```bash
|
||||
$ he --encode < foo.txt > foo-escaped.html
|
||||
```
|
||||
|
||||
Or do the same with an online text file:
|
||||
|
||||
```bash
|
||||
$ curl -sL "http://git.io/HnfEaw" | he --encode > escaped.html
|
||||
```
|
||||
|
||||
Or, the opposite — read a local file containing a snippet of HTML in a text context, decode it back to plain text, and save the result to a new file:
|
||||
|
||||
```bash
|
||||
$ he --decode < foo-escaped.html > foo.txt
|
||||
```
|
||||
|
||||
Or do the same with an online HTML snippet:
|
||||
|
||||
```bash
|
||||
$ curl -sL "http://git.io/HnfEaw" | he --decode > decoded.txt
|
||||
```
|
||||
|
||||
See `he --help` for the full list of options.
|
||||
|
||||
## Support
|
||||
|
||||
he has been tested in at least Chrome 27-29, Firefox 3-22, Safari 4-6, Opera 10-12, IE 6-10, Node.js v0.10.0, Narwhal 0.3.2, RingoJS 0.8-0.9, PhantomJS 1.9.0, and Rhino 1.7RC4.
|
||||
|
||||
## Unit tests & code coverage
|
||||
|
||||
After cloning this repository, run `npm install` to install the dependencies needed for he development and testing. You may want to install Istanbul _globally_ using `npm install istanbul -g`.
|
||||
|
||||
Once that’s done, you can run the unit tests in Node using `npm test` or `node tests/tests.js`. To run the tests in Rhino, Ringo, Narwhal, and web browsers as well, use `grunt test`.
|
||||
|
||||
To generate the code coverage report, use `grunt cover`.
|
||||
|
||||
## Acknowledgements
|
||||
|
||||
Thanks to [Simon Pieters](http://simon.html5.org/) ([@zcorpan](https://twitter.com/zcorpan)) for the many suggestions.
|
||||
|
||||
## Author
|
||||
|
||||
| [](https://twitter.com/mathias "Follow @mathias on Twitter") |
|
||||
|---|
|
||||
| [Mathias Bynens](https://mathiasbynens.be/) |
|
||||
|
||||
## License
|
||||
|
||||
_he_ is available under the [MIT](http://mths.be/mit) license.
|
||||
143
www/node_modules/he/bin/he
generated
vendored
Executable file
143
www/node_modules/he/bin/he
generated
vendored
Executable file
@@ -0,0 +1,143 @@
|
||||
#!/usr/bin/env node
|
||||
(function() {
|
||||
|
||||
var fs = require('fs');
|
||||
var he = require('../he.js');
|
||||
var strings = process.argv.splice(2);
|
||||
var stdin = process.stdin;
|
||||
var data;
|
||||
var timeout;
|
||||
var action;
|
||||
var options = {};
|
||||
var log = console.log;
|
||||
|
||||
var main = function() {
|
||||
var option = strings[0];
|
||||
var count = 0;
|
||||
|
||||
if (/^(?:-h|--help|undefined)$/.test(option)) {
|
||||
log(
|
||||
'he v%s - http://mths.be/he',
|
||||
he.version
|
||||
);
|
||||
log([
|
||||
'\nUsage:\n',
|
||||
'\the [--escape] string',
|
||||
'\the [--encode] [--use-named-refs] [--everything] [--allow-unsafe] string',
|
||||
'\the [--decode] [--attribute] [--strict] string',
|
||||
'\the [-v | --version]',
|
||||
'\the [-h | --help]',
|
||||
'\nExamples:\n',
|
||||
'\the --escape \\<img\\ src\\=\\\'x\\\'\\ onerror\\=\\"prompt\\(1\\)\\"\\>',
|
||||
'\techo \'© 𝌆\' | he --decode'
|
||||
].join('\n'));
|
||||
return process.exit(1);
|
||||
}
|
||||
|
||||
if (/^(?:-v|--version)$/.test(option)) {
|
||||
log('v%s', he.version);
|
||||
return process.exit(1);
|
||||
}
|
||||
|
||||
strings.forEach(function(string) {
|
||||
// Process options
|
||||
if (string == '--escape') {
|
||||
action = 'escape';
|
||||
return;
|
||||
}
|
||||
if (string == '--encode') {
|
||||
action = 'encode';
|
||||
return;
|
||||
}
|
||||
if (string == '--use-named-refs') {
|
||||
action = 'encode';
|
||||
options.useNamedReferences = true;
|
||||
return;
|
||||
}
|
||||
if (string == '--everything') {
|
||||
action = 'encode';
|
||||
options.encodeEverything = true;
|
||||
return;
|
||||
}
|
||||
if (string == '--allow-unsafe') {
|
||||
action = 'encode';
|
||||
options.allowUnsafeSymbols = true;
|
||||
return;
|
||||
}
|
||||
if (string == '--decode') {
|
||||
action = 'decode';
|
||||
return;
|
||||
}
|
||||
if (string == '--attribute') {
|
||||
action = 'decode';
|
||||
options.isAttributeValue = true;
|
||||
return;
|
||||
}
|
||||
if (string == '--strict') {
|
||||
action = 'decode';
|
||||
options.strict = true;
|
||||
return;
|
||||
}
|
||||
// Process string(s)
|
||||
var result;
|
||||
if (!action) {
|
||||
log('Error: he requires at least one option and a string argument.');
|
||||
log('Try `he --help` for more information.');
|
||||
return process.exit(1);
|
||||
}
|
||||
try {
|
||||
result = he[action](string, options);
|
||||
log(result);
|
||||
count++;
|
||||
} catch(error) {
|
||||
log(error.message + '\n');
|
||||
log('Error: failed to %s.', action);
|
||||
log('If you think this is a bug in he, please report it:');
|
||||
log('https://github.com/mathiasbynens/he/issues/new');
|
||||
log(
|
||||
'\nStack trace using he@%s:\n',
|
||||
he.version
|
||||
);
|
||||
log(error.stack);
|
||||
return process.exit(1);
|
||||
}
|
||||
});
|
||||
if (!count) {
|
||||
log('Error: he requires a string argument.');
|
||||
log('Try `he --help` for more information.');
|
||||
return process.exit(1);
|
||||
}
|
||||
// Return with exit status 0 outside of the `forEach` loop, in case
|
||||
// multiple strings were passed in.
|
||||
return process.exit(0);
|
||||
};
|
||||
|
||||
if (stdin.isTTY) {
|
||||
// handle shell arguments
|
||||
main();
|
||||
} else {
|
||||
// Either the script is called from within a non-TTY context, or `stdin`
|
||||
// content is being piped in.
|
||||
if (!process.stdout.isTTY) {
|
||||
// The script was called from a non-TTY context. This is a rather uncommon
|
||||
// use case we don’t actively support. However, we don’t want the script
|
||||
// to wait forever in such cases, so…
|
||||
timeout = setTimeout(function() {
|
||||
// …if no piped data arrived after a whole minute, handle shell
|
||||
// arguments instead.
|
||||
main();
|
||||
}, 60000);
|
||||
}
|
||||
data = '';
|
||||
stdin.on('data', function(chunk) {
|
||||
clearTimeout(timeout);
|
||||
data += chunk;
|
||||
});
|
||||
stdin.on('end', function() {
|
||||
strings.push(data.trim());
|
||||
main();
|
||||
});
|
||||
stdin.resume();
|
||||
}
|
||||
|
||||
}());
|
||||
329
www/node_modules/he/he.js
generated
vendored
Normal file
329
www/node_modules/he/he.js
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
78
www/node_modules/he/man/he.1
generated
vendored
Normal file
78
www/node_modules/he/man/he.1
generated
vendored
Normal file
@@ -0,0 +1,78 @@
|
||||
.Dd July 27, 2013
|
||||
.Dt he 1
|
||||
.Sh NAME
|
||||
.Nm he
|
||||
.Nd encode/decode HTML entities just like a browser would
|
||||
.Sh SYNOPSIS
|
||||
.Nm
|
||||
.Op Fl -escape Ar string
|
||||
.br
|
||||
.Op Fl -encode Ar string
|
||||
.br
|
||||
.Op Fl -encode Fl -use-named-refs Fl -everything Fl -allow-unsafe Ar string
|
||||
.br
|
||||
.Op Fl -decode Ar string
|
||||
.br
|
||||
.Op Fl -decode Fl -attribute Ar string
|
||||
.br
|
||||
.Op Fl -decode Fl -strict Ar string
|
||||
.br
|
||||
.Op Fl v | -version
|
||||
.br
|
||||
.Op Fl h | -help
|
||||
.Sh DESCRIPTION
|
||||
.Nm
|
||||
encodes/decodes HTML entities in strings just like a browser would.
|
||||
.Sh OPTIONS
|
||||
.Bl -ohang -offset
|
||||
.It Sy "--escape"
|
||||
Take a string of text and escape it for use in text contexts in XML or HTML documents. Only the following characters are escaped: `&`, `<`, `>`, `"`, and `'`.
|
||||
.It Sy "--encode"
|
||||
Take a string of text and encode any symbols that aren't printable ASCII symbols and that can be replaced with character references. For example, it would turn `©` into `©`, but it wouldn't turn `+` into `+` since there is no point in doing so. Additionally, it replaces any remaining non-ASCII symbols with a hexadecimal escape sequence (e.g. `𝌆`). The return value of this function is always valid HTML.
|
||||
.It Sy "--encode --use-named-refs"
|
||||
Enable the use of named character references (like `©`) in the output. If compatibility with older browsers is a concern, don't use this option.
|
||||
.It Sy "--encode --everything"
|
||||
Encode every symbol in the input string, even safe printable ASCII symbols.
|
||||
.It Sy "--encode --allow-unsafe"
|
||||
Encode non-ASCII characters only. This leaves unsafe HTML/XML symbols like `&`, `<`, `>`, `"`, and `'` intact.
|
||||
.It Sy "--decode"
|
||||
Takes a string of HTML and decode any named and numerical character references in it using the algorithm described in the HTML spec.
|
||||
.It Sy "--decode --attribute"
|
||||
Parse the input as if it was an HTML attribute value rather than a string in an HTML text content.
|
||||
.It Sy "--decode --strict"
|
||||
Throw an error if an invalid character reference is encountered.
|
||||
.It Sy "-v, --version"
|
||||
Print he's version.
|
||||
.It Sy "-h, --help"
|
||||
Show the help screen.
|
||||
.El
|
||||
.Sh EXIT STATUS
|
||||
The
|
||||
.Nm he
|
||||
utility exits with one of the following values:
|
||||
.Pp
|
||||
.Bl -tag -width flag -compact
|
||||
.It Li 0
|
||||
.Nm
|
||||
successfully encoded/decoded the input and printed the result.
|
||||
.It Li 1
|
||||
.Nm
|
||||
wasn't instructed to encode/decode anything (for example, the
|
||||
.Ar --help
|
||||
flag was set); or, an error occurred.
|
||||
.El
|
||||
.Sh EXAMPLES
|
||||
.Bl -ohang -offset
|
||||
.It Sy "he --escape '<script>alert(1)</script>'"
|
||||
Print an escaped version of the given string that is safe for use in HTML text contexts, escaping only `&`, `<`, `>`, `"`, and `'`.
|
||||
.It Sy "he --decode '©𝌆'"
|
||||
Print the decoded version of the given HTML string.
|
||||
.It Sy "echo\ '©𝌆'\ |\ he --decode"
|
||||
Print the decoded version of the HTML string that gets piped in.
|
||||
.El
|
||||
.Sh BUGS
|
||||
he's bug tracker is located at <https://github.com/mathiasbynens/he/issues>.
|
||||
.Sh AUTHOR
|
||||
Mathias Bynens <https://mathiasbynens.be/>
|
||||
.Sh WWW
|
||||
<http://mths.be/he>
|
||||
116
www/node_modules/he/package.json
generated
vendored
Normal file
116
www/node_modules/he/package.json
generated
vendored
Normal file
@@ -0,0 +1,116 @@
|
||||
{
|
||||
"_args": [
|
||||
[
|
||||
{
|
||||
"raw": "he@^0.5.0",
|
||||
"scope": null,
|
||||
"escapedName": "he",
|
||||
"name": "he",
|
||||
"rawSpec": "^0.5.0",
|
||||
"spec": ">=0.5.0 <0.6.0",
|
||||
"type": "range"
|
||||
},
|
||||
"/home/nau/MEGA/CODI/githubRepos/colspace/www/node_modules/ecstatic"
|
||||
]
|
||||
],
|
||||
"_from": "he@>=0.5.0 <0.6.0",
|
||||
"_id": "he@0.5.0",
|
||||
"_inCache": true,
|
||||
"_location": "/he",
|
||||
"_npmUser": {
|
||||
"name": "mathias",
|
||||
"email": "mathias@qiwi.be"
|
||||
},
|
||||
"_npmVersion": "1.4.9",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"raw": "he@^0.5.0",
|
||||
"scope": null,
|
||||
"escapedName": "he",
|
||||
"name": "he",
|
||||
"rawSpec": "^0.5.0",
|
||||
"spec": ">=0.5.0 <0.6.0",
|
||||
"type": "range"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/ecstatic"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/he/-/he-0.5.0.tgz",
|
||||
"_shasum": "2c05ffaef90b68e860f3fd2b54ef580989277ee2",
|
||||
"_shrinkwrap": null,
|
||||
"_spec": "he@^0.5.0",
|
||||
"_where": "/home/nau/MEGA/CODI/githubRepos/colspace/www/node_modules/ecstatic",
|
||||
"author": {
|
||||
"name": "Mathias Bynens",
|
||||
"url": "https://mathiasbynens.be/"
|
||||
},
|
||||
"bin": {
|
||||
"he": "bin/he"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/mathiasbynens/he/issues"
|
||||
},
|
||||
"dependencies": {},
|
||||
"description": "A robust HTML entities encoder/decoder with full Unicode support.",
|
||||
"devDependencies": {
|
||||
"coveralls": "^2.11.1",
|
||||
"grunt": "^0.4.5",
|
||||
"grunt-shell": "^1.0.1",
|
||||
"grunt-template": "^0.2.3",
|
||||
"istanbul": "^0.3.0",
|
||||
"jsesc": "^0.5.0",
|
||||
"lodash": "^2.4.1",
|
||||
"qunit-extras": "^1.1.0",
|
||||
"qunitjs": "~1.11.0",
|
||||
"regenerate": "^0.6.2",
|
||||
"requirejs": "^2.1.14",
|
||||
"string.fromcodepoint": "^0.2.1"
|
||||
},
|
||||
"directories": {
|
||||
"bin": "bin",
|
||||
"man": "man",
|
||||
"test": "tests"
|
||||
},
|
||||
"dist": {
|
||||
"shasum": "2c05ffaef90b68e860f3fd2b54ef580989277ee2",
|
||||
"tarball": "https://registry.npmjs.org/he/-/he-0.5.0.tgz"
|
||||
},
|
||||
"files": [
|
||||
"LICENSE-MIT.txt",
|
||||
"he.js",
|
||||
"bin/",
|
||||
"man/"
|
||||
],
|
||||
"homepage": "http://mths.be/he",
|
||||
"keywords": [
|
||||
"string",
|
||||
"entities",
|
||||
"entity",
|
||||
"html",
|
||||
"encode",
|
||||
"decode",
|
||||
"unicode"
|
||||
],
|
||||
"license": "MIT",
|
||||
"main": "he.js",
|
||||
"maintainers": [
|
||||
{
|
||||
"name": "mathias",
|
||||
"email": "mathias@qiwi.be"
|
||||
}
|
||||
],
|
||||
"man": [
|
||||
"/Users/mathias/.npm/he/0.5.0/package/man/he.1"
|
||||
],
|
||||
"name": "he",
|
||||
"optionalDependencies": {},
|
||||
"readme": "ERROR: No README data found!",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/mathiasbynens/he.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "node tests/tests.js"
|
||||
},
|
||||
"version": "0.5.0"
|
||||
}
|
||||
7
www/node_modules/http-proxy/.npmignore
generated
vendored
Normal file
7
www/node_modules/http-proxy/.npmignore
generated
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
test
|
||||
examples
|
||||
doc
|
||||
benchmark
|
||||
.travis.yml
|
||||
CHANGELOG.md
|
||||
UPGRADING.md
|
||||
23
www/node_modules/http-proxy/LICENSE
generated
vendored
Normal file
23
www/node_modules/http-proxy/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
|
||||
node-http-proxy
|
||||
|
||||
Copyright (c) 2010-2016 Charlie Robbins, Jarrett Cruger & the Contributors.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
"Software"), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sublicense, and/or sell copies of the Software, and to
|
||||
permit persons to whom the Software is furnished to do so, subject to
|
||||
the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
493
www/node_modules/http-proxy/README.md
generated
vendored
Normal file
493
www/node_modules/http-proxy/README.md
generated
vendored
Normal file
@@ -0,0 +1,493 @@
|
||||
<p align="center">
|
||||
<img src="https://raw.github.com/nodejitsu/node-http-proxy/master/doc/logo.png"/>
|
||||
</p>
|
||||
|
||||
node-http-proxy
|
||||
=======
|
||||
|
||||
<p align="left">
|
||||
<a href="https://travis-ci.org/nodejitsu/node-http-proxy" target="_blank">
|
||||
<img src="https://travis-ci.org/nodejitsu/node-http-proxy.png"/></a>
|
||||
<a href="https://coveralls.io/r/nodejitsu/node-http-proxy" target="_blank">
|
||||
<img src="https://coveralls.io/repos/nodejitsu/node-http-proxy/badge.png"/></a>
|
||||
</p>
|
||||
|
||||
`node-http-proxy` is an HTTP programmable proxying library that supports
|
||||
websockets. It is suitable for implementing components such as reverse
|
||||
proxies and load balancers.
|
||||
|
||||
### Table of Contents
|
||||
* [Installation](#installation)
|
||||
* [Upgrading from 0.8.x ?](#upgrading-from-08x-)
|
||||
* [Core Concept](#core-concept)
|
||||
* [Use Cases](#use-cases)
|
||||
* [Setup a basic stand-alone proxy server](#setup-a-basic-stand-alone-proxy-server)
|
||||
* [Setup a stand-alone proxy server with custom server logic](#setup-a-stand-alone-proxy-server-with-custom-server-logic)
|
||||
* [Setup a stand-alone proxy server with proxy request header re-writing](#setup-a-stand-alone-proxy-server-with-proxy-request-header-re-writing)
|
||||
* [Modify a response from a proxied server](#modify-a-response-from-a-proxied-server)
|
||||
* [Setup a stand-alone proxy server with latency](#setup-a-stand-alone-proxy-server-with-latency)
|
||||
* [Using HTTPS](#using-https)
|
||||
* [Proxying WebSockets](#proxying-websockets)
|
||||
* [Options](#options)
|
||||
* [Listening for proxy events](#listening-for-proxy-events)
|
||||
* [Shutdown](#shutdown)
|
||||
* [Miscellaneous](#miscellaneous)
|
||||
* [Test](#test)
|
||||
* [ProxyTable API](#proxytable-api)
|
||||
* [Logo](#logo)
|
||||
* [Contributing and Issues](#contributing-and-issues)
|
||||
* [License](#license)
|
||||
|
||||
### Installation
|
||||
|
||||
`npm install http-proxy --save`
|
||||
|
||||
**[Back to top](#table-of-contents)**
|
||||
|
||||
### Upgrading from 0.8.x ?
|
||||
|
||||
Click [here](UPGRADING.md)
|
||||
|
||||
**[Back to top](#table-of-contents)**
|
||||
|
||||
### Core Concept
|
||||
|
||||
A new proxy is created by calling `createProxyServer` and passing
|
||||
an `options` object as argument ([valid properties are available here](lib/http-proxy.js#L33-L50))
|
||||
|
||||
```javascript
|
||||
var httpProxy = require('http-proxy');
|
||||
|
||||
var proxy = httpProxy.createProxyServer(options); // See (†)
|
||||
```
|
||||
†Unless listen(..) is invoked on the object, this does not create a webserver. See below.
|
||||
|
||||
An object will be returned with four methods:
|
||||
|
||||
* web `req, res, [options]` (used for proxying regular HTTP(S) requests)
|
||||
* ws `req, socket, head, [options]` (used for proxying WS(S) requests)
|
||||
* listen `port` (a function that wraps the object in a webserver, for your convenience)
|
||||
* close `[callback]` (a function that closes the inner webserver and stops listening on given port)
|
||||
|
||||
It is then possible to proxy requests by calling these functions
|
||||
|
||||
```javascript
|
||||
http.createServer(function(req, res) {
|
||||
proxy.web(req, res, { target: 'http://mytarget.com:8080' });
|
||||
});
|
||||
```
|
||||
|
||||
Errors can be listened on either using the Event Emitter API
|
||||
|
||||
```javascript
|
||||
proxy.on('error', function(e) {
|
||||
...
|
||||
});
|
||||
```
|
||||
|
||||
or using the callback API
|
||||
|
||||
```javascript
|
||||
proxy.web(req, res, { target: 'http://mytarget.com:8080' }, function(e) { ... });
|
||||
```
|
||||
|
||||
When a request is proxied it follows two different pipelines ([available here](lib/http-proxy/passes))
|
||||
which apply transformations to both the `req` and `res` object.
|
||||
The first pipeline (incoming) is responsible for the creation and manipulation of the stream that connects your client to the target.
|
||||
The second pipeline (outgoing) is responsible for the creation and manipulation of the stream that, from your target, returns data
|
||||
to the client.
|
||||
|
||||
**[Back to top](#table-of-contents)**
|
||||
|
||||
### Use Cases
|
||||
|
||||
#### Setup a basic stand-alone proxy server
|
||||
|
||||
```js
|
||||
var http = require('http'),
|
||||
httpProxy = require('http-proxy');
|
||||
//
|
||||
// Create your proxy server and set the target in the options.
|
||||
//
|
||||
httpProxy.createProxyServer({target:'http://localhost:9000'}).listen(8000); // See (†)
|
||||
|
||||
//
|
||||
// Create your target server
|
||||
//
|
||||
http.createServer(function (req, res) {
|
||||
res.writeHead(200, { 'Content-Type': 'text/plain' });
|
||||
res.write('request successfully proxied!' + '\n' + JSON.stringify(req.headers, true, 2));
|
||||
res.end();
|
||||
}).listen(9000);
|
||||
```
|
||||
†Invoking listen(..) triggers the creation of a web server. Otherwise, just the proxy instance is created.
|
||||
|
||||
**[Back to top](#table-of-contents)**
|
||||
|
||||
#### Setup a stand-alone proxy server with custom server logic
|
||||
This example show how you can proxy a request using your own HTTP server
|
||||
and also you can put your own logic to handle the request.
|
||||
|
||||
```js
|
||||
var http = require('http'),
|
||||
httpProxy = require('http-proxy');
|
||||
|
||||
//
|
||||
// Create a proxy server with custom application logic
|
||||
//
|
||||
var proxy = httpProxy.createProxyServer({});
|
||||
|
||||
//
|
||||
// Create your custom server and just call `proxy.web()` to proxy
|
||||
// a web request to the target passed in the options
|
||||
// also you can use `proxy.ws()` to proxy a websockets request
|
||||
//
|
||||
var server = http.createServer(function(req, res) {
|
||||
// You can define here your custom logic to handle the request
|
||||
// and then proxy the request.
|
||||
proxy.web(req, res, { target: 'http://127.0.0.1:5060' });
|
||||
});
|
||||
|
||||
console.log("listening on port 5050")
|
||||
server.listen(5050);
|
||||
```
|
||||
|
||||
**[Back to top](#table-of-contents)**
|
||||
|
||||
#### Setup a stand-alone proxy server with proxy request header re-writing
|
||||
This example shows how you can proxy a request using your own HTTP server that
|
||||
modifies the outgoing proxy request by adding a special header.
|
||||
|
||||
```js
|
||||
var http = require('http'),
|
||||
httpProxy = require('http-proxy');
|
||||
|
||||
//
|
||||
// Create a proxy server with custom application logic
|
||||
//
|
||||
var proxy = httpProxy.createProxyServer({});
|
||||
|
||||
// To modify the proxy connection before data is sent, you can listen
|
||||
// for the 'proxyReq' event. When the event is fired, you will receive
|
||||
// the following arguments:
|
||||
// (http.ClientRequest proxyReq, http.IncomingMessage req,
|
||||
// http.ServerResponse res, Object options). This mechanism is useful when
|
||||
// you need to modify the proxy request before the proxy connection
|
||||
// is made to the target.
|
||||
//
|
||||
proxy.on('proxyReq', function(proxyReq, req, res, options) {
|
||||
proxyReq.setHeader('X-Special-Proxy-Header', 'foobar');
|
||||
});
|
||||
|
||||
var server = http.createServer(function(req, res) {
|
||||
// You can define here your custom logic to handle the request
|
||||
// and then proxy the request.
|
||||
proxy.web(req, res, {
|
||||
target: 'http://127.0.0.1:5060'
|
||||
});
|
||||
});
|
||||
|
||||
console.log("listening on port 5050")
|
||||
server.listen(5050);
|
||||
```
|
||||
|
||||
**[Back to top](#table-of-contents)**
|
||||
|
||||
#### Modify a response from a proxied server
|
||||
Sometimes when you have received a HTML/XML document from the server of origin you would like to modify it before forwarding it on.
|
||||
|
||||
[Harmon](https://github.com/No9/harmon) allows you to do this in a streaming style so as to keep the pressure on the proxy to a minimum.
|
||||
|
||||
**[Back to top](#table-of-contents)**
|
||||
|
||||
#### Setup a stand-alone proxy server with latency
|
||||
|
||||
```js
|
||||
var http = require('http'),
|
||||
httpProxy = require('http-proxy');
|
||||
|
||||
//
|
||||
// Create a proxy server with latency
|
||||
//
|
||||
var proxy = httpProxy.createProxyServer();
|
||||
|
||||
//
|
||||
// Create your server that makes an operation that waits a while
|
||||
// and then proxies the request
|
||||
//
|
||||
http.createServer(function (req, res) {
|
||||
// This simulates an operation that takes 500ms to execute
|
||||
setTimeout(function () {
|
||||
proxy.web(req, res, {
|
||||
target: 'http://localhost:9008'
|
||||
});
|
||||
}, 500);
|
||||
}).listen(8008);
|
||||
|
||||
//
|
||||
// Create your target server
|
||||
//
|
||||
http.createServer(function (req, res) {
|
||||
res.writeHead(200, { 'Content-Type': 'text/plain' });
|
||||
res.write('request successfully proxied to: ' + req.url + '\n' + JSON.stringify(req.headers, true, 2));
|
||||
res.end();
|
||||
}).listen(9008);
|
||||
```
|
||||
|
||||
**[Back to top](#table-of-contents)**
|
||||
|
||||
#### Using HTTPS
|
||||
You can activate the validation of a secure SSL certificate to the target connection (avoid self signed certs), just set `secure: true` in the options.
|
||||
|
||||
##### HTTPS -> HTTP
|
||||
|
||||
```js
|
||||
//
|
||||
// Create the HTTPS proxy server in front of a HTTP server
|
||||
//
|
||||
httpProxy.createServer({
|
||||
target: {
|
||||
host: 'localhost',
|
||||
port: 9009
|
||||
},
|
||||
ssl: {
|
||||
key: fs.readFileSync('valid-ssl-key.pem', 'utf8'),
|
||||
cert: fs.readFileSync('valid-ssl-cert.pem', 'utf8')
|
||||
}
|
||||
}).listen(8009);
|
||||
```
|
||||
|
||||
##### HTTPS -> HTTPS
|
||||
|
||||
```js
|
||||
//
|
||||
// Create the proxy server listening on port 443
|
||||
//
|
||||
httpProxy.createServer({
|
||||
ssl: {
|
||||
key: fs.readFileSync('valid-ssl-key.pem', 'utf8'),
|
||||
cert: fs.readFileSync('valid-ssl-cert.pem', 'utf8')
|
||||
},
|
||||
target: 'https://localhost:9010',
|
||||
secure: true // Depends on your needs, could be false.
|
||||
}).listen(443);
|
||||
```
|
||||
|
||||
**[Back to top](#table-of-contents)**
|
||||
|
||||
#### Proxying WebSockets
|
||||
You can activate the websocket support for the proxy using `ws:true` in the options.
|
||||
|
||||
```js
|
||||
//
|
||||
// Create a proxy server for websockets
|
||||
//
|
||||
httpProxy.createServer({
|
||||
target: 'ws://localhost:9014',
|
||||
ws: true
|
||||
}).listen(8014);
|
||||
```
|
||||
|
||||
Also you can proxy the websocket requests just calling the `ws(req, socket, head)` method.
|
||||
|
||||
```js
|
||||
//
|
||||
// Setup our server to proxy standard HTTP requests
|
||||
//
|
||||
var proxy = new httpProxy.createProxyServer({
|
||||
target: {
|
||||
host: 'localhost',
|
||||
port: 9015
|
||||
}
|
||||
});
|
||||
var proxyServer = http.createServer(function (req, res) {
|
||||
proxy.web(req, res);
|
||||
});
|
||||
|
||||
//
|
||||
// Listen to the `upgrade` event and proxy the
|
||||
// WebSocket requests as well.
|
||||
//
|
||||
proxyServer.on('upgrade', function (req, socket, head) {
|
||||
proxy.ws(req, socket, head);
|
||||
});
|
||||
|
||||
proxyServer.listen(8015);
|
||||
```
|
||||
|
||||
**[Back to top](#table-of-contents)**
|
||||
|
||||
### Options
|
||||
|
||||
`httpProxy.createProxyServer` supports the following options:
|
||||
|
||||
* **target**: url string to be parsed with the url module
|
||||
* **forward**: url string to be parsed with the url module
|
||||
* **agent**: object to be passed to http(s).request (see Node's [https agent](http://nodejs.org/api/https.html#https_class_https_agent) and [http agent](http://nodejs.org/api/http.html#http_class_http_agent) objects)
|
||||
* **ssl**: object to be passed to https.createServer()
|
||||
* **ws**: true/false, if you want to proxy websockets
|
||||
* **xfwd**: true/false, adds x-forward headers
|
||||
* **secure**: true/false, if you want to verify the SSL Certs
|
||||
* **toProxy**: true/false, passes the absolute URL as the `path` (useful for proxying to proxies)
|
||||
* **prependPath**: true/false, Default: true - specify whether you want to prepend the target's path to the proxy path
|
||||
* **ignorePath**: true/false, Default: false - specify whether you want to ignore the proxy path of the incoming request (note: you will have to append / manually if required).
|
||||
* **localAddress**: Local interface string to bind for outgoing connections
|
||||
* **changeOrigin**: true/false, Default: false - changes the origin of the host header to the target URL
|
||||
* **preserveHeaderKeyCase**: true/false, Default: false - specify whether you want to keep letter case of response header key
|
||||
* **auth**: Basic authentication i.e. 'user:password' to compute an Authorization header.
|
||||
* **hostRewrite**: rewrites the location hostname on (201/301/302/307/308) redirects.
|
||||
* **autoRewrite**: rewrites the location host/port on (201/301/302/307/308) redirects based on requested host/port. Default: false.
|
||||
* **protocolRewrite**: rewrites the location protocol on (201/301/302/307/308) redirects to 'http' or 'https'. Default: null.
|
||||
* **cookieDomainRewrite**: rewrites domain of `set-cookie` headers. Possible values:
|
||||
* `false` (default): disable cookie rewriting
|
||||
* String: new domain, for example `cookieDomainRewrite: "new.domain"`. To remove the domain, use `cookieDomainRewrite: ""`.
|
||||
* Object: mapping of domains to new domains, use `"*"` to match all domains.
|
||||
For example keep one domain unchanged, rewrite one domain and remove other domains:
|
||||
```
|
||||
cookieDomainRewrite: {
|
||||
"unchanged.domain": "unchanged.domain",
|
||||
"old.domain": "new.domain",
|
||||
"*": ""
|
||||
}
|
||||
```
|
||||
* **headers**: object with extra headers to be added to target requests.
|
||||
* **proxyTimeout**: timeout (in millis) when proxy receives no response from target
|
||||
|
||||
**NOTE:**
|
||||
`options.ws` and `options.ssl` are optional.
|
||||
`options.target` and `options.forward` cannot both be missing
|
||||
|
||||
If you are using the `proxyServer.listen` method, the following options are also applicable:
|
||||
|
||||
* **ssl**: object to be passed to https.createServer()
|
||||
* **ws**: true/false, if you want to proxy websockets
|
||||
|
||||
**[Back to top](#table-of-contents)**
|
||||
|
||||
### Listening for proxy events
|
||||
|
||||
* `error`: The error event is emitted if the request to the target fail. **We do not do any error handling of messages passed between client and proxy, and messages passed between proxy and target, so it is recommended that you listen on errors and handle them.**
|
||||
* `proxyReq`: This event is emitted before the data is sent. It gives you a chance to alter the proxyReq request object. Applies to "web" connections
|
||||
* `proxyReqWs`: This event is emitted before the data is sent. It gives you a chance to alter the proxyReq request object. Applies to "websocket" connections
|
||||
* `proxyRes`: This event is emitted if the request to the target got a response.
|
||||
* `open`: This event is emitted once the proxy websocket was created and piped into the target websocket.
|
||||
* `close`: This event is emitted once the proxy websocket was closed.
|
||||
* (DEPRECATED) `proxySocket`: Deprecated in favor of `open`.
|
||||
|
||||
```js
|
||||
var httpProxy = require('http-proxy');
|
||||
// Error example
|
||||
//
|
||||
// Http Proxy Server with bad target
|
||||
//
|
||||
var proxy = httpProxy.createServer({
|
||||
target:'http://localhost:9005'
|
||||
});
|
||||
|
||||
proxy.listen(8005);
|
||||
|
||||
//
|
||||
// Listen for the `error` event on `proxy`.
|
||||
proxy.on('error', function (err, req, res) {
|
||||
res.writeHead(500, {
|
||||
'Content-Type': 'text/plain'
|
||||
});
|
||||
|
||||
res.end('Something went wrong. And we are reporting a custom error message.');
|
||||
});
|
||||
|
||||
//
|
||||
// Listen for the `proxyRes` event on `proxy`.
|
||||
//
|
||||
proxy.on('proxyRes', function (proxyRes, req, res) {
|
||||
console.log('RAW Response from the target', JSON.stringify(proxyRes.headers, true, 2));
|
||||
});
|
||||
|
||||
//
|
||||
// Listen for the `open` event on `proxy`.
|
||||
//
|
||||
proxy.on('open', function (proxySocket) {
|
||||
// listen for messages coming FROM the target here
|
||||
proxySocket.on('data', hybiParseAndLogMessage);
|
||||
});
|
||||
|
||||
//
|
||||
// Listen for the `close` event on `proxy`.
|
||||
//
|
||||
proxy.on('close', function (res, socket, head) {
|
||||
// view disconnected websocket connections
|
||||
console.log('Client disconnected');
|
||||
});
|
||||
```
|
||||
|
||||
**[Back to top](#table-of-contents)**
|
||||
|
||||
### Shutdown
|
||||
|
||||
* When testing or running server within another program it may be necessary to close the proxy.
|
||||
* This will stop the proxy from accepting new connections.
|
||||
|
||||
```js
|
||||
var proxy = new httpProxy.createProxyServer({
|
||||
target: {
|
||||
host: 'localhost',
|
||||
port: 1337
|
||||
}
|
||||
});
|
||||
|
||||
proxy.close();
|
||||
```
|
||||
|
||||
**[Back to top](#table-of-contents)**
|
||||
|
||||
### Miscellaneous
|
||||
|
||||
#### ProxyTable API
|
||||
|
||||
A proxy table API is available through this add-on [module](https://github.com/donasaur/http-proxy-rules), which lets you define a set of rules to translate matching routes to target routes that the reverse proxy will talk to.
|
||||
|
||||
#### Test
|
||||
|
||||
```
|
||||
$ npm test
|
||||
```
|
||||
|
||||
#### Logo
|
||||
|
||||
Logo created by [Diego Pasquali](http://dribbble.com/diegopq)
|
||||
|
||||
**[Back to top](#table-of-contents)**
|
||||
|
||||
### Contributing and Issues
|
||||
|
||||
* Search on Google/Github
|
||||
* If you can't find anything, open an issue
|
||||
* If you feel comfortable about fixing the issue, fork the repo
|
||||
* Commit to your local branch (which must be different from `master`)
|
||||
* Submit your Pull Request (be sure to include tests and update documentation)
|
||||
|
||||
**[Back to top](#table-of-contents)**
|
||||
|
||||
### License
|
||||
|
||||
>The MIT License (MIT)
|
||||
>
|
||||
>Copyright (c) 2010 - 2016 Charlie Robbins, Jarrett Cruger & the Contributors.
|
||||
>
|
||||
>Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
>of this software and associated documentation files (the "Software"), to deal
|
||||
>in the Software without restriction, including without limitation the rights
|
||||
>to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
>copies of the Software, and to permit persons to whom the Software is
|
||||
>furnished to do so, subject to the following conditions:
|
||||
>
|
||||
>The above copyright notice and this permission notice shall be included in
|
||||
>all copies or substantial portions of the Software.
|
||||
>
|
||||
>THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
>IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
>FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
>AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
>LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
>OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
>THE SOFTWARE.
|
||||
13
www/node_modules/http-proxy/index.js
generated
vendored
Normal file
13
www/node_modules/http-proxy/index.js
generated
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
/*!
|
||||
* Caron dimonio, con occhi di bragia
|
||||
* loro accennando, tutte le raccoglie;
|
||||
* batte col remo qualunque s’adagia
|
||||
*
|
||||
* Charon the demon, with the eyes of glede,
|
||||
* Beckoning to them, collects them all together,
|
||||
* Beats with his oar whoever lags behind
|
||||
*
|
||||
* Dante - The Divine Comedy (Canto III)
|
||||
*/
|
||||
|
||||
module.exports = require('./lib/http-proxy');
|
||||
66
www/node_modules/http-proxy/lib/http-proxy.js
generated
vendored
Normal file
66
www/node_modules/http-proxy/lib/http-proxy.js
generated
vendored
Normal file
@@ -0,0 +1,66 @@
|
||||
// Use explicit /index.js to help browserify negociation in require '/lib/http-proxy' (!)
|
||||
var ProxyServer = require('./http-proxy/index.js').Server;
|
||||
|
||||
|
||||
/**
|
||||
* Creates the proxy server.
|
||||
*
|
||||
* Examples:
|
||||
*
|
||||
* httpProxy.createProxyServer({ .. }, 8000)
|
||||
* // => '{ web: [Function], ws: [Function] ... }'
|
||||
*
|
||||
* @param {Object} Options Config object passed to the proxy
|
||||
*
|
||||
* @return {Object} Proxy Proxy object with handlers for `ws` and `web` requests
|
||||
*
|
||||
* @api public
|
||||
*/
|
||||
|
||||
|
||||
function createProxyServer(options) {
|
||||
/*
|
||||
* `options` is needed and it must have the following layout:
|
||||
*
|
||||
* {
|
||||
* target : <url string to be parsed with the url module>
|
||||
* forward: <url string to be parsed with the url module>
|
||||
* agent : <object to be passed to http(s).request>
|
||||
* ssl : <object to be passed to https.createServer()>
|
||||
* ws : <true/false, if you want to proxy websockets>
|
||||
* xfwd : <true/false, adds x-forward headers>
|
||||
* secure : <true/false, verify SSL certificate>
|
||||
* toProxy: <true/false, explicitly specify if we are proxying to another proxy>
|
||||
* prependPath: <true/false, Default: true - specify whether you want to prepend the target's path to the proxy path>
|
||||
* ignorePath: <true/false, Default: false - specify whether you want to ignore the proxy path of the incoming request>
|
||||
* localAddress : <Local interface string to bind for outgoing connections>
|
||||
* changeOrigin: <true/false, Default: false - changes the origin of the host header to the target URL>
|
||||
* preserveHeaderKeyCase: <true/false, Default: false - specify whether you want to keep letter case of response header key >
|
||||
* auth : Basic authentication i.e. 'user:password' to compute an Authorization header.
|
||||
* hostRewrite: rewrites the location hostname on (301/302/307/308) redirects, Default: null.
|
||||
* autoRewrite: rewrites the location host/port on (301/302/307/308) redirects based on requested host/port. Default: false.
|
||||
* protocolRewrite: rewrites the location protocol on (301/302/307/308) redirects to 'http' or 'https'. Default: null.
|
||||
* }
|
||||
*
|
||||
* NOTE: `options.ws` and `options.ssl` are optional.
|
||||
* `options.target and `options.forward` cannot be
|
||||
* both missing
|
||||
* }
|
||||
*/
|
||||
|
||||
return new ProxyServer(options);
|
||||
}
|
||||
|
||||
|
||||
ProxyServer.createProxyServer = createProxyServer;
|
||||
ProxyServer.createServer = createProxyServer;
|
||||
ProxyServer.createProxy = createProxyServer;
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Export the proxy "Server" as the main export.
|
||||
*/
|
||||
module.exports = ProxyServer;
|
||||
|
||||
249
www/node_modules/http-proxy/lib/http-proxy/common.js
generated
vendored
Normal file
249
www/node_modules/http-proxy/lib/http-proxy/common.js
generated
vendored
Normal file
@@ -0,0 +1,249 @@
|
||||
var common = exports,
|
||||
url = require('url'),
|
||||
extend = require('util')._extend,
|
||||
required = require('requires-port');
|
||||
|
||||
var upgradeHeader = /(^|,)\s*upgrade\s*($|,)/i,
|
||||
isSSL = /^https|wss/,
|
||||
cookieDomainRegex = /(;\s*domain=)([^;]+)/i;
|
||||
|
||||
/**
|
||||
* Simple Regex for testing if protocol is https
|
||||
*/
|
||||
common.isSSL = isSSL;
|
||||
/**
|
||||
* Copies the right headers from `options` and `req` to
|
||||
* `outgoing` which is then used to fire the proxied
|
||||
* request.
|
||||
*
|
||||
* Examples:
|
||||
*
|
||||
* common.setupOutgoing(outgoing, options, req)
|
||||
* // => { host: ..., hostname: ...}
|
||||
*
|
||||
* @param {Object} Outgoing Base object to be filled with required properties
|
||||
* @param {Object} Options Config object passed to the proxy
|
||||
* @param {ClientRequest} Req Request Object
|
||||
* @param {String} Forward String to select forward or target
|
||||
*
|
||||
* @return {Object} Outgoing Object with all required properties set
|
||||
*
|
||||
* @api private
|
||||
*/
|
||||
|
||||
common.setupOutgoing = function(outgoing, options, req, forward) {
|
||||
outgoing.port = options[forward || 'target'].port ||
|
||||
(isSSL.test(options[forward || 'target'].protocol) ? 443 : 80);
|
||||
|
||||
['host', 'hostname', 'socketPath', 'pfx', 'key',
|
||||
'passphrase', 'cert', 'ca', 'ciphers', 'secureProtocol'].forEach(
|
||||
function(e) { outgoing[e] = options[forward || 'target'][e]; }
|
||||
);
|
||||
|
||||
outgoing.method = req.method;
|
||||
outgoing.headers = extend({}, req.headers);
|
||||
|
||||
if (options.headers){
|
||||
extend(outgoing.headers, options.headers);
|
||||
}
|
||||
|
||||
if (options.auth) {
|
||||
outgoing.auth = options.auth;
|
||||
}
|
||||
|
||||
if (options.ca) {
|
||||
outgoing.ca = options.ca;
|
||||
}
|
||||
|
||||
if (isSSL.test(options[forward || 'target'].protocol)) {
|
||||
outgoing.rejectUnauthorized = (typeof options.secure === "undefined") ? true : options.secure;
|
||||
}
|
||||
|
||||
|
||||
outgoing.agent = options.agent || false;
|
||||
outgoing.localAddress = options.localAddress;
|
||||
|
||||
//
|
||||
// Remark: If we are false and not upgrading, set the connection: close. This is the right thing to do
|
||||
// as node core doesn't handle this COMPLETELY properly yet.
|
||||
//
|
||||
if (!outgoing.agent) {
|
||||
outgoing.headers = outgoing.headers || {};
|
||||
if (typeof outgoing.headers.connection !== 'string'
|
||||
|| !upgradeHeader.test(outgoing.headers.connection)
|
||||
) { outgoing.headers.connection = 'close'; }
|
||||
}
|
||||
|
||||
|
||||
// the final path is target path + relative path requested by user:
|
||||
var target = options[forward || 'target'];
|
||||
var targetPath = target && options.prependPath !== false
|
||||
? (target.path || '')
|
||||
: '';
|
||||
|
||||
//
|
||||
// Remark: Can we somehow not use url.parse as a perf optimization?
|
||||
//
|
||||
var outgoingPath = !options.toProxy
|
||||
? (url.parse(req.url).path || '')
|
||||
: req.url;
|
||||
|
||||
//
|
||||
// Remark: ignorePath will just straight up ignore whatever the request's
|
||||
// path is. This can be labeled as FOOT-GUN material if you do not know what
|
||||
// you are doing and are using conflicting options.
|
||||
//
|
||||
outgoingPath = !options.ignorePath ? outgoingPath : '';
|
||||
|
||||
outgoing.path = common.urlJoin(targetPath, outgoingPath);
|
||||
|
||||
if (options.changeOrigin) {
|
||||
outgoing.headers.host =
|
||||
required(outgoing.port, options[forward || 'target'].protocol) && !hasPort(outgoing.host)
|
||||
? outgoing.host + ':' + outgoing.port
|
||||
: outgoing.host;
|
||||
}
|
||||
return outgoing;
|
||||
};
|
||||
|
||||
/**
|
||||
* Set the proper configuration for sockets,
|
||||
* set no delay and set keep alive, also set
|
||||
* the timeout to 0.
|
||||
*
|
||||
* Examples:
|
||||
*
|
||||
* common.setupSocket(socket)
|
||||
* // => Socket
|
||||
*
|
||||
* @param {Socket} Socket instance to setup
|
||||
*
|
||||
* @return {Socket} Return the configured socket.
|
||||
*
|
||||
* @api private
|
||||
*/
|
||||
|
||||
common.setupSocket = function(socket) {
|
||||
socket.setTimeout(0);
|
||||
socket.setNoDelay(true);
|
||||
|
||||
socket.setKeepAlive(true, 0);
|
||||
|
||||
return socket;
|
||||
};
|
||||
|
||||
/**
|
||||
* Get the port number from the host. Or guess it based on the connection type.
|
||||
*
|
||||
* @param {Request} req Incoming HTTP request.
|
||||
*
|
||||
* @return {String} The port number.
|
||||
*
|
||||
* @api private
|
||||
*/
|
||||
common.getPort = function(req) {
|
||||
var res = req.headers.host ? req.headers.host.match(/:(\d+)/) : '';
|
||||
|
||||
return res ?
|
||||
res[1] :
|
||||
common.hasEncryptedConnection(req) ? '443' : '80';
|
||||
};
|
||||
|
||||
/**
|
||||
* Check if the request has an encrypted connection.
|
||||
*
|
||||
* @param {Request} req Incoming HTTP request.
|
||||
*
|
||||
* @return {Boolean} Whether the connection is encrypted or not.
|
||||
*
|
||||
* @api private
|
||||
*/
|
||||
common.hasEncryptedConnection = function(req) {
|
||||
return Boolean(req.connection.encrypted || req.connection.pair);
|
||||
};
|
||||
|
||||
/**
|
||||
* OS-agnostic join (doesn't break on URLs like path.join does on Windows)>
|
||||
*
|
||||
* @return {String} The generated path.
|
||||
*
|
||||
* @api private
|
||||
*/
|
||||
|
||||
common.urlJoin = function() {
|
||||
//
|
||||
// We do not want to mess with the query string. All we want to touch is the path.
|
||||
//
|
||||
var args = Array.prototype.slice.call(arguments),
|
||||
lastIndex = args.length - 1,
|
||||
last = args[lastIndex],
|
||||
lastSegs = last.split('?'),
|
||||
retSegs;
|
||||
|
||||
args[lastIndex] = lastSegs.shift();
|
||||
|
||||
//
|
||||
// Join all strings, but remove empty strings so we don't get extra slashes from
|
||||
// joining e.g. ['', 'am']
|
||||
//
|
||||
retSegs = [
|
||||
args.filter(Boolean).join('/')
|
||||
.replace(/\/+/g, '/')
|
||||
.replace('http:/', 'http://')
|
||||
.replace('https:/', 'https://')
|
||||
];
|
||||
|
||||
// Only join the query string if it exists so we don't have trailing a '?'
|
||||
// on every request
|
||||
|
||||
// Handle case where there could be multiple ? in the URL.
|
||||
retSegs.push.apply(retSegs, lastSegs);
|
||||
|
||||
return retSegs.join('?')
|
||||
};
|
||||
|
||||
/**
|
||||
* Rewrites or removes the domain of a cookie header
|
||||
*
|
||||
* @param {String|Array} Header
|
||||
* @param {Object} Config, mapping of domain to rewritten domain.
|
||||
* '*' key to match any domain, null value to remove the domain.
|
||||
*
|
||||
* @api private
|
||||
*/
|
||||
common.rewriteCookieDomain = function rewriteCookieDomain(header, config) {
|
||||
if (Array.isArray(header)) {
|
||||
return header.map(function (headerElement) {
|
||||
return rewriteCookieDomain(headerElement, config);
|
||||
});
|
||||
}
|
||||
return header.replace(cookieDomainRegex, function(match, prefix, previousDomain) {
|
||||
var newDomain;
|
||||
if (previousDomain in config) {
|
||||
newDomain = config[previousDomain];
|
||||
} else if ('*' in config) {
|
||||
newDomain = config['*'];
|
||||
} else {
|
||||
//no match, return previous domain
|
||||
return match;
|
||||
}
|
||||
if (newDomain) {
|
||||
//replace domain
|
||||
return prefix + newDomain;
|
||||
} else {
|
||||
//remove domain
|
||||
return '';
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Check the host and see if it potentially has a port in it (keep it simple)
|
||||
*
|
||||
* @returns {Boolean} Whether we have one or not
|
||||
*
|
||||
* @api private
|
||||
*/
|
||||
function hasPort(host) {
|
||||
return !!~host.indexOf(':');
|
||||
};
|
||||
184
www/node_modules/http-proxy/lib/http-proxy/index.js
generated
vendored
Normal file
184
www/node_modules/http-proxy/lib/http-proxy/index.js
generated
vendored
Normal file
@@ -0,0 +1,184 @@
|
||||
var httpProxy = module.exports,
|
||||
extend = require('util')._extend,
|
||||
parse_url = require('url').parse,
|
||||
EE3 = require('eventemitter3'),
|
||||
http = require('http'),
|
||||
https = require('https'),
|
||||
web = require('./passes/web-incoming'),
|
||||
ws = require('./passes/ws-incoming');
|
||||
|
||||
httpProxy.Server = ProxyServer;
|
||||
|
||||
/**
|
||||
* Returns a function that creates the loader for
|
||||
* either `ws` or `web`'s passes.
|
||||
*
|
||||
* Examples:
|
||||
*
|
||||
* httpProxy.createRightProxy('ws')
|
||||
* // => [Function]
|
||||
*
|
||||
* @param {String} Type Either 'ws' or 'web'
|
||||
*
|
||||
* @return {Function} Loader Function that when called returns an iterator for the right passes
|
||||
*
|
||||
* @api private
|
||||
*/
|
||||
|
||||
function createRightProxy(type) {
|
||||
|
||||
return function(options) {
|
||||
return function(req, res /*, [head], [opts] */) {
|
||||
var passes = (type === 'ws') ? this.wsPasses : this.webPasses,
|
||||
args = [].slice.call(arguments),
|
||||
cntr = args.length - 1,
|
||||
head, cbl;
|
||||
|
||||
/* optional args parse begin */
|
||||
if(typeof args[cntr] === 'function') {
|
||||
cbl = args[cntr];
|
||||
|
||||
cntr--;
|
||||
}
|
||||
|
||||
if(
|
||||
!(args[cntr] instanceof Buffer) &&
|
||||
args[cntr] !== res
|
||||
) {
|
||||
//Copy global options
|
||||
options = extend({}, options);
|
||||
//Overwrite with request options
|
||||
extend(options, args[cntr]);
|
||||
|
||||
cntr--;
|
||||
}
|
||||
|
||||
if(args[cntr] instanceof Buffer) {
|
||||
head = args[cntr];
|
||||
}
|
||||
|
||||
/* optional args parse end */
|
||||
|
||||
['target', 'forward'].forEach(function(e) {
|
||||
if (typeof options[e] === 'string')
|
||||
options[e] = parse_url(options[e]);
|
||||
});
|
||||
|
||||
if (!options.target && !options.forward) {
|
||||
return this.emit('error', new Error('Must provide a proper URL as target'));
|
||||
}
|
||||
|
||||
for(var i=0; i < passes.length; i++) {
|
||||
/**
|
||||
* Call of passes functions
|
||||
* pass(req, res, options, head)
|
||||
*
|
||||
* In WebSockets case the `res` variable
|
||||
* refer to the connection socket
|
||||
* pass(req, socket, options, head)
|
||||
*/
|
||||
if(passes[i](req, res, options, head, this, cbl)) { // passes can return a truthy value to halt the loop
|
||||
break;
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
}
|
||||
httpProxy.createRightProxy = createRightProxy;
|
||||
|
||||
function ProxyServer(options) {
|
||||
EE3.call(this);
|
||||
|
||||
options = options || {};
|
||||
options.prependPath = options.prependPath === false ? false : true;
|
||||
|
||||
this.web = this.proxyRequest = createRightProxy('web')(options);
|
||||
this.ws = this.proxyWebsocketRequest = createRightProxy('ws')(options);
|
||||
this.options = options;
|
||||
|
||||
this.webPasses = Object.keys(web).map(function(pass) {
|
||||
return web[pass];
|
||||
});
|
||||
|
||||
this.wsPasses = Object.keys(ws).map(function(pass) {
|
||||
return ws[pass];
|
||||
});
|
||||
|
||||
this.on('error', this.onError, this);
|
||||
|
||||
}
|
||||
|
||||
require('util').inherits(ProxyServer, EE3);
|
||||
|
||||
ProxyServer.prototype.onError = function (err) {
|
||||
//
|
||||
// Remark: Replicate node core behavior using EE3
|
||||
// so we force people to handle their own errors
|
||||
//
|
||||
if(this.listeners('error').length === 1) {
|
||||
throw err;
|
||||
}
|
||||
};
|
||||
|
||||
ProxyServer.prototype.listen = function(port, hostname) {
|
||||
var self = this,
|
||||
closure = function(req, res) { self.web(req, res); };
|
||||
|
||||
this._server = this.options.ssl ?
|
||||
https.createServer(this.options.ssl, closure) :
|
||||
http.createServer(closure);
|
||||
|
||||
if(this.options.ws) {
|
||||
this._server.on('upgrade', function(req, socket, head) { self.ws(req, socket, head); });
|
||||
}
|
||||
|
||||
this._server.listen(port, hostname);
|
||||
|
||||
return this;
|
||||
};
|
||||
|
||||
ProxyServer.prototype.close = function(callback) {
|
||||
var self = this;
|
||||
if (this._server) {
|
||||
this._server.close(done);
|
||||
}
|
||||
|
||||
// Wrap callback to nullify server after all open connections are closed.
|
||||
function done() {
|
||||
self._server = null;
|
||||
if (callback) {
|
||||
callback.apply(null, arguments);
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
ProxyServer.prototype.before = function(type, passName, callback) {
|
||||
if (type !== 'ws' && type !== 'web') {
|
||||
throw new Error('type must be `web` or `ws`');
|
||||
}
|
||||
var passes = (type === 'ws') ? this.wsPasses : this.webPasses,
|
||||
i = false;
|
||||
|
||||
passes.forEach(function(v, idx) {
|
||||
if(v.name === passName) i = idx;
|
||||
})
|
||||
|
||||
if(i === false) throw new Error('No such pass');
|
||||
|
||||
passes.splice(i, 0, callback);
|
||||
};
|
||||
ProxyServer.prototype.after = function(type, passName, callback) {
|
||||
if (type !== 'ws' && type !== 'web') {
|
||||
throw new Error('type must be `web` or `ws`');
|
||||
}
|
||||
var passes = (type === 'ws') ? this.wsPasses : this.webPasses,
|
||||
i = false;
|
||||
|
||||
passes.forEach(function(v, idx) {
|
||||
if(v.name === passName) i = idx;
|
||||
})
|
||||
|
||||
if(i === false) throw new Error('No such pass');
|
||||
|
||||
passes.splice(i++, 0, callback);
|
||||
};
|
||||
180
www/node_modules/http-proxy/lib/http-proxy/passes/web-incoming.js
generated
vendored
Normal file
180
www/node_modules/http-proxy/lib/http-proxy/passes/web-incoming.js
generated
vendored
Normal file
@@ -0,0 +1,180 @@
|
||||
var http = require('http'),
|
||||
https = require('https'),
|
||||
web_o = require('./web-outgoing'),
|
||||
common = require('../common');
|
||||
|
||||
web_o = Object.keys(web_o).map(function(pass) {
|
||||
return web_o[pass];
|
||||
});
|
||||
|
||||
/*!
|
||||
* Array of passes.
|
||||
*
|
||||
* A `pass` is just a function that is executed on `req, res, options`
|
||||
* so that you can easily add new checks while still keeping the base
|
||||
* flexible.
|
||||
*/
|
||||
|
||||
|
||||
module.exports = {
|
||||
|
||||
/**
|
||||
* Sets `content-length` to '0' if request is of DELETE type.
|
||||
*
|
||||
* @param {ClientRequest} Req Request object
|
||||
* @param {IncomingMessage} Res Response object
|
||||
* @param {Object} Options Config object passed to the proxy
|
||||
*
|
||||
* @api private
|
||||
*/
|
||||
|
||||
deleteLength: function deleteLength(req, res, options) {
|
||||
if((req.method === 'DELETE' || req.method === 'OPTIONS')
|
||||
&& !req.headers['content-length']) {
|
||||
req.headers['content-length'] = '0';
|
||||
delete req.headers['transfer-encoding'];
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Sets timeout in request socket if it was specified in options.
|
||||
*
|
||||
* @param {ClientRequest} Req Request object
|
||||
* @param {IncomingMessage} Res Response object
|
||||
* @param {Object} Options Config object passed to the proxy
|
||||
*
|
||||
* @api private
|
||||
*/
|
||||
|
||||
timeout: function timeout(req, res, options) {
|
||||
if(options.timeout) {
|
||||
req.socket.setTimeout(options.timeout);
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Sets `x-forwarded-*` headers if specified in config.
|
||||
*
|
||||
* @param {ClientRequest} Req Request object
|
||||
* @param {IncomingMessage} Res Response object
|
||||
* @param {Object} Options Config object passed to the proxy
|
||||
*
|
||||
* @api private
|
||||
*/
|
||||
|
||||
XHeaders: function XHeaders(req, res, options) {
|
||||
if(!options.xfwd) return;
|
||||
|
||||
var encrypted = req.isSpdy || common.hasEncryptedConnection(req);
|
||||
var values = {
|
||||
for : req.connection.remoteAddress || req.socket.remoteAddress,
|
||||
port : common.getPort(req),
|
||||
proto: encrypted ? 'https' : 'http'
|
||||
};
|
||||
|
||||
['for', 'port', 'proto'].forEach(function(header) {
|
||||
req.headers['x-forwarded-' + header] =
|
||||
(req.headers['x-forwarded-' + header] || '') +
|
||||
(req.headers['x-forwarded-' + header] ? ',' : '') +
|
||||
values[header];
|
||||
});
|
||||
|
||||
req.headers['x-forwarded-host'] = req.headers['host'] || '';
|
||||
},
|
||||
|
||||
/**
|
||||
* Does the actual proxying. If `forward` is enabled fires up
|
||||
* a ForwardStream, same happens for ProxyStream. The request
|
||||
* just dies otherwise.
|
||||
*
|
||||
* @param {ClientRequest} Req Request object
|
||||
* @param {IncomingMessage} Res Response object
|
||||
* @param {Object} Options Config object passed to the proxy
|
||||
*
|
||||
* @api private
|
||||
*/
|
||||
|
||||
stream: function stream(req, res, options, _, server, clb) {
|
||||
|
||||
// And we begin!
|
||||
server.emit('start', req, res, options.target || options.forward);
|
||||
|
||||
if(options.forward) {
|
||||
// If forward enable, so just pipe the request
|
||||
var forwardReq = (options.forward.protocol === 'https:' ? https : http).request(
|
||||
common.setupOutgoing(options.ssl || {}, options, req, 'forward')
|
||||
);
|
||||
|
||||
// error handler (e.g. ECONNRESET, ECONNREFUSED)
|
||||
// Handle errors on incoming request as well as it makes sense to
|
||||
var forwardError = createErrorHandler(forwardReq, options.forward);
|
||||
req.on('error', forwardError);
|
||||
forwardReq.on('error', forwardError);
|
||||
|
||||
(options.buffer || req).pipe(forwardReq);
|
||||
if(!options.target) { return res.end(); }
|
||||
}
|
||||
|
||||
// Request initalization
|
||||
var proxyReq = (options.target.protocol === 'https:' ? https : http).request(
|
||||
common.setupOutgoing(options.ssl || {}, options, req)
|
||||
);
|
||||
|
||||
// Enable developers to modify the proxyReq before headers are sent
|
||||
proxyReq.on('socket', function(socket) {
|
||||
if(server) { server.emit('proxyReq', proxyReq, req, res, options); }
|
||||
});
|
||||
|
||||
// allow outgoing socket to timeout so that we could
|
||||
// show an error page at the initial request
|
||||
if(options.proxyTimeout) {
|
||||
proxyReq.setTimeout(options.proxyTimeout, function() {
|
||||
proxyReq.abort();
|
||||
});
|
||||
}
|
||||
|
||||
// Ensure we abort proxy if request is aborted
|
||||
req.on('aborted', function () {
|
||||
proxyReq.abort();
|
||||
});
|
||||
|
||||
// handle errors in proxy and incoming request, just like for forward proxy
|
||||
var proxyError = createErrorHandler(proxyReq, options.target);
|
||||
req.on('error', proxyError);
|
||||
proxyReq.on('error', proxyError);
|
||||
|
||||
function createErrorHandler(proxyReq, url) {
|
||||
return function proxyError(err) {
|
||||
if (req.socket.destroyed && err.code === 'ECONNRESET') {
|
||||
server.emit('econnreset', err, req, res, url);
|
||||
return proxyReq.abort();
|
||||
}
|
||||
|
||||
if (clb) {
|
||||
clb(err, req, res, url);
|
||||
} else {
|
||||
server.emit('error', err, req, res, url);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
(options.buffer || req).pipe(proxyReq);
|
||||
|
||||
proxyReq.on('response', function(proxyRes) {
|
||||
if(server) { server.emit('proxyRes', proxyRes, req, res); }
|
||||
for(var i=0; i < web_o.length; i++) {
|
||||
if(web_o[i](req, res, proxyRes, options)) { break; }
|
||||
}
|
||||
|
||||
// Allow us to listen when the proxy has completed
|
||||
proxyRes.on('end', function () {
|
||||
server.emit('end', req, res, proxyRes);
|
||||
});
|
||||
|
||||
proxyRes.pipe(res);
|
||||
});
|
||||
|
||||
//proxyReq.end();
|
||||
}
|
||||
|
||||
};
|
||||
138
www/node_modules/http-proxy/lib/http-proxy/passes/web-outgoing.js
generated
vendored
Normal file
138
www/node_modules/http-proxy/lib/http-proxy/passes/web-outgoing.js
generated
vendored
Normal file
@@ -0,0 +1,138 @@
|
||||
var url = require('url'),
|
||||
common = require('../common');
|
||||
|
||||
|
||||
var redirectRegex = /^201|30(1|2|7|8)$/;
|
||||
|
||||
/*!
|
||||
* Array of passes.
|
||||
*
|
||||
* A `pass` is just a function that is executed on `req, res, options`
|
||||
* so that you can easily add new checks while still keeping the base
|
||||
* flexible.
|
||||
*/
|
||||
|
||||
module.exports = { // <--
|
||||
|
||||
/**
|
||||
* If is a HTTP 1.0 request, remove chunk headers
|
||||
*
|
||||
* @param {ClientRequest} Req Request object
|
||||
* @param {IncomingMessage} Res Response object
|
||||
* @param {proxyResponse} Res Response object from the proxy request
|
||||
*
|
||||
* @api private
|
||||
*/
|
||||
removeChunked: function removeChunked(req, res, proxyRes) {
|
||||
if (req.httpVersion === '1.0') {
|
||||
delete proxyRes.headers['transfer-encoding'];
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* If is a HTTP 1.0 request, set the correct connection header
|
||||
* or if connection header not present, then use `keep-alive`
|
||||
*
|
||||
* @param {ClientRequest} Req Request object
|
||||
* @param {IncomingMessage} Res Response object
|
||||
* @param {proxyResponse} Res Response object from the proxy request
|
||||
*
|
||||
* @api private
|
||||
*/
|
||||
setConnection: function setConnection(req, res, proxyRes) {
|
||||
if (req.httpVersion === '1.0') {
|
||||
proxyRes.headers.connection = req.headers.connection || 'close';
|
||||
} else if (req.httpVersion !== '2.0' && !proxyRes.headers.connection) {
|
||||
proxyRes.headers.connection = req.headers.connection || 'keep-alive';
|
||||
}
|
||||
},
|
||||
|
||||
setRedirectHostRewrite: function setRedirectHostRewrite(req, res, proxyRes, options) {
|
||||
if ((options.hostRewrite || options.autoRewrite || options.protocolRewrite)
|
||||
&& proxyRes.headers['location']
|
||||
&& redirectRegex.test(proxyRes.statusCode)) {
|
||||
var target = url.parse(options.target);
|
||||
var u = url.parse(proxyRes.headers['location']);
|
||||
|
||||
// make sure the redirected host matches the target host before rewriting
|
||||
if (target.host != u.host) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (options.hostRewrite) {
|
||||
u.host = options.hostRewrite;
|
||||
} else if (options.autoRewrite) {
|
||||
u.host = req.headers['host'];
|
||||
}
|
||||
if (options.protocolRewrite) {
|
||||
u.protocol = options.protocolRewrite;
|
||||
}
|
||||
|
||||
proxyRes.headers['location'] = u.format();
|
||||
}
|
||||
},
|
||||
/**
|
||||
* Copy headers from proxyResponse to response
|
||||
* set each header in response object.
|
||||
*
|
||||
* @param {ClientRequest} Req Request object
|
||||
* @param {IncomingMessage} Res Response object
|
||||
* @param {proxyResponse} Res Response object from the proxy request
|
||||
* @param {Object} Options options.cookieDomainRewrite: Config to rewrite cookie domain
|
||||
*
|
||||
* @api private
|
||||
*/
|
||||
writeHeaders: function writeHeaders(req, res, proxyRes, options) {
|
||||
var rewriteCookieDomainConfig = options.cookieDomainRewrite,
|
||||
preserveHeaderKeyCase = options.preserveHeaderKeyCase,
|
||||
rawHeaderKeyMap,
|
||||
setHeader = function(key, header) {
|
||||
if (header == undefined) return;
|
||||
if (rewriteCookieDomainConfig && key.toLowerCase() === 'set-cookie') {
|
||||
header = common.rewriteCookieDomain(header, rewriteCookieDomainConfig);
|
||||
}
|
||||
res.setHeader(String(key).trim(), header);
|
||||
};
|
||||
|
||||
if (typeof rewriteCookieDomainConfig === 'string') { //also test for ''
|
||||
rewriteCookieDomainConfig = { '*': rewriteCookieDomainConfig };
|
||||
}
|
||||
|
||||
// message.rawHeaders is added in: v0.11.6
|
||||
// https://nodejs.org/api/http.html#http_message_rawheaders
|
||||
if (preserveHeaderKeyCase && proxyRes.rawHeaders != undefined) {
|
||||
rawHeaderKeyMap = {};
|
||||
for (var i = 0; i < proxyRes.rawHeaders.length; i += 2) {
|
||||
var key = proxyRes.rawHeaders[i];
|
||||
rawHeaderKeyMap[key.toLowerCase()] = key;
|
||||
}
|
||||
}
|
||||
|
||||
Object.keys(proxyRes.headers).forEach(function(key) {
|
||||
var header = proxyRes.headers[key];
|
||||
if (preserveHeaderKeyCase && rawHeaderKeyMap) {
|
||||
key = rawHeaderKeyMap[key] || key;
|
||||
}
|
||||
setHeader(key, header);
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* Set the statusCode from the proxyResponse
|
||||
*
|
||||
* @param {ClientRequest} Req Request object
|
||||
* @param {IncomingMessage} Res Response object
|
||||
* @param {proxyResponse} Res Response object from the proxy request
|
||||
*
|
||||
* @api private
|
||||
*/
|
||||
writeStatusCode: function writeStatusCode(req, res, proxyRes) {
|
||||
// From Node.js docs: response.writeHead(statusCode[, statusMessage][, headers])
|
||||
if(proxyRes.statusMessage) {
|
||||
res.writeHead(proxyRes.statusCode, proxyRes.statusMessage);
|
||||
} else {
|
||||
res.writeHead(proxyRes.statusCode);
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
156
www/node_modules/http-proxy/lib/http-proxy/passes/ws-incoming.js
generated
vendored
Normal file
156
www/node_modules/http-proxy/lib/http-proxy/passes/ws-incoming.js
generated
vendored
Normal file
@@ -0,0 +1,156 @@
|
||||
var http = require('http'),
|
||||
https = require('https'),
|
||||
common = require('../common');
|
||||
|
||||
/*!
|
||||
* Array of passes.
|
||||
*
|
||||
* A `pass` is just a function that is executed on `req, socket, options`
|
||||
* so that you can easily add new checks while still keeping the base
|
||||
* flexible.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Websockets Passes
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
module.exports = {
|
||||
/**
|
||||
* WebSocket requests must have the `GET` method and
|
||||
* the `upgrade:websocket` header
|
||||
*
|
||||
* @param {ClientRequest} Req Request object
|
||||
* @param {Socket} Websocket
|
||||
*
|
||||
* @api private
|
||||
*/
|
||||
|
||||
checkMethodAndHeader : function checkMethodAndHeader(req, socket) {
|
||||
if (req.method !== 'GET' || !req.headers.upgrade) {
|
||||
socket.destroy();
|
||||
return true;
|
||||
}
|
||||
|
||||
if (req.headers.upgrade.toLowerCase() !== 'websocket') {
|
||||
socket.destroy();
|
||||
return true;
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Sets `x-forwarded-*` headers if specified in config.
|
||||
*
|
||||
* @param {ClientRequest} Req Request object
|
||||
* @param {Socket} Websocket
|
||||
* @param {Object} Options Config object passed to the proxy
|
||||
*
|
||||
* @api private
|
||||
*/
|
||||
|
||||
XHeaders : function XHeaders(req, socket, options) {
|
||||
if(!options.xfwd) return;
|
||||
|
||||
var values = {
|
||||
for : req.connection.remoteAddress || req.socket.remoteAddress,
|
||||
port : common.getPort(req),
|
||||
proto: common.hasEncryptedConnection(req) ? 'wss' : 'ws'
|
||||
};
|
||||
|
||||
['for', 'port', 'proto'].forEach(function(header) {
|
||||
req.headers['x-forwarded-' + header] =
|
||||
(req.headers['x-forwarded-' + header] || '') +
|
||||
(req.headers['x-forwarded-' + header] ? ',' : '') +
|
||||
values[header];
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* Does the actual proxying. Make the request and upgrade it
|
||||
* send the Switching Protocols request and pipe the sockets.
|
||||
*
|
||||
* @param {ClientRequest} Req Request object
|
||||
* @param {Socket} Websocket
|
||||
* @param {Object} Options Config object passed to the proxy
|
||||
*
|
||||
* @api private
|
||||
*/
|
||||
stream : function stream(req, socket, options, head, server, clb) {
|
||||
common.setupSocket(socket);
|
||||
|
||||
if (head && head.length) socket.unshift(head);
|
||||
|
||||
|
||||
var proxyReq = (common.isSSL.test(options.target.protocol) ? https : http).request(
|
||||
common.setupOutgoing(options.ssl || {}, options, req)
|
||||
);
|
||||
|
||||
// Enable developers to modify the proxyReq before headers are sent
|
||||
if (server) { server.emit('proxyReqWs', proxyReq, req, socket, options, head); }
|
||||
|
||||
// Error Handler
|
||||
proxyReq.on('error', onOutgoingError);
|
||||
proxyReq.on('response', function (res) {
|
||||
// if upgrade event isn't going to happen, close the socket
|
||||
if (!res.upgrade) socket.end();
|
||||
});
|
||||
|
||||
proxyReq.on('upgrade', function(proxyRes, proxySocket, proxyHead) {
|
||||
proxySocket.on('error', onOutgoingError);
|
||||
|
||||
// Allow us to listen when the websocket has completed
|
||||
proxySocket.on('end', function () {
|
||||
server.emit('close', proxyRes, proxySocket, proxyHead);
|
||||
});
|
||||
|
||||
// The pipe below will end proxySocket if socket closes cleanly, but not
|
||||
// if it errors (eg, vanishes from the net and starts returning
|
||||
// EHOSTUNREACH). We need to do that explicitly.
|
||||
socket.on('error', function () {
|
||||
proxySocket.end();
|
||||
});
|
||||
|
||||
common.setupSocket(proxySocket);
|
||||
|
||||
if (proxyHead && proxyHead.length) proxySocket.unshift(proxyHead);
|
||||
|
||||
//
|
||||
// Remark: Handle writing the headers to the socket when switching protocols
|
||||
// Also handles when a header is an array
|
||||
//
|
||||
socket.write(
|
||||
Object.keys(proxyRes.headers).reduce(function (head, key) {
|
||||
var value = proxyRes.headers[key];
|
||||
|
||||
if (!Array.isArray(value)) {
|
||||
head.push(key + ': ' + value);
|
||||
return head;
|
||||
}
|
||||
|
||||
for (var i = 0; i < value.length; i++) {
|
||||
head.push(key + ': ' + value[i]);
|
||||
}
|
||||
return head;
|
||||
}, ['HTTP/1.1 101 Switching Protocols'])
|
||||
.join('\r\n') + '\r\n\r\n'
|
||||
);
|
||||
|
||||
proxySocket.pipe(socket).pipe(proxySocket);
|
||||
|
||||
server.emit('open', proxySocket);
|
||||
server.emit('proxySocket', proxySocket); //DEPRECATED.
|
||||
});
|
||||
|
||||
return proxyReq.end(); // XXX: CHECK IF THIS IS THIS CORRECT
|
||||
|
||||
function onOutgoingError(err) {
|
||||
if (clb) {
|
||||
clb(err, req, socket);
|
||||
} else {
|
||||
server.emit('error', err, req, socket);
|
||||
}
|
||||
socket.end();
|
||||
}
|
||||
}
|
||||
};
|
||||
117
www/node_modules/http-proxy/package.json
generated
vendored
Normal file
117
www/node_modules/http-proxy/package.json
generated
vendored
Normal file
@@ -0,0 +1,117 @@
|
||||
{
|
||||
"_args": [
|
||||
[
|
||||
{
|
||||
"raw": "http-proxy@^1.8.1",
|
||||
"scope": null,
|
||||
"escapedName": "http-proxy",
|
||||
"name": "http-proxy",
|
||||
"rawSpec": "^1.8.1",
|
||||
"spec": ">=1.8.1 <2.0.0",
|
||||
"type": "range"
|
||||
},
|
||||
"/home/nau/MEGA/CODI/githubRepos/colspace/www/node_modules/http-server"
|
||||
]
|
||||
],
|
||||
"_from": "http-proxy@>=1.8.1 <2.0.0",
|
||||
"_id": "http-proxy@1.16.2",
|
||||
"_inCache": true,
|
||||
"_location": "/http-proxy",
|
||||
"_nodeVersion": "6.9.1",
|
||||
"_npmOperationalInternal": {
|
||||
"host": "packages-18-east.internal.npmjs.com",
|
||||
"tmp": "tmp/http-proxy-1.16.2.tgz_1481039349196_0.5866330966819078"
|
||||
},
|
||||
"_npmUser": {
|
||||
"name": "jcrugzz",
|
||||
"email": "jcrugzz@gmail.com"
|
||||
},
|
||||
"_npmVersion": "3.10.8",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"raw": "http-proxy@^1.8.1",
|
||||
"scope": null,
|
||||
"escapedName": "http-proxy",
|
||||
"name": "http-proxy",
|
||||
"rawSpec": "^1.8.1",
|
||||
"spec": ">=1.8.1 <2.0.0",
|
||||
"type": "range"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/http-server"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/http-proxy/-/http-proxy-1.16.2.tgz",
|
||||
"_shasum": "06dff292952bf64dbe8471fa9df73066d4f37742",
|
||||
"_shrinkwrap": null,
|
||||
"_spec": "http-proxy@^1.8.1",
|
||||
"_where": "/home/nau/MEGA/CODI/githubRepos/colspace/www/node_modules/http-server",
|
||||
"author": {
|
||||
"name": "Charlie Robbins",
|
||||
"email": "charlie.robbins@gmail.com"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/nodejitsu/node-http-proxy/issues"
|
||||
},
|
||||
"dependencies": {
|
||||
"eventemitter3": "1.x.x",
|
||||
"requires-port": "1.x.x"
|
||||
},
|
||||
"description": "HTTP proxying for the masses",
|
||||
"devDependencies": {
|
||||
"async": "*",
|
||||
"blanket": "*",
|
||||
"coveralls": "*",
|
||||
"dox": "*",
|
||||
"expect.js": "*",
|
||||
"mocha": "*",
|
||||
"mocha-lcov-reporter": "*",
|
||||
"semver": "^5.0.3",
|
||||
"socket.io": "*",
|
||||
"socket.io-client": "*",
|
||||
"sse": "0.0.6",
|
||||
"ws": "^0.8.0"
|
||||
},
|
||||
"directories": {},
|
||||
"dist": {
|
||||
"shasum": "06dff292952bf64dbe8471fa9df73066d4f37742",
|
||||
"tarball": "https://registry.npmjs.org/http-proxy/-/http-proxy-1.16.2.tgz"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
},
|
||||
"gitHead": "c1fb596b856df971d291585ccf105233f7deca51",
|
||||
"homepage": "https://github.com/nodejitsu/node-http-proxy#readme",
|
||||
"license": "MIT",
|
||||
"main": "index.js",
|
||||
"maintainers": [
|
||||
{
|
||||
"name": "indexzero",
|
||||
"email": "charlie.robbins@gmail.com"
|
||||
},
|
||||
{
|
||||
"name": "cronopio",
|
||||
"email": "aristizabal.daniel@gmail.com"
|
||||
},
|
||||
{
|
||||
"name": "yawnt",
|
||||
"email": "yawn.localhost@gmail.com"
|
||||
},
|
||||
{
|
||||
"name": "jcrugzz",
|
||||
"email": "jcrugzz@gmail.com"
|
||||
}
|
||||
],
|
||||
"name": "http-proxy",
|
||||
"optionalDependencies": {},
|
||||
"readme": "ERROR: No README data found!",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/nodejitsu/node-http-proxy.git"
|
||||
},
|
||||
"scripts": {
|
||||
"coveralls": "mocha --require blanket --reporter mocha-lcov-reporter | ./node_modules/coveralls/bin/coveralls.js",
|
||||
"test": "mocha test/*-test.js",
|
||||
"test-cov": "mocha --require blanket -R html-cov > cov/coverage.html"
|
||||
},
|
||||
"version": "1.16.2"
|
||||
}
|
||||
3
www/node_modules/http-server/.npmignore
generated
vendored
Normal file
3
www/node_modules/http-server/.npmignore
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
node_modules/*
|
||||
!node_modules/node-static
|
||||
npm-debug.log
|
||||
22
www/node_modules/http-server/.travis.yml
generated
vendored
Normal file
22
www/node_modules/http-server/.travis.yml
generated
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
sudo: false
|
||||
language: node_js
|
||||
node_js:
|
||||
- "0.10"
|
||||
- "0.12"
|
||||
- "4.1"
|
||||
|
||||
before_install:
|
||||
- travis_retry npm install -g npm@2.14.5
|
||||
- travis_retry npm install
|
||||
|
||||
script:
|
||||
- npm test
|
||||
|
||||
matrix:
|
||||
allow_failures:
|
||||
- node_js: "0.10"
|
||||
|
||||
notifications:
|
||||
email:
|
||||
- travis@nodejitsu.com
|
||||
irc: "irc.freenode.org#nodejitsu"
|
||||
20
www/node_modules/http-server/LICENSE
generated
vendored
Normal file
20
www/node_modules/http-server/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
Copyright (c) 2011 Charlie Robbins, Marak Squires, and the Contributors.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
"Software"), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sublicense, and/or sell copies of the Software, and to
|
||||
permit persons to whom the Software is furnished to do so, subject to
|
||||
the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
69
www/node_modules/http-server/README.md
generated
vendored
Normal file
69
www/node_modules/http-server/README.md
generated
vendored
Normal file
@@ -0,0 +1,69 @@
|
||||
# http-server: a command-line http server
|
||||
|
||||
`http-server` is a simple, zero-configuration command-line http server. It is powerful enough for production usage, but it's simple and hackable enough to be used for testing, local development, and learning.
|
||||
|
||||

|
||||
|
||||
# Installing globally:
|
||||
|
||||
Installation via `npm`:
|
||||
|
||||
npm install http-server -g
|
||||
|
||||
This will install `http-server` globally so that it may be run from the command line.
|
||||
|
||||
## Usage:
|
||||
|
||||
http-server [path] [options]
|
||||
|
||||
`[path]` defaults to `./public` if the folder exists, and `./` otherwise.
|
||||
|
||||
# Installing as a node app
|
||||
|
||||
mkdir myapp
|
||||
cd myapp/
|
||||
jitsu install http-server
|
||||
|
||||
*If you do not have `jitsu` installed you can install it via `npm install jitsu -g`*
|
||||
|
||||
## Usage
|
||||
|
||||
### Starting http-server locally
|
||||
|
||||
node bin/http-server
|
||||
|
||||
*Now you can visit http://localhost:8080 to view your server*
|
||||
|
||||
## Available Options:
|
||||
|
||||
`-p` Port to use (defaults to 8080)
|
||||
|
||||
`-a` Address to use (defaults to 0.0.0.0)
|
||||
|
||||
`-d` Show directory listings (defaults to 'True')
|
||||
|
||||
`-i` Display autoIndex (defaults to 'True')
|
||||
|
||||
`-e` or `--ext` Default file extension if none supplied (defaults to 'html')
|
||||
|
||||
`-s` or `--silent` Suppress log messages from output
|
||||
|
||||
`--cors` Enable CORS via the `Access-Control-Allow-Origin` header
|
||||
|
||||
`-o` Open browser window after starting the server
|
||||
|
||||
`-c` Set cache time (in seconds) for cache-control max-age header, e.g. -c10 for 10 seconds (defaults to '3600'). To disable caching, use -c-1.
|
||||
|
||||
`-U` or `--utc` Use UTC time format in log messages.
|
||||
|
||||
`-P` or `--proxy` Proxies all requests which can't be resolved locally to the given url. e.g.: -P http://someurl.com
|
||||
|
||||
`-S` or `--ssl` Enable https.
|
||||
|
||||
`-C` or `--cert` Path to ssl cert file (default: cert.pem).
|
||||
|
||||
`-K` or `--key` Path to ssl key file (default: key.pem).
|
||||
|
||||
`-r` or `--robots` Provide a /robots.txt (whose content defaults to 'User-agent: *\nDisallow: /')
|
||||
|
||||
`-h` or `--help` Print this list and exit.
|
||||
174
www/node_modules/http-server/bin/http-server
generated
vendored
Executable file
174
www/node_modules/http-server/bin/http-server
generated
vendored
Executable file
@@ -0,0 +1,174 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
'use strict';
|
||||
|
||||
var colors = require('colors'),
|
||||
os = require('os'),
|
||||
httpServer = require('../lib/http-server'),
|
||||
portfinder = require('portfinder'),
|
||||
opener = require('opener'),
|
||||
argv = require('optimist')
|
||||
.boolean('cors')
|
||||
.argv;
|
||||
|
||||
var ifaces = os.networkInterfaces();
|
||||
|
||||
if (argv.h || argv.help) {
|
||||
console.log([
|
||||
'usage: http-server [path] [options]',
|
||||
'',
|
||||
'options:',
|
||||
' -p Port to use [8080]',
|
||||
' -a Address to use [0.0.0.0]',
|
||||
' -d Show directory listings [true]',
|
||||
' -i Display autoIndex [true]',
|
||||
' -e --ext Default file extension if none supplied [none]',
|
||||
' -s --silent Suppress log messages from output',
|
||||
' --cors[=headers] Enable CORS via the "Access-Control-Allow-Origin" header',
|
||||
' Optionally provide CORS headers list separated by commas',
|
||||
' -o [path] Open browser window after starting the server',
|
||||
' -c Cache time (max-age) in seconds [3600], e.g. -c10 for 10 seconds.',
|
||||
' To disable caching, use -c-1.',
|
||||
' -U --utc Use UTC time format in log messages.',
|
||||
'',
|
||||
' -P --proxy Fallback proxy if the request cannot be resolved. e.g.: http://someurl.com',
|
||||
'',
|
||||
' -S --ssl Enable https.',
|
||||
' -C --cert Path to ssl cert file (default: cert.pem).',
|
||||
' -K --key Path to ssl key file (default: key.pem).',
|
||||
'',
|
||||
' -r --robots Respond to /robots.txt [User-agent: *\\nDisallow: /]',
|
||||
' -h --help Print this list and exit.'
|
||||
].join('\n'));
|
||||
process.exit();
|
||||
}
|
||||
|
||||
var port = argv.p || parseInt(process.env.PORT, 10),
|
||||
host = argv.a || '0.0.0.0',
|
||||
ssl = !!argv.S || !!argv.ssl,
|
||||
proxy = argv.P || argv.proxy,
|
||||
utc = argv.U || argv.utc,
|
||||
logger;
|
||||
|
||||
if (!argv.s && !argv.silent) {
|
||||
logger = {
|
||||
info: console.log,
|
||||
request: function (req, res, error) {
|
||||
var date = utc ? new Date().toUTCString() : new Date();
|
||||
if (error) {
|
||||
logger.info(
|
||||
'[%s] "%s %s" Error (%s): "%s"',
|
||||
date, req.method.red, req.url.red,
|
||||
error.status.toString().red, error.message.red
|
||||
);
|
||||
}
|
||||
else {
|
||||
logger.info(
|
||||
'[%s] "%s %s" "%s"',
|
||||
date, req.method.cyan, req.url.cyan,
|
||||
req.headers['user-agent']
|
||||
);
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
else if (colors) {
|
||||
logger = {
|
||||
info: function () {},
|
||||
request: function () {}
|
||||
};
|
||||
}
|
||||
|
||||
if (!port) {
|
||||
portfinder.basePort = 8080;
|
||||
portfinder.getPort(function (err, port) {
|
||||
if (err) { throw err; }
|
||||
listen(port);
|
||||
});
|
||||
}
|
||||
else {
|
||||
listen(port);
|
||||
}
|
||||
|
||||
function listen(port) {
|
||||
var options = {
|
||||
root: argv._[0],
|
||||
cache: argv.c,
|
||||
showDir: argv.d,
|
||||
autoIndex: argv.i,
|
||||
robots: argv.r || argv.robots,
|
||||
ext: argv.e || argv.ext,
|
||||
logFn: logger.request,
|
||||
proxy: proxy
|
||||
};
|
||||
|
||||
if (argv.cors) {
|
||||
options.cors = true;
|
||||
if (typeof argv.cors === 'string') {
|
||||
options.corsHeaders = argv.cors;
|
||||
}
|
||||
}
|
||||
|
||||
if (ssl) {
|
||||
options.https = {
|
||||
cert: argv.C || argv.cert || 'cert.pem',
|
||||
key: argv.K || argv.key || 'key.pem'
|
||||
};
|
||||
}
|
||||
|
||||
var server = httpServer.createServer(options);
|
||||
server.listen(port, host, function () {
|
||||
var canonicalHost = host === '0.0.0.0' ? '127.0.0.1' : host,
|
||||
protocol = ssl ? 'https://' : 'http://';
|
||||
|
||||
logger.info(['Starting up http-server, serving '.yellow,
|
||||
server.root.cyan,
|
||||
ssl ? (' through'.yellow + ' https'.cyan) : '',
|
||||
'\nAvailable on:'.yellow
|
||||
].join(''));
|
||||
|
||||
if (argv.a && host !== '0.0.0.0') {
|
||||
logger.info((' ' + protocol + canonicalHost + ':' + port.toString()).green);
|
||||
}
|
||||
else {
|
||||
Object.keys(ifaces).forEach(function (dev) {
|
||||
ifaces[dev].forEach(function (details) {
|
||||
if (details.family === 'IPv4') {
|
||||
logger.info((' ' + protocol + details.address + ':' + port.toString()).green);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
if (typeof proxy === 'string') {
|
||||
logger.info('Unhandled requests will be served from: ' + proxy);
|
||||
}
|
||||
|
||||
logger.info('Hit CTRL-C to stop the server');
|
||||
if (argv.o) {
|
||||
opener(
|
||||
protocol + '//' + canonicalHost + ':' + port,
|
||||
{ command: argv.o !== true ? argv.o : null }
|
||||
);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
if (process.platform === 'win32') {
|
||||
require('readline').createInterface({
|
||||
input: process.stdin,
|
||||
output: process.stdout
|
||||
}).on('SIGINT', function () {
|
||||
process.emit('SIGINT');
|
||||
});
|
||||
}
|
||||
|
||||
process.on('SIGINT', function () {
|
||||
logger.info('http-server stopped.'.red);
|
||||
process.exit();
|
||||
});
|
||||
|
||||
process.on('SIGTERM', function () {
|
||||
logger.info('http-server stopped.'.red);
|
||||
process.exit();
|
||||
});
|
||||
139
www/node_modules/http-server/lib/http-server.js
generated
vendored
Normal file
139
www/node_modules/http-server/lib/http-server.js
generated
vendored
Normal file
@@ -0,0 +1,139 @@
|
||||
'use strict';
|
||||
|
||||
var fs = require('fs'),
|
||||
union = require('union'),
|
||||
ecstatic = require('ecstatic'),
|
||||
httpProxy = require('http-proxy'),
|
||||
corser = require('corser');
|
||||
|
||||
//
|
||||
// Remark: backwards compatibility for previous
|
||||
// case convention of HTTP
|
||||
//
|
||||
exports.HttpServer = exports.HTTPServer = HttpServer;
|
||||
|
||||
/**
|
||||
* Returns a new instance of HttpServer with the
|
||||
* specified `options`.
|
||||
*/
|
||||
exports.createServer = function (options) {
|
||||
return new HttpServer(options);
|
||||
};
|
||||
|
||||
/**
|
||||
* Constructor function for the HttpServer object
|
||||
* which is responsible for serving static files along
|
||||
* with other HTTP-related features.
|
||||
*/
|
||||
function HttpServer(options) {
|
||||
options = options || {};
|
||||
|
||||
if (options.root) {
|
||||
this.root = options.root;
|
||||
}
|
||||
else {
|
||||
try {
|
||||
fs.lstatSync('./public');
|
||||
this.root = './public';
|
||||
}
|
||||
catch (err) {
|
||||
this.root = './';
|
||||
}
|
||||
}
|
||||
|
||||
this.headers = options.headers || {};
|
||||
|
||||
this.cache = options.cache === undefined ? 3600 : options.cache; // in seconds.
|
||||
this.showDir = options.showDir !== 'false';
|
||||
this.autoIndex = options.autoIndex !== 'false';
|
||||
this.contentType = options.contentType || 'application/octet-stream';
|
||||
|
||||
if (options.ext) {
|
||||
this.ext = options.ext === true
|
||||
? 'html'
|
||||
: options.ext;
|
||||
}
|
||||
|
||||
var before = options.before ? options.before.slice() : [];
|
||||
|
||||
before.push(function (req, res) {
|
||||
if (options.logFn) {
|
||||
options.logFn(req, res);
|
||||
}
|
||||
|
||||
res.emit('next');
|
||||
});
|
||||
|
||||
if (options.cors) {
|
||||
this.headers['Access-Control-Allow-Origin'] = '*';
|
||||
this.headers['Access-Control-Allow-Headers'] = 'Origin, X-Requested-With, Content-Type, Accept, Range';
|
||||
if (options.corsHeaders) {
|
||||
options.corsHeaders.split(/\s*,\s*/)
|
||||
.forEach(function (h) { this.headers['Access-Control-Allow-Headers'] += ', ' + h; }, this);
|
||||
}
|
||||
before.push(corser.create(options.corsHeaders ? {
|
||||
requestHeaders: this.headers['Access-Control-Allow-Headers'].split(/\s*,\s*/)
|
||||
} : null));
|
||||
}
|
||||
|
||||
if (options.robots) {
|
||||
before.push(function (req, res) {
|
||||
if (req.url === '/robots.txt') {
|
||||
res.setHeader('Content-Type', 'text/plain');
|
||||
var robots = options.robots === true
|
||||
? 'User-agent: *\nDisallow: /'
|
||||
: options.robots.replace(/\\n/, '\n');
|
||||
|
||||
return res.end(robots);
|
||||
}
|
||||
|
||||
res.emit('next');
|
||||
});
|
||||
}
|
||||
|
||||
before.push(ecstatic({
|
||||
root: this.root,
|
||||
cache: this.cache,
|
||||
showDir: this.showDir,
|
||||
autoIndex: this.autoIndex,
|
||||
defaultExt: this.ext,
|
||||
contentType: this.contentType,
|
||||
handleError: typeof options.proxy !== 'string'
|
||||
}));
|
||||
|
||||
if (typeof options.proxy === 'string') {
|
||||
var proxy = httpProxy.createProxyServer({});
|
||||
before.push(function (req, res) {
|
||||
proxy.web(req, res, {
|
||||
target: options.proxy,
|
||||
changeOrigin: true
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
var serverOptions = {
|
||||
before: before,
|
||||
headers: this.headers,
|
||||
onError: function (err, req, res) {
|
||||
if (options.logFn) {
|
||||
options.logFn(req, res, err);
|
||||
}
|
||||
|
||||
res.end();
|
||||
}
|
||||
};
|
||||
|
||||
if (options.https) {
|
||||
serverOptions.https = options.https;
|
||||
}
|
||||
|
||||
this.server = union.createServer(serverOptions);
|
||||
}
|
||||
|
||||
HttpServer.prototype.listen = function () {
|
||||
this.server.listen.apply(this.server, arguments);
|
||||
};
|
||||
|
||||
HttpServer.prototype.close = function () {
|
||||
return this.server.close();
|
||||
};
|
||||
145
www/node_modules/http-server/package.json
generated
vendored
Normal file
145
www/node_modules/http-server/package.json
generated
vendored
Normal file
@@ -0,0 +1,145 @@
|
||||
{
|
||||
"_args": [
|
||||
[
|
||||
{
|
||||
"raw": "http-server@0.9.0",
|
||||
"scope": null,
|
||||
"escapedName": "http-server",
|
||||
"name": "http-server",
|
||||
"rawSpec": "0.9.0",
|
||||
"spec": "0.9.0",
|
||||
"type": "version"
|
||||
},
|
||||
"/home/nau/MEGA/CODI/githubRepos/colspace/www"
|
||||
]
|
||||
],
|
||||
"_from": "http-server@0.9.0",
|
||||
"_id": "http-server@0.9.0",
|
||||
"_inCache": true,
|
||||
"_location": "/http-server",
|
||||
"_nodeVersion": "4.2.2",
|
||||
"_npmOperationalInternal": {
|
||||
"host": "packages-6-west.internal.npmjs.com",
|
||||
"tmp": "tmp/http-server-0.9.0.tgz_1455864708425_0.19514421350322664"
|
||||
},
|
||||
"_npmUser": {
|
||||
"name": "indexzero",
|
||||
"email": "charlie.robbins@gmail.com"
|
||||
},
|
||||
"_npmVersion": "3.7.1",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"raw": "http-server@0.9.0",
|
||||
"scope": null,
|
||||
"escapedName": "http-server",
|
||||
"name": "http-server",
|
||||
"rawSpec": "0.9.0",
|
||||
"spec": "0.9.0",
|
||||
"type": "version"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/http-server/-/http-server-0.9.0.tgz",
|
||||
"_shasum": "8f1b06bdc733618d4dc42831c7ba1aff4e06001a",
|
||||
"_shrinkwrap": null,
|
||||
"_spec": "http-server@0.9.0",
|
||||
"_where": "/home/nau/MEGA/CODI/githubRepos/colspace/www",
|
||||
"bin": {
|
||||
"http-server": "./bin/http-server",
|
||||
"hs": "./bin/http-server"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/nodeapps/http-server/issues"
|
||||
},
|
||||
"contributors": [
|
||||
{
|
||||
"name": "Charlie Robbins",
|
||||
"email": "charlie.robbins@gmail.com"
|
||||
},
|
||||
{
|
||||
"name": "Marak Squires",
|
||||
"email": "marak.squires@gmail.com"
|
||||
},
|
||||
{
|
||||
"name": "Charlie McConnell",
|
||||
"email": "charlie@charlieistheman.com"
|
||||
},
|
||||
{
|
||||
"name": "Joshua Holbrook",
|
||||
"email": "josh.holbrook@gmail.com"
|
||||
},
|
||||
{
|
||||
"name": "Maciej Małecki",
|
||||
"email": "maciej.malecki@notimplemented.org"
|
||||
},
|
||||
{
|
||||
"name": "Matthew Bergman",
|
||||
"email": "mzbphoto@gmail.com"
|
||||
},
|
||||
{
|
||||
"name": "brad dunbar",
|
||||
"email": "dunbarb2@gmail.com"
|
||||
},
|
||||
{
|
||||
"name": "Dominic Tarr"
|
||||
},
|
||||
{
|
||||
"name": "Travis Person",
|
||||
"email": "travis.person@gmail.com"
|
||||
},
|
||||
{
|
||||
"name": "Jinkwon Lee",
|
||||
"email": "master@bdyne.net"
|
||||
}
|
||||
],
|
||||
"dependencies": {
|
||||
"colors": "1.0.3",
|
||||
"corser": "~2.0.0",
|
||||
"ecstatic": "^1.4.0",
|
||||
"http-proxy": "^1.8.1",
|
||||
"opener": "~1.4.0",
|
||||
"optimist": "0.6.x",
|
||||
"portfinder": "0.4.x",
|
||||
"union": "~0.4.3"
|
||||
},
|
||||
"description": "A simple zero-configuration command-line http server",
|
||||
"devDependencies": {
|
||||
"common-style": "^3.0.0",
|
||||
"request": "2.49.x",
|
||||
"vows": "0.7.x"
|
||||
},
|
||||
"directories": {},
|
||||
"dist": {
|
||||
"shasum": "8f1b06bdc733618d4dc42831c7ba1aff4e06001a",
|
||||
"tarball": "https://registry.npmjs.org/http-server/-/http-server-0.9.0.tgz"
|
||||
},
|
||||
"gitHead": "1a8552c5e028bd5500027ee940111133927a4e94",
|
||||
"homepage": "https://github.com/indexzero/http-server#readme",
|
||||
"keywords": [
|
||||
"cli",
|
||||
"command"
|
||||
],
|
||||
"license": "MIT",
|
||||
"main": "./lib/http-server",
|
||||
"maintainers": [
|
||||
{
|
||||
"name": "indexzero",
|
||||
"email": "charlie.robbins@gmail.com"
|
||||
}
|
||||
],
|
||||
"name": "http-server",
|
||||
"optionalDependencies": {},
|
||||
"preferGlobal": "true",
|
||||
"readme": "ERROR: No README data found!",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/indexzero/http-server.git"
|
||||
},
|
||||
"scripts": {
|
||||
"pretest": "common bin/http-server lib/ test",
|
||||
"start": "node ./bin/http-server",
|
||||
"test": "vows --spec --isolate"
|
||||
},
|
||||
"version": "0.9.0"
|
||||
}
|
||||
10
www/node_modules/http-server/public/404.html
generated
vendored
Normal file
10
www/node_modules/http-server/public/404.html
generated
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>404</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>404</h1>
|
||||
|
||||
<p>Were you just making up filenames or what?</p>
|
||||
</body>
|
||||
</html>
|
||||
BIN
www/node_modules/http-server/public/img/turtle.png
generated
vendored
Normal file
BIN
www/node_modules/http-server/public/img/turtle.png
generated
vendored
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 191 KiB |
12
www/node_modules/http-server/public/index.html
generated
vendored
Normal file
12
www/node_modules/http-server/public/index.html
generated
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>node.js http server</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<h1>Serving up static files like they were turtles strapped to rockets.</h1>
|
||||
|
||||
<img src="./img/turtle.png"/>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
BIN
www/node_modules/http-server/screenshots/directory.png
generated
vendored
Normal file
BIN
www/node_modules/http-server/screenshots/directory.png
generated
vendored
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 24 KiB |
BIN
www/node_modules/http-server/screenshots/public.png
generated
vendored
Normal file
BIN
www/node_modules/http-server/screenshots/public.png
generated
vendored
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 226 KiB |
BIN
www/node_modules/http-server/screenshots/start.png
generated
vendored
Normal file
BIN
www/node_modules/http-server/screenshots/start.png
generated
vendored
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 20 KiB |
2
www/node_modules/http-server/test/fixtures/root/canYouSeeMe
generated
vendored
Normal file
2
www/node_modules/http-server/test/fixtures/root/canYouSeeMe
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
I bet you can. I'm in your index.
|
||||
|
||||
2
www/node_modules/http-server/test/fixtures/root/file
generated
vendored
Normal file
2
www/node_modules/http-server/test/fixtures/root/file
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
hello, I know nodejitsu
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user