fix(download): recognize civitai.red and civitai.green URLs in batch download (#1003)

This commit is contained in:
Will Miao
2026-07-02 10:28:03 +08:00
parent fe90f7f9b1
commit d7291f73c9
2 changed files with 16 additions and 2 deletions

View File

@@ -463,8 +463,8 @@ export class DownloadManager {
const trimmed = url.trim();
if (!trimmed) return null;
// CivitAI
if (/civitai\.com\/models\//i.test(trimmed) || /civitaiarchive|civarchive/i.test(trimmed)) {
// CivitAI — matches civitai.com, civitai.red, civitai.green, etc.
if (/civitai\.(?:com|red|green)\/models\//i.test(trimmed) || /civitaiarchive|civarchive/i.test(trimmed)) {
// Will be parsed by existing CivitAI logic
return { type: 'civitai' };
}

View File

@@ -62,6 +62,20 @@ describe('DownloadManager.detectUrlType — HF URL detection', () => {
expect(result).toEqual({ type: 'civitai' });
});
it('detects CivitAI URL on civitai.red domain', () => {
const result = DownloadManager.detectUrlType(
'https://civitai.red/models/12345/my-model'
);
expect(result).toEqual({ type: 'civitai' });
});
it('detects CivitAI URL on civitai.green domain', () => {
const result = DownloadManager.detectUrlType(
'https://civitai.green/models/67890/another-model'
);
expect(result).toEqual({ type: 'civitai' });
});
it('detects CivArchive URL', () => {
const result = DownloadManager.detectUrlType(
'https://civarchive.com/models/456'