Replaces scheme to https for all urls returned to client side.

This commit is contained in:
Victor Usoltsev 2020-10-07 21:01:17 +13:00
commit 4332e5cf51
8 changed files with 50 additions and 50 deletions

View file

@ -98,7 +98,7 @@ namespace Ombi.Core.Engine
};
newSeason.Episodes.Add(new EpisodeRequests
{
Url = e.url,
Url = e.url.ToHttpsUrl(),
Title = e.name,
AirDate = e.airstamp.HasValue() ? DateTime.Parse(e.airstamp) : DateTime.MinValue,
EpisodeNumber = e.number,
@ -111,7 +111,7 @@ namespace Ombi.Core.Engine
// We already have the season, so just add the episode
season.Episodes.Add(new EpisodeRequests
{
Url = e.url,
Url = e.url.ToHttpsUrl(),
Title = e.name,
AirDate = e.airstamp.HasValue() ? DateTime.Parse(e.airstamp) : DateTime.MinValue,
EpisodeNumber = e.number,

View file

@ -85,10 +85,10 @@ namespace Ombi.Core.Engine.V2
if (lidarrArtistTask != null)
{
var artistResult = await lidarrArtistTask;
info.Banner = artistResult.images?.FirstOrDefault(x => x.coverType.Equals("banner", StringComparison.InvariantCultureIgnoreCase))?.url.Replace("http", "https");
info.Logo = artistResult.images?.FirstOrDefault(x => x.coverType.Equals("logo", StringComparison.InvariantCultureIgnoreCase))?.url.Replace("http", "https");
info.Poster = artistResult.images?.FirstOrDefault(x => x.coverType.Equals("poster", StringComparison.InvariantCultureIgnoreCase))?.url.Replace("http", "https");
info.FanArt = artistResult.images?.FirstOrDefault(x => x.coverType.Equals("fanart", StringComparison.InvariantCultureIgnoreCase))?.url.Replace("http", "https");
info.Banner = artistResult.images?.FirstOrDefault(x => x.coverType.Equals("banner", StringComparison.InvariantCultureIgnoreCase))?.url.ToHttpsUrl();
info.Logo = artistResult.images?.FirstOrDefault(x => x.coverType.Equals("logo", StringComparison.InvariantCultureIgnoreCase))?.url.ToHttpsUrl();
info.Poster = artistResult.images?.FirstOrDefault(x => x.coverType.Equals("poster", StringComparison.InvariantCultureIgnoreCase))?.url.ToHttpsUrl();
info.FanArt = artistResult.images?.FirstOrDefault(x => x.coverType.Equals("fanart", StringComparison.InvariantCultureIgnoreCase))?.url.ToHttpsUrl();
info.Overview = artistResult.overview;
}
@ -108,11 +108,11 @@ namespace Ombi.Core.Engine.V2
{
if ((cover.thumbnails?.small ?? string.Empty).HasValue())
{
return new AlbumArt(cover.thumbnails.small);
return new AlbumArt(cover.thumbnails.small.ToHttpsUrl());
}
if ((cover.thumbnails?.large ?? string.Empty).HasValue())
{
return new AlbumArt(cover.thumbnails.large);
return new AlbumArt(cover.thumbnails.large.ToHttpsUrl());
}
}
@ -152,69 +152,69 @@ namespace Ombi.Core.Engine.V2
switch (relation.TypeId)
{
case RelationLinks.AllMusic:
links.AllMusic = relation.Url?.Resource;
links.AllMusic = relation.Url?.Resource.ToHttpsUrl();
break;
case RelationLinks.BbcMusic:
links.BbcMusic = relation.Url?.Resource;
links.BbcMusic = relation.Url?.Resource.ToHttpsUrl();
break;
case RelationLinks.Discogs:
links.Discogs = relation.Url?.Resource;
links.Discogs = relation.Url?.Resource.ToHttpsUrl();
break;
case RelationLinks.Homepage:
links.HomePage = relation.Url?.Resource;
links.HomePage = relation.Url?.Resource.ToHttpsUrl();
break;
case RelationLinks.Imdb:
links.Imdb = relation.Url?.Resource;
links.Imdb = relation.Url?.Resource.ToHttpsUrl();
break;
case RelationLinks.LastFm:
links.LastFm = relation.Url?.Resource;
links.LastFm = relation.Url?.Resource.ToHttpsUrl();
break;
case RelationLinks.MySpace:
links.MySpace = relation.Url?.Resource;
links.MySpace = relation.Url?.Resource.ToHttpsUrl();
break;
case RelationLinks.OnlineCommunity:
links.OnlineCommunity = relation.Url?.Resource;
links.OnlineCommunity = relation.Url?.Resource.ToHttpsUrl();
break;
case RelationLinks.SocialNetwork:
if ((relation.Url?.Resource ?? string.Empty).Contains("twitter", CompareOptions.IgnoreCase))
{
links.Twitter = relation.Url?.Resource;
links.Twitter = relation.Url?.Resource.ToHttpsUrl();
}
if ((relation.Url?.Resource ?? string.Empty).Contains("facebook", CompareOptions.IgnoreCase))
{
links.Facebook = relation.Url?.Resource;
links.Facebook = relation.Url?.Resource.ToHttpsUrl();
}
if ((relation.Url?.Resource ?? string.Empty).Contains("instagram", CompareOptions.IgnoreCase))
{
links.Instagram = relation.Url?.Resource;
links.Instagram = relation.Url?.Resource.ToHttpsUrl();
}
if ((relation.Url?.Resource ?? string.Empty).Contains("vk", CompareOptions.IgnoreCase))
{
links.Vk = relation.Url?.Resource;
links.Vk = relation.Url?.Resource.ToHttpsUrl();
}
break;
case RelationLinks.Streams:
if ((relation.Url?.Resource ?? string.Empty).Contains("spotify", CompareOptions.IgnoreCase))
{
links.Spotify = relation.Url?.Resource;
links.Spotify = relation.Url?.Resource.ToHttpsUrl();
}
if ((relation.Url?.Resource ?? string.Empty).Contains("deezer", CompareOptions.IgnoreCase))
{
links.Deezer = relation.Url?.Resource;
links.Deezer = relation.Url?.Resource.ToHttpsUrl();
}
break;
case RelationLinks.YouTube:
links.YouTube = relation.Url?.Resource;
links.YouTube = relation.Url?.Resource.ToHttpsUrl();
break;
case RelationLinks.Download:
if ((relation.Url?.Resource ?? string.Empty).Contains("google", CompareOptions.IgnoreCase))
{
links.Google = relation.Url?.Resource;
links.Google = relation.Url?.Resource.ToHttpsUrl();
}
if ((relation.Url?.Resource ?? string.Empty).Contains("apple", CompareOptions.IgnoreCase))
{
links.Apple = relation.Url?.Resource;
links.Apple = relation.Url?.Resource.ToHttpsUrl();
}
break;

View file

@ -1,11 +1,9 @@
using System;
using AutoMapper;
using System.Collections.Generic;
using System.Linq;
using System.Security.Principal;
using System.Threading.Tasks;
using Ombi.Core.Rule.Interfaces;
using Ombi.Store.Repository.Requests;
using Ombi.Core.Authentication;
@ -85,7 +83,7 @@ namespace Ombi.Core.Engine.V2
};
newSeason.Episodes.Add(new EpisodeRequests
{
Url = e.url,
Url = e.url.ToHttpsUrl(),
Title = e.name,
AirDate = e.airstamp,
EpisodeNumber = e.number,
@ -98,7 +96,7 @@ namespace Ombi.Core.Engine.V2
// We already have the season, so just add the episode
season.Episodes.Add(new EpisodeRequests
{
Url = e.url,
Url = e.url.ToHttpsUrl(),
Title = e.name,
AirDate = e.airstamp,
EpisodeNumber = e.number,
@ -141,7 +139,7 @@ namespace Ombi.Core.Engine.V2
if (!string.IsNullOrEmpty(item.Images?.Medium))
{
item.Images.Medium = item.Images.Medium.Replace("http:", "https:");
item.Images.Medium = item.Images.Medium.ToHttpsUrl();
}
if (item.Cast?.Any() ?? false)
@ -150,7 +148,7 @@ namespace Ombi.Core.Engine.V2
{
if (!string.IsNullOrEmpty(cast.Character?.Image?.Medium))
{
cast.Character.Image.Medium = cast.Character?.Image?.Medium.Replace("http:", "https:");
cast.Character.Image.Medium = cast.Character?.Image?.Medium.ToHttpsUrl();
}
}
}
@ -168,9 +166,9 @@ namespace Ombi.Core.Engine.V2
return model;
}
model.Trailer = result.Trailer?.AbsoluteUri ?? string.Empty;
model.Trailer = result.Trailer?.AbsoluteUri.ToHttpsUrl() ?? string.Empty;
model.Certification = result.Certification;
model.Homepage = result.Homepage?.AbsoluteUri ?? string.Empty;
model.Homepage = result.Homepage?.AbsoluteUri.ToHttpsUrl() ?? string.Empty;
}
return model;
}

View file

@ -55,7 +55,7 @@ namespace Ombi.Core.Helpers
FirstAir = dt;
// For some reason the poster path is always http
PosterPath = ShowInfo.image?.medium.Replace("http:", "https:");
PosterPath = ShowInfo.image?.medium.ToHttpsUrl();
return this;
}
@ -113,7 +113,7 @@ namespace Ombi.Core.Helpers
EpisodeNumber = ep.number,
AirDate = FormatDate(ep.airdate),
Title = ep.name,
Url = ep.url
Url = ep.url.ToHttpsUrl()
}
},
SeasonNumber = ep.season,
@ -126,7 +126,7 @@ namespace Ombi.Core.Helpers
EpisodeNumber = ep.number,
AirDate = FormatDate(ep.airdate),
Title = ep.name,
Url = ep.url
Url = ep.url.ToHttpsUrl()
});
}
}
@ -146,7 +146,7 @@ namespace Ombi.Core.Helpers
EpisodeNumber = ep.number,
AirDate = FormatDate(ep.airdate),
Title = ep.name,
Url = ep.url
Url = ep.url.ToHttpsUrl()
});
}
}
@ -170,7 +170,7 @@ namespace Ombi.Core.Helpers
EpisodeNumber = ep.number,
AirDate = FormatDate(ep.airdate),
Title = ep.name,
Url = ep.url
Url = ep.url.ToHttpsUrl()
});
}
}
@ -200,7 +200,7 @@ namespace Ombi.Core.Helpers
EpisodeNumber = ep.number,
AirDate = FormatDate(ep.airdate),
Title = ep.name,
Url = ep.url,
Url = ep.url.ToHttpsUrl()
});
}
}
@ -216,7 +216,7 @@ namespace Ombi.Core.Helpers
EpisodeNumber = ep.number,
AirDate = FormatDate(ep.airdate),
Title = ep.name,
Url = ep.url,
Url = ep.url.ToHttpsUrl()
});
seasonRequests.Add(newRequest);
}