Merge branch 'JSON_Post'

This commit is contained in:
MrFry 2020-04-03 11:32:24 +02:00
commit cc8de2e15f

View file

@ -1019,7 +1019,7 @@
sentData.id = GetId() sentData.id = GetId()
sentData.quiz = quiz sentData.quiz = quiz
console.log('SENT DATA', sentData) console.log('SENT DATA', sentData)
SendXHRMessage('datatoadd=' + JSON.stringify(sentData)).then((res) => { SendXHRMessage(JSON.stringify(sentData)).then((res) => {
next(res.success, sentData, res.newQuestions) next(res.success, sentData, res.newQuestions)
}) })
} catch (e) { } catch (e) {
@ -1623,9 +1623,14 @@
if (now > lastCheck + (infoExpireTime * 1000)) { if (now > lastCheck + (infoExpireTime * 1000)) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
const url = apiAdress +
'infos?version=true&motd=true&subjinfo=true&cversion=' +
info().script.version +
'&cid=' + GetId()
xmlhttpRequest({ xmlhttpRequest({
method: 'GET', method: 'GET',
url: apiAdress + 'infos?version=true&motd=true&subjinfo=true&cversion=' + info().script.version, url: url,
onload: function (response) { onload: function (response) {
try { try {
setVal('lastInfoCheckTime', now) setVal('lastInfoCheckTime', now)
@ -1668,7 +1673,9 @@
} }
params.push(key + '=' + encodeURIComponent(val)) params.push(key + '=' + encodeURIComponent(val))
}) })
url += params.join('&') url += params.join('&') +
'&cversion=' + info().script.version +
'&cid=' + GetId()
xmlhttpRequest({ xmlhttpRequest({
method: 'GET', method: 'GET',
@ -1712,7 +1719,7 @@
url: url, url: url,
data: message, data: message,
headers: { headers: {
'Content-Type': 'application/x-www-form-urlencoded' 'Content-Type': 'application/json'
}, },
onerror: function (e) { onerror: function (e) {
Log('Data send error', e) Log('Data send error', e)