Merge branch 'master' of github.com:c9/newclient into profile-005-5-page-cache-project-page

pull/117/merge
Nikolai Onken 2015-07-07 15:53:38 +00:00
commit a00eef3fec
4 zmienionych plików z 66 dodań i 3 usunięć

Wyświetl plik

@ -302,6 +302,9 @@ module.exports = function(options) {
{
packagePath: "plugins/c9.ide.language/language",
workspaceDir: workspaceDir,
staticPrefix: options.packed
? staticPrefix
: options.ideBaseUrl + "/uph" + staticPrefix,
workerPrefix: options.CORSWorkerPrefix // "/static/standalone/worker"
},
"plugins/c9.ide.language/keyhandler",

Wyświetl plik

@ -274,6 +274,9 @@ var config = require.config = function(cfg) {
cfg.paths && Object.keys(cfg.paths).forEach(function(p) {
config.paths[p] = cfg.paths[p];
});
if (cfg.baseUrlLoadBalancers)
config.baseUrlLoadBalancers = cfg.baseUrlLoadBalancers;
};
config.packages = Object.create(null);
config.paths = Object.create(null);
@ -322,9 +325,24 @@ require.toUrl = function(moduleName, ext, skipExt) {
if (!absRe.test(url)) {
url = (config.baseUrl || require.MODULE_LOAD_URL + "/") + url;
}
if (url[0] === "/" && config.baseUrlLoadBalancers) {
var n = Math.abs(hashCode(url)) % config.baseUrlLoadBalancers.length;
url = config.baseUrlLoadBalancers[n] + url;
}
return url;
};
function hashCode(string) {
var result = 0, i, chr, len;
if (string.length == 0) return result;
for (i = 0, len = string.length; i < len; i++) {
chr = string.charCodeAt(i);
result = ((result << 5) - result) + chr;
result |= 0; // Convert to 32bit integer
}
return result;
}
var loadScript = function(path, id, callback) {
// TODO use importScripts for webworkers
var head = document.head || document.documentElement;

Wyświetl plik

@ -56,7 +56,7 @@
"c9"
],
"c9plugins": {
"c9.ide.language": "#7be4170efe",
"c9.ide.language": "#db72b232cf",
"c9.ide.language.css": "#ef8a28943e",
"c9.ide.language.generic": "#7505e7902e",
"c9.ide.language.html": "#bbe81afed1",
@ -71,7 +71,7 @@
"c9.ide.local": "#a9703b630c",
"c9.ide.find": "#6cc6d3379d",
"c9.ide.find.infiles": "#72582de3cd",
"c9.ide.find.replace": "#e4daf722b8",
"c9.ide.find.replace": "#44772dd796",
"c9.ide.run.debug": "#c7f1ed5d5d",
"c9.automate": "#47e2c429c9",
"c9.ide.ace.emmet": "#0ab4c6cd68",
@ -112,6 +112,6 @@
"c9.ide.threewaymerge": "#229382aa0b",
"c9.ide.undo": "#b028bcb4d5",
"c9.ide.upload": "#0bd010d3dc",
"c9.ide.welcome": "#4b9685584c"
"c9.ide.welcome": "#9eda5a8706"
}
}

Wyświetl plik

@ -0,0 +1,42 @@
"use strict";
plugin.consumes = [
"db", "connect.static"
];
plugin.provides = [
"unpacked_helper"
];
module.exports = plugin;
function plugin(options, imports, register) {
var connectStatic = imports["connect.static"];
var assert = require("assert");
var baseUrl = options.baseUrl;
var ideBaseUrl = options.ideBaseUrl;
assert(baseUrl, "baseUrl must be set");
assert(ideBaseUrl, "ideBaseUrl must be set");
var balancers = [
baseUrl + "/uph",
];
/* UNDONE: for now we put all static content on one domain
because of reports of CORS errors
if (!options.avoidSubdomains)
balancers.push(
ideBaseUrl
// We could include others but dogfooding URLs like
// vfs.newclient-lennartcl.c9.io don't have a cert, so
// let's not
// apiBaseUrl + "/uph",
// vfsBaseUrl + "/uph"
);
*/
connectStatic.getRequireJsConfig().baseUrlLoadBalancers = balancers;
assert(connectStatic.getRequireJsConfig().baseUrlLoadBalancers);
register(null, {
"unpacked_helper": {}
});
}