调整目录

This commit is contained in:
mlogclub
2026-04-24 12:01:30 +08:00
parent 7889ecb0d2
commit a9275c2d4a
209 changed files with 0 additions and 0 deletions
+16
View File
@@ -0,0 +1,16 @@
const API_BASE_URL =
process.env.NEXT_PUBLIC_API_BASE_URL?.trim() ||
(process.env.NODE_ENV === "development" ? "http://127.0.0.1:8083" : "")
export function createWebSocketBaseUrl() {
if (API_BASE_URL) {
return API_BASE_URL.replace(/^http/, "ws").replace(/\/$/, "")
}
if (typeof window === "undefined") {
return ""
}
const protocol = window.location.protocol === "https:" ? "wss:" : "ws:"
return `${protocol}//${window.location.host}`
}