kopia lustrzana https://github.com/c9/core
Merge remote-tracking branch 'origin/master' into release-ssoSecret-rotation
commit
878b3caa79
|
@ -54,7 +54,8 @@ rules:
|
|||
camelcase: [1, { properties: "never" }]
|
||||
id-blacklist: [1, "uname", "cb", "acct"]
|
||||
default-case: 1
|
||||
eqeqeq: [1, "smart"]
|
||||
// DISABLED: too much old code still uses this, e.g. for strings that should really be numbers
|
||||
// eqeqeq: [1, "smart"]
|
||||
|
||||
// React rules
|
||||
react/jsx-curly-spacing: 1
|
||||
|
|
|
@ -55,7 +55,7 @@ exports.commands = [{
|
|||
readOnly: true
|
||||
}, {
|
||||
name: "goToNextError",
|
||||
bindKey: bindKey("Alt-E", "Ctrl-E"),
|
||||
bindKey: bindKey("Alt-E", "F4"),
|
||||
exec: function(editor) {
|
||||
config.loadModule("ace/ext/error_marker", function(module) {
|
||||
module.showErrorMarker(editor, 1);
|
||||
|
@ -65,7 +65,7 @@ exports.commands = [{
|
|||
readOnly: true
|
||||
}, {
|
||||
name: "goToPreviousError",
|
||||
bindKey: bindKey("Alt-Shift-E", "Ctrl-Shift-E"),
|
||||
bindKey: bindKey("Alt-Shift-E", "Shift-F4"),
|
||||
exec: function(editor) {
|
||||
config.loadModule("ace/ext/error_marker", function(module) {
|
||||
module.showErrorMarker(editor, -1);
|
||||
|
@ -190,7 +190,7 @@ exports.commands = [{
|
|||
readOnly: true
|
||||
}, {
|
||||
name: "selecttostart",
|
||||
bindKey: bindKey("Ctrl-Shift-Home", "Command-Shift-Up"),
|
||||
bindKey: bindKey("Ctrl-Shift-Home", "Command-Shift-Home|Command-Shift-Up"),
|
||||
exec: function(editor) { editor.getSelection().selectFileStart(); },
|
||||
multiSelectAction: "forEach",
|
||||
readOnly: true,
|
||||
|
@ -206,7 +206,7 @@ exports.commands = [{
|
|||
aceCommandGroup: "fileJump"
|
||||
}, {
|
||||
name: "selectup",
|
||||
bindKey: bindKey("Shift-Up", "Shift-Up"),
|
||||
bindKey: bindKey("Shift-Up", "Shift-Up|Ctrl-Shift-P"),
|
||||
exec: function(editor) { editor.getSelection().selectUp(); },
|
||||
multiSelectAction: "forEach",
|
||||
scrollIntoView: "cursor",
|
||||
|
@ -220,7 +220,7 @@ exports.commands = [{
|
|||
readOnly: true
|
||||
}, {
|
||||
name: "selecttoend",
|
||||
bindKey: bindKey("Ctrl-Shift-End", "Command-Shift-Down"),
|
||||
bindKey: bindKey("Ctrl-Shift-End", "Command-Shift-End|Command-Shift-Down"),
|
||||
exec: function(editor) { editor.getSelection().selectFileEnd(); },
|
||||
multiSelectAction: "forEach",
|
||||
readOnly: true,
|
||||
|
@ -236,7 +236,7 @@ exports.commands = [{
|
|||
aceCommandGroup: "fileJump"
|
||||
}, {
|
||||
name: "selectdown",
|
||||
bindKey: bindKey("Shift-Down", "Shift-Down"),
|
||||
bindKey: bindKey("Shift-Down", "Shift-Down|Ctrl-Shift-N"),
|
||||
exec: function(editor) { editor.getSelection().selectDown(); },
|
||||
multiSelectAction: "forEach",
|
||||
scrollIntoView: "cursor",
|
||||
|
@ -264,7 +264,7 @@ exports.commands = [{
|
|||
readOnly: true
|
||||
}, {
|
||||
name: "selecttolinestart",
|
||||
bindKey: bindKey("Alt-Shift-Left", "Command-Shift-Left"),
|
||||
bindKey: bindKey("Alt-Shift-Left", "Command-Shift-Left|Ctrl-Shift-A"),
|
||||
exec: function(editor) { editor.getSelection().selectLineStart(); },
|
||||
multiSelectAction: "forEach",
|
||||
scrollIntoView: "cursor",
|
||||
|
@ -278,7 +278,7 @@ exports.commands = [{
|
|||
readOnly: true
|
||||
}, {
|
||||
name: "selectleft",
|
||||
bindKey: bindKey("Shift-Left", "Shift-Left"),
|
||||
bindKey: bindKey("Shift-Left", "Shift-Left|Ctrl-Shift-B"),
|
||||
exec: function(editor) { editor.getSelection().selectLeft(); },
|
||||
multiSelectAction: "forEach",
|
||||
scrollIntoView: "cursor",
|
||||
|
@ -306,7 +306,7 @@ exports.commands = [{
|
|||
readOnly: true
|
||||
}, {
|
||||
name: "selecttolineend",
|
||||
bindKey: bindKey("Alt-Shift-Right", "Command-Shift-Right"),
|
||||
bindKey: bindKey("Alt-Shift-Right", "Command-Shift-Right|Shift-End|Ctrl-Shift-E"),
|
||||
exec: function(editor) { editor.getSelection().selectLineEnd(); },
|
||||
multiSelectAction: "forEach",
|
||||
scrollIntoView: "cursor",
|
||||
|
|
|
@ -2,8 +2,8 @@ var fs = require("fs");
|
|||
|
||||
exports.parse = function(hostname) {
|
||||
|
||||
var m1 = hostname.match(/^([0-9a-z-]+?)-([a-z]+)-([a-z]+)-([0-9]+)-([a-z0-9]+)$/);
|
||||
var m2 = hostname.match(/^([0-9a-z-]+?)-([a-z]+)-([a-z]+)-([a-z0-9]+)-([a-z0-9]{4})$/);
|
||||
var m1 = hostname.match(/^([0-9a-z-]+?)-([0-9a-z]+)-([a-z]+)-([0-9]+)-([a-z0-9]+)$/);
|
||||
var m2 = hostname.match(/^([0-9a-z-]+?)-([0-9a-z]+)-([a-z]+)-([a-z0-9]+)-([a-z0-9]{4})$/);
|
||||
|
||||
if (m1) {
|
||||
return {
|
||||
|
|
|
@ -23,5 +23,6 @@ describe(__filename, function() {
|
|||
assertServerName(hostname.parse("newclient-gce-eu-prod-d4fg"), "newclient", "gce", "eu", "d4fg", "prod");
|
||||
assertServerName(hostname.parse("ide-old-gce-usw-02-prod"), "ide-old", "gce", "usw", "02", "prod");
|
||||
assertServerName(hostname.parse("docker-premium-eu-115-prod"), "docker", "premium", "eu", "115", "prod");
|
||||
assertServerName(hostname.parse("docker-c9admin-usw-389-prod"), "docker", "c9admin", "usw", "389", "prod");
|
||||
});
|
||||
});
|
||||
|
|
|
@ -9,6 +9,12 @@ module.exports = ratelimit;
|
|||
|
||||
function ratelimit(key, duration, max) {
|
||||
var requests = Object.create(null); // in case there handles like 'constructor'
|
||||
var rootKey = "params";
|
||||
if (/^req\./.test(key)) {
|
||||
rootKey = null;
|
||||
key = key.replace(/^req\./, "");
|
||||
}
|
||||
|
||||
setInterval(function() {
|
||||
Object.keys(requests).forEach(expireRequests);
|
||||
}, Math.min(duration * 0.75, MAX_EXPIRE_INTERVAL));
|
||||
|
@ -38,7 +44,8 @@ function ratelimit(key, duration, max) {
|
|||
}
|
||||
|
||||
return function(req, res, next) {
|
||||
var handle = resolveValue(req.params, key);
|
||||
var root = rootKey ? req[rootKey] : req;
|
||||
var handle = resolveValue(root, key);
|
||||
|
||||
requests[handle] = requests[handle] || [];
|
||||
if (requests[handle].length >= max) {
|
||||
|
|
|
@ -33,15 +33,34 @@ describe("ratelimit", function() {
|
|||
});
|
||||
|
||||
it("Should work with deep keys", function (done) {
|
||||
var limiter = ratelimit("user.id", 10, 1);
|
||||
var limiter = ratelimit("user.id", 100, 1);
|
||||
limiter({params: {user: {id: "hey"}}}, null, function (err) {
|
||||
assert(!err, err);
|
||||
limiter({params: {user: {id: "yay"}}}, null, function (err) {
|
||||
assert(!err, err);
|
||||
limiter({params: {user: {id: "hey"}}}, null, function (err) {
|
||||
assert(err);
|
||||
assert.equal(err.code, 429);
|
||||
done();
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
it("Should work with parameters directly on req, if req is specified as the first part of the deep key", function (done) {
|
||||
var limiter = ratelimit("req.user.id", 100, 1);
|
||||
limiter({user: {id: "hey"}}, null, function (err) {
|
||||
assert(!err, err);
|
||||
limiter({user: {id: "yay"}}, null, function (err) {
|
||||
assert(!err, err);
|
||||
limiter({user: {id: "hey"}}, null, function (err) {
|
||||
assert(err);
|
||||
assert.equal(err.code, 429);
|
||||
done();
|
||||
});
|
||||
});
|
||||
});
|
||||
})
|
||||
|
||||
it("Should work again after a delay", function (done) {
|
||||
var limiter = ratelimit("username", 10, 1);
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"name": "c9",
|
||||
"description": "New Cloud9 Client",
|
||||
"version": "3.1.3182",
|
||||
"version": "3.1.3243",
|
||||
"author": "Ajax.org B.V. <info@ajax.org>",
|
||||
"private": true,
|
||||
"main": "bin/c9",
|
||||
|
@ -71,7 +71,7 @@
|
|||
"c9.ide.language.javascript.infer": "#b9c2e4bdb8",
|
||||
"c9.ide.language.jsonalyzer": "#a0549e14ff",
|
||||
"c9.ide.language.codeintel": "#0fe92d6f46",
|
||||
"c9.ide.collab": "#a414999755",
|
||||
"c9.ide.collab": "#9c6e7a8438",
|
||||
"c9.ide.local": "#9169fec157",
|
||||
"c9.ide.find": "#e632ecf4be",
|
||||
"c9.ide.find.infiles": "#ad9ff74638",
|
||||
|
@ -90,12 +90,12 @@
|
|||
"c9.ide.configuration": "#a936df26bb",
|
||||
"c9.ide.dialog.wizard": "#7667ec79a8",
|
||||
"c9.ide.fontawesome": "#781602c5d8",
|
||||
"c9.ide.format": "#8270e4fef2",
|
||||
"c9.ide.format": "#786871dd42",
|
||||
"c9.ide.help.support": "#fbe8eb5c36",
|
||||
"c9.ide.imgeditor": "#612e75ef4f",
|
||||
"c9.ide.immediate": "#0b0ee744f9",
|
||||
"c9.ide.installer": "#2921efaf6d",
|
||||
"c9.ide.language.python": "#e1b6ce0937",
|
||||
"c9.ide.language.python": "#ec0b9070a4",
|
||||
"c9.ide.language.go": "#6ce1c7a7ef",
|
||||
"c9.ide.navigate": "#5d5707058c",
|
||||
"c9.ide.newresource": "#981a408a7b",
|
||||
|
|
|
@ -77,6 +77,12 @@ define(function(require, exports, module) {
|
|||
}, {
|
||||
bindKey: {win: "Ctrl-z", mac: "Cmd-z"},
|
||||
name: "\u0018\u0015" // "ctrl-x ctrl-u"
|
||||
}, {
|
||||
bindKey: {win: null, mac: "Cmd-Left"},
|
||||
name: "\x1b[1~" // "ctrl-x ctrl-u"
|
||||
}, {
|
||||
bindKey: {win: null, mac: "Cmd-Right"},
|
||||
name: "\x1b[4~" // "ctrl-x ctrl-u"
|
||||
}];
|
||||
|
||||
specialKeys.addCommands(aliases);
|
||||
|
|
|
@ -25,7 +25,7 @@ describe("The build module", function(){
|
|||
options = {
|
||||
version: "testing",
|
||||
compress: false,
|
||||
baseUrl: "https://cdn.c9.io/static/abcd1234"
|
||||
baseUrl: "https://static.c9.io/static/abcd1234"
|
||||
};
|
||||
|
||||
buildPlugin(options, {
|
||||
|
|
|
@ -31,25 +31,24 @@ case "$uname" in
|
|||
esac
|
||||
|
||||
|
||||
cd `dirname $0`/..
|
||||
SOURCE=`pwd`
|
||||
PATH=$HOME/.c9/node/bin:$PATH
|
||||
|
||||
LOCAL=$SOURCE/local
|
||||
APPDIR=$SOURCE/build/webkitbuilds/app.nw
|
||||
cd "$(dirname "$0")/.."
|
||||
SOURCE="$(pwd)"
|
||||
|
||||
if [ "$os" == "linux" ]; then
|
||||
if [ ! -d $SOURCE/build/webkitbuilds/cache/linux/0.12.3 ]; then
|
||||
mkdir -p $SOURCE/build/webkitbuilds/cache/linux/0.12.3/
|
||||
pushd $SOURCE/build/webkitbuilds/cache/linux/0.12.3
|
||||
if [ ! -d "$SOURCE"/build/webkitbuilds/cache/linux/0.12.3 ]; then
|
||||
mkdir -p "$SOURCE"/build/webkitbuilds/cache/linux/0.12.3/
|
||||
pushd "$SOURCE"/build/webkitbuilds/cache/linux/0.12.3
|
||||
wget http://dl.nwjs.io/v0.12.3/nwjs-v0.12.3-linux-x64.tar.gz
|
||||
tar -zxf nwjs-v0.12.3-linux-x64.tar.gz
|
||||
popd
|
||||
fi
|
||||
DEST="$SOURCE/build/Cloud9-dev-linux"
|
||||
rm -rf "$DEST"
|
||||
mkdir -p $DEST
|
||||
cp -R $SOURCE/build/webkitbuilds/cache/linux/0.12.3/nwjs-v0.12.3-linux-x64/* $DEST
|
||||
cp $SOURCE/build/linux/c9.png $DEST/icon.png
|
||||
mkdir -p "$DEST"
|
||||
cp -R "$SOURCE"/build/webkitbuilds/cache/linux/0.12.3/nwjs-v0.12.3-linux-x64/* "$DEST"
|
||||
cp "$SOURCE"/build/linux/c9.png "$DEST"/icon.png
|
||||
|
||||
node --eval "
|
||||
var path = require('path')
|
||||
|
@ -58,14 +57,14 @@ if [ "$os" == "linux" ]; then
|
|||
delete p.dependencies;
|
||||
p.window.icon = 'icon.png';
|
||||
console.log(JSON.stringify(p, null, 2));
|
||||
" > $DEST/package.json
|
||||
" > "$DEST"/package.json
|
||||
|
||||
fi
|
||||
|
||||
if [ "$os" == "darwin" ]; then
|
||||
if [ ! -d $SOURCE/build/webkitbuilds/cache/mac/0.9.3 ]; then
|
||||
mkdir -p $SOURCE/build/webkitbuilds/cache/mac/0.9.3/node-webkit.app
|
||||
pushd $SOURCE/build/webkitbuilds/cache/mac/0.9.3
|
||||
if [ ! -d "$SOURCE"/build/webkitbuilds/cache/mac/0.9.3 ]; then
|
||||
mkdir -p "$SOURCE"/build/webkitbuilds/cache/mac/0.9.3/node-webkit.app
|
||||
pushd "$SOURCE"/build/webkitbuilds/cache/mac/0.9.3
|
||||
curl -OL http://dl.node-webkit.org/v0.9.3/node-webkit-v0.9.3-pre8-osx-ia32.zip
|
||||
unzip node-webkit-v0.9.3-pre8-osx-ia32.zip
|
||||
popd
|
||||
|
@ -77,11 +76,11 @@ if [ "$os" == "darwin" ]; then
|
|||
rm -rf "$DEST"
|
||||
mkdir -p "$RES/app.nw"
|
||||
|
||||
cp -R $SOURCE/build/webkitbuilds/cache/mac/0.9.3/node-webkit.app/* $DEST
|
||||
cat $SOURCE/local/Info.plist | sed "s/Cloud9/Cloud9-dev/" > $DEST/Contents/Info.plist
|
||||
cp -R "$SOURCE"/build/webkitbuilds/cache/mac/0.9.3/node-webkit.app/* "$DEST"
|
||||
cat "$SOURCE"/local/Info.plist | sed "s/Cloud9/Cloud9-dev/" > "$DEST"/Contents/Info.plist
|
||||
# TODO add blue icon for dev mode
|
||||
# rm $DEST/Contents/Resources/nw.icns
|
||||
cp $SOURCE/build/osx/c9.icns $DEST/Contents/Resources/nw.icns
|
||||
cp "$SOURCE"/build/osx/c9.icns "$DEST"/Contents/Resources/nw.icns
|
||||
|
||||
node --eval "
|
||||
var path = require('path')
|
||||
|
@ -90,13 +89,12 @@ if [ "$os" == "darwin" ]; then
|
|||
delete p.dependencies;
|
||||
// p.window.icon = 'icon.png';
|
||||
console.log(JSON.stringify(p, null, 2));
|
||||
" > $RES/app.nw/package.json
|
||||
" > "$RES"/app.nw/package.json
|
||||
|
||||
echo dev app created in build/Cloud9-dev.app/Contents/MacOS/node-webkit
|
||||
fi
|
||||
|
||||
if [ "$os" == "windows" ]; then
|
||||
NODE_VERSION=v0.12.2
|
||||
NW_VERSION=v0.12.2
|
||||
# TODO find a more reliable place to put c9 dependencies
|
||||
HOME="$HOMEDRIVE$HOMEPATH"
|
||||
|
@ -165,4 +163,3 @@ if [ "$os" == "windows" ]; then
|
|||
fi
|
||||
|
||||
|
||||
|
||||
|
|
Ładowanie…
Reference in New Issue