Browse Source

Fix PNG embedding

pull/46/head
coomdev 2 years ago
parent
commit
ce67bff719
  1. 2
      main.meta.js
  2. 507
      main.user.js
  3. 8
      src/png.ts

2
main.meta.js

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

507
main.user.js

File diff suppressed because it is too large

8
src/png.ts

@ -70,11 +70,11 @@ export class PNGEncoder {
async insertchunk(chunk: PNGChunk) {
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
const buff = chunk[1];
await this.writer.write(await buff()); // chunk includes chunkname
b.writeInt32BE(buf(await buff()), 0);
await this.writer.write(buff); // chunk includes chunkname
b.writeInt32BE(buf(buff), 0);
await this.writer.write(b);
}

Loading…
Cancel
Save