Skip to content

Commit

Permalink
Update brotli decompression code
Browse files Browse the repository at this point in the history
  • Loading branch information
Jcparkyn committed Nov 26, 2023
1 parent 43f97bd commit f2b50f1
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 22 deletions.
25 changes: 23 additions & 2 deletions Nodexr/wwwroot/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,29 @@
<script src="js/GeneratedJS/NoodleDragHandler.js" type="text/javascript"></script>
<script src="js/GeneratedJS/ZoomHandler.js" type="text/javascript"></script>
<script src="js/GeneratedJS/WindowSplits.js" type="text/javascript"></script>
<script src="js/Decompression/decode.js" type="text/javascript"></script>
<script src="js/Decompression/BrotliDecompress.js" type="text/javascript"></script>
<script type="module">
import { BrotliDecode } from './js/Decompression/decode.min.js';
Blazor.start({
loadBootResource: function (type, name, defaultUri, integrity) {
if (type !== 'dotnetjs' && location.hostname !== 'localhost' && type !== 'configuration') {
return (async function () {
const response = await fetch(defaultUri + '.br', { cache: 'no-cache' });
if (!response.ok) {
throw new Error(response.statusText);
}
const originalResponseBuffer = await response.arrayBuffer();
const originalResponseArray = new Int8Array(originalResponseBuffer);
const decompressedResponseArray = BrotliDecode(originalResponseArray);
const contentType = type ===
'dotnetwasm' ? 'application/wasm' : 'application/octet-stream';
return new Response(decompressedResponseArray,
{ headers: { 'content-type': contentType } });
})();
}
}
});
</script>

<script data-goatcounter="https://nodexr.goatcounter.com/count"
async src="//gc.zgo.at/count.js"></script>
</body>
Expand Down
19 changes: 0 additions & 19 deletions Nodexr/wwwroot/js/Decompression/BrotliDecompress.js

This file was deleted.

1 change: 0 additions & 1 deletion Nodexr/wwwroot/js/Decompression/decode.js

This file was deleted.

1 change: 1 addition & 0 deletions Nodexr/wwwroot/js/Decompression/decode.min.js

Large diffs are not rendered by default.

0 comments on commit f2b50f1

Please sign in to comment.