@machhub-dev/sdk-ts 1.0.5 → 1.0.6
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/cjs/sdk-ts.js +5 -2
- package/dist/sdk-ts.js +5 -2
- package/package.json +1 -1
- package/src/sdk-ts.ts +7 -4
package/dist/cjs/sdk-ts.js
CHANGED
|
@@ -126,12 +126,15 @@ class SDK {
|
|
|
126
126
|
const application_id = config.application_id ||
|
|
127
127
|
this.extractApplicationIDFromRuntimeID(envCfg.runtimeID);
|
|
128
128
|
this.applicationID = application_id;
|
|
129
|
-
// Determine the hostname - use window.location
|
|
129
|
+
// Determine the hostname - use window.location in browser, otherwise fallback to localhost
|
|
130
130
|
const hostname = typeof window !== 'undefined' ? window.location.hostname : 'localhost';
|
|
131
131
|
const secured = typeof window !== 'undefined' ? window.location.protocol === 'https:' : false;
|
|
132
132
|
let host = hostname;
|
|
133
133
|
if (envCfg.hostingMode === 'port' || !envCfg.hostingMode) {
|
|
134
|
-
host
|
|
134
|
+
// In browser, use window.location.host which includes the port only when non-standard
|
|
135
|
+
// (e.g. "localhost:6190" for local dev, "machhub.dev" when behind a reverse proxy on 443)
|
|
136
|
+
// In non-browser environments, fall back to hostname:envCfg.port
|
|
137
|
+
host = typeof window !== 'undefined' ? window.location.host : `${hostname}:${envCfg.port}`;
|
|
135
138
|
}
|
|
136
139
|
else if (envCfg.hostingMode === 'path') {
|
|
137
140
|
host += envCfg.pathHosted;
|
package/dist/sdk-ts.js
CHANGED
|
@@ -123,12 +123,15 @@ export class SDK {
|
|
|
123
123
|
const application_id = config.application_id ||
|
|
124
124
|
this.extractApplicationIDFromRuntimeID(envCfg.runtimeID);
|
|
125
125
|
this.applicationID = application_id;
|
|
126
|
-
// Determine the hostname - use window.location
|
|
126
|
+
// Determine the hostname - use window.location in browser, otherwise fallback to localhost
|
|
127
127
|
const hostname = typeof window !== 'undefined' ? window.location.hostname : 'localhost';
|
|
128
128
|
const secured = typeof window !== 'undefined' ? window.location.protocol === 'https:' : false;
|
|
129
129
|
let host = hostname;
|
|
130
130
|
if (envCfg.hostingMode === 'port' || !envCfg.hostingMode) {
|
|
131
|
-
host
|
|
131
|
+
// In browser, use window.location.host which includes the port only when non-standard
|
|
132
|
+
// (e.g. "localhost:6190" for local dev, "machhub.dev" when behind a reverse proxy on 443)
|
|
133
|
+
// In non-browser environments, fall back to hostname:envCfg.port
|
|
134
|
+
host = typeof window !== 'undefined' ? window.location.host : `${hostname}:${envCfg.port}`;
|
|
132
135
|
}
|
|
133
136
|
else if (envCfg.hostingMode === 'path') {
|
|
134
137
|
host += envCfg.pathHosted;
|
package/package.json
CHANGED
package/src/sdk-ts.ts
CHANGED
|
@@ -145,15 +145,18 @@ export class SDK {
|
|
|
145
145
|
|
|
146
146
|
this.applicationID = application_id;
|
|
147
147
|
|
|
148
|
-
// Determine the hostname - use window.location
|
|
148
|
+
// Determine the hostname - use window.location in browser, otherwise fallback to localhost
|
|
149
149
|
const hostname = typeof window !== 'undefined' ? window.location.hostname : 'localhost';
|
|
150
150
|
const secured = typeof window !== 'undefined' ? window.location.protocol === 'https:' : false;
|
|
151
151
|
|
|
152
|
-
let host = hostname
|
|
152
|
+
let host = hostname;
|
|
153
153
|
if (envCfg.hostingMode === 'port' || !envCfg.hostingMode) {
|
|
154
|
-
host
|
|
154
|
+
// In browser, use window.location.host which includes the port only when non-standard
|
|
155
|
+
// (e.g. "localhost:6190" for local dev, "machhub.dev" when behind a reverse proxy on 443)
|
|
156
|
+
// In non-browser environments, fall back to hostname:envCfg.port
|
|
157
|
+
host = typeof window !== 'undefined' ? window.location.host : `${hostname}:${envCfg.port}`;
|
|
155
158
|
} else if (envCfg.hostingMode === 'path') {
|
|
156
|
-
host += envCfg.pathHosted
|
|
159
|
+
host += envCfg.pathHosted;
|
|
157
160
|
}
|
|
158
161
|
|
|
159
162
|
if (!config.httpUrl) {
|