up
This commit is contained in:
+3
-4
@@ -1,10 +1,9 @@
|
|||||||
services:
|
services:
|
||||||
app:
|
app:
|
||||||
image: ${DOCKER_USER:-mirrors2}/meoo:${VERSION:-latest}
|
image: ${DOCKER_USER:-mirrors2}/auv:${VERSION:-latest}
|
||||||
build:
|
container_name: auv
|
||||||
context: .
|
|
||||||
ports:
|
ports:
|
||||||
- "8000:8000"
|
- "8000:8000"
|
||||||
env_file:
|
env_file:
|
||||||
- ./backend/.env
|
- .env
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
|
|||||||
+10
-3
@@ -1,6 +1,13 @@
|
|||||||
// Python 后端 API 客户端 — 自动适配局域网 IP
|
// Python 后端 API 客户端
|
||||||
// 前端 JS 在浏览器中运行时,API 用当前页面的 hostname(端口 8000)
|
// 生产环境:同源反代,用相对路径
|
||||||
const API_BASE = `http://${window.location.hostname}:8000`;
|
// 开发环境:Vite 3015 → 后端 8000,显式跨域
|
||||||
|
const API_BASE = (() => {
|
||||||
|
const { hostname, port } = window.location;
|
||||||
|
if (port === '3015') {
|
||||||
|
return `http://${hostname}:8000`;
|
||||||
|
}
|
||||||
|
return '';
|
||||||
|
})();
|
||||||
|
|
||||||
export function getApiBaseUrl(): string {
|
export function getApiBaseUrl(): string {
|
||||||
return API_BASE;
|
return API_BASE;
|
||||||
|
|||||||
Reference in New Issue
Block a user