mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
Improve UI
This commit is contained in:
parent
43d01146a2
commit
bf03a7ba57
7 changed files with 65 additions and 45 deletions
|
@ -152,7 +152,7 @@ define(["apphost", "appSettings", "dom", "connectionManager", "loading", "layout
|
|||
|
||||
function loginQuickConnect() {
|
||||
var apiClient = getApiClient();
|
||||
var friendlyName = navigator.userAgent; // TODO: what should this be changed to?
|
||||
var friendlyName = navigator.userAgent;
|
||||
|
||||
var url = apiClient.getUrl("/QuickConnect/Initiate?FriendlyName=" + friendlyName);
|
||||
apiClient.getJSON(url)
|
||||
|
@ -174,25 +174,37 @@ define(["apphost", "appSettings", "dom", "connectionManager", "loading", "layout
|
|||
loading.show();
|
||||
|
||||
var interval = setInterval(async function() {
|
||||
let connectUrl = apiClient.getUrl('/QuickConnect/Connect?Secret=' + json.Secret);
|
||||
let data = await apiClient.getJSON(connectUrl);
|
||||
if (data.Authenticated) {
|
||||
let result = await apiClient.quickConnect(data.Authentication);
|
||||
var user = result.User;
|
||||
var serverId = getParameterByName("serverid");
|
||||
var newUrl = "home.html";
|
||||
try {
|
||||
let connectUrl = apiClient.getUrl('/QuickConnect/Connect?Secret=' + json.Secret);
|
||||
let data = await apiClient.getJSON(connectUrl);
|
||||
if (data.Authenticated) {
|
||||
let result = await apiClient.quickConnect(data.Authentication);
|
||||
var user = result.User;
|
||||
var serverId = getParameterByName("serverid");
|
||||
var newUrl = "home.html";
|
||||
|
||||
if (user.Policy.IsAdministrator && !serverId) {
|
||||
newUrl = "dashboard.html";
|
||||
if (user.Policy.IsAdministrator && !serverId) {
|
||||
newUrl = "dashboard.html";
|
||||
}
|
||||
|
||||
loading.hide();
|
||||
Dashboard.onServerChanged(user.Id, result.AccessToken, apiClient);
|
||||
Dashboard.navigate(newUrl);
|
||||
clearInterval(interval);
|
||||
|
||||
return true;
|
||||
}
|
||||
} catch (e) {
|
||||
Dashboard.alert({
|
||||
message: "Quick connect was deactivated before the login request could be approved",
|
||||
title: "Unexpected error"
|
||||
});
|
||||
|
||||
loading.hide();
|
||||
Dashboard.onServerChanged(user.Id, result.AccessToken, apiClient);
|
||||
Dashboard.navigate(newUrl);
|
||||
console.error("Unable to login with quick connect", e);
|
||||
clearInterval(interval);
|
||||
|
||||
return true;
|
||||
loading.hide();
|
||||
}
|
||||
|
||||
return false;
|
||||
}, 5000);
|
||||
|
||||
|
|
|
@ -3,12 +3,10 @@ define(["jQuery", "loading", "fnchecked"], function ($, loading) {
|
|||
|
||||
var page;
|
||||
function loadPage(status) {
|
||||
var active = (status == "Active");
|
||||
var available = (status == "Available") || active;
|
||||
var available = status === "Available" || status === "Active";
|
||||
|
||||
page.querySelector("#quickConnectStatus").textContent = status.toLocaleLowerCase();
|
||||
page.querySelector("#chkQuickConnectAvailable").checked = available;
|
||||
page.querySelector("#chkQuickConnectActive").checked = active;
|
||||
|
||||
loading.hide();
|
||||
}
|
||||
|
@ -17,9 +15,6 @@ define(["jQuery", "loading", "fnchecked"], function ($, loading) {
|
|||
loading.show();
|
||||
|
||||
var newStatus = page.querySelector("#chkQuickConnectAvailable").checked ? "Available" : "Unavailable";
|
||||
if (newStatus && page.querySelector("#chkQuickConnectActive").checked) {
|
||||
newStatus = "Active";
|
||||
}
|
||||
|
||||
var url = ApiClient.getUrl("/QuickConnect/Available");
|
||||
|
||||
|
@ -30,9 +25,8 @@ define(["jQuery", "loading", "fnchecked"], function ($, loading) {
|
|||
},
|
||||
url: url
|
||||
}, true).then(() => {
|
||||
Dashboard.alert({
|
||||
message: "Settings saved",
|
||||
title: "Saved"
|
||||
require(["toast"], function (toast) {
|
||||
toast("Settings saved");
|
||||
});
|
||||
|
||||
setTimeout(updatePage, 500);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue