1
0
Fork 0
mirror of https://github.com/jellyfin/jellyfin-web synced 2025-03-30 19:56:21 +00:00

Add dashboard branding page

This commit is contained in:
Bill Thornton 2024-11-20 17:56:59 -05:00
parent 441494d5b2
commit ca5f94df63
8 changed files with 259 additions and 10 deletions

View file

@ -1,3 +1,6 @@
// NOTE: This is used for jsdoc return type
// eslint-disable-next-line no-unused-vars
import { Api } from '@jellyfin/sdk';
import { MINIMUM_VERSION } from '@jellyfin/sdk/lib/versions';
import { ConnectionManager, Credentials, ApiClient } from 'jellyfin-apiclient';
@ -6,6 +9,7 @@ import Dashboard from '../utils/dashboard';
import Events from '../utils/events.ts';
import { setUserInfo } from '../scripts/settings/userSettings';
import appSettings from '../scripts/settings/appSettings';
import { toApi } from 'utils/jellyfin-apiclient/compat';
const normalizeImageOptions = options => {
if (!options.quality && (options.maxWidth || options.width || options.maxHeight || options.height || options.fillWidth || options.fillHeight)) {
@ -111,6 +115,17 @@ class ServerConnections extends ConnectionManager {
return apiClient;
}
/**
* Gets the Api that is currently connected.
* @returns {Api|undefined} The current Api instance.
*/
getCurrentApi() {
const apiClient = this.currentApiClient();
if (!apiClient) return;
return toApi(apiClient);
}
/**
* Gets the ApiClient that is currently connected or throws if not defined.
* @async

View file

@ -37,16 +37,16 @@ export const toAsyncPageRoute = ({
return {
path,
lazy: async () => {
const { default: route } = await importRoute(page ?? path, type);
const {
// If there is a default export, use it as the Component for compatibility
default: Component,
...route
} = await importRoute(page ?? path, type);
// If route is not a RouteObject, use it as the Component
if (!route.Component) {
return {
Component: route
};
}
return route;
return {
Component,
...route
};
}
};
};