feat: add production Traefik docker-compose, dynamic origin resolution, and next.config
This commit is contained in:
@@ -17,7 +17,26 @@ import { soundFX } from "@/lib/soundEffects";
|
||||
export default function TitanQuantTerminalPage() {
|
||||
const [isUnlocked, setIsUnlocked] = useState(false);
|
||||
const [authToken, setAuthToken] = useState("");
|
||||
const [apiBaseUrl, setApiBaseUrl] = useState("http://localhost:8085");
|
||||
const [apiBaseUrl, setApiBaseUrl] = useState(() => {
|
||||
if (typeof window !== "undefined") {
|
||||
if (window.location.hostname === "localhost" && window.location.port === "3000") {
|
||||
return "http://localhost:8085";
|
||||
}
|
||||
return window.location.origin;
|
||||
}
|
||||
return process.env.NEXT_PUBLIC_API_URL || "http://localhost:8085";
|
||||
});
|
||||
|
||||
const [wsUrl, setWsUrl] = useState(() => {
|
||||
if (typeof window !== "undefined") {
|
||||
if (window.location.hostname === "localhost" && window.location.port === "3000") {
|
||||
return "ws://localhost:8085/ws/stream";
|
||||
}
|
||||
const proto = window.location.protocol === "https:" ? "wss:" : "ws:";
|
||||
return `${proto}//${window.location.host}/ws/stream`;
|
||||
}
|
||||
return process.env.NEXT_PUBLIC_WS_URL || "ws://localhost:8085/ws/stream";
|
||||
});
|
||||
const [activeSymbol, setActiveSymbol] = useState("XAUUSD");
|
||||
const [activeTimeframe, setActiveTimeframe] = useState("15m");
|
||||
const [candles, setCandles] = useState<any[]>([]);
|
||||
@@ -31,10 +50,17 @@ export default function TitanQuantTerminalPage() {
|
||||
const [exnessServer, setExnessServer] = useState("Exness-MT5Real15");
|
||||
|
||||
// WebSocket Hook
|
||||
const { isConnected, packet, ping } = useExnessWebSocket("ws://localhost:8085/ws/stream");
|
||||
const { isConnected, packet, ping } = useExnessWebSocket(wsUrl);
|
||||
|
||||
// Check Existing Session & Auto-Lock on Inactivity
|
||||
useEffect(() => {
|
||||
if (typeof window !== "undefined") {
|
||||
if (window.location.hostname !== "localhost") {
|
||||
setApiBaseUrl(window.location.origin);
|
||||
const proto = window.location.protocol === "https:" ? "wss:" : "ws:";
|
||||
setWsUrl(`${proto}//${window.location.host}/ws/stream`);
|
||||
}
|
||||
}
|
||||
const saved = sessionStorage.getItem("aura_trade_token");
|
||||
if (saved) {
|
||||
setAuthToken(saved);
|
||||
|
||||
Reference in New Issue
Block a user