Skip to content
This repository was archived by the owner on Dec 9, 2023. It is now read-only.

Commit 3b8aa73

Browse files
update logging
1 parent 5800b42 commit 3b8aa73

File tree

2 files changed

+17
-19
lines changed

2 files changed

+17
-19
lines changed

apiclient.js

+4-16
Original file line numberDiff line numberDiff line change
@@ -802,7 +802,7 @@ class ApiClient {
802802

803803
fetchWithFailover(request, enableReconnection, signal) {
804804

805-
console.log(`Requesting ${request.url}`);
805+
console.log(`apiclient.fetchWithFailover ${request.url}`);
806806

807807
request.timeout = 30000;
808808
const instance = this;
@@ -1463,11 +1463,7 @@ class ApiClient {
14631463

14641464
} else {
14651465

1466-
return this.ajax({
1467-
type: "GET",
1468-
url: this.getUrl("LiveTv/Programs", options),
1469-
dataType: "json"
1470-
});
1466+
return this.getJSON(this.getUrl("LiveTv/Programs", options));
14711467
}
14721468
}
14731469

@@ -1480,11 +1476,7 @@ class ApiClient {
14801476

14811477
if (this.isMinServerVersion('4.4.3')) {
14821478

1483-
return this.ajax({
1484-
type: "GET",
1485-
url: this.getUrl("LiveTv/EPG", options),
1486-
dataType: "json"
1487-
}).then(modifyEpgResponse.bind(this));
1479+
return this.getJSON(this.getUrl("LiveTv/EPG", options)).then(modifyEpgResponse.bind(this));
14881480
}
14891481

14901482
const serverId = this.serverId();
@@ -1545,11 +1537,7 @@ class ApiClient {
15451537
}
15461538

15471539
getLiveTvRecommendedPrograms(options = {}) {
1548-
return this.ajax({
1549-
type: "GET",
1550-
url: this.getUrl("LiveTv/Programs/Recommended", options),
1551-
dataType: "json"
1552-
});
1540+
return this.getJSON(this.getUrl("LiveTv/Programs/Recommended", options));
15531541
}
15541542

15551543
getLiveTvRecordings(options, signal) {

connectionmanager.js

+13-3
Original file line numberDiff line numberDiff line change
@@ -388,6 +388,8 @@ function ensureConnectUser(instance, credentials) {
388388

389389
function validateAuthentication(instance, server, serverUrl) {
390390

391+
console.log('connectionManager.validateAuthentication: ' + serverUrl);
392+
391393
return ajax({
392394

393395
type: "GET",
@@ -691,6 +693,8 @@ function afterConnectValidated(
691693
verifyLocalAuthentication,
692694
options) {
693695

696+
console.log('connectionManager.afterConnectValidated: ' + serverUrl);
697+
694698
options = options || {};
695699

696700
if (verifyLocalAuthentication && server.AccessToken) {
@@ -740,6 +744,8 @@ function afterConnectValidated(
740744
return Promise.resolve(result);
741745
};
742746

747+
console.log('connectionManager.afterConnectValidated result.State: ' + (result.State || ''));
748+
743749
if (result.State === 'SignedIn') {
744750
afterConnected(instance, result.ApiClient, options);
745751

@@ -752,6 +758,8 @@ function afterConnectValidated(
752758

753759
function onSuccessfulConnection(instance, server, systemInfo, connectionMode, serverUrl, options) {
754760

761+
console.log('connectionManager.onSuccessfulConnection: ' + serverUrl);
762+
755763
const credentials = instance.credentialProvider().credentials();
756764
options = options || {};
757765
if (credentials.ConnectAccessToken && options.enableAutoLogin !== false) {
@@ -779,12 +787,14 @@ function onSuccessfulConnection(instance, server, systemInfo, connectionMode, se
779787
}
780788
}
781789

782-
function resolveIfAvailable(instance, url, server, result, connectionMode, serverUrl, options) {
790+
function resolveIfAvailable(instance, url, server, result, connectionMode, options) {
791+
792+
console.log('connectionManager.resolveIfAvailable: ' + url);
783793

784794
const promise = instance.validateServerAddress ? instance.validateServerAddress(instance, ajax, url) : Promise.resolve();
785795

786796
return promise.then(() => {
787-
return onSuccessfulConnection(instance, server, result, connectionMode, serverUrl, options);
797+
return onSuccessfulConnection(instance, server, result, connectionMode, url, options);
788798
}, () => {
789799
console.log('minServerVersion requirement not met. Server version: ' + result.Version);
790800
return {
@@ -1166,7 +1176,7 @@ export default class ConnectionManager {
11661176
updateServerInfo(server, result);
11671177
}
11681178

1169-
return resolveIfAvailable(instance, serverUrl, server, result, connectionMode, serverUrl, options);
1179+
return resolveIfAvailable(instance, serverUrl, server, result, connectionMode, options);
11701180
}
11711181

11721182
}, function () {

0 commit comments

Comments
 (0)