seacloud-sdk 0.12.2 → 0.12.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -288,7 +288,10 @@ async function initSeacloud(apiKeyOrConfig, options) {
288
288
  try {
289
289
  const parentHost = await getHostFromParent(3e3);
290
290
  if (parentHost) {
291
- const isDevelopment = parentHost.includes("localhost") || parentHost.includes("127.0.0.1") || parentHost.includes(":3000") || parentHost.includes(":8080") || parentHost.includes("seaverse.dev");
291
+ const devHostPatterns = ["localhost", "127.0.0.1", ":3000", ":8080", "seaverse.dev"];
292
+ const currentHost = typeof globalThis !== "undefined" && typeof globalThis.window !== "undefined" ? globalThis.window.location.host : "";
293
+ const checkIsDev = (host) => devHostPatterns.some((pattern) => host.includes(pattern));
294
+ const isDevelopment = checkIsDev(currentHost) || checkIsDev(parentHost);
292
295
  if (isDevelopment) {
293
296
  config.baseUrl = "https://proxy-rs.sg.seaverse.dev";
294
297
  console.log("[SeaCloud SDK] \u68C0\u6D4B\u5230\u5F00\u53D1\u73AF\u5883\uFF0C\u4F7F\u7528\u5F00\u53D1 baseUrl:", config.baseUrl);