mirror of
https://github.com/Jackett/Jackett.git
synced 2025-09-30 23:47:17 +02:00
Cardigann: add support for settings type checkbox
This commit is contained in:
@@ -214,7 +214,21 @@ namespace Jackett.Indexers
|
||||
configData = new ConfigurationData();
|
||||
foreach (var Setting in Definition.Settings)
|
||||
{
|
||||
configData.AddDynamic(Setting.Name, new StringItem { Name = Setting.Label });
|
||||
Item item;
|
||||
if (Setting.Type != null && Setting.Type == "checkbox")
|
||||
{
|
||||
item = new BoolItem() { Value = false };
|
||||
}
|
||||
else if(Setting.Type != null && Setting.Type == "password")
|
||||
{
|
||||
item = new StringItem();
|
||||
}
|
||||
else
|
||||
{
|
||||
item = new StringItem();
|
||||
}
|
||||
item.Name = Setting.Label;
|
||||
configData.AddDynamic(Setting.Name, item);
|
||||
}
|
||||
|
||||
foreach (var Category in Definition.Caps.Categories)
|
||||
@@ -236,7 +250,17 @@ namespace Jackett.Indexers
|
||||
|
||||
foreach (settingsField Setting in Definition.Settings)
|
||||
{
|
||||
variables[".Config."+Setting.Name] = ((StringItem)configData.GetDynamic(Setting.Name)).Value;
|
||||
string value;
|
||||
var item = configData.GetDynamic(Setting.Name);
|
||||
if (item.GetType() == typeof(BoolItem))
|
||||
{
|
||||
value = (((BoolItem)item).Value == true ? "true" : "");
|
||||
}
|
||||
else
|
||||
{
|
||||
value = ((StringItem)item).Value;
|
||||
}
|
||||
variables[".Config."+Setting.Name] = value;
|
||||
}
|
||||
return variables;
|
||||
}
|
||||
@@ -887,7 +911,7 @@ namespace Jackett.Indexers
|
||||
{
|
||||
if (Selector.Text != null)
|
||||
{
|
||||
return applyFilters(Selector.Text, Selector.Filters, variables);
|
||||
return applyFilters(applyGoTemplateText(Selector.Text, variables), Selector.Filters, variables);
|
||||
}
|
||||
|
||||
IElement selection = Dom;
|
||||
@@ -1100,6 +1124,12 @@ namespace Jackett.Indexers
|
||||
switch (FieldName)
|
||||
{
|
||||
case "download":
|
||||
if (string.IsNullOrEmpty(value))
|
||||
{
|
||||
value = null;
|
||||
release.Link = null;
|
||||
break;
|
||||
}
|
||||
if (value.StartsWith("magnet:"))
|
||||
{
|
||||
release.MagnetUri = new Uri(value);
|
||||
|
Reference in New Issue
Block a user