Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

[feature] Session: added a function to set the domain URL of AJAX req…

…uests
  • Loading branch information...
commit c87f1877030ead3bdf0aeaae53fba2bba4d5b343 1 parent 01b8b0e
@Aqua-Ye Aqua-Ye authored
View
17 lib/plugins/server/session.js
@@ -120,9 +120,12 @@ var LowLevelPingLoop = {};
throw("Error: the connexion with the server seems to be lost. Please reload");
}
+ // Domain used for AJAX request
+ var domain_url = "";
+
function internal_ajax(settings){
if(linked_with_server){
- settings.url = internal_url + settings.url;
+ settings.url = domain_url + internal_url + settings.url;
if(to_register.length != 0){
var body = settings.data;
if (typeof body == 'undefined') body="";
@@ -564,6 +567,10 @@ var LowLevelPingLoop = {};
}
}
+ LowLevelSession.set_domain_url = function(d) {
+ domain_url = d;
+ }
+
LowLevelSession.llmake = function(st, unserialize, fun_session,
ctx, dfun, more, concurrent) {
the_ping_loop();
@@ -748,6 +755,14 @@ function set_uu(x0, x1) {
}
/**
+ * @register {string -> void}
+ */
+function set_domain_url(d) {
+ LowLevelSession.set_domain_url(d);
+ return js_void;
+}
+
+/**
* @register {'st, \
(opa[option('ctx)], RPC.Json.private.native, \
continuation(opa[option('msg)]) -> void), \
View
5 lib/stdlib/core/rpc/core/session.opa
@@ -185,6 +185,11 @@ type make_at_response = option(RPC.Json.json)
Session = {{
/**
+ * Explicitely set the domain's URL used by AJAX request, no domain by default
+ */
+ @client set_domain_url = %%Session.set_domain_url%%
+
+ /**
* {2 Creating sessions}
*/
Please sign in to comment.
Something went wrong with that request. Please try again.