mirror of
https://github.com/hrfee/jellyfin-accounts.git
synced 2024-12-22 09:00:14 +00:00
Replace jquery ajax in setup.js
This commit is contained in:
parent
94e69ad090
commit
71f05f2348
@ -13,6 +13,7 @@ for (var i = 0; i < authRadios.length; i++) {
|
|||||||
checkAuthRadio();
|
checkAuthRadio();
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
function checkEmailRadio() {
|
function checkEmailRadio() {
|
||||||
document.getElementById('emailNextButton').href = '#page-5';
|
document.getElementById('emailNextButton').href = '#page-5';
|
||||||
document.getElementById('valBackButton').href = '#page-7';
|
document.getElementById('valBackButton').href = '#page-7';
|
||||||
@ -35,6 +36,7 @@ for (var i = 0; i < emailRadios.length; i++) {
|
|||||||
checkEmailRadio();
|
checkEmailRadio();
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
function checkSSL() {
|
function checkSSL() {
|
||||||
var label = document.getElementById('emailSSL_TLSLabel');
|
var label = document.getElementById('emailSSL_TLSLabel');
|
||||||
if (document.getElementById('emailSSL_TLS').checked) {
|
if (document.getElementById('emailSSL_TLS').checked) {
|
||||||
@ -101,16 +103,15 @@ document.getElementById('jfTestButton').onclick = function() {
|
|||||||
jfData['jfHost'] = document.getElementById('jfHost').value;
|
jfData['jfHost'] = document.getElementById('jfHost').value;
|
||||||
jfData['jfUser'] = document.getElementById('jfUser').value;
|
jfData['jfUser'] = document.getElementById('jfUser').value;
|
||||||
jfData['jfPassword'] = document.getElementById('jfPassword').value;
|
jfData['jfPassword'] = document.getElementById('jfPassword').value;
|
||||||
$.ajax('/testJF', {
|
var req = new XMLHttpRequest();
|
||||||
type : 'POST',
|
req.open("POST", "/testJF", true);
|
||||||
dataType : 'json',
|
req.setRequestHeader('Content-Type', 'application/json; charset=UTF-8');
|
||||||
contentType : 'application/json',
|
req.responseType = 'json';
|
||||||
data : JSON.stringify(jfData),
|
req.onreadystatechange = function() {
|
||||||
complete: function(response) {
|
if (this.readyState == 4) {
|
||||||
testButton.disabled = false;
|
testButton.disabled = false;
|
||||||
testButton.className = '';
|
testButton.className = '';
|
||||||
var success = response['responseJSON']['success'];
|
if (this.response['success'] == true) {
|
||||||
if (success == true) {
|
|
||||||
testButton.classList.add('btn', 'btn-success');
|
testButton.classList.add('btn', 'btn-success');
|
||||||
testButton.textContent = 'Success';
|
testButton.textContent = 'Success';
|
||||||
nextButton.classList.remove('disabled');
|
nextButton.classList.remove('disabled');
|
||||||
@ -118,9 +119,10 @@ document.getElementById('jfTestButton').onclick = function() {
|
|||||||
} else {
|
} else {
|
||||||
testButton.classList.add('btn', 'btn-danger');
|
testButton.classList.add('btn', 'btn-danger');
|
||||||
testButton.textContent = 'Failed';
|
testButton.textContent = 'Failed';
|
||||||
}
|
};
|
||||||
}
|
};
|
||||||
});
|
};
|
||||||
|
req.send(JSON.stringify(jfData));
|
||||||
};
|
};
|
||||||
|
|
||||||
document.getElementById('submitButton').onclick = function() {
|
document.getElementById('submitButton').onclick = function() {
|
||||||
@ -158,7 +160,7 @@ document.getElementById('submitButton').onclick = function() {
|
|||||||
if (document.getElementById('emailDisabledRadio').checked) {
|
if (document.getElementById('emailDisabledRadio').checked) {
|
||||||
config['password_resets']['enabled'] = 'false';
|
config['password_resets']['enabled'] = 'false';
|
||||||
config['invite_emails']['enabled'] = 'false';
|
config['invite_emails']['enabled'] = 'false';
|
||||||
} else {
|
} else {
|
||||||
if (document.getElementById('emailSMTPRadio').checked) {
|
if (document.getElementById('emailSMTPRadio').checked) {
|
||||||
if (document.getElementById('emailSSL_TLS').checked) {
|
if (document.getElementById('emailSSL_TLS').checked) {
|
||||||
config['smtp']['encryption'] = 'ssl_tls';
|
config['smtp']['encryption'] = 'ssl_tls';
|
||||||
@ -217,18 +219,18 @@ document.getElementById('submitButton').onclick = function() {
|
|||||||
config['ui']['contact_message'] = document.getElementById('msgContact').value;
|
config['ui']['contact_message'] = document.getElementById('msgContact').value;
|
||||||
config['ui']['help_message'] = document.getElementById('msgHelp').value;
|
config['ui']['help_message'] = document.getElementById('msgHelp').value;
|
||||||
config['ui']['success_message'] = document.getElementById('msgSuccess').value;
|
config['ui']['success_message'] = document.getElementById('msgSuccess').value;
|
||||||
console.log(config);
|
// Send it
|
||||||
$.ajax('/modifyConfig', {
|
var req = new XMLHttpRequest();
|
||||||
type : 'POST',
|
req.open("POST", "/modifyConfig", true);
|
||||||
dataType : 'json',
|
req.setRequestHeader('Content-Type', 'application/json; charset=UTF-8');
|
||||||
contentType : 'application/json',
|
req.responseType = 'json';
|
||||||
data : JSON.stringify(config),
|
req.onreadystatechange = function() {
|
||||||
complete: function(response) {
|
if (this.readyState == 4) {
|
||||||
submitButton.disabled = false;
|
submitButton.disabled = false;
|
||||||
submitButton.className = '';
|
submitButton.className = '';
|
||||||
submitButton.classList.add('btn', 'btn-success');
|
submitButton.classList.add('btn', 'btn-success');
|
||||||
submitButton.textContent = 'Success';
|
submitButton.textContent = 'Success';
|
||||||
}
|
};
|
||||||
});
|
};
|
||||||
|
req.send(JSON.stringify(config));
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user