资源文件地址
parent
c2a2307b34
commit
f4b0cdc569
|
|
@ -104,12 +104,9 @@ function Planet({ body, size, emissive, emissiveIntensity, allBodies, isSelected
|
|||
(r) => !r.file_path.includes('atmosphere') && !r.file_path.includes('night')
|
||||
);
|
||||
if (mainTexture) {
|
||||
// Construct full URL from file_path
|
||||
// Construct path for Nginx proxy
|
||||
// file_path is like "texture/2k_sun.jpg", need to add "upload/" prefix
|
||||
const protocol = window.location.protocol;
|
||||
const hostname = window.location.hostname;
|
||||
const port = import.meta.env.VITE_API_BASE_URL ? '' : ':8000';
|
||||
setTexturePath(`${protocol}//${hostname}${port}/upload/${mainTexture.file_path}`);
|
||||
setTexturePath(`/upload/${mainTexture.file_path}`);
|
||||
} else {
|
||||
setTexturePath(null);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,11 +9,8 @@ export function InterstellarTicker({ isPlaying }: InterstellarTickerProps) {
|
|||
|
||||
useEffect(() => {
|
||||
if (!audioRef.current) {
|
||||
// Initialize audio element
|
||||
const protocol = window.location.protocol;
|
||||
const hostname = window.location.hostname;
|
||||
const port = import.meta.env.VITE_API_BASE_URL ? '' : ':8000';
|
||||
const audioUrl = `${protocol}//${hostname}${port}/upload/assets/tick_sample.m4a`;
|
||||
// Initialize audio element with Nginx proxied path
|
||||
const audioUrl = `/upload/assets/tick_sample.m4a`;
|
||||
|
||||
const audio = new Audio(audioUrl);
|
||||
audio.loop = true; // Enable looping
|
||||
|
|
|
|||
|
|
@ -242,11 +242,10 @@ export function Probe({ body, allBodies, isSelected = false }: ProbeProps) {
|
|||
setResourceScale(scale);
|
||||
console.log(`[Probe ${body.name}] Scale from resource:`, scale);
|
||||
|
||||
// Construct full URL from file_path
|
||||
const protocol = window.location.protocol;
|
||||
const hostname = window.location.hostname;
|
||||
const port = import.meta.env.VITE_API_BASE_URL ? '' : ':8000';
|
||||
const fullPath = `${protocol}//${hostname}${port}/upload/${modelResource.file_path}`;
|
||||
// Construct path for Nginx proxy
|
||||
// Database stores relative path like "texture/2k_mercury.jpg" or "model/webb.glb"
|
||||
// We need to add /upload/ prefix for Nginx to proxy to backend
|
||||
const fullPath = `/upload/${modelResource.file_path}`;
|
||||
console.log(`[Probe ${body.name}] Model path:`, fullPath);
|
||||
|
||||
// Preload the model before setting the path
|
||||
|
|
|
|||
|
|
@ -7,5 +7,22 @@ export default defineConfig({
|
|||
server: {
|
||||
host: '0.0.0.0', // Listen on all network interfaces
|
||||
port: 5173,
|
||||
proxy: {
|
||||
// Proxy API requests to backend
|
||||
'/api': {
|
||||
target: 'http://localhost:8000',
|
||||
changeOrigin: true,
|
||||
},
|
||||
// Proxy upload files to backend
|
||||
'/upload': {
|
||||
target: 'http://localhost:8000',
|
||||
changeOrigin: true,
|
||||
},
|
||||
// Proxy public assets to backend
|
||||
'/public': {
|
||||
target: 'http://localhost:8000',
|
||||
changeOrigin: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
|
|
|
|||
Loading…
Reference in New Issue