mirror of
https://github.com/willmiao/ComfyUI-Lora-Manager.git
synced 2026-09-25 13:04:09 -03:00
feat: support reverse-proxy URL subpaths (llama-swap, SwarmUI) (#1122)
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
import { describe, it, expect, afterEach } from 'vitest';
|
||||
|
||||
import { getComfyUIBasePath, lmUrl } from '../../../web/comfyui/base_path.js';
|
||||
|
||||
describe('web/comfyui/base_path.js', () => {
|
||||
afterEach(() => {
|
||||
window.history.replaceState({}, '', '/');
|
||||
});
|
||||
|
||||
it.each([
|
||||
['/', ''],
|
||||
['/comfyui/', '/comfyui'],
|
||||
['/comfyui', '/comfyui'],
|
||||
['/ComfyBackendDirect/', '/ComfyBackendDirect'],
|
||||
])('maps %s to base path %s', (pathname, expected) => {
|
||||
window.history.replaceState({}, '', pathname);
|
||||
expect(getComfyUIBasePath()).toBe(expected);
|
||||
});
|
||||
|
||||
it('builds prefixed URLs', () => {
|
||||
window.history.replaceState({}, '', '/comfyui/');
|
||||
expect(lmUrl('/api/lm/version-info')).toBe('/comfyui/api/lm/version-info');
|
||||
expect(lmUrl('/loras')).toBe('/comfyui/loras');
|
||||
|
||||
window.history.replaceState({}, '', '/');
|
||||
expect(lmUrl('/api/lm/version-info')).toBe('/api/lm/version-info');
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user