Skip to content

Commit

Permalink
Fix to pass needed request headers
Browse files Browse the repository at this point in the history
  • Loading branch information
iliajie committed Aug 20, 2021
1 parent 1bb0b76 commit 4a58685
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 9 deletions.
2 changes: 1 addition & 1 deletion extensions/mail/mail.min.js

Large diffs are not rendered by default.

Binary file modified extensions/mail/mail.min.js.gz
Binary file not shown.
18 changes: 11 additions & 7 deletions extensions/mail/mail.src.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,11 @@ const mail = (function() {
pjax: {
fetch: get_pjax_content,
},
fetch: {
options: {
headers: { 'x-requested-with': 'XMLHttpRequest' },
}
},
load: load,
sdata: get_server_data,
mavailable: core.moduleAvailable,
Expand Down Expand Up @@ -901,7 +906,7 @@ const mail = (function() {
}

// Get reply form as provided
fetch(`${prefix}/${xtarget.reply}?${form}`)
fetch(`${prefix}/${xtarget.reply}?${form}`, _.fetch.options)
.then(rs => {
return rs.text();
}).then(rs => {
Expand Down Expand Up @@ -1381,7 +1386,7 @@ const mail = (function() {

// Discard the draft
purge: function(id, folder, message) {
fetch(`${xtarget.delete}&id=${id}&folder=${folder}&d=${message}`).then(r => {
fetch(`${xtarget.delete}&id=${id}&folder=${folder}&d=${message}`, _.fetch.options).then(r => {
r.text().then(() => {
draft.refresh();
});
Expand Down Expand Up @@ -1529,7 +1534,7 @@ const mail = (function() {
}).then(file => {
if (file) {
let suid = generate.random();
fetch(xtarget.getSize + file).then(r => {
fetch(xtarget.getSize + file, _.fetch.options).then(r => {
r.text().then(rs => {
let s = rs.split(`|`),
size = s[1].replace(/\s+/g, String());
Expand Down Expand Up @@ -1665,7 +1670,7 @@ const mail = (function() {
scheduled.events();

// Bring address book autocompletion
fetch(xtarget.addressBook)
fetch(xtarget.addressBook, _.fetch.options)
.then(function(rs) {
return rs.text();
})
Expand Down Expand Up @@ -2837,7 +2842,7 @@ const mail = (function() {
*/
$($$.$.controls.search.link).on('click', function() {
let link = this.getAttribute('data-href');
fetch(link)
fetch(link, _.fetch.options)
.then(function(response) {
return response.json();
})
Expand Down Expand Up @@ -3555,5 +3560,4 @@ const mail = (function() {
},
compose: compose.message
}
})();

})();
2 changes: 1 addition & 1 deletion theme.info
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
desc=Authentic Theme
longdesc=Webmin/Usermin/Virtualmin/Cloudmin theme based on Bootstrap and Font Awesome (https://github.com/authentic-theme/authentic-theme)
version=19.83-RC6
mversion=00
mversion=01
depends=1.974 1.824
webmin=1
usermin=1
Binary file modified unauthenticated/js/bundle.min.js.gz
Binary file not shown.

0 comments on commit 4a58685

Please sign in to comment.