Skip to content

Commit

Permalink
v13.1.3
Browse files Browse the repository at this point in the history
  • Loading branch information
boehlerlukas committed Jan 15, 2024
1 parent 5f330f1 commit ebbc6d4
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 6 deletions.
2 changes: 1 addition & 1 deletion build/index.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion demo/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Gleap.setFrameUrl("http://0.0.0.0:3001");
Gleap.setApiUrl("http://0.0.0.0:9000");
Gleap.setWSApiUrl("ws://0.0.0.0:8080");

Gleap.initialize("ogWhNhuiZcGWrva5nlDS8l7a78OfaLlV");
Gleap.initialize("rinrKZAvjqOheSjpdUjFnp01tSOF3WTd");

/*Gleap.setUrlHandler((url, newTab) => {
alert("URL: " + url + " newTab: " + newTab);
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "gleap",
"version": "13.1.2",
"version": "13.1.3",
"main": "build/index.js",
"scripts": {
"start": "webpack serve",
Expand Down
1 change: 1 addition & 0 deletions published/13.1.3/index.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion published/latest/index.js

Large diffs are not rendered by default.

18 changes: 16 additions & 2 deletions src/GleapNetworkIntercepter.js
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,21 @@ class GleapNetworkIntercepter {
}

getTextContentSize(text) {
const size = new TextEncoder().encode(text).length;
var size = 0;
try {
size = new TextEncoder().encode(text).length;
} catch (exp) {
try {
size = encodeURI(s).split(/%..|./).length - 1;
} catch (exp) {
try {
size = new Blob([text]).size;
} catch (exp) {
size = text.length;
}
}
}

const kiloBytes = size / 1024;
const megaBytes = kiloBytes / 1024;
return megaBytes;
Expand Down Expand Up @@ -430,7 +444,7 @@ class GleapNetworkIntercepter {
XMLHttpRequest.prototype.gleapSetRequestHeader =
XMLHttpRequest.prototype.setRequestHeader;
}

if (XMLHttpRequest.prototype.gleapSetRequestHeader) {
XMLHttpRequest.prototype.setRequestHeader = function (header, value) {
if (!this.requestHeaders) {
Expand Down

0 comments on commit ebbc6d4

Please sign in to comment.