kopia lustrzana https://github.com/c9/core
Merge remote-tracking branch 'origin/master' into fix/engineio-upgrade
Conflicts: npm-shrinkwrap.jsonpull/39/head
commit
2cd16eacf7
|
@ -33,7 +33,6 @@ module.exports = function(config, optimist) {
|
||||||
.describe("hosted", "Use default config of the hosted version")
|
.describe("hosted", "Use default config of the hosted version")
|
||||||
.default("hosted", false)
|
.default("hosted", false)
|
||||||
.describe("auth", "Basic Auth username:password")
|
.describe("auth", "Basic Auth username:password")
|
||||||
.default("auth", ":")
|
|
||||||
.describe("collab", "Whether to enable collab.")
|
.describe("collab", "Whether to enable collab.")
|
||||||
.default("collab", config.collab)
|
.default("collab", config.collab)
|
||||||
.describe("cache", "use cached version of cdn files")
|
.describe("cache", "use cached version of cdn files")
|
||||||
|
@ -90,7 +89,12 @@ module.exports = function(config, optimist) {
|
||||||
if (testing && argv.k)
|
if (testing && argv.k)
|
||||||
require("child_process").exec("tmux -L cloud91.9 kill-server", function(){});
|
require("child_process").exec("tmux -L cloud91.9 kill-server", function(){});
|
||||||
|
|
||||||
var auth = argv.auth.split(":");
|
var isLocalhost = host == "localhost" || host == "127.0.0.1";
|
||||||
|
if (argv.auth !== ":" && !isLocalhost) {
|
||||||
|
console.log("Authentication is required when not running on localhost.\nPlease use -a user:pass or --listen localhost to listen locally.");
|
||||||
|
process.exit(255);
|
||||||
|
}
|
||||||
|
var auth = (argv.auth || ":").split(":");
|
||||||
|
|
||||||
var plugins = [
|
var plugins = [
|
||||||
{
|
{
|
||||||
|
|
|
@ -0,0 +1,9 @@
|
||||||
|
module.exports = function (callback) {
|
||||||
|
var start = Date.now();
|
||||||
|
// setInterval is handled after setImmediate and setTimeout handlers
|
||||||
|
var interval = setTimeout(function () {
|
||||||
|
clearInterval(interval);
|
||||||
|
var took = Date.now() - start;
|
||||||
|
return callback(took);
|
||||||
|
}, 0);
|
||||||
|
};
|
|
@ -0,0 +1,60 @@
|
||||||
|
"use strict";
|
||||||
|
"use server";
|
||||||
|
|
||||||
|
var assert = require("assert");
|
||||||
|
var blocked = require("./blocked");
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
|
||||||
|
"test normal run should return low blocked time": function(next) {
|
||||||
|
blocked(function(time) {
|
||||||
|
assert(time < 10);
|
||||||
|
next();
|
||||||
|
});
|
||||||
|
},
|
||||||
|
"test busy loop should report high blocked time": function(next) {
|
||||||
|
blocked(function(time) {
|
||||||
|
assert(time >= 100);
|
||||||
|
next();
|
||||||
|
});
|
||||||
|
|
||||||
|
var start = Date.now();
|
||||||
|
while (Date.now() - start < 100) {}
|
||||||
|
},
|
||||||
|
"test busy loop in setTimeout should report high blocked time": function(next) {
|
||||||
|
setTimeout(function() {
|
||||||
|
var start = Date.now();
|
||||||
|
while (Date.now() - start < 100) {}
|
||||||
|
}, 0);
|
||||||
|
|
||||||
|
blocked(function(time) {
|
||||||
|
assert(time >= 100);
|
||||||
|
next();
|
||||||
|
});
|
||||||
|
},
|
||||||
|
"test busy loop in setInterval should report high blocked time": function(next) {
|
||||||
|
var interval = setInterval(function() {
|
||||||
|
clearInterval(interval);
|
||||||
|
var start = Date.now();
|
||||||
|
while (Date.now() - start < 100) {}
|
||||||
|
});
|
||||||
|
|
||||||
|
blocked(function(time) {
|
||||||
|
assert(time >= 100);
|
||||||
|
next();
|
||||||
|
});
|
||||||
|
},
|
||||||
|
"test busy loop in setImmediate should report high blocked time": function(next) {
|
||||||
|
setImmediate(function() {
|
||||||
|
var start = Date.now();
|
||||||
|
while (Date.now() - start < 100) {}
|
||||||
|
});
|
||||||
|
|
||||||
|
blocked(function(time) {
|
||||||
|
assert(time >= 100);
|
||||||
|
next();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
!module.parent && require("asyncjs").test.testcase(module.exports).exec();
|
|
@ -58,7 +58,7 @@ module.exports = {
|
||||||
},
|
},
|
||||||
|
|
||||||
"test get head revision sync": function(next) {
|
"test get head revision sync": function(next) {
|
||||||
var rev = git.getHeadRevisionSync(__dirname + "/../");
|
var rev = git.getHeadRevisionSync(__dirname + "/../../");
|
||||||
assert.equal(rev.length, 40);
|
assert.equal(rev.length, 40);
|
||||||
|
|
||||||
next();
|
next();
|
||||||
|
@ -70,6 +70,6 @@ module.exports = {
|
||||||
next();
|
next();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
!module.parent && require("asyncjs").test.testcase(module.exports).exec();
|
!module.parent && require("asyncjs").test.testcase(module.exports).exec();
|
||||||
|
|
|
@ -1,30 +1,14 @@
|
||||||
/*global describe it before after beforeEach afterEach define*/
|
/*global describe it before after beforeEach afterEach define*/
|
||||||
"use strict";
|
"use strict";
|
||||||
"use client";
|
|
||||||
"use server";
|
"use server";
|
||||||
"use mocha";
|
"use mocha";
|
||||||
|
|
||||||
// Test flags
|
require("c9/inline-mocha")(module);
|
||||||
//
|
|
||||||
// "use root"; the unit test will be executed as root (using sudo); use with care! (ex. back-up / restore tests)
|
|
||||||
// "use non-osx"; test will be skipped if the operating system is Mac OS
|
|
||||||
// "use server"; tests are supposed to run on server-side (either with node or mocha)
|
|
||||||
// "use client"; tests are run by means of Selenium on client side
|
|
||||||
// "use mocha"; tests can be run by mocha or by node; this label indicates needs be run using mocha.
|
|
||||||
|
|
||||||
if (typeof define === "undefined") {
|
var assert = require("assert");
|
||||||
require("c9/inline-mocha")(module);
|
|
||||||
require("amd-loader");
|
|
||||||
require("../../test/setup_paths");
|
|
||||||
}
|
|
||||||
|
|
||||||
define(function(require, exports, module) {
|
|
||||||
|
|
||||||
var assert = require("ace/test/assertions");
|
|
||||||
var passcrypt = require('./passcrypt');
|
var passcrypt = require('./passcrypt');
|
||||||
var bcrypt = require('bcrypt');
|
var bcrypt = require('bcrypt');
|
||||||
|
|
||||||
|
|
||||||
describe("c9/passcrypt", function(){
|
describe("c9/passcrypt", function(){
|
||||||
this.timeout(2000);
|
this.timeout(2000);
|
||||||
|
|
||||||
|
@ -78,6 +62,4 @@ describe("c9/passcrypt", function(){
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
if (typeof onload !== "undefined")
|
if (typeof onload !== "undefined") onload();
|
||||||
onload();
|
|
||||||
});
|
|
||||||
|
|
|
@ -59,8 +59,8 @@
|
||||||
"c9.ide.language.javascript.eslint": "#cf4b2d05af",
|
"c9.ide.language.javascript.eslint": "#cf4b2d05af",
|
||||||
"c9.ide.language.javascript.tern": "#a65ad88dd9",
|
"c9.ide.language.javascript.tern": "#a65ad88dd9",
|
||||||
"c9.ide.language.javascript.infer": "#702bbd4dcd",
|
"c9.ide.language.javascript.infer": "#702bbd4dcd",
|
||||||
"c9.ide.language.jsonalyzer": "#eaf8152b03",
|
"c9.ide.language.jsonalyzer": "#722983bf96",
|
||||||
"c9.ide.collab": "#d07855bac7",
|
"c9.ide.collab": "#13fe5c8f27",
|
||||||
"c9.ide.local": "#2bfd7ff051",
|
"c9.ide.local": "#2bfd7ff051",
|
||||||
"c9.ide.find": "#989c06e6a7",
|
"c9.ide.find": "#989c06e6a7",
|
||||||
"c9.ide.find.infiles": "#28b3cfcb47",
|
"c9.ide.find.infiles": "#28b3cfcb47",
|
||||||
|
|
|
@ -79,9 +79,6 @@ define(function(require, module, exports) {
|
||||||
var widths = options.widths || {};
|
var widths = options.widths || {};
|
||||||
var count = 0;
|
var count = 0;
|
||||||
|
|
||||||
if (custom === undefined)
|
|
||||||
custom = !(body || heading);
|
|
||||||
|
|
||||||
var dialog, buttons, titles;
|
var dialog, buttons, titles;
|
||||||
|
|
||||||
var loaded;
|
var loaded;
|
||||||
|
@ -183,7 +180,8 @@ define(function(require, module, exports) {
|
||||||
implementation();
|
implementation();
|
||||||
|
|
||||||
// Update UI
|
// Update UI
|
||||||
if (!custom && (heading || body)) {
|
var custom = options.custom || !(heading || body);
|
||||||
|
if (!custom) {
|
||||||
titles.$int.innerHTML = "<h3 style='margin:0 0 10px 0'>"
|
titles.$int.innerHTML = "<h3 style='margin:0 0 10px 0'>"
|
||||||
+ heading + "</h3><div class='alertMsg'>"
|
+ heading + "</h3><div class='alertMsg'>"
|
||||||
+ body + "</div>";
|
+ body + "</div>";
|
||||||
|
|
|
@ -256,19 +256,21 @@ define(function(require, exports, module) {
|
||||||
function bindKey(key, command, asDefault) {
|
function bindKey(key, command, asDefault) {
|
||||||
removeCommand(command, null, true);
|
removeCommand(command, null, true);
|
||||||
|
|
||||||
if (!key || !command)
|
if (!command)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
command.bindKey = {
|
if (typeof key == "string" || !key) {
|
||||||
position: command.originalBindKey.position
|
command.bindKey = {};
|
||||||
};
|
command.bindKey[commandManager.platform] = key;
|
||||||
|
} else
|
||||||
|
command.bindKey = key;
|
||||||
|
|
||||||
command.bindKey[commandManager.platform] = key;
|
if (command.bindKey.position == undefined)
|
||||||
|
command.bindKey.position = command.originalBindKey.position;
|
||||||
|
|
||||||
commandManager.bindKey(key, command, asDefault);
|
commandManager.bindKey(command.bindKey, command, asDefault);
|
||||||
|
plugin.commandManager.setProperty(command.name,
|
||||||
plugin.commandManager
|
command.bindKey[commandManager.platform]);
|
||||||
.setProperty(command.name, key);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function findKey(key, scope) {
|
function findKey(key, scope) {
|
||||||
|
@ -291,11 +293,7 @@ define(function(require, exports, module) {
|
||||||
|
|
||||||
Object.keys(commands).forEach(function(name) {
|
Object.keys(commands).forEach(function(name) {
|
||||||
var cmd = commands[name];
|
var cmd = commands[name];
|
||||||
var key = cmd.bindKey && cmd.bindKey[platform];
|
bindKey(cmd.originalBindKey, cmd);
|
||||||
if (key)
|
|
||||||
bindKey(key, cmd);
|
|
||||||
else
|
|
||||||
delete plugin.commandManager[name];
|
|
||||||
});
|
});
|
||||||
|
|
||||||
if (noReload)
|
if (noReload)
|
||||||
|
|
|
@ -173,6 +173,8 @@ define(function(require, exports, module) {
|
||||||
"By resetting your keybindings to their "
|
"By resetting your keybindings to their "
|
||||||
+ "defaults you will lose all custom keybindings.",
|
+ "defaults you will lose all custom keybindings.",
|
||||||
function(){
|
function(){
|
||||||
|
settings.set("user/ace/@keyboardmode", "default");
|
||||||
|
settings.set("user/key-bindings/@platform", "auto");
|
||||||
reset();
|
reset();
|
||||||
}, function(){});
|
}, function(){});
|
||||||
},
|
},
|
||||||
|
|
|
@ -932,6 +932,7 @@ define(function(require, exports, module) {
|
||||||
plugin.on("load", function(){
|
plugin.on("load", function(){
|
||||||
aml = new ui.menu({
|
aml = new ui.menu({
|
||||||
id: options.id,
|
id: options.id,
|
||||||
|
zindex: options.zindex,
|
||||||
"onprop.visible" : function(e) {
|
"onprop.visible" : function(e) {
|
||||||
emit(e.value ? "show" : "hide", lastCoords);
|
emit(e.value ? "show" : "hide", lastCoords);
|
||||||
checkItems.call(this, e);
|
checkItems.call(this, e);
|
||||||
|
@ -1032,6 +1033,12 @@ define(function(require, exports, module) {
|
||||||
* @readonly
|
* @readonly
|
||||||
*/
|
*/
|
||||||
get visible(){ return aml.visible; },
|
get visible(){ return aml.visible; },
|
||||||
|
/**
|
||||||
|
* Specifies the zindex of the menu
|
||||||
|
* @property {Number} zindex
|
||||||
|
*/
|
||||||
|
get zindex(){ return aml && ui.getStyle(aml.$ext, "z-index"); },
|
||||||
|
set zindex(value) { aml && aml.setAttribute("zindex", value); },
|
||||||
/**
|
/**
|
||||||
* The menu items appended to this menu
|
* The menu items appended to this menu
|
||||||
* @property {MenuItem[]} items
|
* @property {MenuItem[]} items
|
||||||
|
|
|
@ -122,8 +122,6 @@ define(function(require, exports, module) {
|
||||||
}
|
}
|
||||||
|
|
||||||
var url = server + "/" + req.projectSession.pid + "/preview";
|
var url = server + "/" + req.projectSession.pid + "/preview";
|
||||||
if (req.session.token)
|
|
||||||
url += "?access_token=" + encodeURIComponent(req.session.token);
|
|
||||||
|
|
||||||
req.proxyUrl = url;
|
req.proxyUrl = url;
|
||||||
next();
|
next();
|
||||||
|
@ -135,6 +133,8 @@ define(function(require, exports, module) {
|
||||||
|
|
||||||
var path = req.params.path;
|
var path = req.params.path;
|
||||||
var url = req.proxyUrl + path;
|
var url = req.proxyUrl + path;
|
||||||
|
if (req.session.token)
|
||||||
|
url += "?access_token=" + encodeURIComponent(req.session.token);
|
||||||
|
|
||||||
var parsedUrl = parseUrl(url);
|
var parsedUrl = parseUrl(url);
|
||||||
var httpModule = parsedUrl.protocol == "https:" ? https : http;
|
var httpModule = parsedUrl.protocol == "https:" ? https : http;
|
||||||
|
|
|
@ -146,7 +146,7 @@ Vfs.prototype._createEngine = function(vfs, options) {
|
||||||
var that = this;
|
var that = this;
|
||||||
|
|
||||||
var engine = new eio.Server({
|
var engine = new eio.Server({
|
||||||
pingTimeout: 3000,
|
pingTimeout: 5000,
|
||||||
pingInterval: 15000,
|
pingInterval: 15000,
|
||||||
transports: ["polling", "websocket"],
|
transports: ["polling", "websocket"],
|
||||||
allowUpgrades: true,
|
allowUpgrades: true,
|
||||||
|
|
|
@ -67,18 +67,24 @@ function main(config, settings, options, callback) {
|
||||||
compress: options.compress,
|
compress: options.compress,
|
||||||
virtual: options.virtual
|
virtual: options.virtual
|
||||||
})
|
})
|
||||||
.concat({
|
|
||||||
consumes: [],
|
|
||||||
provides: ["cdn.build", "db"],
|
|
||||||
setup: function(options, imports, register) {
|
|
||||||
register(null, { "cdn.build": {}, "db": {} });
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.filter(function(p) {
|
.filter(function(p) {
|
||||||
var path = p.packagePath;
|
var path = p.packagePath;
|
||||||
return !path || path.indexOf("c9.db.redis/redis") == -1
|
return !path || path.indexOf("c9.db.redis/redis") == -1
|
||||||
&& path.indexOf("c9.static/build") == -1
|
&& path.indexOf("c9.static/build") == -1
|
||||||
&& path.indexOf("c9.api/health") == -1;
|
&& path.indexOf("c9.api/health") == -1;
|
||||||
|
})
|
||||||
|
.concat({
|
||||||
|
consumes: [],
|
||||||
|
provides: ["cdn.build", "db", "health"],
|
||||||
|
setup: function(options, imports, register) {
|
||||||
|
register(null, {
|
||||||
|
"cdn.build": {},
|
||||||
|
"db": {},
|
||||||
|
"health": {
|
||||||
|
addCheck: function() {}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
Ładowanie…
Reference in New Issue