@sailfish-ai/recorder 1.2.8 → 1.2.9
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 +11 -9
- package/dist/sailfish-recorder.cjs.js +1 -1
- package/dist/sailfish-recorder.cjs.js.br +0 -0
- package/dist/sailfish-recorder.cjs.js.gz +0 -0
- package/dist/sailfish-recorder.es.js +1 -1
- package/dist/sailfish-recorder.es.js.br +0 -0
- package/dist/sailfish-recorder.es.js.gz +0 -0
- package/dist/sailfish-recorder.umd.js +1 -1
- package/dist/sailfish-recorder.umd.js.br +0 -0
- package/dist/sailfish-recorder.umd.js.gz +0 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -7,7 +7,12 @@ import { initializeRecording } from "./recording";
|
|
|
7
7
|
// Default list of domains to ignore
|
|
8
8
|
const DOMAINS_TO_NOT_PROPAGATE_HEADER_TO_DEFAULT = [
|
|
9
9
|
"t.co",
|
|
10
|
+
"*.twitter.com",
|
|
11
|
+
"*.gravatar.com",
|
|
10
12
|
"identitytoolkit.googleapis.com",
|
|
13
|
+
"*.amazonaws.com", // Exclude AWS S3
|
|
14
|
+
"*.smooch.io", // Exclude smooch-related requests
|
|
15
|
+
"*.zendesk.com", // Exclude zendesk-related requests
|
|
11
16
|
];
|
|
12
17
|
const DOMAINS_TO_NOT_RECORD_NETWORK_REQUESTS_TO = [];
|
|
13
18
|
export const DEFAULT_CAPTURE_SETTINGS = {
|
|
@@ -158,6 +163,7 @@ export function matchUrlWithWildcard(url, patterns) {
|
|
|
158
163
|
});
|
|
159
164
|
}
|
|
160
165
|
// Updated XMLHttpRequest interceptor with CORS protection
|
|
166
|
+
// Updated XMLHttpRequest interceptor with domain exclusion
|
|
161
167
|
function setupXMLHttpRequestInterceptor(domainsToNotPropagateHeaderTo, domainsToPropagateHeadersTo = []) {
|
|
162
168
|
const originalOpen = XMLHttpRequest.prototype.open;
|
|
163
169
|
const originalSend = XMLHttpRequest.prototype.send;
|
|
@@ -167,17 +173,13 @@ function setupXMLHttpRequestInterceptor(domainsToNotPropagateHeaderTo, domainsTo
|
|
|
167
173
|
...DOMAINS_TO_NOT_PROPAGATE_HEADER_TO_DEFAULT,
|
|
168
174
|
...domainsToNotPropagateHeaderTo,
|
|
169
175
|
];
|
|
170
|
-
// Exclude certain resource types (like images) from being intercepted
|
|
171
|
-
const resourceExcludeList = ["image", "font", "script"];
|
|
172
176
|
// Intercept open()
|
|
173
177
|
XMLHttpRequest.prototype.open = function (method, url, ...args) {
|
|
174
178
|
console.log("Sailfish XMLHttpRequest.prototype.open", method, url);
|
|
175
179
|
this._requestUrl = typeof url === "string" && url.length > 0 ? url : null;
|
|
176
|
-
// Skip interception for excluded
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
resourceExcludeList.some((type) => resourceType.includes(type))) {
|
|
180
|
-
console.log(`[XML] Skipping resource request for ${url} (type: ${resourceType})`);
|
|
180
|
+
// Skip interception for excluded domains
|
|
181
|
+
if (matchUrlWithWildcard(url, combinedIgnoreDomains)) {
|
|
182
|
+
console.log(`[XML] Skipping request for excluded domain: ${url}`);
|
|
181
183
|
return originalOpen.apply(this, [method, url, ...args]);
|
|
182
184
|
}
|
|
183
185
|
return originalOpen.apply(this, [method, url, ...args]);
|
|
@@ -188,9 +190,9 @@ function setupXMLHttpRequestInterceptor(domainsToNotPropagateHeaderTo, domainsTo
|
|
|
188
190
|
const url = this._requestUrl;
|
|
189
191
|
if (!url)
|
|
190
192
|
return originalSend.apply(this, args);
|
|
191
|
-
// Skip domain check for
|
|
193
|
+
// Skip domain check for excluded domains
|
|
192
194
|
if (matchUrlWithWildcard(url, combinedIgnoreDomains)) {
|
|
193
|
-
console.log(`[XML] [
|
|
195
|
+
console.log(`[XML] [ExcludedDomain] IGNORE --> ${url}`);
|
|
194
196
|
return originalSend.apply(this, args);
|
|
195
197
|
}
|
|
196
198
|
// Check if domain should propagate headers
|