앱 실시간 차트 갱신오류 수정
This commit is contained in:
@@ -77,13 +77,28 @@ export function getApiBase(): string {
|
||||
return API_BASE.replace(/\/api$/, '');
|
||||
}
|
||||
|
||||
/**
|
||||
* Desktop Tauri WebView(https 커스텀 스킴)에서는 ws://·http API XHR 이 mixed content 로 차단된다.
|
||||
* exdev REST 는 tauri HTTP 로 우회하지만 SockJS/WebSocket 은 페이지 오리진 정책을 따른다.
|
||||
*/
|
||||
export function getSecureApiOrigin(): string {
|
||||
const origin = getApiBase().replace(/\/$/, '');
|
||||
const pageSecure =
|
||||
typeof window !== 'undefined'
|
||||
&& (window.location.protocol === 'https:' || isDesktopClient());
|
||||
if (pageSecure && /^http:\/\//i.test(origin)) {
|
||||
return origin.replace(/^http:/i, 'https:');
|
||||
}
|
||||
return origin;
|
||||
}
|
||||
|
||||
/**
|
||||
* STOMP SockJS 엔드포인트.
|
||||
* Spring Boot context-path가 /api 이므로 반드시 /api/ws/trading 경로를 사용한다.
|
||||
*/
|
||||
export function getStompSockJsUrl(): string {
|
||||
const base = API_BASE.replace(/\/$/, '');
|
||||
return base.endsWith('/api') ? `${base}/ws/trading` : `${base}/api/ws/trading`;
|
||||
const secureOrigin = getSecureApiOrigin();
|
||||
return `${secureOrigin}/api/ws/trading`;
|
||||
}
|
||||
|
||||
// UUID 생성 — HTTPS/localhost: crypto.randomUUID() 사용, HTTP: 폴리필
|
||||
|
||||
Reference in New Issue
Block a user