mirror of
https://github.com/Prowlarr/Prowlarr.git
synced 2025-09-17 17:14:18 +02:00
Misc Fixes
This commit is contained in:
@@ -56,8 +56,8 @@
|
||||
margin-top: 0;
|
||||
}
|
||||
|
||||
.externalLinks {
|
||||
margin: 0 2px;
|
||||
width: 22px;
|
||||
text-align: center;
|
||||
.externalLink {
|
||||
composes: link from '~Components/Link/Link.css';
|
||||
|
||||
color: $textColor;
|
||||
}
|
@@ -14,9 +14,9 @@ import translate from 'Utilities/String/translate';
|
||||
import CapabilitiesLabel from './CapabilitiesLabel';
|
||||
import IndexerStatusCell from './IndexerStatusCell';
|
||||
import ProtocolLabel from './ProtocolLabel';
|
||||
import styles from './MovieIndexRow.css';
|
||||
import styles from './IndexerIndexRow.css';
|
||||
|
||||
class MovieIndexRow extends Component {
|
||||
class IndexerIndexRow extends Component {
|
||||
|
||||
//
|
||||
// Lifecycle
|
||||
@@ -61,6 +61,7 @@ class MovieIndexRow extends Component {
|
||||
const {
|
||||
id,
|
||||
name,
|
||||
baseUrl,
|
||||
enable,
|
||||
tags,
|
||||
protocol,
|
||||
@@ -213,8 +214,10 @@ class MovieIndexRow extends Component {
|
||||
className={styles[column.name]}
|
||||
>
|
||||
<IconButton
|
||||
className={styles.externalLink}
|
||||
name={icons.EXTERNAL_LINK}
|
||||
title={'Website'}
|
||||
to={baseUrl}
|
||||
/>
|
||||
|
||||
<IconButton
|
||||
@@ -247,8 +250,9 @@ class MovieIndexRow extends Component {
|
||||
}
|
||||
}
|
||||
|
||||
MovieIndexRow.propTypes = {
|
||||
IndexerIndexRow.propTypes = {
|
||||
id: PropTypes.number.isRequired,
|
||||
baseUrl: PropTypes.string.isRequired,
|
||||
protocol: PropTypes.string.isRequired,
|
||||
privacy: PropTypes.string.isRequired,
|
||||
priority: PropTypes.number.isRequired,
|
||||
@@ -267,8 +271,8 @@ MovieIndexRow.propTypes = {
|
||||
timeFormat: PropTypes.string.isRequired
|
||||
};
|
||||
|
||||
MovieIndexRow.defaultProps = {
|
||||
IndexerIndexRow.defaultProps = {
|
||||
tags: []
|
||||
};
|
||||
|
||||
export default MovieIndexRow;
|
||||
export default IndexerIndexRow;
|
@@ -5,8 +5,8 @@ import VirtualTableRow from 'Components/Table/VirtualTableRow';
|
||||
import { sortDirections } from 'Helpers/Props';
|
||||
import MovieIndexItemConnector from 'Indexer/Index/MovieIndexItemConnector';
|
||||
import getIndexOfFirstCharacter from 'Utilities/Array/getIndexOfFirstCharacter';
|
||||
import IndexerIndexRow from './IndexerIndexRow';
|
||||
import MovieIndexHeaderConnector from './MovieIndexHeaderConnector';
|
||||
import MovieIndexRow from './MovieIndexRow';
|
||||
import styles from './MovieIndexTable.css';
|
||||
|
||||
class MovieIndexTable extends Component {
|
||||
@@ -62,7 +62,7 @@ class MovieIndexTable extends Component {
|
||||
>
|
||||
<MovieIndexItemConnector
|
||||
key={movie.id}
|
||||
component={MovieIndexRow}
|
||||
component={IndexerIndexRow}
|
||||
columns={columns}
|
||||
indexerId={movie.id}
|
||||
isSelected={selectedState[movie.id]}
|
||||
|
@@ -58,6 +58,12 @@
|
||||
margin-top: 0;
|
||||
}
|
||||
|
||||
.downloadLink {
|
||||
composes: link from '~Components/Link/Link.css';
|
||||
|
||||
color: $textColor;
|
||||
}
|
||||
|
||||
.externalLinks {
|
||||
margin: 0 2px;
|
||||
width: 22px;
|
||||
|
@@ -215,6 +215,7 @@ class SearchIndexRow extends Component {
|
||||
className={styles[column.name]}
|
||||
>
|
||||
<IconButton
|
||||
className={styles.downloadLink}
|
||||
name={icons.DOWNLOAD}
|
||||
title={'Grab'}
|
||||
to={downloadUrl}
|
||||
|
@@ -81,7 +81,7 @@ export const defaultState = {
|
||||
filters: []
|
||||
},
|
||||
{
|
||||
key: 'grabbed',
|
||||
key: 'releaseGrabbed',
|
||||
label: translate('Grabbed'),
|
||||
filters: [
|
||||
{
|
||||
@@ -92,56 +92,12 @@ export const defaultState = {
|
||||
]
|
||||
},
|
||||
{
|
||||
key: 'imported',
|
||||
label: translate('Imported'),
|
||||
key: 'indexerQuery',
|
||||
label: translate('IndexerQuery'),
|
||||
filters: [
|
||||
{
|
||||
key: 'eventType',
|
||||
value: '3',
|
||||
type: filterTypes.EQUAL
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
key: 'failed',
|
||||
label: translate('Failed'),
|
||||
filters: [
|
||||
{
|
||||
key: 'eventType',
|
||||
value: '4',
|
||||
type: filterTypes.EQUAL
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
key: 'deleted',
|
||||
label: translate('Deleted'),
|
||||
filters: [
|
||||
{
|
||||
key: 'eventType',
|
||||
value: '6',
|
||||
type: filterTypes.EQUAL
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
key: 'renamed',
|
||||
label: translate('Renamed'),
|
||||
filters: [
|
||||
{
|
||||
key: 'eventType',
|
||||
value: '8',
|
||||
type: filterTypes.EQUAL
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
key: 'ignored',
|
||||
label: translate('Ignored'),
|
||||
filters: [
|
||||
{
|
||||
key: 'eventType',
|
||||
value: '9',
|
||||
value: '2',
|
||||
type: filterTypes.EQUAL
|
||||
}
|
||||
]
|
||||
|
@@ -40,6 +40,7 @@ namespace NzbDrone.Core.Datastore
|
||||
|
||||
Mapper.Entity<IndexerDefinition>("Indexers").RegisterModel()
|
||||
.Ignore(x => x.ImplementationName)
|
||||
.Ignore(i => i.BaseUrl)
|
||||
.Ignore(i => i.Protocol)
|
||||
.Ignore(i => i.Privacy)
|
||||
.Ignore(i => i.SupportsRss)
|
||||
|
@@ -15,7 +15,7 @@ namespace NzbDrone.Core.Indexers.Cardigann
|
||||
private readonly IIndexerDefinitionUpdateService _definitionService;
|
||||
|
||||
public override string Name => "Cardigann";
|
||||
public override string BaseUrl => throw new System.NotImplementedException();
|
||||
public override string BaseUrl => "";
|
||||
|
||||
public override DownloadProtocol Protocol => DownloadProtocol.Torrent;
|
||||
public override IndexerPrivacy Privacy => IndexerPrivacy.Private;
|
||||
@@ -76,6 +76,24 @@ namespace NzbDrone.Core.Indexers.Cardigann
|
||||
};
|
||||
}
|
||||
|
||||
protected override bool CheckIfLoginNeeded(HttpResponse httpResponse)
|
||||
{
|
||||
var generator = (CardigannRequestGenerator)GetRequestGenerator();
|
||||
|
||||
SetCookieFunctions(generator);
|
||||
|
||||
return generator.CheckIfLoginIsNeeded(httpResponse);
|
||||
}
|
||||
|
||||
protected override void DoLogin()
|
||||
{
|
||||
var generator = (CardigannRequestGenerator)GetRequestGenerator();
|
||||
|
||||
SetCookieFunctions(generator);
|
||||
|
||||
generator.DoLogin();
|
||||
}
|
||||
|
||||
protected override void Test(List<ValidationFailure> failures)
|
||||
{
|
||||
base.Test(failures);
|
||||
|
@@ -155,15 +155,10 @@ namespace NzbDrone.Core.Indexers.Cardigann
|
||||
return variables;
|
||||
}
|
||||
|
||||
private void Authenticate()
|
||||
public void DoLogin()
|
||||
{
|
||||
var login = _definition.Login;
|
||||
|
||||
if (login == null || TestLogin())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (login.Method == "post")
|
||||
{
|
||||
var pairs = new Dictionary<string, string>();
|
||||
@@ -725,7 +720,7 @@ namespace NzbDrone.Core.Indexers.Cardigann
|
||||
|
||||
protected string GetRedirectDomainHint(HttpResponse result) => GetRedirectDomainHint(result.Request.Url.ToString(), result.Headers.GetSingleValue("Location"));
|
||||
|
||||
protected bool CheckIfLoginIsNeeded(HttpResponse response, IHtmlDocument document)
|
||||
public bool CheckIfLoginIsNeeded(HttpResponse response)
|
||||
{
|
||||
if (response.HasHttpRedirect)
|
||||
{
|
||||
@@ -745,6 +740,9 @@ namespace NzbDrone.Core.Indexers.Cardigann
|
||||
return false;
|
||||
}
|
||||
|
||||
var parser = new HtmlParser();
|
||||
var document = parser.ParseDocument(response.Content);
|
||||
|
||||
if (_definition.Login.Test.Selector != null)
|
||||
{
|
||||
var selection = document.QuerySelectorAll(_definition.Login.Test.Selector);
|
||||
@@ -759,13 +757,6 @@ namespace NzbDrone.Core.Indexers.Cardigann
|
||||
|
||||
private IEnumerable<IndexerRequest> GetRequest(Dictionary<string, object> variables)
|
||||
{
|
||||
Cookies = GetCookies();
|
||||
|
||||
if (Cookies == null || !Cookies.Any())
|
||||
{
|
||||
Authenticate();
|
||||
}
|
||||
|
||||
var search = _definition.Search;
|
||||
|
||||
var mappedCategories = MapTorznabCapsToTrackers((int[])variables[".Query.Categories"]);
|
||||
@@ -890,14 +881,6 @@ namespace NzbDrone.Core.Indexers.Cardigann
|
||||
}
|
||||
}
|
||||
|
||||
if (Cookies != null)
|
||||
{
|
||||
foreach (var cookie in Cookies)
|
||||
{
|
||||
request.HttpRequest.Cookies.Add(cookie.Key, cookie.Value);
|
||||
}
|
||||
}
|
||||
|
||||
request.HttpRequest.Method = method;
|
||||
|
||||
yield return request;
|
||||
|
@@ -72,8 +72,6 @@ namespace NzbDrone.Core.Indexers.Gazelle
|
||||
|
||||
cookies = response.GetCookies();
|
||||
|
||||
Cookies = cookies;
|
||||
|
||||
UpdateCookies(cookies, DateTime.Now + TimeSpan.FromDays(30));
|
||||
|
||||
_logger.Debug("Gazelle authentication succeeded.");
|
||||
|
@@ -65,7 +65,6 @@ namespace NzbDrone.Core.Indexers.Definitions
|
||||
var response = _httpClient.Execute(authLoginRequest);
|
||||
|
||||
cookies = response.GetCookies();
|
||||
Cookies = cookies;
|
||||
UpdateCookies(cookies, DateTime.Now + TimeSpan.FromDays(30));
|
||||
|
||||
_logger.Debug("HDTorrents authentication succeeded.");
|
||||
|
@@ -304,6 +304,7 @@ namespace NzbDrone.Core.Indexers.Definitions
|
||||
Title = title,
|
||||
Guid = details.AbsoluteUri,
|
||||
DownloadUrl = link.AbsoluteUri,
|
||||
InfoUrl = details.AbsoluteUri,
|
||||
PublishDate = publishDate,
|
||||
Category = cat,
|
||||
Size = size,
|
||||
|
@@ -16,7 +16,7 @@ namespace NzbDrone.Core.Indexers.Newznab
|
||||
private readonly INewznabCapabilitiesProvider _capabilitiesProvider;
|
||||
|
||||
public override string Name => "Newznab";
|
||||
public override string BaseUrl => Settings.BaseUrl;
|
||||
public override string BaseUrl => GetBaseUrlFromSettings();
|
||||
public override bool FollowRedirect => true;
|
||||
|
||||
public override DownloadProtocol Protocol => DownloadProtocol.Usenet;
|
||||
@@ -40,6 +40,18 @@ namespace NzbDrone.Core.Indexers.Newznab
|
||||
return new NewznabRssParser(Settings);
|
||||
}
|
||||
|
||||
public string GetBaseUrlFromSettings()
|
||||
{
|
||||
var baseUrl = "";
|
||||
|
||||
if (Definition == null || Settings == null || Settings.Categories == null)
|
||||
{
|
||||
return baseUrl;
|
||||
}
|
||||
|
||||
return Settings.BaseUrl;
|
||||
}
|
||||
|
||||
public IndexerCapabilities GetCapabilitiesFromSettings()
|
||||
{
|
||||
var caps = new IndexerCapabilities();
|
||||
|
@@ -242,6 +242,7 @@ namespace NzbDrone.Core.Indexers.Definitions
|
||||
Title = title,
|
||||
Guid = details.AbsoluteUri,
|
||||
DownloadUrl = link.AbsoluteUri,
|
||||
InfoUrl = details.AbsoluteUri,
|
||||
PublishDate = publishDate,
|
||||
Category = _categories.MapTrackerCatToNewznab(row.c.ToString()),
|
||||
Size = (long)row.size,
|
||||
|
@@ -66,7 +66,6 @@ namespace NzbDrone.Core.Indexers.Definitions
|
||||
var response = _httpClient.Execute(authLoginRequest);
|
||||
|
||||
cookies = response.GetCookies();
|
||||
Cookies = cookies;
|
||||
UpdateCookies(cookies, DateTime.Now + TimeSpan.FromDays(30));
|
||||
|
||||
_logger.Debug("TorrentLeech authentication succeeded.");
|
||||
|
@@ -17,7 +17,7 @@ namespace NzbDrone.Core.Indexers.Torznab
|
||||
private readonly INewznabCapabilitiesProvider _capabilitiesProvider;
|
||||
|
||||
public override string Name => "Torznab";
|
||||
public override string BaseUrl => Settings.BaseUrl;
|
||||
public override string BaseUrl => "";
|
||||
|
||||
public override DownloadProtocol Protocol => DownloadProtocol.Torrent;
|
||||
public override IndexerPrivacy Privacy => IndexerPrivacy.Private;
|
||||
|
@@ -136,7 +136,7 @@ namespace NzbDrone.Core.Indexers
|
||||
|
||||
generator.CookiesUpdater = (cookies, expiration) =>
|
||||
{
|
||||
_indexerStatusService.UpdateCookies(Definition.Id, cookies, expiration);
|
||||
UpdateCookies(cookies, expiration);
|
||||
};
|
||||
|
||||
return generator;
|
||||
@@ -156,6 +156,7 @@ namespace NzbDrone.Core.Indexers
|
||||
|
||||
protected void UpdateCookies(IDictionary<string, string> cookies, DateTime? expiration)
|
||||
{
|
||||
Cookies = cookies;
|
||||
_indexerStatusService.UpdateCookies(Definition.Id, cookies, expiration);
|
||||
}
|
||||
|
||||
@@ -434,6 +435,8 @@ namespace NzbDrone.Core.Indexers
|
||||
response = _httpClient.Execute(request.HttpRequest);
|
||||
}
|
||||
|
||||
UpdateCookies(Cookies, DateTime.Now + TimeSpan.FromDays(30));
|
||||
|
||||
return new IndexerResponse(request, response, stopWatch.ElapsedMilliseconds);
|
||||
}
|
||||
|
||||
|
@@ -10,6 +10,7 @@ namespace NzbDrone.Core.Indexers
|
||||
bool SupportsSearch { get; }
|
||||
IndexerCapabilities Capabilities { get; }
|
||||
|
||||
string BaseUrl { get; }
|
||||
DownloadProtocol Protocol { get; }
|
||||
IndexerPrivacy Privacy { get; }
|
||||
|
||||
|
@@ -7,6 +7,7 @@ namespace NzbDrone.Core.Indexers
|
||||
{
|
||||
public class IndexerDefinition : ProviderDefinition
|
||||
{
|
||||
public string BaseUrl { get; set; }
|
||||
public DownloadProtocol Protocol { get; set; }
|
||||
public IndexerPrivacy Privacy { get; set; }
|
||||
public bool SupportsRss { get; set; }
|
||||
|
@@ -52,6 +52,7 @@ namespace NzbDrone.Core.Indexers
|
||||
var settings = (CardigannSettings)definition.Settings;
|
||||
var defFile = _definitionService.GetDefinition(settings.DefinitionFile);
|
||||
definition.ExtraFields = defFile.Settings;
|
||||
definition.BaseUrl = defFile.Links.First();
|
||||
definition.Privacy = defFile.Type == "private" ? IndexerPrivacy.Private : IndexerPrivacy.Public;
|
||||
definition.Capabilities = new IndexerCapabilities();
|
||||
definition.Capabilities.ParseCardigannSearchModes(defFile.Caps.Modes);
|
||||
@@ -71,6 +72,7 @@ namespace NzbDrone.Core.Indexers
|
||||
var settings = (CardigannSettings)definition.Settings;
|
||||
var defFile = _definitionService.GetDefinition(settings.DefinitionFile);
|
||||
definition.ExtraFields = defFile.Settings;
|
||||
definition.BaseUrl = defFile.Links.First();
|
||||
definition.Privacy = defFile.Type == "private" ? IndexerPrivacy.Private : IndexerPrivacy.Public;
|
||||
definition.Capabilities = new IndexerCapabilities();
|
||||
definition.Capabilities.ParseCardigannSearchModes(defFile.Caps.Modes);
|
||||
@@ -158,6 +160,7 @@ namespace NzbDrone.Core.Indexers
|
||||
//We want to use the definition Caps and Privacy for Cardigann instead of the provider.
|
||||
if (definition.Implementation != typeof(Cardigann.Cardigann).Name)
|
||||
{
|
||||
definition.BaseUrl = provider.BaseUrl;
|
||||
definition.Privacy = provider.Privacy;
|
||||
definition.Capabilities = provider.Capabilities;
|
||||
}
|
||||
|
@@ -10,6 +10,7 @@ namespace Prowlarr.Api.V1.Indexers
|
||||
{
|
||||
public class IndexerResource : ProviderResource
|
||||
{
|
||||
public string BaseUrl { get; set; }
|
||||
public bool Enable { get; set; }
|
||||
public bool SupportsRss { get; set; }
|
||||
public bool SupportsSearch { get; set; }
|
||||
@@ -49,6 +50,7 @@ namespace Prowlarr.Api.V1.Indexers
|
||||
}
|
||||
}
|
||||
|
||||
resource.BaseUrl = definition.BaseUrl;
|
||||
resource.Enable = definition.Enable;
|
||||
resource.SupportsRss = definition.SupportsRss;
|
||||
resource.SupportsSearch = definition.SupportsSearch;
|
||||
@@ -85,6 +87,7 @@ namespace Prowlarr.Api.V1.Indexers
|
||||
}
|
||||
|
||||
definition.Enable = resource.Enable;
|
||||
definition.BaseUrl = resource.BaseUrl;
|
||||
definition.Priority = resource.Priority;
|
||||
definition.Privacy = resource.Privacy;
|
||||
definition.Added = resource.Added;
|
||||
|
Reference in New Issue
Block a user