summaryrefslogtreecommitdiffstats
path: root/web/index.js
diff options
context:
space:
mode:
Diffstat (limited to 'web/index.js')
-rw-r--r--web/index.js15
1 files changed, 14 insertions, 1 deletions
diff --git a/web/index.js b/web/index.js
index c6fb3f7..e8accf0 100644
--- a/web/index.js
+++ b/web/index.js
@@ -102,12 +102,25 @@ async function getSysinfo() {
102} 102}
103 103
104async function load(gpxFile) { 104async function load(gpxFile) {
105 let compressedParts = [];
106 const compressedReader = gpxFile.stream().pipeThrough(new CompressionStream("deflate-raw")).getReader();
107 while (true) {
108 const { done, value } = await compressedReader.read();
109 if (done) {
110 break;
111 } else {
112 compressedParts.push(value);
113 }
114 }
115
105 const rsp = await fetch(apiBaseUrl + "/gpx", { 116 const rsp = await fetch(apiBaseUrl + "/gpx", {
106 method: "POST", 117 method: "POST",
107 headers: { 118 headers: {
108 "Accept-Language": "nl-NL", 119 "Accept-Language": "nl-NL",
120 "Content-Encoding": "x-deflate-raw",
121 "Content-Type": "application/gpx+xml",
109 }, 122 },
110 body: gpxFile, 123 body: new Blob(compressedParts),
111 }); 124 });
112 if (!rsp.ok) { 125 if (!rsp.ok) {
113 await showProblem(rsp); 126 await showProblem(rsp);