55 * This file is copyright under the latest version of the EUPL.
66 * Please see LICENSE file for your rights under this license. */
77
8- /* global utils:false, Chart:false, apiFailure:false, THEME_COLORS:false, customTooltips:false, htmlLegendPlugin:false,doughnutTooltip:false, ChartDeferred:false, REFRESH_INTERVAL: false, updateQueryFrequency: false */
8+ /* global utils:false, apiUrl:false, Chart:false, apiFailure:false, THEME_COLORS:false, customTooltips:false, htmlLegendPlugin:false,doughnutTooltip:false, ChartDeferred:false, REFRESH_INTERVAL: false, updateQueryFrequency: false */
99
1010// Define global variables
1111var timeLineChart , clientsChart ;
@@ -22,7 +22,7 @@ Chart.defaults.set("plugins.deferred", {
2222
2323var failures = 0 ;
2424function updateQueriesOverTime ( ) {
25- $ . getJSON ( "/api /history", function ( data ) {
25+ $ . getJSON ( apiUrl + " /history", function ( data ) {
2626 // Remove graph if there are no results (e.g. new
2727 // installation or privacy mode enabled)
2828 if ( jQuery . isEmptyObject ( data . history ) ) {
@@ -92,7 +92,7 @@ function updateQueriesOverTime() {
9292}
9393
9494function updateQueryTypesPie ( ) {
95- $ . getJSON ( "/api /stats/query_types", function ( data ) {
95+ $ . getJSON ( apiUrl + " /stats/query_types", function ( data ) {
9696 var v = [ ] ,
9797 c = [ ] ,
9898 k = [ ] ,
@@ -134,7 +134,7 @@ function updateQueryTypesPie() {
134134}
135135
136136function updateClientsOverTime ( ) {
137- $ . getJSON ( "/api /history/clients", function ( data ) {
137+ $ . getJSON ( apiUrl + " /history/clients", function ( data ) {
138138 // Remove graph if there are no results (e.g. new
139139 // installation or privacy mode enabled)
140140 if ( jQuery . isEmptyObject ( data . history ) ) {
@@ -212,7 +212,7 @@ function updateClientsOverTime() {
212212
213213var upstreams = { } ;
214214function updateForwardDestinationsPie ( ) {
215- $ . getJSON ( "/api /stats/upstreams", function ( data ) {
215+ $ . getJSON ( apiUrl + " /stats/upstreams", function ( data ) {
216216 var v = [ ] ,
217217 c = [ ] ,
218218 k = [ ] ,
@@ -273,13 +273,13 @@ function updateForwardDestinationsPie() {
273273function updateTopClientsTable ( blocked ) {
274274 let api , style , tablecontent , overlay , clienttable ;
275275 if ( blocked ) {
276- api = "/api /stats/top_clients?blocked=true";
276+ api = apiUrl + " /stats/top_clients?blocked=true";
277277 style = "queries-blocked" ;
278278 tablecontent = $ ( "#client-frequency-blocked td" ) . parent ( ) ;
279279 overlay = $ ( "#client-frequency-blocked .overlay" ) ;
280280 clienttable = $ ( "#client-frequency-blocked" ) . find ( "tbody:last" ) ;
281281 } else {
282- api = "/api /stats/top_clients";
282+ api = apiUrl + " /stats/top_clients";
283283 style = "queries-permitted" ;
284284 tablecontent = $ ( "#client-frequency td" ) . parent ( ) ;
285285 overlay = $ ( "#client-frequency .overlay" ) ;
@@ -333,13 +333,13 @@ function updateTopClientsTable(blocked) {
333333function updateTopDomainsTable ( blocked ) {
334334 let api , style , tablecontent , overlay , domaintable ;
335335 if ( blocked ) {
336- api = "/api /stats/top_domains?blocked=true";
336+ api = apiUrl + " /stats/top_domains?blocked=true";
337337 style = "queries-blocked" ;
338338 tablecontent = $ ( "#ad-frequency td" ) . parent ( ) ;
339339 overlay = $ ( "#ad-frequency .overlay" ) ;
340340 domaintable = $ ( "#ad-frequency" ) . find ( "tbody:last" ) ;
341341 } else {
342- api = "/api /stats/top_domains";
342+ api = apiUrl + " /stats/top_domains";
343343 style = "queries-permitted" ;
344344 tablecontent = $ ( "#domain-frequency td" ) . parent ( ) ;
345345 overlay = $ ( "#domain-frequency .overlay" ) ;
@@ -408,7 +408,7 @@ function updateTopLists() {
408408var previousCount = 0 ;
409409var firstSummaryUpdate = true ;
410410function updateSummaryData ( runOnce = false ) {
411- $ . getJSON ( "/api /stats/summary", function ( data ) {
411+ $ . getJSON ( apiUrl + " /stats/summary", function ( data ) {
412412 var intl = new Intl . NumberFormat ( ) ;
413413 const newCount = parseInt ( data . queries . total , 10 ) ;
414414
0 commit comments