diff --git a/.idea/.idea.Abyss/.idea/dataSources.local.xml b/.idea/.idea.Abyss/.idea/dataSources.local.xml index 087b8e5..c87036b 100644 --- a/.idea/.idea.Abyss/.idea/dataSources.local.xml +++ b/.idea/.idea.Abyss/.idea/dataSources.local.xml @@ -1,6 +1,6 @@ - + " diff --git a/.idea/.idea.Abyss/.idea/workspace.xml b/.idea/.idea.Abyss/.idea/workspace.xml index 6af6c93..463921d 100644 --- a/.idea/.idea.Abyss/.idea/workspace.xml +++ b/.idea/.idea.Abyss/.idea/workspace.xml @@ -11,9 +11,9 @@ + - - + - { "associatedIndex": 3 @@ -137,7 +137,7 @@ "vue.rearranger.settings.migration": "true" } } - + @@ -311,6 +311,14 @@ + + + + + + + + diff --git a/Abyss/Components/Controllers/Media/ImageController.cs b/Abyss/Components/Controllers/Media/ImageController.cs index 4d291b0..4dbb751 100644 --- a/Abyss/Components/Controllers/Media/ImageController.cs +++ b/Abyss/Components/Controllers/Media/ImageController.cs @@ -53,4 +53,11 @@ public class ImageController(ComicService comicService) : BaseController var r = await comicService.Page(id, file, Token, Ip); return r ?? _403; } + + [HttpGet("{id}/achieve")] + public async Task Achieve(string id) + { + var r = await comicService.Achieve(id, Token, Ip); + return r ?? _404; + } } \ No newline at end of file diff --git a/Abyss/Components/Services/Media/ComicService.cs b/Abyss/Components/Services/Media/ComicService.cs index 6972cb8..e03568e 100644 --- a/Abyss/Components/Services/Media/ComicService.cs +++ b/Abyss/Components/Services/Media/ComicService.cs @@ -1,3 +1,4 @@ +using System.Text.RegularExpressions; using Abyss.Components.Services.Misc; using Abyss.Components.Static; using Abyss.Model.Media; @@ -14,7 +15,9 @@ public class ComicService(ResourceService rs, ConfigureService config) => await rs.Initialize(ImageFolder, token, owner, ip); public async Task QueryCollections(string token, string ip) - => await rs.Query(ImageFolder, token, ip); + => (await rs.Query(ImageFolder, token, ip))? + .Where(x => Regex.Match(x, @"^-?\d+$").Success) + .ToArray(); public async Task Query(string id, string token, string ip) { @@ -63,4 +66,14 @@ public class ComicService(ResourceService rs, ConfigureService config) return null; } + + public async Task Achieve(string id, string token, string ip) + { + if (Helpers.SafePathCombine(ImageFolder, [".achieve", $"{id}.zip"]) is { } d) + { + return await rs.Get(d, token, ip, "application/zip"); + } + + return null; + } } \ No newline at end of file