Use relative path for server requests of sao

Closes #9239
This commit is contained in:
Cédric Krier
2023-11-12 23:43:41 +01:00
parent 84c47a0433
commit ceb1e9d0df
6 changed files with 17 additions and 15 deletions
+1
View File
@@ -1,3 +1,4 @@
* Use relative path for server requests
* Use cookie to store session
* Move the logout entry and add a help entry to the notification menu
* Add visual hint on widget of modified field
+1 -1
View File
@@ -178,7 +178,7 @@
'params': params
})),
'dataType': 'json',
'url': '/' + (session.database || '') + '/',
'url': (session.database || '.') + '/',
'type': 'post',
'complete': [function() {
Sao.common.processing.hide(timeoutID);
+2 -2
View File
@@ -451,11 +451,11 @@ var Sao = {
Sao.set_url = function(path, name) {
var session = Sao.Session.current_session;
if (session) {
var url = '#' + session.database;
var url = session.database;
if (path) {
url += '/' + path;
}
window.location = url;
window.location.hash = url;
}
Sao.set_title(name);
};
+11 -10
View File
@@ -58,7 +58,7 @@
'contentType': 'application/json',
'data': JSON.stringify({}),
'dataType': 'json',
'url': `/${this.database}/session/logout`,
'url': `${this.database}/session/logout`,
'type': 'post',
});
this.unstore();
@@ -189,7 +189,7 @@
'params': []
}),
'dataType': 'json',
'url': '/',
'url': '.',
'type': 'post',
'complete': [function() {
Sao.common.processing.hide(timeoutID);
@@ -295,7 +295,7 @@
dfd.resolve(session);
dialog.modal.remove();
if (database_url() != database) {
window.location = '#' + database;
window.location.hash = database;
}
}, function() {
disable_form(false);
@@ -314,10 +314,11 @@
return;
}
disable_form();
var host = window.location.protocol + '//' + window.location.host;
var next = new URL(host + '/');
const base = (
window.location.protocol + '//' + window.location.host + window.location.pathname);
var next = new URL(base);
next.searchParams.append('login_service', evt.data);
var url = new URL(host + '/' + database + evt.data);
var url = new URL(base + database + evt.data);
url.searchParams.append('next', next.href);
var service_window = window.open(url.href, '_blank', 'popup=1');
const timer = window.setInterval(() => {
@@ -330,7 +331,7 @@
dfd.resolve(session);
dialog.modal.remove();
if (database_url() != database) {
window.location = '#' + database;
window.location.hash = database;
}
} else {
disable_form(false);
@@ -449,7 +450,7 @@
'contentType': 'application/json',
'data': JSON.stringify(data),
'dataType': 'json',
'url': `/${this.session.database}/session/login`,
'url': `${this.session.database}/session/login`,
'type': 'post',
'complete': [function() {
Sao.common.processing.hide(timeoutID);
@@ -601,7 +602,7 @@
'params': []
}),
'dataType': 'json',
'url': '/',
'url': '.',
'type': 'post',
'complete': [function() {
Sao.common.processing.hide(timeoutID);
@@ -623,7 +624,7 @@
'params': []
}),
'dataType': 'json',
'url': '/',
'url': '.',
'type': 'post',
'complete': [function() {
Sao.common.processing.hide(timeoutID);
+1 -1
View File
@@ -5010,7 +5010,7 @@ function eval_pyson(value){
if (!record || (record.id < 0)) {
uri = '';
} else {
uri = '/' + record.model.session.database +
uri = record.model.session.database +
'/ir/html/' + record.model.name + '/' + record.id + '/' +
this.field_name;
uri += '?language=' + encodeURIComponent(
+1 -1
View File
@@ -2429,7 +2429,7 @@
query_string = query_string.map(function(param) {
return param.map(encodeURIComponent).join('=');
}).join('&');
this.button_url.attr('href', '/' + path.join('/') + '?' + query_string);
this.button_url.attr('href', path.join('/') + '?' + query_string);
},
});