aboutsummaryrefslogtreecommitdiff
path: root/xP/public/xP.js
diff options
context:
space:
mode:
authorPřemysl Eric Janouch <p@janouch.name>2022-09-15 02:32:15 +0200
committerPřemysl Eric Janouch <p@janouch.name>2022-09-15 02:32:58 +0200
commit9cf44aa4dd56c164d71d73d91741ffd11b863ffb (patch)
tree2e939fe626b94b3b28b11ebbd14439c18657378a /xP/public/xP.js
parentb53fc1918fe410d08c3ea400d61d822fe2facc89 (diff)
downloadxK-9cf44aa4dd56c164d71d73d91741ffd11b863ffb.tar.gz
xK-9cf44aa4dd56c164d71d73d91741ffd11b863ffb.tar.xz
xK-9cf44aa4dd56c164d71d73d91741ffd11b863ffb.zip
xP: speed up log decoding
Diffstat (limited to 'xP/public/xP.js')
-rw-r--r--xP/public/xP.js6
1 files changed, 4 insertions, 2 deletions
diff --git a/xP/public/xP.js b/xP/public/xP.js
index ca5fcf2..d302a86 100644
--- a/xP/public/xP.js
+++ b/xP/public/xP.js
@@ -117,8 +117,10 @@ class RelayRpc extends EventTarget {
}
base64decode(str) {
- return decodeURIComponent(atob(str).split('').map(c =>
- '%' + ('00' + c.charCodeAt(0).toString(16)).slice(-2)).join(''))
+ const text = atob(str), bytes = new Uint8Array(text.length)
+ for (let i = 0; i < text.length; i++)
+ bytes[i] = text.charCodeAt(i)
+ return new TextDecoder().decode(bytes)
}
}