Commit 343a80bb authored by Mathieu Giraud's avatar Mathieu Giraud

Merge branch 'hotfix-c/do-not-remove-proxy-config' into 'dev'

Do not remove proxy config

See merge request !544
parents 53782695 0515f46b
Pipeline #105148 passed with stages
in 47 minutes and 53 seconds
......@@ -21,6 +21,9 @@ var config = {
"cgi_address" : "https://db.vidjil.org/cgi/", // Public test server
// "cgi_address" : "http://127.0.1.1/cgi-bin/",
/* Proxy for accessing resources without cross-domain issues */
"proxy": "https://db.vidjil.org/proxy/",
/* Used for the standalone http://app.vidjil.org/analyze page */
"segmenter_address" : "https://db.vidjil.org/vidjil/segmenter",
......
......@@ -161,15 +161,7 @@ function imgtPostForSegmenter(species, data, system, segmenter, override_imgt_op
//disabled due to security concerns
//form.action = "http://www.imgt.org/IMGT_vquest/vquest";
//using proxy on server to allow requests on other site than vidjil one's in JS.
if (typeof config != 'undefined' && typeof config.db_address != 'undefined') {
form.action = config.db_address+"/proxy/imgt"
} else {
console.log({
"type": "flash",
"msg": "Your installation doesn't seem to be associated with a database.",
"priority": 2
});
}
form.action = getProxy()+"imgt";
form.method = "POST";
for (var k in imgtInput) {
......@@ -433,15 +425,7 @@ function assignSubsetsPost(species, data, system) {
form.target = "_blank";
form.enctype = 'multipart/form-data';
form.name = 'assignsubsets';
if (typeof config != 'undefined' && typeof config.db_address != 'undefined') {
form.action = config.db_address+"/proxy/assign_subsets"
} else {
console.log({
"type": "flash",
"msg": "Your installation doesn't seem to be associated with a database.",
"priority": 2
});
}
form.action = getProxy()+"assign_subsets";
form.method = "POST";
var formData = {};
formData.fastatext = data;
......
......@@ -766,4 +766,22 @@ function getNFirstSequences(data, n) {
}
}
/**
* @return a proxy URL if one can be obtained in the config (ending with /) or
* throws an exception and logs the error.
*/
function getProxy() {
if (typeof config != 'undefined') {
if (typeof config.proxy != 'undefined') {
return config.proxy+"/";
} else if (typeof config.db_address != 'undefined') {
return config.db_address+"/proxy/";
}
}
console.log({
"type": "flash",
"msg": "Your installation doesn't seem to have an associated proxy.",
"priority": 2
});
throw "No proxy";
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment