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/cli.js CHANGED
@@ -292,7 +292,10 @@ async function initSeacloud(apiKeyOrConfig, options) {
292
292
  try {
293
293
  const parentHost = await getHostFromParent(3e3);
294
294
  if (parentHost) {
295
- const isDevelopment = parentHost.includes("localhost") || parentHost.includes("127.0.0.1") || parentHost.includes(":3000") || parentHost.includes(":8080") || parentHost.includes("seaverse.dev");
295
+ const devHostPatterns = ["localhost", "127.0.0.1", ":3000", ":8080", "seaverse.dev"];
296
+ const currentHost = typeof globalThis !== "undefined" && typeof globalThis.window !== "undefined" ? globalThis.window.location.host : "";
297
+ const checkIsDev = (host) => devHostPatterns.some((pattern) => host.includes(pattern));
298
+ const isDevelopment = checkIsDev(currentHost) || checkIsDev(parentHost);
296
299
  if (isDevelopment) {
297
300
  config.baseUrl = "https://proxy-rs.sg.seaverse.dev";
298
301
  console.log("[SeaCloud SDK] \u68C0\u6D4B\u5230\u5F00\u53D1\u73AF\u5883\uFF0C\u4F7F\u7528\u5F00\u53D1 baseUrl:", config.baseUrl);