updated bravia profiles

This commit is contained in:
Luke Pulverenti 2015-05-06 08:56:26 -04:00
parent 1d66f5e9a3
commit 3a20f6af21
8 changed files with 158 additions and 20 deletions

View File

@ -4,8 +4,7 @@
<title>${TitleSignIn}</title>
</head>
<body class="serverlessPage">
<div class="backdropContainer" style="background-image:url(css/images/splash.jpg);top:0;"></div>
<div id="connectLoginPage" data-role="page" class="page standalonePage connectLoginPage lightBackdropPage backdropPage staticBackdropPage" data-theme="b" style="background-color: rgba(0, 0,0, .9)!important;">
<div id="connectLoginPage" data-role="page" class="page standalonePage connectLoginPage" data-theme="b">
<div data-role="content">
@ -24,15 +23,23 @@
<input type="password" id="txtManualPassword" required="required" />
</div>
<button type="submit" data-icon="check">
${ButtonSignIn}
<button class="btn btnActionAccent" data-role="none" type="submit">
<span>
${ButtonSignIn}
</span>
<i class="fa fa-check"></i>
</button>
<p class="forgotPassword" style="display:none;">
<a href="http://emby.media/community/index.php?app=core&module=global&section=lostpass" target="_blank">${ButtonForgotPassword}</a>
</p>
<div class="skip">
<br />
<a data-role="button" data-icon="delete" href="connectlogin.html?mode=manualserver">${ButtonSkip}</a>
<a class="btn btnDarkAccent" href="connectlogin.html?mode=manualserver">
<span>
${ButtonSkip}
</span>
<i class="fa fa-close"></i>
</a>
<div class="fieldDescription">${TextConnectToServerManually}</div>
</div>
@ -45,7 +52,7 @@
<form class="manualServerForm" style="text-align: center; margin: 0 auto;display:none;">
<h1 style="text-align: left;">${HeaderNewServer}</h1>
<h1 style="text-align: left;">${HeaderConnectToServer}</h1>
<br />
<div>
<label for="txtServerHost" style="text-align: left;">${LabelServerHost}</label>
@ -59,9 +66,18 @@
</div>
<br /><br />
<button type="submit" data-icon="check">
${ButtonConnect}
<button class="btn btnActionAccent" data-role="none" type="submit">
<span>
${ButtonConnect}
</span>
<i class="fa fa-check"></i>
</button>
<a class="btn btnDarkAccent" href="#" data-rel="back">
<span>
${ButtonCancel}
</span>
<i class="fa fa-close"></i>
</a>
</form>
<div class="welcomeContainer readOnlyContent" style="text-align: center; margin: 0 auto;display:none;">
@ -72,7 +88,7 @@
<p style="margin:2em 0;" class="embyIntroDownloadMessage"></p>
<a class="btn btnActionAccent btnIconRight" href="connectlogin.html">
<a class="btn btnActionAccent btnIconRight" href="connectlogin.html?mode=connect">
<span>
${ButtonNext}
</span>

View File

@ -29,6 +29,7 @@
</button>
</p>
<br />
<br />
</form>
<div class="visualLoginForm" style="display: none; text-align: center;">
@ -37,6 +38,8 @@
<p class="localhostMessage" style="text-align: center; display: none;">${PasswordLocalhostMessage}</p>
<br />
<div class="readOnlyContent" style="margin: 2em auto 0;">
<a href="#" onclick="LoginPage.showManualForm($.mobile.activePage, true);" data-role="button" data-icon="lock">${ButtonManualLogin}</a>
</div>
@ -54,9 +57,6 @@
<a href="selectserver.html" data-role="button" data-icon="action">
${ButtonChangeServer}
</a>
<a href="connectlogin.html?mode=connect" data-role="button" data-icon="lock">
${ButtonSignInWithConnect}
</a>
</div>
</div>

View File

@ -56,6 +56,14 @@
loadMode(page, 'welcome');
}
break;
case MediaBrowser.ConnectionState.Unavailable:
{
Dashboard.alert({
message: Globalize.translate("MessageUnableToConnectToServer"),
title: Globalize.translate("HeaderConnectionFailure")
});
}
break;
default:
break;
}
@ -76,9 +84,9 @@
function loadPage(page) {
var mode = getParameterByName('mode');
var mode = getParameterByName('mode') || 'auto';
if (!mode) {
if (mode == 'auto') {
if (Dashboard.isRunningInCordova()) {
loadAppConnection(page);
@ -91,6 +99,9 @@
}
function loadMode(page, mode) {
$(document.body).prepend('<div class="backdropContainer" style="background-image:url(css/images/splash.jpg);top:0;"></div>');
$(page).addClass('lightBackdropPage backdropPage staticBackdropPage');
if (mode == 'welcome') {
$('.connectLoginForm', page).hide();
$('.welcomeContainer', page).show();
@ -145,6 +156,14 @@
handleConnectionResult(page, result);
}).fail(function () {
Dashboard.hideLoadingMsg();
handleConnectionResult(page, {
State: MediaBrowser.ConnectionState.Unavailable
});
});
}

View File

@ -44,6 +44,7 @@ var Dashboard = {
isConnectMode: function () {
return true;
if (Dashboard.isRunningInCordova()) {
return true;
}
@ -56,6 +57,7 @@ var Dashboard = {
isRunningInCordova: function () {
return true;
return window.appMode == 'cordova';
},

View File

@ -2477,7 +2477,9 @@
self.authenticateUserByName = function (name, password) {
if (!name) {
throw new Error("null name");
var deferred = DeferredBuilder.Deferred();
deferred.reject();
return deferred.promise();
}
var url = self.getUrl("Users/authenticatebyname");

View File

@ -944,10 +944,15 @@
self.connectToAddress = function (address) {
address = normalizeAddress(address);
var deferred = DeferredBuilder.Deferred();
if (!address) {
deferred.reject();
return deferred.promise();
}
address = normalizeAddress(address);
tryConnect(address, 15000).done(function (publicInfo) {
logger.log('connectToAddress ' + address + ' succeeded');
@ -976,10 +981,14 @@
self.loginToConnect = function (username, password) {
if (!username) {
throw new Error("null username");
var deferred = DeferredBuilder.Deferred();
deferred.reject();
return deferred.promise();
}
if (!password) {
throw new Error("null password");
var deferred = DeferredBuilder.Deferred();
deferred.reject();
return deferred.promise();
}
var md5 = self.getConnectPasswordHash(password);

View File

@ -0,0 +1,19 @@
(function (globalScope) {
globalScope.ServerDiscovery = {
findServers: function (timeoutMs) {
var deferred = DeferredBuilder.Deferred();
var servers = [];
// Expected server properties
// Name, Id, Address, EndpointAddress (optional)
deferred.resolveWith(null, [servers]);
return deferred.promise();
}
};
})(window);

View File

@ -1,16 +1,87 @@
(function (globalScope) {
function stringToArrayBuffer(string) {
// UTF-16LE
var buf = new ArrayBuffer(string.length * 2);
var bufView = new Uint16Array(buf);
for (var i = 0, strLen = string.length; i < strLen; i++) {
bufView[i] = string.charCodeAt(i);
}
return buf;
}
globalScope.ServerDiscovery = {
findServers: function (timeoutMs) {
var deferred = DeferredBuilder.Deferred();
var servers = [];
// Expected server properties
// Name, Id, Address, EndpointAddress (optional)
deferred.resolveWith(null, [servers]);
var chrome = globalScope.chrome;
if (!chrome) {
deferred.resolveWith(null, [servers]);
return deferred.promise();
}
var data = stringToArrayBuffer('who is EmbyServer?');
var isTimedOut = false;
var socketId;
var timeout = setTimeout(function () {
isTimedOut = true;
deferred.resolveWith(null, [servers]);
if (socketId) {
chrome.sockets.udp.onReceive.removeListener(onReceive);
chrome.sockets.udp.close(socketId);
}
}, timeoutMs);
function onReceive(info) {
if (info.socketId == socketId) {
//expect(info.remotePort).toBeTruthy();
//expect(info.remoteAddress).toBeTruthy();
//expect(info).toBeValidUdpReadResultEqualTo(data);
}
}
var port = 7359;
chrome.sockets.udp.create(function (createInfo) {
socketId = createInfo.socketId;
chrome.sockets.udp.bind(createInfo.socketId, '0.0.0.0', port, function (result) {
chrome.sockets.udp.send(createInfo.socketId, data, '255.255.255.255', port, function (result) {
if (result < 0) {
console.log('send fail: ' + result);
chrome.sockets.udp.close(createInfo.socketId);
if (!isTimedOut) {
clearTimeout(timeout);
deferred.resolveWith(null, [servers]);
}
} else {
console.log('sendTo: success ' + port);
if (!isTimedOut) {
chrome.sockets.udp.onReceive.addListener(onReceive);
}
}
});
});
});
return deferred.promise();
}
};