kopia lustrzana https://github.com/c9/core
Merge remote-tracking branch 'origin/update-dockerfiles' into single-sign-out
commit
9b3e007435
|
@ -25,6 +25,7 @@ plugins/c9.fs/mock/
|
|||
|
||||
# ignore node_modules
|
||||
node_modules/*
|
||||
plugins/c9.batch/analytics/node_modules/
|
||||
# except git subtrees
|
||||
!node_modules/ace*
|
||||
!node_modules/architect*
|
||||
|
|
|
@ -0,0 +1,28 @@
|
|||
/**
|
||||
* JSON (de-)serializer with support for encosing regular expressions
|
||||
*/
|
||||
"use strict";
|
||||
|
||||
exports.replacer = function(key, value) {
|
||||
if (value instanceof RegExp)
|
||||
return ("__REGEXP " + value.toString());
|
||||
else
|
||||
return value;
|
||||
};
|
||||
|
||||
exports.reviver = function(key, value) {
|
||||
if ((value + "").indexOf("__REGEXP ") == 0) {
|
||||
var m = value.match(/__REGEXP \/(.*)\/(.*)?/);
|
||||
return new RegExp(m[1], m[2]);
|
||||
}
|
||||
else
|
||||
return value;
|
||||
};
|
||||
|
||||
exports.stringify = function(value, space) {
|
||||
return JSON.stringify(value, exports.replacer, space);
|
||||
};
|
||||
|
||||
exports.parse = function(rext) {
|
||||
return JSON.parse(rext, exports.reviver);
|
||||
};
|
|
@ -0,0 +1,27 @@
|
|||
/*global describe it before after beforeEach afterEach define*/
|
||||
"use strict";
|
||||
"use server";
|
||||
"use mocha";
|
||||
|
||||
require("c9/inline-mocha")(module);
|
||||
|
||||
var assert = require("assert-diff");
|
||||
var reJSON = require("./json-with-re");
|
||||
|
||||
describe(__filename, function(){
|
||||
it("should encode regular expressions", function() {
|
||||
assert.deepEqual(reJSON.stringify({ foo: /foo/ }), '{"foo":"__REGEXP /foo/"}');
|
||||
assert.deepEqual(reJSON.stringify({ foo: /foo\//gi }), "{\"foo\":\"__REGEXP /foo\\\\//gi\"}");
|
||||
});
|
||||
it("should decode regular expressions", function() {
|
||||
assert.deepEqual(reJSON.parse('{"foo":"__REGEXP /foo/"}'), { foo: /foo/ });
|
||||
assert.deepEqual(reJSON.parse("{\"foo\":\"__REGEXP /foo\\\\//gi\"}"), { foo: /foo\//gi });
|
||||
});
|
||||
it("should deal with null values", function() {
|
||||
var o = {
|
||||
foo: null,
|
||||
bar: /dd/
|
||||
};
|
||||
assert.deepEqual(reJSON.parse(reJSON.stringify(o)), o);
|
||||
});
|
||||
});
|
|
@ -91,12 +91,12 @@ function getBaseUrl(req, sourceBaseUrlPattern, targetBaseUrlPattern) {
|
|||
targetHost = "c9.io";
|
||||
}
|
||||
|
||||
if (targetHost.match(/^(ide|vfs)./) && !targetBaseUrlPattern)
|
||||
if (/^(ide|vfs)./.test(targetHost) && !targetBaseUrlPattern)
|
||||
console.error(new Error("Warning: no targetBaseUrlPattern specified, will stay at " + targetHost), {
|
||||
sourceBaseUrlPattern: sourceBaseUrlPattern
|
||||
});
|
||||
|
||||
if (targetHost.match(/^(ide|vfs)./))
|
||||
if (/^(ide|vfs)./.test(targetHost))
|
||||
console.trace("Warning: possibly incorrect baseUrl constructed, with 'ide.' in the hostname: " + targetHost);
|
||||
|
||||
return replaceDomain(targetBaseUrlPattern || sourceBaseUrlPattern, targetHost)
|
||||
|
|
|
@ -1,11 +1,24 @@
|
|||
"use strict";
|
||||
|
||||
var url = require("url");
|
||||
|
||||
module.exports = function(options, imports, register) {
|
||||
|
||||
var trustedDomainsRe = options.trustedDomainsRe || /.*/;
|
||||
|
||||
imports.connect.addResponseMethod("redirect", function(location) {
|
||||
this.writeHead(302, {Location: location});
|
||||
this.end("");
|
||||
});
|
||||
imports.connect.addResponseMethod("secureRedirect", function(location) {
|
||||
var parsedLocation = url.parse(location);
|
||||
|
||||
if (!trustedDomainsRe.test(parsedLocation.host))
|
||||
location = parsedLocation.path;
|
||||
|
||||
this.writeHead(302, {Location: location});
|
||||
this.end("");
|
||||
});
|
||||
imports.connect.addResponseMethod("returnTo", function(req, defaultReturn) {
|
||||
var url = defaultReturn || "/";
|
||||
if (req.session && req.session.returnTo) {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"name": "c9",
|
||||
"description": "New Cloud9 Client",
|
||||
"version": "3.1.126",
|
||||
"version": "3.1.176",
|
||||
"author": "Ajax.org B.V. <info@ajax.org>",
|
||||
"private": true,
|
||||
"main": "bin/c9",
|
||||
|
@ -71,7 +71,7 @@
|
|||
"c9.ide.find": "#35379124ca",
|
||||
"c9.ide.find.infiles": "#c132ad243c",
|
||||
"c9.ide.find.replace": "#44772dd796",
|
||||
"c9.ide.run.debug": "#a46abda8e9",
|
||||
"c9.ide.run.debug": "#3b76105b4e",
|
||||
"c9.automate": "#47e2c429c9",
|
||||
"c9.ide.ace.emmet": "#6dc4585e02",
|
||||
"c9.ide.ace.gotoline": "#a8ff07c8f4",
|
||||
|
|
|
@ -61,11 +61,8 @@ function plugin(options, imports, register) {
|
|||
|
||||
var domain = socket._httpMessage && socket._httpMessage.domain;
|
||||
var req = domain && domain.members[0];
|
||||
if (req && req.url) {
|
||||
metrics.increment("request.timeout");
|
||||
if (req && req.url)
|
||||
sendRequestWarning(new Error("Request timed out: " + req.url), req);
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
function sendRequestError(err, req) {
|
||||
|
|
|
@ -183,6 +183,8 @@ define(function(require, module, exports) {
|
|||
});
|
||||
plugin.on("unload", function(){
|
||||
loaded = false;
|
||||
defaultEditor = null;
|
||||
group = null;
|
||||
});
|
||||
|
||||
/***** Register and define API *****/
|
||||
|
|
|
@ -356,6 +356,13 @@ define(function(require, exports, module) {
|
|||
}
|
||||
});
|
||||
});
|
||||
handle.on("unload", function(){
|
||||
mnuTerminal = null;
|
||||
lastEditor = null;
|
||||
lastTerminal = null;
|
||||
shownDotsHelp = null;
|
||||
installPrompted = null;
|
||||
});
|
||||
|
||||
handle.draw = function(){
|
||||
ui.insertMarkup(null, markupMenu, handle);
|
||||
|
|
|
@ -13,7 +13,8 @@ function plugin(options, imports, register) {
|
|||
register(null, {
|
||||
"metrics": {
|
||||
log: function() {},
|
||||
increment: function() {}
|
||||
increment: function() {},
|
||||
timing: function() {}
|
||||
}
|
||||
});
|
||||
}
|
|
@ -1,14 +1,18 @@
|
|||
define(function(require, exports, module) {
|
||||
"use strict";
|
||||
|
||||
main.consumes = ["Plugin", "vfs.connect"];
|
||||
main.consumes = [
|
||||
"Plugin",
|
||||
"vfs.connect",
|
||||
"metrics"
|
||||
];
|
||||
main.provides = ["vfs.cache"];
|
||||
return main;
|
||||
|
||||
|
||||
function main(options, imports, register) {
|
||||
var Plugin = imports.Plugin;
|
||||
var connectVfs = imports["vfs.connect"].connect;
|
||||
var metrics = imports.metrics;
|
||||
|
||||
var async = require("async");
|
||||
var uid = require("c9/uid");
|
||||
|
@ -54,10 +58,12 @@ define(function(require, exports, module) {
|
|||
if (err) return done(err);
|
||||
|
||||
entry.connectTime = Date.now() - entry.startTime;
|
||||
metrics.timing("vfs.connect.time", entry.connectTime);
|
||||
|
||||
entry.emit("loaded");
|
||||
|
||||
cache[vfsid] = entry;
|
||||
entry.keepalive();
|
||||
|
||||
vfs.on("destroy", function() {
|
||||
remove(vfsid);
|
||||
|
@ -126,7 +132,6 @@ define(function(require, exports, module) {
|
|||
};
|
||||
|
||||
entry.keepalive = function() {
|
||||
clearTimeout(timer);
|
||||
startTimer();
|
||||
};
|
||||
|
||||
|
@ -139,7 +144,6 @@ define(function(require, exports, module) {
|
|||
}, maxAge);
|
||||
}
|
||||
|
||||
startTimer();
|
||||
return entry;
|
||||
}
|
||||
|
||||
|
|
|
@ -36,7 +36,6 @@ function plugin(options, imports, register) {
|
|||
var connect = imports.connect;
|
||||
var render = imports["connect.render"];
|
||||
var analytics = imports["analytics"];
|
||||
var async = require("async");
|
||||
|
||||
var Types = require("frontdoor").Types;
|
||||
var error = require("http-error");
|
||||
|
|
Ładowanie…
Reference in New Issue