closes #36
This commit is contained in:
parent
579e038537
commit
eeb5a37423
1335
build/app.bundle.js
1335
build/app.bundle.js
File diff suppressed because it is too large
Load Diff
12
build/app.js
12
build/app.js
|
@ -10,7 +10,7 @@
|
|||
var resolved = require.resolve(path);
|
||||
|
||||
// lookup failed
|
||||
if (null == resolved) {
|
||||
if (null === resolved) {
|
||||
orig = orig || path;
|
||||
parent = parent || 'root';
|
||||
var err = new Error('Failed to require "' + orig + '" from "' + parent + '"');
|
||||
|
@ -36,7 +36,7 @@
|
|||
}
|
||||
|
||||
return module.exports;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Registered modules.
|
||||
|
@ -76,7 +76,7 @@
|
|||
];
|
||||
|
||||
for (var i = 0; i < paths.length; i++) {
|
||||
var path = paths[i];
|
||||
path = paths[i];
|
||||
if (require.modules.hasOwnProperty(path)) return path;
|
||||
if (require.aliases.hasOwnProperty(path)) return require.aliases[path];
|
||||
}
|
||||
|
@ -102,7 +102,7 @@
|
|||
for (var i = 0; i < path.length; ++i) {
|
||||
if ('..' == path[i]) {
|
||||
curr.pop();
|
||||
} else if ('.' != path[i] && '' != path[i]) {
|
||||
} else if ('.' !== path[i] && '' !== path[i]) {
|
||||
segs.push(path[i]);
|
||||
}
|
||||
}
|
||||
|
@ -167,7 +167,7 @@
|
|||
var localRequire = function(path) {
|
||||
var resolved = localRequire.resolve(path);
|
||||
return require(resolved, parent, path);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Resolve relative to the parent.
|
||||
|
@ -843,7 +843,7 @@
|
|||
}
|
||||
return _results;
|
||||
})()).join('&');
|
||||
req = superagent.get("" + protocol + "://" + host + "/repos/" + path + "/" + noun + "?" + q).set('Content-Type', 'application/json').set('Accept', 'application/vnd.github.raw');
|
||||
req = superagent.get("" + protocol + "://" + host + "/repos/" + path + "/" + noun + "?" + q).set('Content-Type', 'application/json').set('Accept', 'application/vnd.github.v3');
|
||||
if (token) {
|
||||
req = req.set('Authorization', "token " + token);
|
||||
}
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
"async": "~0.2.9",
|
||||
"proxyquire": "~0.5.1",
|
||||
"lodash": "~1.3.1",
|
||||
"connect": "~2.8.5",
|
||||
"connect": "~2.12.0",
|
||||
"request": "~2.27.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
@ -18,7 +18,7 @@
|
|||
"marked": "~0.2.9",
|
||||
|
||||
"grunt": "~0.4.1",
|
||||
"grunt-apps-c": "0.1.7",
|
||||
"grunt-apps-c": "0.1.10",
|
||||
"grunt-contrib-stylus": "~0.9.0",
|
||||
"grunt-contrib-concat": "~0.3.0",
|
||||
"grunt-contrib-uglify": "~0.2.5",
|
||||
|
|
13
proxy.coffee
13
proxy.coffee
|
@ -1,5 +1,5 @@
|
|||
#!/usr/bin/env coffee
|
||||
{ _ } = require 'lodash'
|
||||
_ = require 'lodash'
|
||||
http = require 'http'
|
||||
fs = require 'fs'
|
||||
connect = require 'connect'
|
||||
|
@ -27,7 +27,11 @@ proxy = (req, res, next) ->
|
|||
# API request?
|
||||
if req.url.match /^\/repos/
|
||||
# The new headers.
|
||||
headers = 'Accept': 'application/vnd.github.raw'
|
||||
headers =
|
||||
# See http://developer.github.com/v3/media/#beta-v3-and-the-future
|
||||
'Accept': 'application/vnd.github.v3'
|
||||
# See http://developer.github.com/v3/#user-agent-required
|
||||
'User-Agent': 'GitHub-Burndown-Chart'
|
||||
# Add a token?
|
||||
headers.Authorization = 'token ' + config.token if config.token
|
||||
# Make the HTTPS request.
|
||||
|
@ -39,9 +43,10 @@ proxy = (req, res, next) ->
|
|||
write _res.statusCode, body
|
||||
|
||||
# Get handled by Connect.
|
||||
next()
|
||||
do next
|
||||
|
||||
app = connect()
|
||||
.use(proxy)
|
||||
.use(connect.static(__dirname + '/public'))
|
||||
.listen process.env.PORT
|
||||
.listen process.env.PORT, ->
|
||||
console.log 'Proxy listening on port', app.address().port
|
|
@ -44,7 +44,7 @@ request = ({ protocol, host, token, path }, query, noun, cb) ->
|
|||
# The content type.
|
||||
.set('Content-Type', 'application/json')
|
||||
# The media type.
|
||||
.set('Accept', 'application/vnd.github.raw')
|
||||
.set('Accept', 'application/vnd.github.v3')
|
||||
|
||||
# Auth token?
|
||||
req = req.set('Authorization', "token #{token}") if token
|
||||
|
|
Loading…
Reference in New Issue