Skip to content

Commit f731bda

Browse files
author
Ben Newman
committed
Merge branch 'devel' into release-1.4.2
2 parents ccd960e + fec8303 commit f731bda

10 files changed

Lines changed: 87 additions & 44 deletions

File tree

meteor

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -113,17 +113,17 @@ fi
113113
DEV_BUNDLE="$SCRIPT_DIR/dev_bundle"
114114
METEOR="$SCRIPT_DIR/tools/index.js"
115115

116+
# Set the nofile ulimit as high as permitted by the hard-limit/kernel
117+
if [ "$(ulimit -Sn)" != "unlimited" ]; then
118+
if [ "$(uname -s)" = "Darwin" ]; then
119+
maxfilesuse="$(sysctl -n kern.maxfilesperproc)"
120+
else
121+
maxfilesuse="$(ulimit -Hn)"
122+
fi
116123

117-
# Bump our file descriptor ulimit as high as it will go. This is a
118-
# temporary workaround for dependancy watching holding open too many
119-
# files: https://app.asana.com/0/364581412985/472479912325
120-
if [ "$(ulimit -n)" != "unlimited" ] ; then
121-
ulimit -n 16384 > /dev/null 2>&1 || \
122-
ulimit -n 8192 > /dev/null 2>&1 || \
123-
ulimit -n 4096 > /dev/null 2>&1 || \
124-
ulimit -n 2048 > /dev/null 2>&1 || \
125-
ulimit -n 1024 > /dev/null 2>&1 || \
126-
ulimit -n 512 > /dev/null 2>&1
124+
if [ -n "${maxfilesuse}" ] && [ "${maxfilesuse}" != "unlimited" ]; then
125+
ulimit -Sn ${maxfilesuse} > /dev/null 2>&1
126+
fi
127127
fi
128128

129129
# We used to set $NODE_PATH here to include the node_modules from the dev

packages/boilerplate-generator/boilerplate_web.cordova.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<meta name="format-detection" content="telephone=no">
55
<meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width, height=device-height">
66
<meta name="msapplication-tap-highlight" content="no">
7-
<meta http-equiv="Content-Security-Policy" content="default-src * data: blob: 'unsafe-inline' 'unsafe-eval' ws: wss:;">
7+
<meta http-equiv="Content-Security-Policy" content="default-src * gap: data: blob: 'unsafe-inline' 'unsafe-eval' ws: wss:;">
88

99
{{! We are explicitly not using bundledJsCssUrlRewriteHook: in cordova we serve assets up directly from disk, so rewriting the URL does not make sense }}
1010

packages/browser-policy-content/browser-policy-content.js

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -102,19 +102,26 @@ var addSourceForDirective = function (directive, src) {
102102
if (_.contains(_.values(keywords), src)) {
103103
cspSrcs[directive].push(src);
104104
} else {
105-
src = src.toLowerCase();
106-
107-
// Trim trailing slashes.
108-
src = src.replace(/\/+$/, '');
109-
110105
var toAdd = [];
111-
// If there is no protocol, add both http:// and https://.
112-
if (! /^([a-z0-9.+-]+:)/.test(src)) {
113-
toAdd.push("http://" + src);
114-
toAdd.push("https://" + src);
106+
107+
//Only add single quotes to CSP2 script digests
108+
if (/^(sha(256|384|512)-)/i.test(src)) {
109+
toAdd.push("'" + src + "'");
115110
} else {
116-
toAdd.push(src);
111+
src = src.toLowerCase();
112+
113+
// Trim trailing slashes.
114+
src = src.replace(/\/+$/, '');
115+
116+
// If there is no protocol, add both http:// and https://.
117+
if (! /^([a-z0-9.+-]+:)/.test(src)) {
118+
toAdd.push("http://" + src);
119+
toAdd.push("https://" + src);
120+
} else {
121+
toAdd.push(src);
122+
}
117123
}
124+
118125
_.each(toAdd, function (s) {
119126
cspSrcs[directive].push(s);
120127
});

packages/mongo/collection.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -704,7 +704,7 @@ Mongo.Collection.prototype._createCappedCollection = function (byteSize, maxDocu
704704
};
705705

706706
/**
707-
* @summary Returns the [`Collection`](http://mongodb.github.io/node-mongodb-native/1.4/api-generated/collection.html) object corresponding to this collection from the [npm `mongodb` driver module](https://www.npmjs.com/package/mongodb) which is wrapped by `Mongo.Collection`.
707+
* @summary Returns the [`Collection`](http://mongodb.github.io/node-mongodb-native/2.2/api/Collection.html) object corresponding to this collection from the [npm `mongodb` driver module](https://www.npmjs.com/package/mongodb) which is wrapped by `Mongo.Collection`.
708708
* @locus Server
709709
*/
710710
Mongo.Collection.prototype.rawCollection = function () {
@@ -716,7 +716,7 @@ Mongo.Collection.prototype.rawCollection = function () {
716716
};
717717

718718
/**
719-
* @summary Returns the [`Db`](http://mongodb.github.io/node-mongodb-native/1.4/api-generated/db.html) object corresponding to this collection's database connection from the [npm `mongodb` driver module](https://www.npmjs.com/package/mongodb) which is wrapped by `Mongo.Collection`.
719+
* @summary Returns the [`Db`](http://mongodb.github.io/node-mongodb-native/2.2/api/Db.html) object corresponding to this collection's database connection from the [npm `mongodb` driver module](https://www.npmjs.com/package/mongodb) which is wrapped by `Mongo.Collection`.
720720
* @locus Server
721721
*/
722722
Mongo.Collection.prototype.rawDatabase = function () {

packages/mongo/connection_options.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/**
22
* @summary Allows for user specified connection options
3-
* @example http://mongodb.github.io/node-mongodb-native/2.1/reference/connecting/connection-settings/
3+
* @example http://mongodb.github.io/node-mongodb-native/2.2/reference/connecting/connection-settings/
44
* @locus Server
55
* @param {Object} options User specified Mongo connection options
66
*/

packages/oauth1/oauth1_server.js

Lines changed: 32 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,26 @@
11
var url = Npm.require("url");
22

3+
OAuth._queryParamsWithAuthTokenUrl = function (authUrl, oauthBinding, params, whitelistedQueryParams) {
4+
params = params || {};
5+
var redirectUrlObj = url.parse(authUrl, true);
6+
7+
_.extend(
8+
redirectUrlObj.query,
9+
_.pick(params.query, whitelistedQueryParams),
10+
{
11+
oauth_token: oauthBinding.requestToken,
12+
}
13+
);
14+
15+
// Clear the `search` so it is rebuilt by Node's `url` from the `query` above.
16+
// Using previous versions of the Node `url` module, this was just set to ""
17+
// However, Node 6 docs seem to indicate that this should be `undefined`.
18+
delete redirectUrlObj.search;
19+
20+
// Reconstruct the URL back with provided query parameters merged with oauth_token
21+
return url.format(redirectUrlObj);
22+
};
23+
324
// connect middleware
425
OAuth._requestHandlers['1'] = function (service, query, res) {
526
var config = ServiceConfiguration.configurations.findOne({service: service.serviceName});
@@ -30,19 +51,19 @@ OAuth._requestHandlers['1'] = function (service, query, res) {
3051
oauthBinding.requestTokenSecret);
3152

3253
// support for scope/name parameters
33-
var redirectUrl = undefined;
54+
var redirectUrl;
55+
var authParams = {
56+
query: query
57+
};
58+
3459
if(typeof urls.authenticate === "function") {
35-
redirectUrl = urls.authenticate(oauthBinding, {
36-
query: query
37-
});
60+
redirectUrl = urls.authenticate(oauthBinding, authParams);
3861
} else {
39-
// Parse the URL to support additional query parameters in urls.authenticate
40-
var redirectUrlObj = url.parse(urls.authenticate, true);
41-
redirectUrlObj.query = redirectUrlObj.query || {};
42-
redirectUrlObj.query.oauth_token = oauthBinding.requestToken;
43-
redirectUrlObj.search = '';
44-
// Reconstruct the URL back with provided query parameters merged with oauth_token
45-
redirectUrl = url.format(redirectUrlObj);
62+
redirectUrl = OAuth._queryParamsWithAuthTokenUrl(
63+
urls.authenticate,
64+
oauthBinding,
65+
authParams
66+
);
4667
}
4768

4869
// redirect to provider login, which will redirect back to "step 2" below

packages/twitter/package.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ Package.onUse(function(api) {
1818
['twitter_configure.html', 'twitter_configure.js'],
1919
'client');
2020

21+
api.addFiles('twitter_common.js', ['server', 'client']);
22+
2123
api.addFiles('twitter_server.js', 'server');
2224
api.addFiles('twitter_client.js', 'client');
2325
});

packages/twitter/twitter_client.js

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
Twitter = {};
2-
31
// Request Twitter credentials for the user
42
// @param options {optional} XXX support options.requestPermissions
53
// @param credentialRequestCompleteCallback {Function} Callback function to call on
@@ -38,9 +36,14 @@ Twitter.requestCredential = function (options, credentialRequestCompleteCallback
3836
}
3937
}
4038

41-
// Handle force login (request the user to enter their credentials)
42-
if (options && options.force_login) {
43-
loginPath += "&force_login=true";
39+
// Support additional, permitted parameters
40+
if (options) {
41+
var hasOwn = Object.prototype.hasOwnProperty;
42+
Twitter.validParamsAuthenticate.forEach(function (param) {
43+
if (hasOwn.call(options, param)) {
44+
loginPath += "&" + param + "=" + encodeURIComponent(options[param]);
45+
}
46+
});
4447
}
4548

4649
var loginUrl = Meteor.absoluteUrl(loginPath);

packages/twitter/twitter_common.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
Twitter = {};
2+
3+
Twitter.validParamsAuthenticate = [
4+
'force_login',
5+
'screen_name'
6+
];

packages/twitter/twitter_server.js

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,17 @@
1-
Twitter = {};
2-
31
var urls = {
42
requestToken: "https://api.twitter.com/oauth/request_token",
53
authorize: "https://api.twitter.com/oauth/authorize",
64
accessToken: "https://api.twitter.com/oauth/access_token",
7-
authenticate: "https://api.twitter.com/oauth/authenticate"
5+
authenticate: function (oauthBinding, params) {
6+
return OAuth._queryParamsWithAuthTokenUrl(
7+
"https://api.twitter.com/oauth/authenticate",
8+
oauthBinding,
9+
params,
10+
Twitter.validParamsAuthenticate
11+
);
12+
}
813
};
914

10-
1115
// https://dev.twitter.com/docs/api/1.1/get/account/verify_credentials
1216
Twitter.whitelistedFields = ['profile_image_url', 'profile_image_url_https', 'lang', 'email'];
1317

0 commit comments

Comments
 (0)