mirror of
https://github.com/siteboon/claudecodeui.git
synced 2026-02-01 14:27:32 +00:00
fix: add type definition for WebSocket URL and remove redundant protocol declaration
This commit is contained in:
@@ -41,11 +41,11 @@ const useWebSocketProviderState = () => {
|
|||||||
const isPlatform = import.meta.env.VITE_IS_PLATFORM === 'true';
|
const isPlatform = import.meta.env.VITE_IS_PLATFORM === 'true';
|
||||||
|
|
||||||
// Construct WebSocket URL
|
// Construct WebSocket URL
|
||||||
let wsUrl;
|
let wsUrl: string;
|
||||||
|
|
||||||
|
const protocol = window.location.protocol === 'https:' ? 'wss:' : 'ws:';
|
||||||
if (isPlatform) {
|
if (isPlatform) {
|
||||||
// Platform mode: Use same domain as the page (goes through proxy)
|
// Platform mode: Use same domain as the page (goes through proxy)
|
||||||
const protocol = window.location.protocol === 'https:' ? 'wss:' : 'ws:';
|
|
||||||
wsUrl = `${protocol}//${window.location.host}/ws`;
|
wsUrl = `${protocol}//${window.location.host}/ws`;
|
||||||
} else {
|
} else {
|
||||||
// OSS mode: Connect to same host:port that served the page
|
// OSS mode: Connect to same host:port that served the page
|
||||||
@@ -54,8 +54,6 @@ const useWebSocketProviderState = () => {
|
|||||||
console.warn('No authentication token found for WebSocket connection');
|
console.warn('No authentication token found for WebSocket connection');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const protocol = window.location.protocol === 'https:' ? 'wss:' : 'ws:';
|
|
||||||
wsUrl = `${protocol}//${window.location.host}/ws?token=${encodeURIComponent(token)}`;
|
wsUrl = `${protocol}//${window.location.host}/ws?token=${encodeURIComponent(token)}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user