send xhr header so errors don't give back HTML pages

master
justcool393 2022-11-11 23:46:21 -06:00
parent b1924e0cdf
commit 9be721dcf4
6 changed files with 7 additions and 0 deletions

View File

@ -188,6 +188,7 @@ const emojisSearchDictionary = {
// get public emojis list // get public emojis list
const emojiRequest = new XMLHttpRequest(); const emojiRequest = new XMLHttpRequest();
emojiRequest.open("GET", '/marsey_list.json'); emojiRequest.open("GET", '/marsey_list.json');
emojiRequest.setRequestHeader('xhr', 'xhr');
emojiRequest.onload = async (e) => { emojiRequest.onload = async (e) => {
console.log("HERE") console.log("HERE")
let emojis = JSON.parse(emojiRequest.response); let emojis = JSON.parse(emojiRequest.response);

View File

@ -147,6 +147,7 @@ function autoSuggestTitle() {
} }
} }
x.open('get','/submit/title?url=' + urlField.value); x.open('get','/submit/title?url=' + urlField.value);
x.setRequestHeader('xhr', 'xhr');
x.send(null); x.send(null);
}; };

View File

@ -131,6 +131,7 @@
const game = document.getElementById('casino-game-wrapper').dataset.game; const game = document.getElementById('casino-game-wrapper').dataset.game;
const xhr = new XMLHttpRequest(); const xhr = new XMLHttpRequest();
xhr.open("get", `/casino/${game}/feed`); xhr.open("get", `/casino/${game}/feed`);
xhr.setRequestHeader('xhr', 'xhr');
xhr.onload = handleFeedResponse.bind(null, xhr); xhr.onload = handleFeedResponse.bind(null, xhr);
xhr.send(); xhr.send();
} }

View File

@ -324,6 +324,7 @@
if (confirmed) { if (confirmed) {
const xhr = new XMLHttpRequest(); const xhr = new XMLHttpRequest();
xhr.open("post", "/casino/roulette/place-bet"); xhr.open("post", "/casino/roulette/place-bet");
xhr.setRequestHeader('xhr', 'xhr');
xhr.onload = handleRouletteResponse.bind(null, xhr); xhr.onload = handleRouletteResponse.bind(null, xhr);
const form = new FormData(); const form = new FormData();
@ -354,6 +355,7 @@
function requestRouletteBets() { function requestRouletteBets() {
const xhr = new XMLHttpRequest(); const xhr = new XMLHttpRequest();
xhr.open("get", "/casino/roulette/bets"); xhr.open("get", "/casino/roulette/bets");
xhr.setRequestHeader('xhr', 'xhr');
xhr.onload = handleRouletteResponse.bind(null, xhr); xhr.onload = handleRouletteResponse.bind(null, xhr);
xhr.send(); xhr.send();
} }

View File

@ -13,6 +13,7 @@
const xhr = new XMLHttpRequest(); const xhr = new XMLHttpRequest();
xhr.open("post", "/casino/slots"); xhr.open("post", "/casino/slots");
xhr.setRequestHeader('xhr', 'xhr');
xhr.onload = handleSlotsResponse.bind(null, xhr); xhr.onload = handleSlotsResponse.bind(null, xhr);
const form = new FormData(); const form = new FormData();

View File

@ -210,6 +210,7 @@
var xhr = new XMLHttpRequest(); var xhr = new XMLHttpRequest();
xhr.withCredentials=true; xhr.withCredentials=true;
xhr.open("POST", '/dismiss_mobile_tip', true); xhr.open("POST", '/dismiss_mobile_tip', true);
xhr.setRequestHeader('xhr', 'xhr');
xhr.send(); xhr.send();
} }
}) })