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

Remove image proxying through API

Removes the web interface image proxying through the `/Images/Remote`
and `/Items/RemoteSearch/Image` API endpoints. This appears to be those
endpoints' only usage in the web client.
This commit is contained in:
Joshua M. Boniface 2021-05-02 01:09:50 -04:00
parent d96b6ac4ee
commit 55fac2448c
3 changed files with 5 additions and 21 deletions

View file

@ -150,10 +150,6 @@ import template from './imageDownloader.template.html';
}); });
} }
function getDisplayUrl(url, apiClient) {
return apiClient.getUrl('Images/Remote', { imageUrl: url });
}
function getRemoteImageHtml(image, imageType, apiClient) { function getRemoteImageHtml(image, imageType, apiClient) {
const tagName = layoutManager.tv ? 'button' : 'div'; const tagName = layoutManager.tv ? 'button' : 'div';
const enableFooterButtons = !layoutManager.tv; const enableFooterButtons = !layoutManager.tv;
@ -209,9 +205,9 @@ import template from './imageDownloader.template.html';
html += '<div class="cardContent">'; html += '<div class="cardContent">';
if (layoutManager.tv || !appHost.supports('externallinks')) { if (layoutManager.tv || !appHost.supports('externallinks')) {
html += '<div class="cardImageContainer lazy" data-src="' + getDisplayUrl(image.Url, apiClient) + '" style="background-position:center center;background-size:contain;"></div>'; html += '<div class="cardImageContainer lazy" data-src="' + image.Url + '" style="background-position:center center;background-size:contain;"></div>';
} else { } else {
html += '<a is="emby-linkbutton" target="_blank" href="' + getDisplayUrl(image.Url, apiClient) + '" class="button-link cardImageContainer lazy" data-src="' + getDisplayUrl(image.Url, apiClient) + '" style="background-position:center center;background-size:contain"></a>'; html += '<a is="emby-linkbutton" target="_blank" href="' + image.Url + '" class="button-link cardImageContainer lazy" data-src="' + image.Url + '" style="background-position:center center;background-size:contain"></a>';
} }
html += '</div>'; html += '</div>';

View file

@ -171,9 +171,8 @@ import template from './itemidentifier.template.html';
let resultHtml = lines.join('<br/>'); let resultHtml = lines.join('<br/>');
if (identifyResult.ImageUrl) { if (identifyResult.ImageUrl) {
const displayUrl = getSearchImageDisplayUrl(identifyResult.ImageUrl, identifyResult.SearchProviderName);
resultHtml = `<div style="display:flex;align-items:center;"><img src="${displayUrl}" style="max-height:240px;" /><div style="margin-left:1em;">${resultHtml}</div>`; resultHtml = `<div style="display:flex;align-items:center;"><img src="${identifyResult.ImageUrl}" style="max-height:240px;" /><div style="margin-left:1em;">${resultHtml}</div>`;
} }
page.querySelector('.selectedSearchResult').innerHTML = resultHtml; page.querySelector('.selectedSearchResult').innerHTML = resultHtml;
@ -218,9 +217,7 @@ import template from './itemidentifier.template.html';
html += '<div class="cardContent searchImage">'; html += '<div class="cardContent searchImage">';
if (result.ImageUrl) { if (result.ImageUrl) {
const displayUrl = getSearchImageDisplayUrl(result.ImageUrl, result.SearchProviderName); html += `<div class="cardImageContainer coveredImage" style="background-image:url('${result.ImageUrl}');"></div>`;
html += `<div class="cardImageContainer coveredImage" style="background-image:url('${displayUrl}');"></div>`;
} else { } else {
html += `<div class="cardImageContainer coveredImage defaultCardBackground defaultCardBackground1"><div class="cardText cardCenteredText">${result.Name}</div></div>`; html += `<div class="cardImageContainer coveredImage defaultCardBackground defaultCardBackground1"><div class="cardText cardCenteredText">${result.Name}</div></div>`;
} }
@ -258,16 +255,6 @@ import template from './itemidentifier.template.html';
return html; return html;
} }
function getSearchImageDisplayUrl(url, provider) {
const apiClient = getApiClient();
return apiClient.getUrl('Items/RemoteSearch/Image', {
imageUrl: url,
ProviderName: provider,
api_key: apiClient.accessToken()
});
}
function submitIdentficationResult(page) { function submitIdentficationResult(page) {
loading.show(); loading.show();

View file

@ -11,6 +11,7 @@
<meta name="mobile-web-app-capable" content="yes"> <meta name="mobile-web-app-capable" content="yes">
<meta name="application-name" content="Jellyfin"> <meta name="application-name" content="Jellyfin">
<meta name="robots" content="noindex, nofollow, noarchive"> <meta name="robots" content="noindex, nofollow, noarchive">
<meta name="referrer" content="no-referrer">
<meta property="og:title" content="Jellyfin"> <meta property="og:title" content="Jellyfin">
<meta property="og:site_name" content="Jellyfin"> <meta property="og:site_name" content="Jellyfin">
<meta property="og:url" content="http://jellyfin.org"> <meta property="og:url" content="http://jellyfin.org">