mirror of
https://github.com/Kareadita/Kavita.git
synced 2025-07-31 14:33:50 -04:00
Vacation Fixes (#709)
* Ignore system and hidden folders when performing directory scan. * Fixed the comic parser tests not using Comic mode for parsing. * Accept all forwarded headers and use them. * Ignore some changes from another branch
This commit is contained in:
parent
f99cf87ab5
commit
7ce13babad
3
.gitignore
vendored
3
.gitignore
vendored
@ -501,3 +501,6 @@ API/stats/
|
|||||||
UI/Web/dist/
|
UI/Web/dist/
|
||||||
/API.Tests/Extensions/Test Data/modified on run.txt
|
/API.Tests/Extensions/Test Data/modified on run.txt
|
||||||
/API/covers/
|
/API/covers/
|
||||||
|
API/config/covers/
|
||||||
|
API/config/*.db
|
||||||
|
UI/Web/.vscode/settings.json
|
||||||
|
@ -56,6 +56,8 @@ namespace API.Tests.Parser
|
|||||||
[InlineData("Batgirl V2000 #57", "Batgirl")]
|
[InlineData("Batgirl V2000 #57", "Batgirl")]
|
||||||
[InlineData("Fables 021 (2004) (Digital) (Nahga-Empire)", "Fables")]
|
[InlineData("Fables 021 (2004) (Digital) (Nahga-Empire)", "Fables")]
|
||||||
[InlineData("2000 AD 0366 [1984-04-28] (flopbie)", "2000 AD")]
|
[InlineData("2000 AD 0366 [1984-04-28] (flopbie)", "2000 AD")]
|
||||||
|
[InlineData("Daredevil - v6 - 10 - (2019)", "Daredevil")]
|
||||||
|
[InlineData("Batman - The Man Who Laughs #1 (2005)", "Batman - The Man Who Laughs")]
|
||||||
public void ParseComicSeriesTest(string filename, string expected)
|
public void ParseComicSeriesTest(string filename, string expected)
|
||||||
{
|
{
|
||||||
Assert.Equal(expected, API.Parser.Parser.ParseComicSeries(filename));
|
Assert.Equal(expected, API.Parser.Parser.ParseComicSeries(filename));
|
||||||
@ -93,6 +95,7 @@ namespace API.Tests.Parser
|
|||||||
[InlineData("Fables 021 (2004) (Digital) (Nahga-Empire).cbr", "0")]
|
[InlineData("Fables 021 (2004) (Digital) (Nahga-Empire).cbr", "0")]
|
||||||
[InlineData("Cyberpunk 2077 - Trauma Team 04.cbz", "0")]
|
[InlineData("Cyberpunk 2077 - Trauma Team 04.cbz", "0")]
|
||||||
[InlineData("2000 AD 0366 [1984-04-28] (flopbie)", "0")]
|
[InlineData("2000 AD 0366 [1984-04-28] (flopbie)", "0")]
|
||||||
|
[InlineData("Daredevil - v6 - 10 - (2019)", "6")]
|
||||||
public void ParseComicVolumeTest(string filename, string expected)
|
public void ParseComicVolumeTest(string filename, string expected)
|
||||||
{
|
{
|
||||||
Assert.Equal(expected, API.Parser.Parser.ParseComicVolume(filename));
|
Assert.Equal(expected, API.Parser.Parser.ParseComicVolume(filename));
|
||||||
@ -134,6 +137,7 @@ namespace API.Tests.Parser
|
|||||||
[InlineData("Fables 021 (2004) (Digital) (Nahga-Empire).cbr", "21")]
|
[InlineData("Fables 021 (2004) (Digital) (Nahga-Empire).cbr", "21")]
|
||||||
[InlineData("Cyberpunk 2077 - Trauma Team #04.cbz", "4")]
|
[InlineData("Cyberpunk 2077 - Trauma Team #04.cbz", "4")]
|
||||||
[InlineData("2000 AD 0366 [1984-04-28] (flopbie)", "366")]
|
[InlineData("2000 AD 0366 [1984-04-28] (flopbie)", "366")]
|
||||||
|
[InlineData("Daredevil - v6 - 10 - (2019)", "10")]
|
||||||
public void ParseComicChapterTest(string filename, string expected)
|
public void ParseComicChapterTest(string filename, string expected)
|
||||||
{
|
{
|
||||||
Assert.Equal(expected, API.Parser.Parser.ParseComicChapter(filename));
|
Assert.Equal(expected, API.Parser.Parser.ParseComicChapter(filename));
|
||||||
@ -172,10 +176,26 @@ namespace API.Tests.Parser
|
|||||||
FullFilePath = filepath, IsSpecial = false
|
FullFilePath = filepath, IsSpecial = false
|
||||||
});
|
});
|
||||||
|
|
||||||
|
filepath = @"E:\Comics\Comics\Publisher\Batman the Detective (2021)\Batman the Detective - v6 - 11 - (2021).cbr";
|
||||||
|
expected.Add(filepath, new ParserInfo
|
||||||
|
{
|
||||||
|
Series = "Batman the Detective", Volumes = "6", Edition = "",
|
||||||
|
Chapters = "11", Filename = "Batman the Detective - v6 - 11 - (2021).cbr", Format = MangaFormat.Archive,
|
||||||
|
FullFilePath = filepath, IsSpecial = false
|
||||||
|
});
|
||||||
|
|
||||||
|
filepath = @"E:\Comics\Comics\Batman - The Man Who Laughs #1 (2005)\Batman - The Man Who Laughs #1 (2005).cbr";
|
||||||
|
expected.Add(filepath, new ParserInfo
|
||||||
|
{
|
||||||
|
Series = "Batman - The Man Who Laughs", Volumes = "0", Edition = "",
|
||||||
|
Chapters = "1", Filename = "Batman - The Man Who Laughs #1 (2005).cbr", Format = MangaFormat.Archive,
|
||||||
|
FullFilePath = filepath, IsSpecial = false
|
||||||
|
});
|
||||||
|
|
||||||
foreach (var file in expected.Keys)
|
foreach (var file in expected.Keys)
|
||||||
{
|
{
|
||||||
var expectedInfo = expected[file];
|
var expectedInfo = expected[file];
|
||||||
var actual = API.Parser.Parser.Parse(file, rootPath);
|
var actual = API.Parser.Parser.Parse(file, rootPath, LibraryType.Comic);
|
||||||
if (expectedInfo == null)
|
if (expectedInfo == null)
|
||||||
{
|
{
|
||||||
Assert.Null(actual);
|
Assert.Null(actual);
|
||||||
|
@ -375,8 +375,11 @@ namespace API.Services
|
|||||||
IEnumerable<string> subDirs;
|
IEnumerable<string> subDirs;
|
||||||
string[] files;
|
string[] files;
|
||||||
|
|
||||||
try {
|
try
|
||||||
subDirs = Directory.GetDirectories(currentDir).Where(path => ExcludeDirectories.Matches(path).Count == 0);
|
{
|
||||||
|
// Default EnumerationOptions will ignore system and hidden folders
|
||||||
|
subDirs = Directory.GetDirectories(currentDir, "*", new EnumerationOptions())
|
||||||
|
.Where(path => ExcludeDirectories.Matches(path).Count == 0);
|
||||||
}
|
}
|
||||||
// Thrown if we do not have discovery permission on the directory.
|
// Thrown if we do not have discovery permission on the directory.
|
||||||
catch (UnauthorizedAccessException e) {
|
catch (UnauthorizedAccessException e) {
|
||||||
|
@ -106,6 +106,11 @@ namespace API
|
|||||||
|
|
||||||
services.AddResponseCaching();
|
services.AddResponseCaching();
|
||||||
|
|
||||||
|
services.Configure<ForwardedHeadersOptions>(options =>
|
||||||
|
{
|
||||||
|
options.ForwardedHeaders =
|
||||||
|
ForwardedHeaders.All;
|
||||||
|
});
|
||||||
|
|
||||||
services.AddHangfire(configuration => configuration
|
services.AddHangfire(configuration => configuration
|
||||||
.UseSimpleAssemblyNameTypeSerializer()
|
.UseSimpleAssemblyNameTypeSerializer()
|
||||||
@ -140,7 +145,7 @@ namespace API
|
|||||||
|
|
||||||
app.UseForwardedHeaders(new ForwardedHeadersOptions
|
app.UseForwardedHeaders(new ForwardedHeadersOptions
|
||||||
{
|
{
|
||||||
ForwardedHeaders = ForwardedHeaders.XForwardedFor | ForwardedHeaders.XForwardedProto
|
ForwardedHeaders = ForwardedHeaders.All
|
||||||
});
|
});
|
||||||
|
|
||||||
app.UseRouting();
|
app.UseRouting();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user