cba2b9ba by acetousk

Secure grapesJs services, improve their logic, add notes

1 parent 600190dc
...@@ -171,7 +171,7 @@ along with this software (see the LICENSE.md file). If not, see ...@@ -171,7 +171,7 @@ along with this software (see the LICENSE.md file). If not, see
171 window.emailTemplateId = new URLSearchParams(window.location.search).get('emailTemplateId'); 171 window.emailTemplateId = new URLSearchParams(window.location.search).get('emailTemplateId');
172 172
173 const request = new XMLHttpRequest(); 173 const request = new XMLHttpRequest();
174 request.open("GET", ("${baseLinkUrl}/rest/s1/moqui-mjml/mjml?grapesLocation="+window.grapesLocation+"&htmlLocation="+window.htmlLocation+"&emailTemplateId="+window.emailTemplateId), false); // `false` makes the request synchronous 174 request.open("GET", ("${baseLinkUrl}/rest/s1/moqui-mjml/mjml?emailTemplateId="+window.emailTemplateId), false); // `false` makes the request synchronous
175 request.send(null); 175 request.send(null);
176 176
177 let response; 177 let response;
...@@ -203,8 +203,8 @@ along with this software (see the LICENSE.md file). If not, see ...@@ -203,8 +203,8 @@ along with this software (see the LICENSE.md file). If not, see
203 // Default storage options 203 // Default storage options
204 options: { 204 options: {
205 remote: { 205 remote: {
206 urlLoad: "${baseLinkUrl}/rest/s1/moqui-mjml/mjml?grapesLocation="+window.grapesLocation+"&htmlLocation="+window.htmlLocation, 206 urlLoad: "${baseLinkUrl}/rest/s1/moqui-mjml/mjml?emailTemplateId="+window.emailTemplateId,
207 urlStore: "${baseLinkUrl}/rest/s1/moqui-mjml/mjml?grapesLocation="+window.grapesLocation+"&htmlLocation="+window.htmlLocation, 207 urlStore: "${baseLinkUrl}/rest/s1/moqui-mjml/mjml?emailTemplateId="+window.emailTemplateId,
208 headers: { 208 headers: {
209 "X-CSRF-Token": document.getElementById('confMoquiSessionToken').value 209 "X-CSRF-Token": document.getElementById('confMoquiSessionToken').value
210 }, 210 },
...@@ -222,9 +222,11 @@ along with this software (see the LICENSE.md file). If not, see ...@@ -222,9 +222,11 @@ along with this software (see the LICENSE.md file). If not, see
222 const url = new URL(window.location.href) 222 const url = new URL(window.location.href)
223 url.searchParams.set('grapesLocation', result.grapesLocation); 223 url.searchParams.set('grapesLocation', result.grapesLocation);
224 url.searchParams.set('htmlLocation', result.htmlLocation); 224 url.searchParams.set('htmlLocation', result.htmlLocation);
225 url.searchParams.set('emailTemplateId', result.emailTemplateId);
225 window.history.pushState({}, '', url) 226 window.history.pushState({}, '', url)
226 window.grapesLocation = result.grapesLocation; 227 window.grapesLocation = result.grapesLocation;
227 window.htmlLocation = result.htmlLocation; 228 window.htmlLocation = result.htmlLocation;
229 window.emailTemplateId = result.emailTemplateId;
228 } 230 }
229 // console.log('onLoad ', result) 231 // console.log('onLoad ', result)
230 return result.data 232 return result.data
......