Fix PNG embedding

This commit is contained in:
coomdev 2022-01-13 13:55:57 +01:00
parent 32e897ba66
commit ce67bff719
3 changed files with 261 additions and 256 deletions

View File

@ -1,7 +1,7 @@
// ==UserScript== // ==UserScript==
// @name PNGExtraEmbed // @name PNGExtraEmbed
// @namespace https://coom.tech/ // @namespace https://coom.tech/
// @version 0.133 // @version 0.135
// @description uhh // @description uhh
// @author You // @author You
// @match https://boards.4channel.org/* // @match https://boards.4channel.org/*

File diff suppressed because it is too large Load Diff

View File

@ -70,11 +70,11 @@ export class PNGEncoder {
async insertchunk(chunk: PNGChunk) { async insertchunk(chunk: PNGChunk) {
const b = Buffer.alloc(4); const b = Buffer.alloc(4);
b.writeInt32BE(chunk[1].length - 4, 0); const buff = await chunk[1]();
b.writeInt32BE(buff.length - 4, 0);
await this.writer.write(b); // write length await this.writer.write(b); // write length
const buff = chunk[1]; await this.writer.write(buff); // chunk includes chunkname
await this.writer.write(await buff()); // chunk includes chunkname b.writeInt32BE(buf(buff), 0);
b.writeInt32BE(buf(await buff()), 0);
await this.writer.write(b); await this.writer.write(b);
} }