Private GIT
Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
J
Jackett
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
vlbox
Jackett
Commits
f26f2d6f
Commit
f26f2d6f
authored
9 years ago
by
flightlevel
Browse files
Options
Downloads
Plain Diff
Merge pull request #249 from flightlevel/tehconnection
TehConnection: Attempt to fix cookie expiration
parents
c896ed82
6ccbfd64
Branches
Branches containing commit
Tags
v0.7.181
Tags containing commit
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/Jackett/Indexers/TehConnection.cs
+32
-12
32 additions, 12 deletions
src/Jackett/Indexers/TehConnection.cs
src/Jackett/Models/IndexerConfig/ConfigurationDataBasicLoginWithFilter.cs
+2
-0
2 additions, 0 deletions
...ls/IndexerConfig/ConfigurationDataBasicLoginWithFilter.cs
with
34 additions
and
12 deletions
src/Jackett/Indexers/TehConnection.cs
+
32
−
12
View file @
f26f2d6f
using
CsQuery
;
using
CsQuery
;
using
Jackett.Indexers
;
using
Jackett.Models
;
using
Jackett.Models
;
using
Jackett.Services
;
using
Jackett.Services
;
using
Jackett.Utils
;
using
Jackett.Utils
;
...
@@ -41,20 +40,28 @@ namespace Jackett.Indexers
...
@@ -41,20 +40,28 @@ namespace Jackett.Indexers
Separate options with a space if using more than one option.<br>Filter options available:
Separate options with a space if using more than one option.<br>Filter options available:
<br><code>QualityEncodeOnly</code><br><code>FreeLeechOnly</code>"
))
<br><code>QualityEncodeOnly</code><br><code>FreeLeechOnly</code>"
))
{
{
AddCategoryMapping
(
7
,
TorznabCatType
.
Movies
);
AddCategoryMapping
(
1
,
TorznabCatType
.
Movies
);
AddCategoryMapping
(
7
,
TorznabCatType
.
MoviesForeign
);
AddCategoryMapping
(
1
,
TorznabCatType
.
MoviesForeign
);
AddCategoryMapping
(
7
,
TorznabCatType
.
MoviesOther
);
AddCategoryMapping
(
1
,
TorznabCatType
.
MoviesOther
);
AddCategoryMapping
(
7
,
TorznabCatType
.
MoviesSD
);
AddCategoryMapping
(
1
,
TorznabCatType
.
MoviesSD
);
AddCategoryMapping
(
7
,
TorznabCatType
.
MoviesHD
);
AddCategoryMapping
(
1
,
TorznabCatType
.
MoviesHD
);
AddCategoryMapping
(
7
,
TorznabCatType
.
Movies3D
);
AddCategoryMapping
(
1
,
TorznabCatType
.
Movies3D
);
AddCategoryMapping
(
7
,
TorznabCatType
.
MoviesBluRay
);
AddCategoryMapping
(
1
,
TorznabCatType
.
MoviesBluRay
);
AddCategoryMapping
(
7
,
TorznabCatType
.
MoviesDVD
);
AddCategoryMapping
(
1
,
TorznabCatType
.
MoviesDVD
);
AddCategoryMapping
(
7
,
TorznabCatType
.
MoviesWEBDL
);
AddCategoryMapping
(
1
,
TorznabCatType
.
MoviesWEBDL
);
}
}
public
async
Task
<
IndexerConfigurationStatus
>
ApplyConfiguration
(
JToken
configJson
)
public
async
Task
<
IndexerConfigurationStatus
>
ApplyConfiguration
(
JToken
configJson
)
{
{
configData
.
LoadValuesFromJson
(
configJson
);
configData
.
LoadValuesFromJson
(
configJson
);
await
DoLogin
();
return
IndexerConfigurationStatus
.
RequiresTesting
;
}
private
async
Task
DoLogin
()
{
var
pairs
=
new
Dictionary
<
string
,
string
>
{
var
pairs
=
new
Dictionary
<
string
,
string
>
{
{
"username"
,
configData
.
Username
.
Value
},
{
"username"
,
configData
.
Username
.
Value
},
{
"password"
,
configData
.
Password
.
Value
},
{
"password"
,
configData
.
Password
.
Value
},
...
@@ -70,11 +77,24 @@ namespace Jackett.Indexers
...
@@ -70,11 +77,24 @@ namespace Jackett.Indexers
string
errorMessage
=
"Unable to login to TehConnection"
;
string
errorMessage
=
"Unable to login to TehConnection"
;
throw
new
ExceptionWithConfigData
(
errorMessage
,
configData
);
throw
new
ExceptionWithConfigData
(
errorMessage
,
configData
);
});
});
return
IndexerConfigurationStatus
.
RequiresTesting
;
}
}
public
async
Task
<
IEnumerable
<
ReleaseInfo
>>
PerformQuery
(
TorznabQuery
query
)
public
async
Task
<
IEnumerable
<
ReleaseInfo
>>
PerformQuery
(
TorznabQuery
query
)
{
{
var
loggedInCheck
=
await
RequestStringWithCookies
(
SearchUrl
);
if
(!
loggedInCheck
.
Content
.
Contains
(
"/logout.php"
))
{
//Cookie appears to expire after a period of time or logging in to the site via browser
DateTime
lastLoggedInCheck
;
DateTime
.
TryParse
(
configData
.
LastLoggedInCheck
.
Value
,
out
lastLoggedInCheck
);
if
(
lastLoggedInCheck
<
DateTime
.
Now
.
AddMinutes
(-
15
))
{
await
DoLogin
();
configData
.
LastLoggedInCheck
.
Value
=
DateTime
.
Now
.
ToString
(
"o"
);
SaveConfig
();
}
}
var
releases
=
new
List
<
ReleaseInfo
>();
var
releases
=
new
List
<
ReleaseInfo
>();
bool
configFreeLeechOnly
=
configData
.
FilterString
.
Value
.
ToLowerInvariant
().
Contains
(
"freeleechonly"
);
bool
configFreeLeechOnly
=
configData
.
FilterString
.
Value
.
ToLowerInvariant
().
Contains
(
"freeleechonly"
);
bool
configQualityEncodeOnly
=
configData
.
FilterString
.
Value
.
ToLowerInvariant
().
Contains
(
"qualityencodeonly"
);
bool
configQualityEncodeOnly
=
configData
.
FilterString
.
Value
.
ToLowerInvariant
().
Contains
(
"qualityencodeonly"
);
...
...
This diff is collapsed.
Click to expand it.
src/Jackett/Models/IndexerConfig/ConfigurationDataBasicLoginWithFilter.cs
+
2
−
0
View file @
f26f2d6f
...
@@ -11,6 +11,7 @@ namespace Jackett.Models.IndexerConfig
...
@@ -11,6 +11,7 @@ namespace Jackett.Models.IndexerConfig
{
{
public
StringItem
Username
{
get
;
private
set
;
}
public
StringItem
Username
{
get
;
private
set
;
}
public
StringItem
Password
{
get
;
private
set
;
}
public
StringItem
Password
{
get
;
private
set
;
}
public
HiddenItem
LastLoggedInCheck
{
get
;
private
set
;
}
public
DisplayItem
FilterExample
{
get
;
private
set
;
}
public
DisplayItem
FilterExample
{
get
;
private
set
;
}
public
StringItem
FilterString
{
get
;
private
set
;
}
public
StringItem
FilterString
{
get
;
private
set
;
}
...
@@ -18,6 +19,7 @@ namespace Jackett.Models.IndexerConfig
...
@@ -18,6 +19,7 @@ namespace Jackett.Models.IndexerConfig
{
{
Username
=
new
StringItem
{
Name
=
"Username"
};
Username
=
new
StringItem
{
Name
=
"Username"
};
Password
=
new
StringItem
{
Name
=
"Password"
};
Password
=
new
StringItem
{
Name
=
"Password"
};
LastLoggedInCheck
=
new
HiddenItem
{
Name
=
"LastLoggedInCheck"
};
FilterExample
=
new
DisplayItem
(
FilterInstructions
)
FilterExample
=
new
DisplayItem
(
FilterInstructions
)
{
{
Name
=
""
Name
=
""
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment