Localize image URLs to current instance.

This commit is contained in:
Kavin 2022-11-27 16:44:42 +00:00
parent a9b16ee727
commit f140f8fe5a
No known key found for this signature in database
GPG Key ID: 49451E4482CC5BCD
1 changed files with 16 additions and 0 deletions

View File

@ -145,6 +145,22 @@ public class StreamHandlers {
Streams streams = federatedGeoBypassResponse.getData();
// re-rewrite image URLs
streams.chapters.forEach(chapter -> chapter.image = rewriteURL(chapter.image));
streams.relatedStreams.forEach(contentItem -> {
if (contentItem instanceof StreamItem streamItem) {
streamItem.thumbnail = rewriteURL(streamItem.thumbnail);
streamItem.uploaderAvatar = rewriteURL(streamItem.uploaderAvatar);
} else if (contentItem instanceof ChannelItem channelItem) {
channelItem.thumbnail = rewriteURL(channelItem.thumbnail);
} else if (contentItem instanceof PlaylistItem playlistItem) {
playlistItem.thumbnail = rewriteURL(playlistItem.thumbnail);
}
});
streams.subtitles.forEach(subtitle -> subtitle.url = rewriteURL(subtitle.url));
streams.thumbnailUrl = rewriteURL(streams.thumbnailUrl);
streams.uploaderAvatar = rewriteURL(streams.uploaderAvatar);
String lbryId;
try {