Add dynamic subpath support (#1011)

* Add dynamic subpath support for WebUI

- Add SubpathConfig utility for server-side subpath detection
- Configure React Router basename from server config
- Update API base URL handling for subpath compatibility
- Fix asset loading with relative paths
- Add VITE_SUBPATH environment variable for development
- Update locales and manifest paths for subpath support

Closes #174

* Move VITE_SUBPATH interface to vite-env.d.ts

* Ensure production bundle always uses relative base
This commit is contained in:
Soner Köksal
2025-09-24 00:23:19 +03:00
committed by GitHub
parent 0706e4671f
commit 4d4477640e
8 changed files with 108 additions and 7 deletions

View File

@@ -10,6 +10,7 @@ import { use } from 'i18next';
import { initReactI18next } from 'react-i18next';
import LanguageDetector from 'i18next-browser-languagedetector';
import HttpBackend from 'i18next-http-backend';
import { SubpathConfig } from '@/lib/utils/SubpathConfig.ts';
/**
* Keys have to match {@link IsoLanguages} codes, they're used for showing the language name in the dropdown in the {@link Settings}.<br/>
@@ -45,7 +46,7 @@ export const i18n = use(initReactI18next)
fallbackLng: 'en',
backend: {
loadPath: '/locales/{{lng}}.json',
loadPath: `${SubpathConfig.getSubpath()}/locales/{{lng}}.json`,
allowMultiLoading: true,
},