2021-03-08 18:45:06 +00:00
|
|
|
function set_config() {
|
|
|
|
|
|
|
|
var clear_cache = document.getElementById('clear_cache').checked;
|
|
|
|
|
|
|
|
config_form = {
|
|
|
|
"password" : current_password,
|
2021-10-04 12:26:50 +00:00
|
|
|
"username" : current_username,
|
2021-03-08 18:45:06 +00:00
|
|
|
"clear_cache" : clear_cache,
|
|
|
|
"data" : {
|
|
|
|
"tautulli_apikey" : tautulli_apikey,
|
|
|
|
"tautulli_ip" : tautulli_ip,
|
|
|
|
"tautulli_port" : tautulli_port,
|
|
|
|
"tautulli_length" : tautulli_length,
|
|
|
|
"tautulli_root" : tautulli_root,
|
|
|
|
"ssl" : ssl,
|
|
|
|
"password" : password,
|
2021-10-04 12:26:50 +00:00
|
|
|
"username" : username,
|
2021-10-04 20:21:43 +00:00
|
|
|
"timezone" : timezone,
|
2021-03-08 18:45:06 +00:00
|
|
|
"wrapped_start" : Math.round(wrapped_start.getTime() / 1000),
|
|
|
|
"wrapped_end" : Math.round(wrapped_end.getTime() / 1000),
|
|
|
|
"get_user_movie_stats" : get_user_movie_stats,
|
|
|
|
"get_user_show_stats" : get_user_show_stats,
|
|
|
|
"get_user_show_buddy" : get_user_show_buddy,
|
2021-10-01 23:21:18 +00:00
|
|
|
"get_user_music_stats" : get_user_music_stats,
|
|
|
|
"get_year_stats_movies" : get_year_stats_movies,
|
|
|
|
"get_year_stats_shows" : get_year_stats_shows,
|
|
|
|
"get_year_stats_music" : get_year_stats_music,
|
|
|
|
"get_year_stats_leaderboard" : get_year_stats_leaderboard,
|
2021-03-08 18:45:06 +00:00
|
|
|
"use_cache" : use_cache,
|
2021-10-05 13:34:30 +00:00
|
|
|
"use_logs" : use_logs
|
2021-03-08 18:45:06 +00:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
var config_data = JSON.stringify(config_form);
|
|
|
|
|
|
|
|
var xhttp = new XMLHttpRequest();
|
|
|
|
xhttp.onreadystatechange = function() {
|
|
|
|
if (this.readyState == 4 && this.status == 200) {
|
|
|
|
var result = JSON.parse(this.responseText);
|
|
|
|
if(result.error) {
|
|
|
|
alert(result.message);
|
|
|
|
} else {
|
|
|
|
alert(result.message);
|
2021-10-11 12:25:19 +00:00
|
|
|
window.location.href = "../";
|
2021-03-08 18:45:06 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
xhttp.withCredentials = true;
|
2021-10-11 12:25:19 +00:00
|
|
|
xhttp.open("post", root + "api/set_config.php");
|
2021-03-08 18:45:06 +00:00
|
|
|
xhttp.send(config_data);
|
|
|
|
}
|