feat: add single-port reverse proxy deployment support

This commit is contained in:
2026-04-02 23:27:46 +03:00
parent 675e173303
commit 3eabd3238f
10 changed files with 122 additions and 12 deletions

View File

@@ -38,6 +38,7 @@ export function AppShell({ children }: { children: React.ReactNode }) {
const username = useSessionStore((state) => state.username)
const clearSession = useSessionStore((state) => state.clearSession)
const fullPlayerOpen = usePlayerStore((state) => state.fullPlayerOpen)
const currentOrigin = typeof window !== 'undefined' ? window.location.origin : ''
const [settingsOpen, setSettingsOpen] = useState(false)
const [userMenuOpen, setUserMenuOpen] = useState(false)
const [paletteOpen, setPaletteOpen] = useState(false)
@@ -87,7 +88,7 @@ export function AppShell({ children }: { children: React.ReactNode }) {
<div className="absolute right-0 top-10 z-30 w-64 overflow-hidden rounded-xl border border-[#24314f] bg-[#0d1528] shadow-2xl">
<div className="border-b border-[#24314f] px-4 py-3">
<div className="text-xl font-semibold text-white">{username ?? 'demo'}</div>
<div className="mt-1 text-sm text-slate-400">https://music.daemonlord.ru</div>
<div className="mt-1 text-sm text-slate-400">{currentOrigin || 'https://music.example.com'}</div>
</div>
<button className="flex w-full items-center justify-between px-4 py-3 text-left text-sm text-slate-100 hover:bg-[#18233a]" type="button">
Сочетания клавиш

View File

@@ -79,7 +79,7 @@ export type PlaylistDetail = PlaylistSummary & {
tracks: Track[]
}
const API_BASE = import.meta.env.VITE_API_BASE ?? 'http://localhost:4040'
const API_BASE = import.meta.env.VITE_API_BASE ?? ''
async function request<T>(path: string, init?: RequestInit): Promise<T> {
const token = useSessionStore.getState().token

View File

@@ -14,5 +14,19 @@ export default defineConfig({
},
server: {
port: 5173,
proxy: {
'/api': {
target: 'http://127.0.0.1:5050',
changeOrigin: true,
},
'/rest': {
target: 'http://127.0.0.1:5050',
changeOrigin: true,
},
'/health': {
target: 'http://127.0.0.1:5050',
changeOrigin: true,
},
},
},
})