Add support for zlib-compressed levels in URLs
This commit is contained in:
parent
e277a1363e
commit
29df283f80
@ -2631,7 +2631,7 @@ export class Editor extends PrimaryView {
|
||||
}, 60 * 1000);
|
||||
});
|
||||
_make_button("Share", ev => {
|
||||
let data = util.b64encode(c2g.synthesize_level(this.stored_level));
|
||||
let data = util.b64encode(fflate.zlibSync(new Uint8Array(c2g.synthesize_level(this.stored_level))));
|
||||
let url = new URL(location);
|
||||
url.searchParams.delete('level');
|
||||
url.searchParams.delete('setpath');
|
||||
|
||||
@ -3263,6 +3263,11 @@ async function main() {
|
||||
else if (b64level) {
|
||||
// TODO all the more important to show errors!!
|
||||
let buf = util.b64decode(b64level);
|
||||
let u8array = new Uint8Array(buf);
|
||||
if (u8array[0] === 0x78) {
|
||||
// zlib compressed
|
||||
buf = fflate.unzlibSync(u8array).buffer;
|
||||
}
|
||||
await conductor.parse_and_load_game(buf, null, 'shared.c2m', null, "Shared level");
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user