forked from aunefyren/wrapperr
-
Notifications
You must be signed in to change notification settings - Fork 0
/
set_config.js
52 lines (48 loc) · 2.31 KB
/
set_config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
function set_config() {
var clear_cache = document.getElementById('clear_cache').checked;
config_form = {
"password" : current_password,
"username" : current_username,
"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,
"username" : username,
"timezone" : timezone,
"wrapped_start" : Math.round(wrapped_start.getTime() / 1000),
"wrapped_end" : Math.round(wrapped_end.getTime() / 1000),
"stats_intro" : stats_intro,
"get_user_movie_stats" : get_user_movie_stats,
"get_user_show_stats" : get_user_show_stats,
"get_user_show_buddy" : get_user_show_buddy,
"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,
"use_cache" : use_cache,
"use_logs" : use_logs
}
};
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);
window.location.href = "../";
}
}
};
xhttp.withCredentials = true;
xhttp.open("post", root + "api/set_config.php");
xhttp.send(config_data);
}