mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
hls updates
This commit is contained in:
parent
bbdbdf346e
commit
9fc4c86111
19 changed files with 255 additions and 246 deletions
|
@ -52,7 +52,7 @@
|
|||
top: 0;
|
||||
}
|
||||
|
||||
@media all and (max-width: 1000px) {
|
||||
@media all and (max-width: 740px) {
|
||||
.headerSelectedPlayer {
|
||||
display: none;
|
||||
}
|
||||
|
|
|
@ -78,7 +78,7 @@
|
|||
}
|
||||
|
||||
.homePageSection + .homePageSection {
|
||||
margin-top: 1em;
|
||||
margin-top: .25em;
|
||||
}
|
||||
|
||||
.sectionHeaderButton {
|
||||
|
|
|
@ -138,7 +138,7 @@
|
|||
-webkit-overflow-scrolling: touch;
|
||||
}
|
||||
|
||||
.bottomLibraryViewNav {
|
||||
.bottomSecondaryNav .libraryViewNav {
|
||||
top: initial;
|
||||
bottom: 0;
|
||||
border-top: 1px solid #444;
|
||||
|
@ -236,7 +236,7 @@
|
|||
border-bottom: 5px solid transparent;
|
||||
}
|
||||
|
||||
.bottomLibraryViewNav a {
|
||||
.bottomSecondaryNav .libraryViewNav a {
|
||||
padding: 12px 0 12px;
|
||||
}
|
||||
|
||||
|
|
|
@ -39,7 +39,7 @@
|
|||
vertical-align: middle;
|
||||
text-align: left;
|
||||
font-size: 15px;
|
||||
max-width: 170px;
|
||||
max-width: 150px;
|
||||
}
|
||||
|
||||
@media (min-width: 800px) {
|
||||
|
|
|
@ -1,18 +1,13 @@
|
|||
(function () {
|
||||
|
||||
function onLoggedIn() {
|
||||
|
||||
Dashboard.hideModalLoadingMsg();
|
||||
Dashboard.navigate('selectserver.html');
|
||||
}
|
||||
|
||||
function login(page, username, password) {
|
||||
|
||||
Dashboard.showModalLoadingMsg();
|
||||
|
||||
ConnectionManager.loginToConnect(username, password).done(function () {
|
||||
|
||||
onLoggedIn();
|
||||
Dashboard.hideModalLoadingMsg();
|
||||
Dashboard.navigate('selectserver.html');
|
||||
|
||||
}).fail(function () {
|
||||
|
||||
|
@ -39,7 +34,7 @@
|
|||
{
|
||||
var apiClient = result.ApiClient;
|
||||
|
||||
Dashboard.onServerChanged(apiClient.serverAddress(), apiClient.getCurrentUserId(), apiClient.accessToken(), apiClient);
|
||||
Dashboard.onServerChanged(apiClient.getCurrentUserId(), apiClient.accessToken(), apiClient);
|
||||
Dashboard.navigate('index.html');
|
||||
}
|
||||
break;
|
||||
|
@ -50,7 +45,7 @@
|
|||
break;
|
||||
case MediaBrowser.ConnectionState.ServerSelection:
|
||||
{
|
||||
onLoggedIn();
|
||||
Dashboard.navigate('selectserver.html');
|
||||
}
|
||||
break;
|
||||
case MediaBrowser.ConnectionState.ConnectSignIn:
|
||||
|
|
|
@ -50,8 +50,10 @@
|
|||
|
||||
var apiClient = ApiClient;
|
||||
|
||||
if (apiClient) {
|
||||
$(apiClient).off("websocketmessage", DashboardPage.onWebSocketMessage).off("websocketopen", DashboardPage.onWebSocketConnectionChange).off("websocketerror", DashboardPage.onWebSocketConnectionChange).off("websocketclose", DashboardPage.onWebSocketConnectionChange);
|
||||
DashboardPage.stopInterval(apiClient);
|
||||
}
|
||||
|
||||
if (DashboardPage.sessionUpdateTimer) {
|
||||
clearInterval(DashboardPage.sessionUpdateTimer);
|
||||
|
@ -1280,7 +1282,11 @@ $(document).on('pagebeforeshowready', "#dashboardPage", DashboardPage.onPageShow
|
|||
createList(this);
|
||||
}
|
||||
|
||||
startListening(ApiClient);
|
||||
var apiClient = ApiClient;
|
||||
|
||||
if (apiClient) {
|
||||
startListening(apiClient);
|
||||
}
|
||||
|
||||
return this;
|
||||
};
|
||||
|
|
|
@ -807,7 +807,7 @@
|
|||
var innerElem = $('.cardOverlayTarget', elem);
|
||||
|
||||
var dataElement = elem;
|
||||
while (!dataElement.getAttribute('data-itemid')) {
|
||||
while (dataElement && !dataElement.getAttribute('data-itemid')) {
|
||||
dataElement = dataElement.parentNode;
|
||||
}
|
||||
|
||||
|
|
|
@ -257,6 +257,7 @@
|
|||
}
|
||||
|
||||
var requiresLibraryMenuRefresh = false;
|
||||
var requiresViewMenuRefresh = false;
|
||||
|
||||
function getLibraryMenu(user) {
|
||||
|
||||
|
@ -460,7 +461,7 @@
|
|||
|
||||
function updateContextText(page) {
|
||||
|
||||
var name = page.getAttribute('data-contextname');
|
||||
var name = $(page)[0].getAttribute('data-contextname');
|
||||
|
||||
if (name) {
|
||||
|
||||
|
@ -490,21 +491,17 @@
|
|||
}
|
||||
}
|
||||
|
||||
$(document).on('pageinit', ".page", function () {
|
||||
function buildViewMenuBar(page) {
|
||||
|
||||
var page = this;
|
||||
if ($(page).hasClass('standalonePage')) {
|
||||
$('.viewMenuBar').remove();
|
||||
return;
|
||||
}
|
||||
|
||||
$('.libraryViewNav', page).wrapInner('<div class="libraryViewNavInner"></div>');
|
||||
if (requiresViewMenuRefresh) {
|
||||
$('.viewMenuBar').remove();
|
||||
}
|
||||
|
||||
$('.libraryViewNav a', page).each(function () {
|
||||
|
||||
this.innerHTML = '<span class="libraryViewNavLinkContent">' + this.innerHTML + '</span>';
|
||||
|
||||
});
|
||||
|
||||
}).on('pagebeforeshowready', ".page:not(.standalonePage)", function () {
|
||||
|
||||
var page = this;
|
||||
var viewMenuBar = $('.viewMenuBar');
|
||||
if (!$('.viewMenuBar').length) {
|
||||
|
||||
|
@ -517,30 +514,42 @@
|
|||
|
||||
updateLibraryNavLinks(page);
|
||||
updateContextText(page);
|
||||
requiresViewMenuRefresh = false;
|
||||
});
|
||||
} else {
|
||||
updateContextText(page);
|
||||
updateLibraryNavLinks(page);
|
||||
updateViewMenuBarHeadroom(page, viewMenuBar);
|
||||
requiresViewMenuRefresh = false;
|
||||
}
|
||||
|
||||
var jpage = $(page);
|
||||
|
||||
if (jpage.hasClass('libraryPage')) {
|
||||
$(document.body).addClass('libraryDocument').removeClass('dashboardDocument');
|
||||
}
|
||||
else if (jpage.hasClass('type-interior')) {
|
||||
$(document.body).addClass('dashboardDocument').removeClass('libraryDocument');
|
||||
} else {
|
||||
$(document.body).removeClass('dashboardDocument').removeClass('libraryDocument');
|
||||
}
|
||||
|
||||
}).on('pagebeforeshowready', ".libraryPage", function () {
|
||||
$(document).on('pageinit', ".page", function () {
|
||||
|
||||
var page = this;
|
||||
|
||||
$('.libraryViewNav', page).wrapInner('<div class="libraryViewNavInner"></div>');
|
||||
|
||||
$('.libraryViewNav a', page).each(function () {
|
||||
|
||||
this.innerHTML = '<span class="libraryViewNavLinkContent">' + this.innerHTML + '</span>';
|
||||
|
||||
});
|
||||
|
||||
}).on('pagebeforeshowready', ".page", function () {
|
||||
|
||||
var page = this;
|
||||
buildViewMenuBar(page);
|
||||
|
||||
var jpage = $(page);
|
||||
|
||||
var isLibraryPage = jpage.hasClass('libraryPage');
|
||||
|
||||
if (isLibraryPage) {
|
||||
$(document.body).addClass('libraryDocument').removeClass('dashboardDocument');
|
||||
|
||||
if (AppInfo.enableBottomTabs) {
|
||||
$('.libraryViewNav', page).addClass('bottomLibraryViewNav');
|
||||
$(page).addClass('noSecondaryNavPage');
|
||||
|
||||
$(function () {
|
||||
|
@ -555,6 +564,12 @@
|
|||
initHeadRoom(this);
|
||||
});
|
||||
}
|
||||
}
|
||||
else if (jpage.hasClass('type-interior')) {
|
||||
$(document.body).addClass('dashboardDocument').removeClass('libraryDocument');
|
||||
} else {
|
||||
$(document.body).removeClass('dashboardDocument').removeClass('libraryDocument');
|
||||
}
|
||||
|
||||
}).on('pageshow', ".libraryPage", function () {
|
||||
|
||||
|
@ -601,8 +616,8 @@
|
|||
initializeApiClient(apiClient);
|
||||
|
||||
}).on('localusersignedin localusersignedout', function () {
|
||||
$('.viewMenuBar').remove();
|
||||
requiresLibraryMenuRefresh = true;
|
||||
requiresViewMenuRefresh = true;
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
@ -105,12 +105,12 @@
|
|||
var newUrl;
|
||||
|
||||
if (user.Policy.IsAdministrator && !serverId) {
|
||||
newUrl = "dashboard.html?u=" + user.Id + '&t=' + result.AccessToken;
|
||||
newUrl = "dashboard.html";
|
||||
} else {
|
||||
newUrl = "index.html?u=" + user.Id + '&t=' + result.AccessToken;
|
||||
newUrl = "index.html";
|
||||
}
|
||||
|
||||
Dashboard.onServerChanged(apiClient.serverAddress(), user.Id, result.AccessToken, apiClient);
|
||||
Dashboard.onServerChanged(user.Id, result.AccessToken, apiClient);
|
||||
Dashboard.navigate(newUrl);
|
||||
|
||||
}).fail(function () {
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
|
||||
case MediaBrowser.ConnectionState.SignedIn:
|
||||
{
|
||||
Dashboard.onServerChanged(apiClient.serverAddress(), apiClient.getCurrentUserId(), apiClient.accessToken(), apiClient);
|
||||
Dashboard.onServerChanged(apiClient.getCurrentUserId(), apiClient.accessToken(), apiClient);
|
||||
Dashboard.navigate('index.html');
|
||||
}
|
||||
break;
|
||||
|
@ -22,7 +22,7 @@
|
|||
{
|
||||
if (Dashboard.isRunningInCordova()) {
|
||||
|
||||
Dashboard.onServerChanged(apiClient.serverAddress(), null, null, apiClient);
|
||||
Dashboard.onServerChanged(null, null, apiClient);
|
||||
Dashboard.navigate('login.html?serverid=' + result.Servers[0].Id);
|
||||
} else {
|
||||
showServerConnectionFailure();
|
||||
|
|
|
@ -104,13 +104,6 @@ var Dashboard = {
|
|||
}
|
||||
},
|
||||
|
||||
onApiClientServerAddressChanged: function () {
|
||||
|
||||
var apiClient = this;
|
||||
|
||||
Dashboard.serverAddress(apiClient.serverAddress());
|
||||
},
|
||||
|
||||
getCurrentUser: function () {
|
||||
|
||||
if (!Dashboard.getUserPromise) {
|
||||
|
@ -130,23 +123,17 @@ var Dashboard = {
|
|||
}
|
||||
},
|
||||
|
||||
getAccessToken: function () {
|
||||
serverAddress: function () {
|
||||
|
||||
return store.getItem('token');
|
||||
},
|
||||
if (Dashboard.isConnectMode()) {
|
||||
var apiClient = window.ApiClient;
|
||||
|
||||
serverAddress: function (val) {
|
||||
|
||||
if (val != null) {
|
||||
|
||||
console.log('Setting server address to: ' + val);
|
||||
|
||||
store.setItem('serverAddress', val);
|
||||
if (apiClient) {
|
||||
return apiClient.serverAddress();
|
||||
}
|
||||
|
||||
var address = store.getItem('serverAddress');
|
||||
|
||||
if (!address && !Dashboard.isConnectMode()) {
|
||||
return null;
|
||||
}
|
||||
|
||||
// Try to get the server address from the browser url
|
||||
// This will preserve protocol, hostname, port and subdirectory
|
||||
|
@ -157,57 +144,43 @@ var Dashboard = {
|
|||
}
|
||||
|
||||
if (index != -1) {
|
||||
address = urlLower.substring(0, index);
|
||||
return address;
|
||||
return urlLower.substring(0, index);
|
||||
}
|
||||
|
||||
// If the above failed, just piece it together manually
|
||||
var loc = window.location;
|
||||
|
||||
address = loc.protocol + '//' + loc.hostname;
|
||||
var address = loc.protocol + '//' + loc.hostname;
|
||||
|
||||
if (loc.port) {
|
||||
address += ':' + loc.port;
|
||||
}
|
||||
}
|
||||
|
||||
return address;
|
||||
},
|
||||
|
||||
getCurrentUserId: function () {
|
||||
|
||||
var autoLoginUserId = getParameterByName('u');
|
||||
|
||||
var storedUserId = store.getItem("userId");
|
||||
|
||||
if (autoLoginUserId && autoLoginUserId != storedUserId) {
|
||||
|
||||
var token = getParameterByName('t');
|
||||
Dashboard.setCurrentUser(autoLoginUserId, token);
|
||||
}
|
||||
|
||||
return autoLoginUserId || storedUserId;
|
||||
},
|
||||
|
||||
setCurrentUser: function (userId, token) {
|
||||
|
||||
store.setItem("userId", userId);
|
||||
store.setItem("token", token);
|
||||
|
||||
var apiClient = window.ApiClient;
|
||||
|
||||
if (apiClient) {
|
||||
apiClient.setCurrentUserId(userId, token);
|
||||
return apiClient.getCurrentUserId();
|
||||
}
|
||||
|
||||
return null;
|
||||
},
|
||||
|
||||
onServerChanged: function (userId, accessToken, apiClient) {
|
||||
|
||||
apiClient = apiClient || window.ApiClient;
|
||||
|
||||
window.ApiClient = apiClient;
|
||||
|
||||
Dashboard.getUserPromise = null;
|
||||
},
|
||||
|
||||
logout: function (logoutWithServer, forceReload) {
|
||||
|
||||
store.removeItem("userId");
|
||||
store.removeItem("token");
|
||||
store.removeItem("serverAddress");
|
||||
|
||||
function onLogoutDone() {
|
||||
|
||||
var loginPage;
|
||||
|
@ -594,9 +567,11 @@ var Dashboard = {
|
|||
|
||||
refreshSystemInfoFromServer: function () {
|
||||
|
||||
if (Dashboard.getAccessToken()) {
|
||||
if (AppInfo.enableFooterNotifications) {
|
||||
ApiClient.getSystemInfo().done(function (info) {
|
||||
var apiClient = ApiClient;
|
||||
|
||||
if (apiClient.accessToken()) {
|
||||
if (apiClient.enableFooterNotifications) {
|
||||
apiClient.getSystemInfo().done(function (info) {
|
||||
|
||||
Dashboard.updateSystemInfo(info);
|
||||
});
|
||||
|
@ -1040,14 +1015,14 @@ var Dashboard = {
|
|||
Dashboard.updateSystemInfo(msg.Data);
|
||||
}
|
||||
else if (msg.MessageType === "UserUpdated" || msg.MessageType === "UserConfigurationUpdated") {
|
||||
Dashboard.validateCurrentUser();
|
||||
|
||||
var user = msg.Data;
|
||||
|
||||
if (user.Id == Dashboard.getCurrentUserId()) {
|
||||
|
||||
Dashboard.validateCurrentUser();
|
||||
$('.currentUsername').html(user.Name);
|
||||
}
|
||||
|
||||
}
|
||||
else if (msg.MessageType === "PackageInstallationCompleted") {
|
||||
Dashboard.getCurrentUser().done(function (currentUser) {
|
||||
|
@ -1076,7 +1051,7 @@ var Dashboard = {
|
|||
}
|
||||
});
|
||||
}
|
||||
else if (msg.MessageType === "PackageInstalling") {
|
||||
else if (msg.MessaapiclientcgeType === "PackageInstalling") {
|
||||
Dashboard.getCurrentUser().done(function (currentUser) {
|
||||
|
||||
if (currentUser.Policy.IsAdministrator) {
|
||||
|
@ -1492,17 +1467,7 @@ var Dashboard = {
|
|||
return deferred.promise();
|
||||
},
|
||||
|
||||
onServerChanged: function (serverAddress, userId, accessToken, apiClient) {
|
||||
|
||||
window.ApiClient = apiClient;
|
||||
if (Dashboard.isConnectMode()) {
|
||||
Dashboard.serverAddress(serverAddress);
|
||||
}
|
||||
|
||||
Dashboard.setCurrentUser(userId, accessToken);
|
||||
},
|
||||
|
||||
ready: function(fn) {
|
||||
ready: function (fn) {
|
||||
|
||||
if (Dashboard.initPromiseDone) {
|
||||
fn();
|
||||
|
@ -1593,8 +1558,7 @@ var AppInfo = {};
|
|||
|
||||
$(apiClient).off('.dashboard')
|
||||
.on("websocketmessage.dashboard", Dashboard.onWebSocketMessageReceived)
|
||||
.on('requestfail.dashboard', Dashboard.onRequestFail)
|
||||
.on('serveraddresschanged.dashboard', Dashboard.onApiClientServerAddressChanged);
|
||||
.on('requestfail.dashboard', Dashboard.onRequestFail);
|
||||
}
|
||||
|
||||
function createConnectionManager(appInfo) {
|
||||
|
@ -1605,41 +1569,36 @@ var AppInfo = {};
|
|||
|
||||
window.ConnectionManager = new MediaBrowser.ConnectionManager(Logger, credentialProvider, appInfo.appName, appInfo.appVersion, appInfo.deviceName, appInfo.deviceId, capabilities);
|
||||
|
||||
if (Dashboard.isConnectMode()) {
|
||||
|
||||
$(ConnectionManager).on('apiclientcreated', function (e, apiClient) {
|
||||
|
||||
initializeApiClient(apiClient);
|
||||
});
|
||||
|
||||
var lastApiClient = ConnectionManager.getLastUsedApiClient();
|
||||
|
||||
if (Dashboard.isConnectMode()) {
|
||||
|
||||
if (!Dashboard.isServerlessPage()) {
|
||||
|
||||
if (Dashboard.serverAddress() && Dashboard.getCurrentUserId() && Dashboard.getAccessToken()) {
|
||||
if (lastApiClient && lastApiClient.serverAddress() && lastApiClient.getCurrentUserId() && lastApiClient.accessToken()) {
|
||||
|
||||
window.ApiClient = new MediaBrowser.ApiClient(Logger, Dashboard.serverAddress(), appInfo.appName, appInfo.appVersion, appInfo.deviceName, appInfo.deviceId);
|
||||
window.ApiClient = lastApiClient;
|
||||
|
||||
ApiClient.setCurrentUserId(Dashboard.getCurrentUserId(), Dashboard.getAccessToken());
|
||||
initializeApiClient(lastApiClient);
|
||||
|
||||
initializeApiClient(ApiClient);
|
||||
//ConnectionManager.addApiClient(lastApiClient, true).fail(Dashboard.logout);
|
||||
|
||||
ConnectionManager.addApiClient(ApiClient, true).fail(Dashboard.logout);
|
||||
|
||||
} else {
|
||||
|
||||
Dashboard.logout();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
window.ApiClient = new MediaBrowser.ApiClient(Logger, Dashboard.serverAddress(), appInfo.appName, appInfo.appVersion, appInfo.deviceName, appInfo.deviceId);
|
||||
if (!lastApiClient) {
|
||||
lastApiClient = new MediaBrowser.ApiClient(Logger, Dashboard.serverAddress(), appInfo.appName, appInfo.appVersion, appInfo.deviceName, appInfo.deviceId);
|
||||
ConnectionManager.addApiClient(lastApiClient);
|
||||
}
|
||||
|
||||
ApiClient.setCurrentUserId(Dashboard.getCurrentUserId(), Dashboard.getAccessToken());
|
||||
|
||||
initializeApiClient(ApiClient);
|
||||
|
||||
ConnectionManager.addApiClient(ApiClient);
|
||||
window.ApiClient = lastApiClient;
|
||||
}
|
||||
|
||||
if (window.ApiClient) {
|
||||
|
@ -1835,7 +1794,7 @@ var AppInfo = {};
|
|||
}
|
||||
}
|
||||
|
||||
function init(deferred, appName, deviceId, deviceName) {
|
||||
function init(deferred, appName, deviceId, deviceName, resolveOnReady) {
|
||||
|
||||
requirejs.config({
|
||||
map: {
|
||||
|
@ -1857,9 +1816,17 @@ var AppInfo = {};
|
|||
|
||||
createConnectionManager(appInfo);
|
||||
|
||||
if (!resolveOnReady) {
|
||||
Dashboard.initPromiseDone = true;
|
||||
deferred.resolve();
|
||||
$(onDocumentReady);
|
||||
}
|
||||
$(function () {
|
||||
onDocumentReady();
|
||||
if (resolveOnReady) {
|
||||
Dashboard.initPromiseDone = true;
|
||||
deferred.resolve();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function initCordovaWithDeviceId(deferred, deviceId) {
|
||||
|
@ -1867,7 +1834,7 @@ var AppInfo = {};
|
|||
requirejs(['thirdparty/cordova/imagestore.js']);
|
||||
}
|
||||
|
||||
init(deferred, "Emby Mobile", deviceId, device.model);
|
||||
init(deferred, "Emby Mobile", deviceId, device.model, true);
|
||||
}
|
||||
|
||||
function initCordova(deferred) {
|
||||
|
@ -1974,15 +1941,14 @@ $(document).on('pagecreate', ".page", function () {
|
|||
Dashboard.firePageEvent(page, 'pagebeforeshowready');
|
||||
}
|
||||
|
||||
}).on('pagebeforeshow', ".page", function () {
|
||||
}).on('pagebeforeshowready', ".page", function () {
|
||||
|
||||
var page = $(this);
|
||||
|
||||
var apiClient = window.ApiClient;
|
||||
|
||||
if (Dashboard.getAccessToken() && Dashboard.getCurrentUserId()) {
|
||||
if (apiClient && apiClient.accessToken() && Dashboard.getCurrentUserId()) {
|
||||
|
||||
if (apiClient) {
|
||||
Dashboard.getCurrentUser().done(function (user) {
|
||||
|
||||
var isSettingsPage = page.hasClass('type-interior');
|
||||
|
@ -1996,7 +1962,6 @@ $(document).on('pagecreate', ".page", function () {
|
|||
Dashboard.ensureToolsMenu(page, user);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Dashboard.ensureHeader(page);
|
||||
Dashboard.ensurePageTitle(page);
|
||||
|
|
|
@ -120,7 +120,7 @@
|
|||
|
||||
};
|
||||
|
||||
$(document).on('pageshow', "#supporterKeyPage", SupporterKeyPage.onPageShow);
|
||||
$(document).on('pageshowready', "#supporterKeyPage", SupporterKeyPage.onPageShow);
|
||||
|
||||
(function () {
|
||||
|
||||
|
@ -255,14 +255,19 @@ $(document).on('pageshow', "#supporterKeyPage", SupporterKeyPage.onPageShow);
|
|||
|
||||
}
|
||||
|
||||
$(document).on('pageinit', "#supporterKeyPage", function () {
|
||||
$(document).on('pageinitdepends', "#supporterKeyPage", function () {
|
||||
|
||||
var page = this;
|
||||
$('#btnAddConnectUser', page).on('click', function () {
|
||||
showAddUserForm(page);
|
||||
});
|
||||
|
||||
}).on('pageshow', "#supporterKeyPage", function () {
|
||||
$('#supporterKeyForm').on('submit', SupporterKeyPage.updateSupporterKey);
|
||||
$('#lostKeyForm').on('submit', SupporterKeyPage.retrieveSupporterKey);
|
||||
$('#linkKeysForm').on('submit', SupporterKeyPage.linkSupporterKeys);
|
||||
$('.popupAddUserForm').on('submit', SupporterKeyPage.onAddConnectUserSubmit).on('submit', SupporterKeyPage.onAddConnectUserSubmit);
|
||||
|
||||
}).on('pageshowready', "#supporterKeyPage", function () {
|
||||
|
||||
var page = this;
|
||||
loadConnectSupporters(page);
|
||||
|
|
|
@ -387,7 +387,7 @@
|
|||
});
|
||||
}
|
||||
|
||||
$(document).on('pageinit', ".libraryPage", function () {
|
||||
$(document).on('pageinitdepends', ".libraryPage", function () {
|
||||
|
||||
var page = this;
|
||||
|
||||
|
@ -396,7 +396,7 @@
|
|||
onCategorySyncButtonClick(page, this);
|
||||
});
|
||||
|
||||
}).on('pagebeforeshow', ".libraryPage", function () {
|
||||
}).on('pagebeforeshowready', ".libraryPage", function () {
|
||||
|
||||
var page = this;
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
<title>${TitleSupport}</title>
|
||||
</head>
|
||||
<body>
|
||||
<div id="supporterKeyPage" data-role="page" class="page type-interior">
|
||||
<div id="supporterKeyPage" data-role="page" class="page type-interior" data-require="scripts/supporterkeypage">
|
||||
|
||||
<div data-role="content">
|
||||
<div class="content-primary">
|
||||
|
@ -132,13 +132,6 @@
|
|||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
$('#supporterKeyForm').on('submit', SupporterKeyPage.updateSupporterKey);
|
||||
$('#lostKeyForm').on('submit', SupporterKeyPage.retrieveSupporterKey);
|
||||
$('#linkKeysForm').on('submit', SupporterKeyPage.linkSupporterKeys);
|
||||
$('.popupAddUserForm').on('submit', SupporterKeyPage.onAddConnectUserSubmit).on('submit', SupporterKeyPage.onAddConnectUserSubmit);
|
||||
</script>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
|
62
dashboard-ui/thirdparty/apiclient/apiclient.js
vendored
62
dashboard-ui/thirdparty/apiclient/apiclient.js
vendored
|
@ -7,7 +7,7 @@
|
|||
/**
|
||||
* Creates a new api client instance
|
||||
* @param {String} serverAddress
|
||||
* @param {String} clientName
|
||||
* @param {String} clientName s
|
||||
* @param {String} applicationVersion
|
||||
*/
|
||||
globalScope.MediaBrowser.ApiClient = function (logger, serverAddress, clientName, applicationVersion, deviceName, deviceId) {
|
||||
|
@ -23,10 +23,8 @@
|
|||
logger.log('ApiClient deviceId: ' + deviceId);
|
||||
|
||||
var self = this;
|
||||
var currentUserId;
|
||||
var accessToken;
|
||||
var webSocket;
|
||||
var serverInfo;
|
||||
var serverInfo = {};
|
||||
|
||||
self.enableAppStorePolicy = false;
|
||||
|
||||
|
@ -37,6 +35,10 @@
|
|||
|
||||
if (val != null) {
|
||||
|
||||
if (val.toLowerCase().indexOf('http') != 0) {
|
||||
throw new Error('Invalid url: ' + val);
|
||||
}
|
||||
|
||||
var changed = val != serverAddress;
|
||||
|
||||
serverAddress = val;
|
||||
|
@ -81,18 +83,11 @@
|
|||
*/
|
||||
self.getCurrentUserId = function () {
|
||||
|
||||
return currentUserId;
|
||||
return serverInfo.UserId;
|
||||
};
|
||||
|
||||
self.accessToken = function () {
|
||||
return accessToken;
|
||||
};
|
||||
|
||||
self.setCurrentUserId = function (userId, token) {
|
||||
|
||||
currentUserId = userId;
|
||||
currentUserPromise = null;
|
||||
accessToken = token;
|
||||
return serverInfo.AccessToken;
|
||||
};
|
||||
|
||||
self.deviceName = function () {
|
||||
|
@ -104,13 +99,14 @@
|
|||
};
|
||||
|
||||
self.clearAuthenticationInfo = function () {
|
||||
accessToken = null;
|
||||
currentUserId = null;
|
||||
self.setAuthenticationInfo(null, null);
|
||||
};
|
||||
|
||||
self.setAuthenticationInfo = function (accessKey, userId) {
|
||||
accessToken = accessKey;
|
||||
currentUserId = userId;
|
||||
currentUserPromise = null;
|
||||
|
||||
serverInfo.AccessToken = accessKey;
|
||||
serverInfo.UserId = userId;
|
||||
};
|
||||
|
||||
self.encodeName = function (name) {
|
||||
|
@ -156,8 +152,10 @@
|
|||
|
||||
var auth = 'MediaBrowser Client="' + clientName + '", Device="' + deviceName + '", DeviceId="' + deviceId + '", Version="' + applicationVersion + '"';
|
||||
|
||||
if (currentUserId) {
|
||||
auth += ', UserId="' + currentUserId + '"';
|
||||
var userId = serverInfo.UserId;
|
||||
|
||||
if (userId) {
|
||||
auth += ', UserId="' + userId + '"';
|
||||
}
|
||||
|
||||
request.headers = {
|
||||
|
@ -165,12 +163,14 @@
|
|||
};
|
||||
}
|
||||
|
||||
var accessToken = serverInfo.AccessToken;
|
||||
|
||||
if (accessToken) {
|
||||
request.headers['X-MediaBrowser-Token'] = accessToken;
|
||||
}
|
||||
}
|
||||
|
||||
if (!self.enableAutomaticNetwork || !self.serverInfo() || self.connectionMode == null) {
|
||||
if (!self.enableAutomaticNetwork || self.connectionMode == null) {
|
||||
logger.log('Requesting url without automatic networking: ' + request.url);
|
||||
return AjaxApi.ajax(request).fail(onRequestFail);
|
||||
}
|
||||
|
@ -332,6 +332,10 @@
|
|||
|
||||
var url = serverAddress;
|
||||
|
||||
if (!url) {
|
||||
throw new Error("serverAddress is yet not set");
|
||||
}
|
||||
|
||||
if (name.charAt(0) != '/') {
|
||||
url += '/';
|
||||
}
|
||||
|
@ -347,6 +351,18 @@
|
|||
|
||||
self.enableAutomaticNetworking = function (server, connectionMode, serverUrl) {
|
||||
|
||||
if (server == null) {
|
||||
throw new Error('server cannot be null');
|
||||
}
|
||||
|
||||
if (connectionMode == null) {
|
||||
throw new Error('connectionMode cannot be null');
|
||||
}
|
||||
|
||||
if (!serverUrl) {
|
||||
throw new Error('serverUrl cannot be null or empty');
|
||||
}
|
||||
|
||||
logger.log('Begin enableAutomaticNetworking');
|
||||
|
||||
self.serverInfo(server);
|
||||
|
@ -363,6 +379,8 @@
|
|||
|
||||
self.openWebSocket = function () {
|
||||
|
||||
var accessToken = serverInfo.AccessToken;
|
||||
|
||||
if (!accessToken) {
|
||||
throw new Error("Cannot open web socket without access token.");
|
||||
}
|
||||
|
@ -557,10 +575,10 @@
|
|||
self.closeWebSocket();
|
||||
|
||||
var done = function () {
|
||||
self.setCurrentUserId(null, null);
|
||||
self.setAuthenticationInfo(null, null);
|
||||
};
|
||||
|
||||
if (accessToken) {
|
||||
if (serverInfo.AccessToken) {
|
||||
var url = self.getUrl("Sessions/Logout");
|
||||
|
||||
return self.ajax({
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
|
||||
var self = this;
|
||||
var apiClients = [];
|
||||
var defaultTimeout = 15000;
|
||||
|
||||
function mergeServers(list1, list2) {
|
||||
|
||||
|
@ -73,7 +74,7 @@
|
|||
url: url,
|
||||
dataType: "json",
|
||||
|
||||
timeout: timeout || 15000
|
||||
timeout: timeout || defaultTimeout
|
||||
|
||||
});
|
||||
}
|
||||
|
@ -100,10 +101,33 @@
|
|||
return credentialProvider.credentials().ConnectAccessToken;
|
||||
};
|
||||
|
||||
self.addApiClient = function (apiClient, enableAutomaticNetworking) {
|
||||
self.getLastUsedApiClient = function() {
|
||||
|
||||
var servers = credentialProvider.credentials().servers;
|
||||
|
||||
servers.sort(function (a, b) {
|
||||
return b.DateLastAccessed - a.DateLastAccessed;
|
||||
});
|
||||
|
||||
if (!servers.length) {
|
||||
return null;
|
||||
}
|
||||
|
||||
var server = servers[0];
|
||||
|
||||
return getOrAddApiClient(server, server.LastConnectionMode);
|
||||
};
|
||||
|
||||
self.addApiClient = function (apiClient) {
|
||||
|
||||
apiClients.push(apiClient);
|
||||
|
||||
Events.on(apiClient, 'authenticated', function (e, result) {
|
||||
onAuthenticated(this, result, {}, true);
|
||||
});
|
||||
|
||||
Events.trigger(self, 'apiclientcreated', [apiClient]);
|
||||
|
||||
return apiClient.getPublicSystemInfo().done(function (systemInfo) {
|
||||
|
||||
var server = credentialProvider.credentials().servers.filter(function (s) {
|
||||
|
@ -115,13 +139,7 @@
|
|||
updateServerInfo(server, systemInfo);
|
||||
|
||||
apiClient.serverInfo(server);
|
||||
Events.trigger(self, 'apiclientcreated', [apiClient]);
|
||||
|
||||
if (enableAutomaticNetworking) {
|
||||
self.connectToServer(server);
|
||||
}
|
||||
});
|
||||
|
||||
};
|
||||
|
||||
function onConnectUserSignIn(user) {
|
||||
|
@ -151,7 +169,7 @@
|
|||
Events.trigger(self, 'apiclientcreated', [apiClient]);
|
||||
}
|
||||
|
||||
if (server.AccessToken) {
|
||||
if (server.AccessToken && server.UserId) {
|
||||
|
||||
apiClient.setAuthenticationInfo(server.AccessToken, server.UserId);
|
||||
}
|
||||
|
@ -799,7 +817,7 @@
|
|||
var address = self.getServerAddress(server, mode);
|
||||
var enableRetry = false;
|
||||
var skipTest = false;
|
||||
var timeout = 15000;
|
||||
var timeout = defaultTimeout;
|
||||
|
||||
if (mode == MediaBrowser.ConnectionMode.Local) {
|
||||
|
||||
|
@ -807,7 +825,7 @@
|
|||
skipTest = true;
|
||||
}
|
||||
enableRetry = true;
|
||||
timeout = 5000;
|
||||
timeout = 7000;
|
||||
}
|
||||
|
||||
else if (mode == MediaBrowser.ConnectionMode.Manual) {
|
||||
|
@ -924,7 +942,7 @@
|
|||
case MediaBrowser.ConnectionMode.Remote:
|
||||
return server.RemoteAddress;
|
||||
default:
|
||||
throw new Error("Unexpected ConnectionMode");
|
||||
return server.ManualAddress || server.LocalAddress || server.RemoteAddress;
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -934,6 +952,10 @@
|
|||
address = "http://" + address;
|
||||
}
|
||||
|
||||
// Seeing failures in iOS when protocol isn't lowercase
|
||||
address = address.replace('Http:', 'http:');
|
||||
address = address.replace('Https:', 'https:');
|
||||
|
||||
return address;
|
||||
}
|
||||
|
||||
|
@ -953,7 +975,7 @@
|
|||
resolveWithFailure(deferred);
|
||||
}
|
||||
|
||||
tryConnect(address, 15000).done(function (publicInfo) {
|
||||
tryConnect(address, defaultTimeout).done(function (publicInfo) {
|
||||
|
||||
logger.log('connectToAddress ' + address + ' succeeded');
|
||||
|
||||
|
|
|
@ -580,12 +580,15 @@
|
|||
|
||||
$(MediaController).on('playerchange', function (e, newPlayer, newTarget) {
|
||||
|
||||
if (newPlayer.name != PlayerName || newTarget.id != currentPairedDeviceId) {
|
||||
if (currentPairedDeviceId) {
|
||||
if (newTarget.id != currentPairedDeviceId) {
|
||||
if (currentWebAppSession) {
|
||||
console.log('Disconnecting from chromecast');
|
||||
currentWebAppSession.disconnect();
|
||||
onDisconnected();
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
|
15
dashboard-ui/thirdparty/cordova/connectsdk.js
vendored
15
dashboard-ui/thirdparty/cordova/connectsdk.js
vendored
|
@ -1,16 +1,5 @@
|
|||
(function () {
|
||||
|
||||
|
||||
function onDeviceFound(e) {
|
||||
|
||||
console.log('device found');
|
||||
}
|
||||
|
||||
function onDeviceLost(e) {
|
||||
|
||||
console.log('device lost');
|
||||
}
|
||||
|
||||
function initSdk() {
|
||||
|
||||
var manager = ConnectSDK.discoveryManager;
|
||||
|
@ -23,9 +12,6 @@
|
|||
// new ConnectSDK.CapabilityFilter(["MediaPlayer.Display.Video", "MediaControl.Pause"])
|
||||
//]);
|
||||
|
||||
manager.addListener('devicefound', onDeviceFound);
|
||||
manager.addListener('devicelost', onDeviceLost);
|
||||
|
||||
manager.startDiscovery();
|
||||
|
||||
requirejs(['thirdparty/cordova/chromecast', 'thirdparty/cordova/generaldevice']);
|
||||
|
@ -33,5 +19,4 @@
|
|||
|
||||
Dashboard.ready(initSdk);
|
||||
|
||||
|
||||
})();
|
|
@ -481,6 +481,7 @@
|
|||
function onDisconnected(device) {
|
||||
|
||||
if (currentDevice && device.getId() == currentDevice.getId()) {
|
||||
currentDevice = null;
|
||||
MediaController.removeActiveTarget(device.getId());
|
||||
}
|
||||
}
|
||||
|
@ -552,6 +553,7 @@
|
|||
|
||||
if (currentDevice && newTarget.id != currentDevice.getId()) {
|
||||
MediaController.removeActiveTarget(currentDevice.getId());
|
||||
currentDevice = null;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue