mirror of
https://github.com/Prowlarr/Prowlarr.git
synced 2025-09-17 17:14:18 +02:00
Secret Dev Settings Page
This commit is contained in:
@@ -8,6 +8,7 @@ import IndexerIndexConnector from 'Indexer/Index/IndexerIndexConnector';
|
|||||||
import StatsConnector from 'Indexer/Stats/StatsConnector';
|
import StatsConnector from 'Indexer/Stats/StatsConnector';
|
||||||
import SearchIndexConnector from 'Search/SearchIndexConnector';
|
import SearchIndexConnector from 'Search/SearchIndexConnector';
|
||||||
import ApplicationSettingsConnector from 'Settings/Applications/ApplicationSettingsConnector';
|
import ApplicationSettingsConnector from 'Settings/Applications/ApplicationSettingsConnector';
|
||||||
|
import DevelopmentSettingsConnector from 'Settings/Development/DevelopmentSettingsConnector';
|
||||||
import GeneralSettingsConnector from 'Settings/General/GeneralSettingsConnector';
|
import GeneralSettingsConnector from 'Settings/General/GeneralSettingsConnector';
|
||||||
import NotificationSettings from 'Settings/Notifications/NotificationSettings';
|
import NotificationSettings from 'Settings/Notifications/NotificationSettings';
|
||||||
import Settings from 'Settings/Settings';
|
import Settings from 'Settings/Settings';
|
||||||
@@ -113,6 +114,11 @@ function AppRoutes(props) {
|
|||||||
component={UISettingsConnector}
|
component={UISettingsConnector}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
<Route
|
||||||
|
path="/settings/development"
|
||||||
|
component={DevelopmentSettingsConnector}
|
||||||
|
/>
|
||||||
|
|
||||||
{/*
|
{/*
|
||||||
System
|
System
|
||||||
*/}
|
*/}
|
||||||
|
143
frontend/src/Settings/Development/DevelopmentSettings.js
Normal file
143
frontend/src/Settings/Development/DevelopmentSettings.js
Normal file
@@ -0,0 +1,143 @@
|
|||||||
|
import PropTypes from 'prop-types';
|
||||||
|
import React, { Component } from 'react';
|
||||||
|
import FieldSet from 'Components/FieldSet';
|
||||||
|
import Form from 'Components/Form/Form';
|
||||||
|
import FormGroup from 'Components/Form/FormGroup';
|
||||||
|
import FormInputGroup from 'Components/Form/FormInputGroup';
|
||||||
|
import FormLabel from 'Components/Form/FormLabel';
|
||||||
|
import LoadingIndicator from 'Components/Loading/LoadingIndicator';
|
||||||
|
import PageContent from 'Components/Page/PageContent';
|
||||||
|
import PageContentBody from 'Components/Page/PageContentBody';
|
||||||
|
import { inputTypes } from 'Helpers/Props';
|
||||||
|
import SettingsToolbarConnector from 'Settings/SettingsToolbarConnector';
|
||||||
|
import translate from 'Utilities/String/translate';
|
||||||
|
|
||||||
|
const logLevelOptions = [
|
||||||
|
{ key: 'info', value: 'Info' },
|
||||||
|
{ key: 'debug', value: 'Debug' },
|
||||||
|
{ key: 'trace', value: 'Trace' }
|
||||||
|
];
|
||||||
|
|
||||||
|
class DevelopmentSettings extends Component {
|
||||||
|
|
||||||
|
//
|
||||||
|
// Render
|
||||||
|
|
||||||
|
render() {
|
||||||
|
const {
|
||||||
|
isFetching,
|
||||||
|
error,
|
||||||
|
settings,
|
||||||
|
hasSettings,
|
||||||
|
onInputChange,
|
||||||
|
onSavePress,
|
||||||
|
...otherProps
|
||||||
|
} = this.props;
|
||||||
|
|
||||||
|
return (
|
||||||
|
<PageContent title={translate('DevelopmentSettings')}>
|
||||||
|
<SettingsToolbarConnector
|
||||||
|
{...otherProps}
|
||||||
|
onSavePress={onSavePress}
|
||||||
|
/>
|
||||||
|
|
||||||
|
<PageContentBody>
|
||||||
|
{
|
||||||
|
isFetching &&
|
||||||
|
<LoadingIndicator />
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
!isFetching && error &&
|
||||||
|
<div>
|
||||||
|
{translate('UnableToLoadDevelopmentSettings')}
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
hasSettings && !isFetching && !error &&
|
||||||
|
<Form
|
||||||
|
id="developmentSettings"
|
||||||
|
{...otherProps}
|
||||||
|
>
|
||||||
|
<FieldSet legend={translate('Logging')}>
|
||||||
|
<FormGroup>
|
||||||
|
<FormLabel>{translate('SettingsLogRotate')}</FormLabel>
|
||||||
|
|
||||||
|
<FormInputGroup
|
||||||
|
type={inputTypes.NUMBER}
|
||||||
|
name="logRotate"
|
||||||
|
helpText={translate('SettingsLogRotateHelpText')}
|
||||||
|
onChange={onInputChange}
|
||||||
|
{...settings.logRotate}
|
||||||
|
/>
|
||||||
|
</FormGroup>
|
||||||
|
|
||||||
|
<FormGroup>
|
||||||
|
<FormLabel>{translate('SettingsConsoleLogLevel')}</FormLabel>
|
||||||
|
<FormInputGroup
|
||||||
|
type={inputTypes.SELECT}
|
||||||
|
name="consoleLogLevel"
|
||||||
|
values={logLevelOptions}
|
||||||
|
onChange={onInputChange}
|
||||||
|
{...settings.consoleLogLevel}
|
||||||
|
/>
|
||||||
|
</FormGroup>
|
||||||
|
|
||||||
|
<FormGroup>
|
||||||
|
<FormLabel>{translate('SettingsLogSql')}</FormLabel>
|
||||||
|
|
||||||
|
<FormInputGroup
|
||||||
|
type={inputTypes.CHECK}
|
||||||
|
name="logSql"
|
||||||
|
helpText={translate('SettingsSqlLoggingHelpText')}
|
||||||
|
onChange={onInputChange}
|
||||||
|
{...settings.logSql}
|
||||||
|
/>
|
||||||
|
</FormGroup>
|
||||||
|
|
||||||
|
<FormGroup>
|
||||||
|
<FormLabel>{translate('SettingsIndexerLogging')}</FormLabel>
|
||||||
|
|
||||||
|
<FormInputGroup
|
||||||
|
type={inputTypes.CHECK}
|
||||||
|
name="logIndexerResponse"
|
||||||
|
helpText={translate('SettingsIndexerLoggingHelpText')}
|
||||||
|
onChange={onInputChange}
|
||||||
|
{...settings.logIndexerResponse}
|
||||||
|
/>
|
||||||
|
</FormGroup>
|
||||||
|
</FieldSet>
|
||||||
|
|
||||||
|
<FieldSet legend={translate('Analytics')}>
|
||||||
|
<FormGroup>
|
||||||
|
<FormLabel>{translate('SettingsFilterSentryEvents')}</FormLabel>
|
||||||
|
|
||||||
|
<FormInputGroup
|
||||||
|
type={inputTypes.CHECK}
|
||||||
|
name="filterSentryEvents"
|
||||||
|
helpText={translate('SettingsFilterSentryEventsHelpText')}
|
||||||
|
onChange={onInputChange}
|
||||||
|
{...settings.filterSentryEvents}
|
||||||
|
/>
|
||||||
|
</FormGroup>
|
||||||
|
</FieldSet>
|
||||||
|
</Form>
|
||||||
|
}
|
||||||
|
</PageContentBody>
|
||||||
|
</PageContent>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
DevelopmentSettings.propTypes = {
|
||||||
|
isFetching: PropTypes.bool.isRequired,
|
||||||
|
error: PropTypes.object,
|
||||||
|
settings: PropTypes.object.isRequired,
|
||||||
|
hasSettings: PropTypes.bool.isRequired,
|
||||||
|
onSavePress: PropTypes.func.isRequired,
|
||||||
|
onInputChange: PropTypes.func.isRequired
|
||||||
|
};
|
||||||
|
|
||||||
|
export default DevelopmentSettings;
|
@@ -0,0 +1,77 @@
|
|||||||
|
import PropTypes from 'prop-types';
|
||||||
|
import React, { Component } from 'react';
|
||||||
|
import { connect } from 'react-redux';
|
||||||
|
import { createSelector } from 'reselect';
|
||||||
|
import { clearPendingChanges } from 'Store/Actions/baseActions';
|
||||||
|
import { fetchDevelopmentSettings, saveDevelopmentSettings, setDevelopmentSettingsValue } from 'Store/Actions/settingsActions';
|
||||||
|
import createSettingsSectionSelector from 'Store/Selectors/createSettingsSectionSelector';
|
||||||
|
import DevelopmentSettings from './DevelopmentSettings';
|
||||||
|
|
||||||
|
const SECTION = 'development';
|
||||||
|
|
||||||
|
function createMapStateToProps() {
|
||||||
|
return createSelector(
|
||||||
|
(state) => state.settings.advancedSettings,
|
||||||
|
createSettingsSectionSelector(SECTION),
|
||||||
|
(advancedSettings, sectionSettings) => {
|
||||||
|
return {
|
||||||
|
advancedSettings,
|
||||||
|
...sectionSettings
|
||||||
|
};
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
const mapDispatchToProps = {
|
||||||
|
setDevelopmentSettingsValue,
|
||||||
|
saveDevelopmentSettings,
|
||||||
|
fetchDevelopmentSettings,
|
||||||
|
clearPendingChanges
|
||||||
|
};
|
||||||
|
|
||||||
|
class DevelopmentSettingsConnector extends Component {
|
||||||
|
|
||||||
|
//
|
||||||
|
// Lifecycle
|
||||||
|
|
||||||
|
componentDidMount() {
|
||||||
|
this.props.fetchDevelopmentSettings();
|
||||||
|
}
|
||||||
|
|
||||||
|
componentWillUnmount() {
|
||||||
|
this.props.clearPendingChanges({ section: `settings.${SECTION}` });
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Listeners
|
||||||
|
|
||||||
|
onInputChange = ({ name, value }) => {
|
||||||
|
this.props.setDevelopmentSettingsValue({ name, value });
|
||||||
|
}
|
||||||
|
|
||||||
|
onSavePress = () => {
|
||||||
|
this.props.saveDevelopmentSettings();
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Render
|
||||||
|
|
||||||
|
render() {
|
||||||
|
return (
|
||||||
|
<DevelopmentSettings
|
||||||
|
onInputChange={this.onInputChange}
|
||||||
|
onSavePress={this.onSavePress}
|
||||||
|
{...this.props}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
DevelopmentSettingsConnector.propTypes = {
|
||||||
|
setDevelopmentSettingsValue: PropTypes.func.isRequired,
|
||||||
|
saveDevelopmentSettings: PropTypes.func.isRequired,
|
||||||
|
fetchDevelopmentSettings: PropTypes.func.isRequired,
|
||||||
|
clearPendingChanges: PropTypes.func.isRequired
|
||||||
|
};
|
||||||
|
|
||||||
|
export default connect(createMapStateToProps, mapDispatchToProps)(DevelopmentSettingsConnector);
|
64
frontend/src/Store/Actions/Settings/development.js
Normal file
64
frontend/src/Store/Actions/Settings/development.js
Normal file
@@ -0,0 +1,64 @@
|
|||||||
|
import { createAction } from 'redux-actions';
|
||||||
|
import createFetchHandler from 'Store/Actions/Creators/createFetchHandler';
|
||||||
|
import createSaveHandler from 'Store/Actions/Creators/createSaveHandler';
|
||||||
|
import createSetSettingValueReducer from 'Store/Actions/Creators/Reducers/createSetSettingValueReducer';
|
||||||
|
import { createThunk } from 'Store/thunks';
|
||||||
|
|
||||||
|
//
|
||||||
|
// Variables
|
||||||
|
|
||||||
|
const section = 'settings.development';
|
||||||
|
|
||||||
|
//
|
||||||
|
// Actions Types
|
||||||
|
|
||||||
|
export const FETCH_DEVELOPMENT_SETTINGS = 'settings/development/fetchDevelopmentSettings';
|
||||||
|
export const SET_DEVELOPMENT_SETTINGS_VALUE = 'settings/development/setDevelopmentSettingsValue';
|
||||||
|
export const SAVE_DEVELOPMENT_SETTINGS = 'settings/development/saveDevelopmentSettings';
|
||||||
|
|
||||||
|
//
|
||||||
|
// Action Creators
|
||||||
|
|
||||||
|
export const fetchDevelopmentSettings = createThunk(FETCH_DEVELOPMENT_SETTINGS);
|
||||||
|
export const saveDevelopmentSettings = createThunk(SAVE_DEVELOPMENT_SETTINGS);
|
||||||
|
export const setDevelopmentSettingsValue = createAction(SET_DEVELOPMENT_SETTINGS_VALUE, (payload) => {
|
||||||
|
return {
|
||||||
|
section,
|
||||||
|
...payload
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
|
//
|
||||||
|
// Details
|
||||||
|
|
||||||
|
export default {
|
||||||
|
|
||||||
|
//
|
||||||
|
// State
|
||||||
|
|
||||||
|
defaultState: {
|
||||||
|
isFetching: false,
|
||||||
|
isPopulated: false,
|
||||||
|
error: null,
|
||||||
|
pendingChanges: {},
|
||||||
|
isSaving: false,
|
||||||
|
saveError: null,
|
||||||
|
item: {}
|
||||||
|
},
|
||||||
|
|
||||||
|
//
|
||||||
|
// Action Handlers
|
||||||
|
|
||||||
|
actionHandlers: {
|
||||||
|
[FETCH_DEVELOPMENT_SETTINGS]: createFetchHandler(section, '/config/development'),
|
||||||
|
[SAVE_DEVELOPMENT_SETTINGS]: createSaveHandler(section, '/config/development')
|
||||||
|
},
|
||||||
|
|
||||||
|
//
|
||||||
|
// Reducers
|
||||||
|
|
||||||
|
reducers: {
|
||||||
|
[SET_DEVELOPMENT_SETTINGS_VALUE]: createSetSettingValueReducer(section)
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
@@ -2,6 +2,7 @@ import { createAction } from 'redux-actions';
|
|||||||
import { handleThunks } from 'Store/thunks';
|
import { handleThunks } from 'Store/thunks';
|
||||||
import createHandleActions from './Creators/createHandleActions';
|
import createHandleActions from './Creators/createHandleActions';
|
||||||
import applications from './Settings/applications';
|
import applications from './Settings/applications';
|
||||||
|
import development from './Settings/development';
|
||||||
import general from './Settings/general';
|
import general from './Settings/general';
|
||||||
import indexerCategories from './Settings/indexerCategories';
|
import indexerCategories from './Settings/indexerCategories';
|
||||||
import indexerFlags from './Settings/indexerFlags';
|
import indexerFlags from './Settings/indexerFlags';
|
||||||
@@ -15,6 +16,7 @@ export * from './Settings/indexerFlags';
|
|||||||
export * from './Settings/languages';
|
export * from './Settings/languages';
|
||||||
export * from './Settings/notifications';
|
export * from './Settings/notifications';
|
||||||
export * from './Settings/applications';
|
export * from './Settings/applications';
|
||||||
|
export * from './Settings/development';
|
||||||
export * from './Settings/ui';
|
export * from './Settings/ui';
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -34,6 +36,7 @@ export const defaultState = {
|
|||||||
languages: languages.defaultState,
|
languages: languages.defaultState,
|
||||||
notifications: notifications.defaultState,
|
notifications: notifications.defaultState,
|
||||||
applications: applications.defaultState,
|
applications: applications.defaultState,
|
||||||
|
development: development.defaultState,
|
||||||
ui: ui.defaultState
|
ui: ui.defaultState
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -61,6 +64,7 @@ export const actionHandlers = handleThunks({
|
|||||||
...languages.actionHandlers,
|
...languages.actionHandlers,
|
||||||
...notifications.actionHandlers,
|
...notifications.actionHandlers,
|
||||||
...applications.actionHandlers,
|
...applications.actionHandlers,
|
||||||
|
...development.actionHandlers,
|
||||||
...ui.actionHandlers
|
...ui.actionHandlers
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -79,6 +83,7 @@ export const reducers = createHandleActions({
|
|||||||
...languages.reducers,
|
...languages.reducers,
|
||||||
...notifications.reducers,
|
...notifications.reducers,
|
||||||
...applications.reducers,
|
...applications.reducers,
|
||||||
|
...development.reducers,
|
||||||
...ui.reducers
|
...ui.reducers
|
||||||
|
|
||||||
}, defaultState, section);
|
}, defaultState, section);
|
||||||
|
@@ -160,6 +160,13 @@ namespace NzbDrone.Core.Configuration
|
|||||||
set { SetValue("PreferIndexerFlags", value); }
|
set { SetValue("PreferIndexerFlags", value); }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public bool LogIndexerResponse
|
||||||
|
{
|
||||||
|
get { return GetValueBoolean("LogIndexerResponse", false); }
|
||||||
|
|
||||||
|
set { SetValue("LogIndexerResponse", value); }
|
||||||
|
}
|
||||||
|
|
||||||
public bool AllowHardcodedSubs
|
public bool AllowHardcodedSubs
|
||||||
{
|
{
|
||||||
get { return GetValueBoolean("AllowHardcodedSubs", false); }
|
get { return GetValueBoolean("AllowHardcodedSubs", false); }
|
||||||
|
@@ -96,6 +96,9 @@ namespace NzbDrone.Core.Configuration
|
|||||||
int BackupInterval { get; }
|
int BackupInterval { get; }
|
||||||
int BackupRetention { get; }
|
int BackupRetention { get; }
|
||||||
|
|
||||||
|
// Indexers
|
||||||
|
bool LogIndexerResponse { get; set; }
|
||||||
|
|
||||||
CertificateValidationType CertificateValidation { get; }
|
CertificateValidationType CertificateValidation { get; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -22,7 +22,8 @@ namespace NzbDrone.Core.Indexers.Cardigann
|
|||||||
|
|
||||||
public override IIndexerRequestGenerator GetRequestGenerator()
|
public override IIndexerRequestGenerator GetRequestGenerator()
|
||||||
{
|
{
|
||||||
return new CardigannRequestGenerator(_definitionService.GetDefinition(Settings.DefinitionFile),
|
return new CardigannRequestGenerator(_configService,
|
||||||
|
_definitionService.GetDefinition(Settings.DefinitionFile),
|
||||||
Settings,
|
Settings,
|
||||||
_logger)
|
_logger)
|
||||||
{
|
{
|
||||||
@@ -32,7 +33,8 @@ namespace NzbDrone.Core.Indexers.Cardigann
|
|||||||
|
|
||||||
public override IParseIndexerResponse GetParser()
|
public override IParseIndexerResponse GetParser()
|
||||||
{
|
{
|
||||||
return new CardigannParser(_definitionService.GetDefinition(Settings.DefinitionFile),
|
return new CardigannParser(_configService,
|
||||||
|
_definitionService.GetDefinition(Settings.DefinitionFile),
|
||||||
Settings,
|
Settings,
|
||||||
_logger);
|
_logger);
|
||||||
}
|
}
|
||||||
|
@@ -10,6 +10,7 @@ using Newtonsoft.Json.Linq;
|
|||||||
using NLog;
|
using NLog;
|
||||||
using NzbDrone.Common.Extensions;
|
using NzbDrone.Common.Extensions;
|
||||||
using NzbDrone.Common.Serializer;
|
using NzbDrone.Common.Serializer;
|
||||||
|
using NzbDrone.Core.Configuration;
|
||||||
using NzbDrone.Core.Parser;
|
using NzbDrone.Core.Parser;
|
||||||
|
|
||||||
namespace NzbDrone.Core.Indexers.Cardigann
|
namespace NzbDrone.Core.Indexers.Cardigann
|
||||||
@@ -20,6 +21,7 @@ namespace NzbDrone.Core.Indexers.Cardigann
|
|||||||
protected readonly CardigannSettings _settings;
|
protected readonly CardigannSettings _settings;
|
||||||
protected readonly Logger _logger;
|
protected readonly Logger _logger;
|
||||||
protected readonly Encoding _encoding;
|
protected readonly Encoding _encoding;
|
||||||
|
protected readonly IConfigService _configService;
|
||||||
|
|
||||||
protected string SiteLink { get; private set; }
|
protected string SiteLink { get; private set; }
|
||||||
|
|
||||||
@@ -46,10 +48,12 @@ namespace NzbDrone.Core.Indexers.Cardigann
|
|||||||
protected static readonly Regex _LogicFunctionRegex = new Regex(
|
protected static readonly Regex _LogicFunctionRegex = new Regex(
|
||||||
$@"\b({string.Join("|", _SupportedLogicFunctions.Select(Regex.Escape))})(?:\s+(\(?\.[^\)\s]+\)?|""[^""]+"")){{2,}}");
|
$@"\b({string.Join("|", _SupportedLogicFunctions.Select(Regex.Escape))})(?:\s+(\(?\.[^\)\s]+\)?|""[^""]+"")){{2,}}");
|
||||||
|
|
||||||
public CardigannBase(CardigannDefinition definition,
|
public CardigannBase(IConfigService configService,
|
||||||
|
CardigannDefinition definition,
|
||||||
CardigannSettings settings,
|
CardigannSettings settings,
|
||||||
Logger logger)
|
Logger logger)
|
||||||
{
|
{
|
||||||
|
_configService = configService;
|
||||||
_definition = definition;
|
_definition = definition;
|
||||||
_settings = settings;
|
_settings = settings;
|
||||||
_encoding = Encoding.GetEncoding(definition.Encoding);
|
_encoding = Encoding.GetEncoding(definition.Encoding);
|
||||||
@@ -206,6 +210,7 @@ namespace NzbDrone.Core.Indexers.Cardigann
|
|||||||
|
|
||||||
protected Dictionary<string, object> GetBaseTemplateVariables()
|
protected Dictionary<string, object> GetBaseTemplateVariables()
|
||||||
{
|
{
|
||||||
|
var indexerLogging = _configService.LogIndexerResponse;
|
||||||
var variables = new Dictionary<string, object>
|
var variables = new Dictionary<string, object>
|
||||||
{
|
{
|
||||||
[".Config.sitelink"] = SiteLink,
|
[".Config.sitelink"] = SiteLink,
|
||||||
@@ -221,7 +226,7 @@ namespace NzbDrone.Core.Indexers.Cardigann
|
|||||||
var name = ".Config." + setting.Name;
|
var name = ".Config." + setting.Name;
|
||||||
var value = _settings.ExtraFieldData.GetValueOrDefault(setting.Name, setting.Default);
|
var value = _settings.ExtraFieldData.GetValueOrDefault(setting.Name, setting.Default);
|
||||||
|
|
||||||
if (setting.Type != "password")
|
if (setting.Type != "password" && indexerLogging)
|
||||||
{
|
{
|
||||||
_logger.Trace($"{name} got value {value.ToJson()}");
|
_logger.Trace($"{name} got value {value.ToJson()}");
|
||||||
}
|
}
|
||||||
@@ -235,12 +240,19 @@ namespace NzbDrone.Core.Indexers.Cardigann
|
|||||||
variables[name] = ((bool)value) ? ".True" : ".False";
|
variables[name] = ((bool)value) ? ".True" : ".False";
|
||||||
}
|
}
|
||||||
else if (setting.Type == "select")
|
else if (setting.Type == "select")
|
||||||
|
{
|
||||||
|
if (indexerLogging)
|
||||||
{
|
{
|
||||||
_logger.Trace($"Setting options: {setting.Options.ToJson()}");
|
_logger.Trace($"Setting options: {setting.Options.ToJson()}");
|
||||||
|
}
|
||||||
|
|
||||||
var sorted = setting.Options.OrderBy(x => x.Key).ToList();
|
var sorted = setting.Options.OrderBy(x => x.Key).ToList();
|
||||||
var selected = sorted[(int)(long)value];
|
var selected = sorted[(int)(long)value];
|
||||||
|
|
||||||
|
if (indexerLogging)
|
||||||
|
{
|
||||||
_logger.Debug($"Selected option: {selected.ToJson()}");
|
_logger.Debug($"Selected option: {selected.ToJson()}");
|
||||||
|
}
|
||||||
|
|
||||||
variables[name] = selected.Key;
|
variables[name] = selected.Key;
|
||||||
}
|
}
|
||||||
@@ -253,7 +265,7 @@ namespace NzbDrone.Core.Indexers.Cardigann
|
|||||||
throw new NotSupportedException();
|
throw new NotSupportedException();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (setting.Type != "password")
|
if (setting.Type != "password" && indexerLogging)
|
||||||
{
|
{
|
||||||
_logger.Debug($"Setting {setting.Name} to {variables[name]}");
|
_logger.Debug($"Setting {setting.Name} to {variables[name]}");
|
||||||
}
|
}
|
||||||
@@ -514,7 +526,7 @@ namespace NzbDrone.Core.Indexers.Cardigann
|
|||||||
var all = variablesRegExMatches.Groups[0].Value;
|
var all = variablesRegExMatches.Groups[0].Value;
|
||||||
var variable = variablesRegExMatches.Groups[1].Value;
|
var variable = variablesRegExMatches.Groups[1].Value;
|
||||||
|
|
||||||
var value = (string)variables[variable];
|
var value = variables[variable].ToString();
|
||||||
if (modifier != null)
|
if (modifier != null)
|
||||||
{
|
{
|
||||||
value = modifier(value);
|
value = modifier(value);
|
||||||
|
@@ -7,6 +7,7 @@ using AngleSharp.Dom;
|
|||||||
using AngleSharp.Html.Parser;
|
using AngleSharp.Html.Parser;
|
||||||
using NLog;
|
using NLog;
|
||||||
using NzbDrone.Common.Extensions;
|
using NzbDrone.Common.Extensions;
|
||||||
|
using NzbDrone.Core.Configuration;
|
||||||
using NzbDrone.Core.Indexers.Exceptions;
|
using NzbDrone.Core.Indexers.Exceptions;
|
||||||
using NzbDrone.Core.Parser;
|
using NzbDrone.Core.Parser;
|
||||||
using NzbDrone.Core.Parser.Model;
|
using NzbDrone.Core.Parser.Model;
|
||||||
@@ -17,10 +18,11 @@ namespace NzbDrone.Core.Indexers.Cardigann
|
|||||||
{
|
{
|
||||||
public Action<IDictionary<string, string>, DateTime?> CookiesUpdater { get; set; }
|
public Action<IDictionary<string, string>, DateTime?> CookiesUpdater { get; set; }
|
||||||
|
|
||||||
public CardigannParser(CardigannDefinition definition,
|
public CardigannParser(IConfigService configService,
|
||||||
|
CardigannDefinition definition,
|
||||||
CardigannSettings settings,
|
CardigannSettings settings,
|
||||||
Logger logger)
|
Logger logger)
|
||||||
: base(definition, settings, logger)
|
: base(configService, definition, settings, logger)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -61,7 +63,7 @@ namespace NzbDrone.Core.Indexers.Cardigann
|
|||||||
{
|
{
|
||||||
results = ApplyFilters(results, search.Preprocessingfilters, variables);
|
results = ApplyFilters(results, search.Preprocessingfilters, variables);
|
||||||
searchResultDocument = searchResultParser.ParseDocument(results);
|
searchResultDocument = searchResultParser.ParseDocument(results);
|
||||||
_logger.Debug(string.Format("CardigannIndexer ({0}): result after preprocessingfilters: {1}", _definition.Id, results));
|
_logger.Trace(string.Format("CardigannIndexer ({0}): result after preprocessingfilters: {1}", _definition.Id, results));
|
||||||
}
|
}
|
||||||
|
|
||||||
var rowsSelector = ApplyGoTemplateText(search.Rows.Selector, variables);
|
var rowsSelector = ApplyGoTemplateText(search.Rows.Selector, variables);
|
||||||
@@ -101,6 +103,7 @@ namespace NzbDrone.Core.Indexers.Cardigann
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
var release = new CardigannReleaseInfo();
|
var release = new CardigannReleaseInfo();
|
||||||
|
var indexerLogging = _configService.LogIndexerResponse;
|
||||||
|
|
||||||
// Parse fields
|
// Parse fields
|
||||||
foreach (var field in search.Fields)
|
foreach (var field in search.Fields)
|
||||||
@@ -334,10 +337,12 @@ namespace NzbDrone.Core.Indexers.Cardigann
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
//Parser errors usually happen on every result and are costly to performance, trace only
|
if (indexerLogging)
|
||||||
|
{
|
||||||
_logger.Trace("Error while parsing field={0}, selector={1}, value={2}: {3}", field.Key, field.Value.Selector, value == null ? "<null>" : value, ex.Message);
|
_logger.Trace("Error while parsing field={0}, selector={1}, value={2}: {3}", field.Key, field.Value.Selector, value == null ? "<null>" : value, ex.Message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
var filters = search.Rows.Filters;
|
var filters = search.Rows.Filters;
|
||||||
var skipRelease = false;
|
var skipRelease = false;
|
||||||
|
@@ -8,6 +8,7 @@ using AngleSharp.Html.Parser;
|
|||||||
using Newtonsoft.Json.Linq;
|
using Newtonsoft.Json.Linq;
|
||||||
using NLog;
|
using NLog;
|
||||||
using NzbDrone.Common.Http;
|
using NzbDrone.Common.Http;
|
||||||
|
using NzbDrone.Core.Configuration;
|
||||||
using NzbDrone.Core.Indexers.Definitions.Cardigann;
|
using NzbDrone.Core.Indexers.Definitions.Cardigann;
|
||||||
using NzbDrone.Core.IndexerSearch.Definitions;
|
using NzbDrone.Core.IndexerSearch.Definitions;
|
||||||
using NzbDrone.Core.Parser;
|
using NzbDrone.Core.Parser;
|
||||||
@@ -21,10 +22,11 @@ namespace NzbDrone.Core.Indexers.Cardigann
|
|||||||
protected HttpResponse landingResult;
|
protected HttpResponse landingResult;
|
||||||
protected IHtmlDocument landingResultDocument;
|
protected IHtmlDocument landingResultDocument;
|
||||||
|
|
||||||
public CardigannRequestGenerator(CardigannDefinition definition,
|
public CardigannRequestGenerator(IConfigService configService,
|
||||||
|
CardigannDefinition definition,
|
||||||
CardigannSettings settings,
|
CardigannSettings settings,
|
||||||
Logger logger)
|
Logger logger)
|
||||||
: base(definition, settings, logger)
|
: base(configService, definition, settings, logger)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -406,8 +406,12 @@ namespace NzbDrone.Core.Indexers
|
|||||||
request.HttpRequest.RateLimit = RateLimit;
|
request.HttpRequest.RateLimit = RateLimit;
|
||||||
}
|
}
|
||||||
|
|
||||||
request.HttpRequest.AllowAutoRedirect = FollowRedirect;
|
if (_configService.LogIndexerResponse)
|
||||||
|
{
|
||||||
request.HttpRequest.LogResponseContent = true;
|
request.HttpRequest.LogResponseContent = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
request.HttpRequest.AllowAutoRedirect = FollowRedirect;
|
||||||
|
|
||||||
Cookies = GetCookies();
|
Cookies = GetCookies();
|
||||||
|
|
||||||
|
@@ -72,6 +72,7 @@
|
|||||||
"DeleteTag": "Delete Tag",
|
"DeleteTag": "Delete Tag",
|
||||||
"DeleteTagMessageText": "Are you sure you want to delete the tag '{0}'?",
|
"DeleteTagMessageText": "Are you sure you want to delete the tag '{0}'?",
|
||||||
"Details": "Details",
|
"Details": "Details",
|
||||||
|
"DevelopmentSettings": "Development Settings",
|
||||||
"Disabled": "Disabled",
|
"Disabled": "Disabled",
|
||||||
"Docker": "Docker",
|
"Docker": "Docker",
|
||||||
"Downloading": "Downloading",
|
"Downloading": "Downloading",
|
||||||
@@ -96,8 +97,6 @@
|
|||||||
"EnableSSL": "Enable SSL",
|
"EnableSSL": "Enable SSL",
|
||||||
"EnableSslHelpText": " Requires restart running as administrator to take effect",
|
"EnableSslHelpText": " Requires restart running as administrator to take effect",
|
||||||
"Error": "Error",
|
"Error": "Error",
|
||||||
"NewznabVipCheckExpiringClientMessage": "Indexer VIP benefits expiring soon: {0}",
|
|
||||||
"NewznabVipCheckExpiredClientMessage": "Indexer VIP benefits have expired: {0}",
|
|
||||||
"ErrorLoadingContents": "Error loading contents",
|
"ErrorLoadingContents": "Error loading contents",
|
||||||
"Events": "Events",
|
"Events": "Events",
|
||||||
"EventType": "Event Type",
|
"EventType": "Event Type",
|
||||||
@@ -176,6 +175,8 @@
|
|||||||
"Name": "Name",
|
"Name": "Name",
|
||||||
"NetCore": ".NET Core",
|
"NetCore": ".NET Core",
|
||||||
"New": "New",
|
"New": "New",
|
||||||
|
"NewznabVipCheckExpiredClientMessage": "Indexer VIP benefits have expired: {0}",
|
||||||
|
"NewznabVipCheckExpiringClientMessage": "Indexer VIP benefits expiring soon: {0}",
|
||||||
"NoBackupsAreAvailable": "No backups are available",
|
"NoBackupsAreAvailable": "No backups are available",
|
||||||
"NoChange": "No Change",
|
"NoChange": "No Change",
|
||||||
"NoChanges": "No Changes",
|
"NoChanges": "No Changes",
|
||||||
@@ -253,12 +254,21 @@
|
|||||||
"SendAnonymousUsageData": "Send Anonymous Usage Data",
|
"SendAnonymousUsageData": "Send Anonymous Usage Data",
|
||||||
"SetTags": "Set Tags",
|
"SetTags": "Set Tags",
|
||||||
"Settings": "Settings",
|
"Settings": "Settings",
|
||||||
|
"SettingsConsoleLogLevel": "Console Log Level",
|
||||||
"SettingsEnableColorImpairedMode": "Enable Color-Impaired Mode",
|
"SettingsEnableColorImpairedMode": "Enable Color-Impaired Mode",
|
||||||
"SettingsEnableColorImpairedModeHelpText": "Altered style to allow color-impaired users to better distinguish color coded information",
|
"SettingsEnableColorImpairedModeHelpText": "Altered style to allow color-impaired users to better distinguish color coded information",
|
||||||
|
"SettingsFilterSentryEvents": "Filter Analytics Events",
|
||||||
|
"SettingsFilterSentryEventsHelpText": "Filter known user error events from being sent as Analytics",
|
||||||
|
"SettingsIndexerLogging": "Enchanced Indexer Logging",
|
||||||
|
"SettingsIndexerLoggingHelpText": "Log additional Indexer data including response",
|
||||||
|
"SettingsLogRotate": "Log Rotation",
|
||||||
|
"SettingsLogRotateHelpText": "Max number of log files to keep saved in logs folder",
|
||||||
|
"SettingsLogSql": "Log Sql",
|
||||||
"SettingsLongDateFormat": "Long Date Format",
|
"SettingsLongDateFormat": "Long Date Format",
|
||||||
"SettingsShortDateFormat": "Short Date Format",
|
"SettingsShortDateFormat": "Short Date Format",
|
||||||
"SettingsShowRelativeDates": "Show Relative Dates",
|
"SettingsShowRelativeDates": "Show Relative Dates",
|
||||||
"SettingsShowRelativeDatesHelpText": "Show relative (Today/Yesterday/etc) or absolute dates",
|
"SettingsShowRelativeDatesHelpText": "Show relative (Today/Yesterday/etc) or absolute dates",
|
||||||
|
"SettingsSqlLoggingHelpText": "Log all SQL queries from Prowlarr",
|
||||||
"SettingsTimeFormat": "Time Format",
|
"SettingsTimeFormat": "Time Format",
|
||||||
"ShowAdvanced": "Show Advanced",
|
"ShowAdvanced": "Show Advanced",
|
||||||
"ShownClickToHide": "Shown, click to hide",
|
"ShownClickToHide": "Shown, click to hide",
|
||||||
@@ -306,6 +316,7 @@
|
|||||||
"UnableToAddANewIndexerPleaseTryAgain": "Unable to add a new indexer, please try again.",
|
"UnableToAddANewIndexerPleaseTryAgain": "Unable to add a new indexer, please try again.",
|
||||||
"UnableToAddANewNotificationPleaseTryAgain": "Unable to add a new notification, please try again.",
|
"UnableToAddANewNotificationPleaseTryAgain": "Unable to add a new notification, please try again.",
|
||||||
"UnableToLoadBackups": "Unable to load backups",
|
"UnableToLoadBackups": "Unable to load backups",
|
||||||
|
"UnableToLoadDevelopmentSettings": "Unable to load Development settings",
|
||||||
"UnableToLoadGeneralSettings": "Unable to load General settings",
|
"UnableToLoadGeneralSettings": "Unable to load General settings",
|
||||||
"UnableToLoadHistory": "Unable to load history",
|
"UnableToLoadHistory": "Unable to load history",
|
||||||
"UnableToLoadIndexers": "Unable to load Indexers",
|
"UnableToLoadIndexers": "Unable to load Indexers",
|
||||||
|
50
src/Prowlarr.Api.V1/Config/DevelopmentConfigModule.cs
Normal file
50
src/Prowlarr.Api.V1/Config/DevelopmentConfigModule.cs
Normal file
@@ -0,0 +1,50 @@
|
|||||||
|
using System.Linq;
|
||||||
|
using System.Reflection;
|
||||||
|
using NzbDrone.Core.Authentication;
|
||||||
|
using NzbDrone.Core.Configuration;
|
||||||
|
using NzbDrone.Core.Validation.Paths;
|
||||||
|
using Prowlarr.Http;
|
||||||
|
|
||||||
|
namespace Prowlarr.Api.V1.Config
|
||||||
|
{
|
||||||
|
public class DevelopmentConfigModule : ProwlarrRestModule<DevelopmentConfigResource>
|
||||||
|
{
|
||||||
|
private readonly IConfigFileProvider _configFileProvider;
|
||||||
|
private readonly IConfigService _configService;
|
||||||
|
|
||||||
|
public DevelopmentConfigModule(IConfigFileProvider configFileProvider,
|
||||||
|
IConfigService configService)
|
||||||
|
: base("/config/development")
|
||||||
|
{
|
||||||
|
_configFileProvider = configFileProvider;
|
||||||
|
_configService = configService;
|
||||||
|
|
||||||
|
GetResourceSingle = GetDevelopmentConfig;
|
||||||
|
GetResourceById = GetDevelopmentConfig;
|
||||||
|
UpdateResource = SaveDevelopmentConfig;
|
||||||
|
}
|
||||||
|
|
||||||
|
private DevelopmentConfigResource GetDevelopmentConfig()
|
||||||
|
{
|
||||||
|
var resource = DevelopmentConfigResourceMapper.ToResource(_configFileProvider, _configService);
|
||||||
|
resource.Id = 1;
|
||||||
|
|
||||||
|
return resource;
|
||||||
|
}
|
||||||
|
|
||||||
|
private DevelopmentConfigResource GetDevelopmentConfig(int id)
|
||||||
|
{
|
||||||
|
return GetDevelopmentConfig();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void SaveDevelopmentConfig(DevelopmentConfigResource resource)
|
||||||
|
{
|
||||||
|
var dictionary = resource.GetType()
|
||||||
|
.GetProperties(BindingFlags.Instance | BindingFlags.Public)
|
||||||
|
.ToDictionary(prop => prop.Name, prop => prop.GetValue(resource, null));
|
||||||
|
|
||||||
|
_configFileProvider.SaveConfigDictionary(dictionary);
|
||||||
|
_configService.SaveConfigDictionary(dictionary);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
30
src/Prowlarr.Api.V1/Config/DevelopmentConfigResource.cs
Normal file
30
src/Prowlarr.Api.V1/Config/DevelopmentConfigResource.cs
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
using NzbDrone.Core.Configuration;
|
||||||
|
using Prowlarr.Http.REST;
|
||||||
|
|
||||||
|
namespace Prowlarr.Api.V1.Config
|
||||||
|
{
|
||||||
|
public class DevelopmentConfigResource : RestResource
|
||||||
|
{
|
||||||
|
//Loggings
|
||||||
|
public string ConsoleLogLevel { get; set; }
|
||||||
|
public bool LogSql { get; set; }
|
||||||
|
public bool LogIndexerResponse { get; set; }
|
||||||
|
public int LogRotate { get; set; }
|
||||||
|
public bool FilterSentryEvents { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class DevelopmentConfigResourceMapper
|
||||||
|
{
|
||||||
|
public static DevelopmentConfigResource ToResource(this IConfigFileProvider model, IConfigService configService)
|
||||||
|
{
|
||||||
|
return new DevelopmentConfigResource
|
||||||
|
{
|
||||||
|
ConsoleLogLevel = model.ConsoleLogLevel,
|
||||||
|
LogSql = model.LogSql,
|
||||||
|
LogIndexerResponse = configService.LogIndexerResponse,
|
||||||
|
LogRotate = model.LogRotate,
|
||||||
|
FilterSentryEvents = model.FilterSentryEvents
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@@ -81,7 +81,7 @@ namespace Prowlarr.Api.V1.Config
|
|||||||
|
|
||||||
private HostConfigResource GetHostConfig()
|
private HostConfigResource GetHostConfig()
|
||||||
{
|
{
|
||||||
var resource = _configFileProvider.ToResource(_configService);
|
var resource = HostConfigResourceMapper.ToResource(_configFileProvider, _configService);
|
||||||
resource.Id = 1;
|
resource.Id = 1;
|
||||||
|
|
||||||
var user = _userService.FindUser();
|
var user = _userService.FindUser();
|
||||||
|
Reference in New Issue
Block a user