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