mirror of https://github.com/Jackett/Jackett
Introduce LegacySiteLinks to automatically update to new SiteLinks
This commit is contained in:
parent
00027a41c1
commit
141f3e57e5
|
@ -24,6 +24,7 @@ namespace Jackett.Indexers
|
|||
}
|
||||
|
||||
public string SiteLink { get; protected set; }
|
||||
public string[] LegacySiteLinks { get; protected set; }
|
||||
public string DefaultSiteLink { get; protected set; }
|
||||
public string[] AlternativeSiteLinks { get; protected set; } = new string[] { };
|
||||
public string DisplayDescription { get; protected set; }
|
||||
|
@ -134,9 +135,17 @@ namespace Jackett.Indexers
|
|||
{
|
||||
configData.SiteLink.Value = DefaultSiteLink;
|
||||
}
|
||||
|
||||
if (!configData.SiteLink.Value.EndsWith("/", StringComparison.Ordinal))
|
||||
configData.SiteLink.Value += "/";
|
||||
|
||||
// reset site link to default if it's a legacy (defunc link)
|
||||
if (LegacySiteLinks != null && LegacySiteLinks.Contains(configData.SiteLink.Value))
|
||||
{
|
||||
logger.Debug(string.Format("changing legacy site link from {0} to {1}", configData.SiteLink.Value, DefaultSiteLink));
|
||||
configData.SiteLink.Value = DefaultSiteLink;
|
||||
}
|
||||
|
||||
// check whether the site link is well-formatted
|
||||
var siteUri = new Uri(configData.SiteLink.Value);
|
||||
SiteLink = configData.SiteLink.Value;
|
||||
|
|
|
@ -78,6 +78,8 @@ namespace Jackett.Indexers
|
|||
if (Definition.Links.Count > 1)
|
||||
AlternativeSiteLinks = Definition.Links.ToArray();
|
||||
DefaultSiteLink = Definition.Links[0];
|
||||
if (Definition.Legacylinks != null)
|
||||
LegacySiteLinks = Definition.Legacylinks.ToArray();
|
||||
Encoding = Encoding.GetEncoding(Definition.Encoding);
|
||||
if (!DefaultSiteLink.EndsWith("/"))
|
||||
DefaultSiteLink += "/";
|
||||
|
|
|
@ -67,6 +67,7 @@ namespace Jackett.Models
|
|||
public string Language { get; set; }
|
||||
public string Encoding { get; set; }
|
||||
public List<string> Links { get; set; }
|
||||
public List<string> Legacylinks { get; set; }
|
||||
public List<string> Certificates { get; set; }
|
||||
public capabilitiesBlock Caps { get; set; }
|
||||
public loginBlock Login { get; set; }
|
||||
|
|
Loading…
Reference in New Issue