Add Civitai platform support

Added 'civitai' to the PLATFORMS config and updated tests to include Civitai path transformations. This enables handling of Civitai URLs in the platform configuration and ensures correct path transformation logic.
This commit is contained in:
xixu-me committed 2025-08-20 21:37:57 +08:00
1 parent d16b296fe7
commit 55adac1ec5
2 files changed
+16

No files matched your search

+1
View File
@@ -10,6 +10,7 @@ export const PLATFORMS = {
sf: 'https://sourceforge.net',
aosp: 'https://android.googlesource.com',
hf: 'https://huggingface.co',
civitai: 'https://civitai.com',
npm: 'https://registry.npmjs.org',
pypi: 'https://pypi.org',
'pypi-files': 'https://files.pythonhosted.org',
+15
View File
@@ -11,6 +11,7 @@ describe('Platform Configuration', () => {
'gitea',
'codeberg',
'hf',
'civitai',
'npm',
'pypi',
'conda',
@@ -79,6 +80,20 @@ describe('Platform Configuration', () => {
);
});
it('should transform Civitai paths correctly', () => {
expect(transformPath('/civitai/api/v1/models', 'civitai')).toBe(
'/api/v1/models'
);
expect(transformPath('/civitai/api/v1/model-versions/1318', 'civitai')).toBe(
'/api/v1/model-versions/1318'
);
expect(transformPath('/civitai/api/download/models/1105', 'civitai')).toBe(
'/api/download/models/1105'
);
});
it('should transform npm paths correctly', () => {
expect(transformPath('/npm/react/-/react-18.2.0.tgz', 'npm')).toBe(
'/react/-/react-18.2.0.tgz'