feat: support reverse-proxy URL subpaths (llama-swap, SwarmUI) (#1122)

This commit is contained in:
Will Miao
2026-09-24 08:04:00 +08:00
parent 755e1a5bca
commit 2f9bd3ee7d
42 changed files with 731 additions and 103 deletions
+21
View File
@@ -0,0 +1,21 @@
import { describe, it, expect, afterEach } from 'vitest';
import { getBasePath, withBasePath } from '../../../static/js/utils/basePath.js';
describe('static/js/utils/basePath.js', () => {
afterEach(() => {
delete window.LM_BASE_PATH;
});
it('returns empty base path when bootstrap did not set one', () => {
expect(getBasePath()).toBe('');
expect(withBasePath('/loras')).toBe('/loras');
});
it('prepends the detected base path', () => {
window.LM_BASE_PATH = '/comfyui';
expect(getBasePath()).toBe('/comfyui');
expect(withBasePath('/loras')).toBe('/comfyui/loras');
expect(withBasePath('/loras/recipes')).toBe('/comfyui/loras/recipes');
});
});