[feat] Image achieve download.

This commit is contained in:
rootacite
2025-11-01 23:39:12 +08:00
parent c23a3260aa
commit 815c88f2bd
4 changed files with 36 additions and 8 deletions

View File

@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="dataSourceStorageLocal" created-in="RD-252.26830.109">
<component name="dataSourceStorageLocal" created-in="RD-252.27397.121">
<data-source name="user" uuid="91acd9d8-5f8b-442f-9d50-17006d4e1ac7">
<database-info product="SQLite" version="3.45.1" jdbc-version="4.2" driver-name="SQLite JDBC" driver-version="3.45.1.0" dbms="SQLITE" exact-version="3.45.1" exact-driver-version="3.45">
<identifier-quote-string>&quot;</identifier-quote-string>

View File

@@ -11,9 +11,9 @@
</component>
<component name="ChangeListManager">
<list default="true" id="bf317275-3039-49bb-a475-725a800a0cce" name="Changes" comment="">
<change beforePath="$PROJECT_DIR$/.idea/.idea.Abyss/.idea/dataSources.local.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/.idea.Abyss/.idea/dataSources.local.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/.idea.Abyss/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/.idea.Abyss/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Abyss/Components/Controllers/Security/UserController.cs" beforeDir="false" afterPath="$PROJECT_DIR$/Abyss/Components/Controllers/Security/UserController.cs" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Abyss/Components/Services/Security/UserService.cs" beforeDir="false" afterPath="$PROJECT_DIR$/Abyss/Components/Services/Security/UserService.cs" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Abyss/Components/Services/Media/ComicService.cs" beforeDir="false" afterPath="$PROJECT_DIR$/Abyss/Components/Services/Media/ComicService.cs" afterDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
@@ -47,7 +47,7 @@
<setting file="file://$PROJECT_DIR$/Abyss/Components/Controllers/Media/IndexController.cs" root0="FORCE_HIGHLIGHTING" />
<setting file="file://$PROJECT_DIR$/Abyss/Components/Controllers/Media/LiveController.cs" root0="FORCE_HIGHLIGHTING" />
<setting file="file://$PROJECT_DIR$/Abyss/Components/Controllers/Middleware/BadRequestExceptionMiddleware.cs" root0="FORCE_HIGHLIGHTING" />
<setting file="file://$PROJECT_DIR$/Abyss/Components/Controllers/Security/UserController.cs" root0="SKIP_HIGHLIGHTING" />
<setting file="file://$PROJECT_DIR$/Abyss/Components/Controllers/Security/UserController.cs" root0="FORCE_HIGHLIGHTING" />
<setting file="file://$PROJECT_DIR$/Abyss/Components/Controllers/Task/TaskController.cs" root0="FORCE_HIGHLIGHTING" />
<setting file="file://$PROJECT_DIR$/Abyss/Components/Services/Admin/Attributes/ModuleAttribute.cs" root0="FORCE_HIGHLIGHTING" />
<setting file="file://$PROJECT_DIR$/Abyss/Components/Services/Admin/CtlService.cs" root0="FORCE_HIGHLIGHTING" />
@@ -56,7 +56,7 @@
<setting file="file://$PROJECT_DIR$/Abyss/Components/Services/Admin/Modules/HelloModule.cs" root0="FORCE_HIGHLIGHTING" />
<setting file="file://$PROJECT_DIR$/Abyss/Components/Services/Admin/Modules/IncludeModule.cs" root0="FORCE_HIGHLIGHTING" />
<setting file="file://$PROJECT_DIR$/Abyss/Components/Services/Admin/Modules/InitModule.cs" root0="FORCE_HIGHLIGHTING" />
<setting file="file://$PROJECT_DIR$/Abyss/Components/Services/Admin/Modules/ListModule.cs" root0="SKIP_HIGHLIGHTING" />
<setting file="file://$PROJECT_DIR$/Abyss/Components/Services/Admin/Modules/ListModule.cs" root0="FORCE_HIGHLIGHTING" />
<setting file="file://$PROJECT_DIR$/Abyss/Components/Services/Admin/Modules/UserAddModule.cs" root0="FORCE_HIGHLIGHTING" />
<setting file="file://$PROJECT_DIR$/Abyss/Components/Services/Admin/Modules/VersionModule.cs" root0="FORCE_HIGHLIGHTING" />
<setting file="file://$PROJECT_DIR$/Abyss/Components/Services/Media/ComicService.cs" root0="FORCE_HIGHLIGHTING" />
@@ -100,7 +100,7 @@
</component>
<component name="MetaFilesCheckinStateConfiguration" checkMetaFiles="true" />
<component name="ProblemsViewState">
<option name="selectedTabId" value="Toolset" />
<option name="selectedTabId" value="CurrentFile" />
</component>
<component name="ProjectColorInfo">{
&quot;associatedIndex&quot;: 3
@@ -137,7 +137,7 @@
&quot;vue.rearranger.settings.migration&quot;: &quot;true&quot;
}
}</component>
<component name="RunManager" selected="Publish to folder.p2">
<component name="RunManager" selected="Publish to folder.p1">
<configuration name="p1" type="DotNetFolderPublish" factoryName="Publish to folder" singleton="false">
<riderPublish configuration="Release" platform="Any CPU" produce_single_file="true" self_contained="true" target_folder="$PROJECT_DIR$/publish" target_framework="net9.0" uuid_high="3690631506471504162" uuid_low="-4858628519588143325">
<runtimes>
@@ -311,6 +311,14 @@
<workItem from="1760629359988" duration="6000" />
<workItem from="1760630875664" duration="1000" />
<workItem from="1761538960257" duration="66000" />
<workItem from="1761539035937" duration="91000" />
<workItem from="1761757068457" duration="722000" />
<workItem from="1761825530863" duration="1000" />
<workItem from="1761825565817" duration="897000" />
<workItem from="1761841595489" duration="267000" />
<workItem from="1761988700826" duration="6000" />
<workItem from="1762005816621" duration="2025000" />
<workItem from="1762010975464" duration="363000" />
</task>
<servers />
</component>

View File

@@ -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<IActionResult> Achieve(string id)
{
var r = await comicService.Achieve(id, Token, Ip);
return r ?? _404;
}
}

View File

@@ -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<string[]?> 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<string?> Query(string id, string token, string ip)
{
@@ -63,4 +66,14 @@ public class ComicService(ResourceService rs, ConfigureService config)
return null;
}
public async Task<PhysicalFileResult?> 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;
}
}