mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
commit
b7ef77b51c
3 changed files with 5 additions and 26 deletions
|
@ -15,16 +15,13 @@ type LogItemProps = {
|
||||||
const LogItemList: FunctionComponent<LogItemProps> = ({ logs }: LogItemProps) => {
|
const LogItemList: FunctionComponent<LogItemProps> = ({ logs }: LogItemProps) => {
|
||||||
const { api } = useApi();
|
const { api } = useApi();
|
||||||
|
|
||||||
// TODO: Use getUri from TS SDK once available.
|
|
||||||
const getLogFileUrl = (logFile: LogFile) => {
|
const getLogFileUrl = (logFile: LogFile) => {
|
||||||
if (!api) return '';
|
if (!api) return '';
|
||||||
|
|
||||||
let url = api.basePath + '/System/Logs/Log';
|
return api.getUri('/System/Logs/Log', {
|
||||||
|
name: logFile.Name,
|
||||||
url += '?name=' + encodeURIComponent(String(logFile.Name));
|
api_key: api.accessToken
|
||||||
url += '&api_key=' + encodeURIComponent(api.accessToken);
|
});
|
||||||
|
|
||||||
return url;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const getDate = (logFile: LogFile) => {
|
const getDate = (logFile: LogFile) => {
|
||||||
|
|
|
@ -35,7 +35,6 @@ import Page from 'components/Page';
|
||||||
import { useApi } from 'hooks/useApi';
|
import { useApi } from 'hooks/useApi';
|
||||||
import globalize from 'lib/globalize';
|
import globalize from 'lib/globalize';
|
||||||
import { getPluginUrl } from 'utils/dashboard';
|
import { getPluginUrl } from 'utils/dashboard';
|
||||||
import { getUri } from 'utils/api';
|
|
||||||
|
|
||||||
interface AlertMessage {
|
interface AlertMessage {
|
||||||
severity?: 'success' | 'info' | 'warning' | 'error'
|
severity?: 'success' | 'info' | 'warning' | 'error'
|
||||||
|
@ -104,7 +103,7 @@ const PluginPage: FC = () => {
|
||||||
|
|
||||||
let imageUrl;
|
let imageUrl;
|
||||||
if (pluginInfo?.HasImage) {
|
if (pluginInfo?.HasImage) {
|
||||||
imageUrl = getUri(`/Plugins/${pluginInfo.Id}/${pluginInfo.Version}/Image`, api);
|
imageUrl = api?.getUri(`/Plugins/${pluginInfo.Id}/${pluginInfo.Version}/Image`);
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|
|
@ -1,17 +0,0 @@
|
||||||
import type { Api } from '@jellyfin/sdk';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets a full URI for a relative URL to the Jellyfin server for a given SDK Api instance.
|
|
||||||
* TODO: Add to SDK
|
|
||||||
* @param api - The Jellyfin SDK Api instance.
|
|
||||||
* @param url - The relative URL.
|
|
||||||
* @returns The complete URI with protocol, host, and base URL (if any).
|
|
||||||
*/
|
|
||||||
export const getUri = (url: string, api?: Api) => {
|
|
||||||
if (!api) return;
|
|
||||||
|
|
||||||
return api.axiosInstance.getUri({
|
|
||||||
baseURL: api.basePath,
|
|
||||||
url
|
|
||||||
});
|
|
||||||
};
|
|
Loading…
Add table
Add a link
Reference in a new issue