Skip to content

Commit

Permalink
NBTify Deflate-Raw
Browse files Browse the repository at this point in the history
Bringing Dovetail up to the latest version of NBTify! That means that now there is support for Deflate-Raw compressed files! This update was waiting on fixes for some additional compression errors in NBTify that went unnoticed in the tests I wrote for Node, because Node has a different streams implementation which was behaving differently, and is passing the tests unexpectedly, meaning the extra unhandled errors were only happening in the browser.

#1
  • Loading branch information
Offroaders123 committed Jul 3, 2023
1 parent fe31ed1 commit 8fa55cd
Show file tree
Hide file tree
Showing 6 changed files with 39 additions and 27 deletions.
32 changes: 20 additions & 12 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -63,18 +63,26 @@ <h3>Format Options</h3>
<fieldset>
<legend>Compression</legend>

<label>
<input type="radio" name="compression" value="none">
None
</label>
<label>
<input type="radio" name="compression" value="gzip">
gzip
</label>
<label>
<input type="radio" name="compression" value="deflate">
deflate (zlib)
</label>
<div>
<label>
<input type="radio" name="compression" value="none">
None
</label>
<label>
<input type="radio" name="compression" value="gzip">
gzip
</label>
</div>
<div>
<label>
<input type="radio" name="compression" value="deflate">
deflate (zlib)
</label>
<label>
<input type="radio" name="compression" value="deflate-raw">
deflate-raw
</label>
</div>
</fieldset>

<fieldset>
Expand Down
16 changes: 8 additions & 8 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@
},
"dependencies": {
"compression-streams-polyfill": "^0.1.4",
"nbtify": "^1.35.2"
"nbtify": "^1.60.2"
},
"devDependencies": {
"better-typescript": "^0.1.3",
"new-javascript": "^0.3.4",
"typescript": "^5.1.3",
"typescript": "^5.1.6",
"vite": "^4.3.9"
}
}
2 changes: 1 addition & 1 deletion public/service-worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
var self = /** @type { ServiceWorkerGlobalScope } */ (/** @type { unknown } */ (globalThis));

const NAME = "Dovetail";
const VERSION = "v1.6.2";
const VERSION = "v1.6.3";
const CACHE_NAME = /** @type { const } */ (`${NAME} ${VERSION}`);

self.addEventListener("activate",event => {
Expand Down
8 changes: 4 additions & 4 deletions src/app.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import "./compression-polyfill.js";
import { read, write, parse, stringify, NBTData, Int32 } from "nbtify";
import type { Name, Endian, Compression, BedrockLevel, NBTDataOptions, RootTag } from "nbtify";
import type { Name, Endian, Compression, BedrockLevel, FormatOptions, RootTag } from "nbtify";

const platform = navigator.userAgentData?.platform ?? navigator.platform;
const isiOSDevice = /^(Mac|iPhone|iPad|iPod)/i.test(platform) && typeof navigator.standalone === "boolean";
Expand Down Expand Up @@ -110,7 +110,7 @@ export async function openFile(file: File): Promise<void> {
/**
* Updates the Format Options dialog to match the NBT file's metadata.
*/
export function openOptions({ name, endian, compression, bedrockLevel }: NBTData): NBTDataOptions {
export function openOptions({ name, endian, compression, bedrockLevel }: NBTData): FormatOptions {
const { elements } = formatForm;

if (name !== null){
Expand Down Expand Up @@ -143,15 +143,15 @@ export async function readFile<T extends RootTag = any>(file: File): Promise<NBT
return read<T>(buffer,{ strict: false });
} else {
alert(error);
return null;
return null;
}
}
}

/**
* Turns the values from the Format Options dialog into the NBT file's metadata.
*/
export function saveOptions(): NBTDataOptions {
export function saveOptions(): FormatOptions {
const { elements } = formatForm;

const name: Name = (elements.disableName.checked) ? null : elements.name.value;
Expand Down
4 changes: 4 additions & 0 deletions styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -99,4 +99,8 @@ form {
display: flex;
gap: 0.75rem;
flex-direction: column;
}

fieldset > div + div {
margin-top: 0.25em;
}

0 comments on commit 8fa55cd

Please sign in to comment.