Browse Source

use file hash as filename when using hydrus

pull/46/head
coomdev 2 years ago
parent
commit
383ed77480
  1. 2
      main.meta.js
  2. 6
      main.user.js
  3. 2
      src/utils.ts

2
main.meta.js

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

6
main.user.js

@ -1,7 +1,7 @@
// ==UserScript== // ==UserScript==
// @name PNGExtraEmbed // @name PNGExtraEmbed
// @namespace https://coom.tech/ // @namespace https://coom.tech/
// @version 0.188 // @version 0.189
// @description uhh // @description uhh
// @author You // @author You
// @match https://boards.4channel.org/* // @match https://boards.4channel.org/*
@ -81,7 +81,7 @@
var define_BUILD_VERSION_default; var define_BUILD_VERSION_default;
var init_define_BUILD_VERSION = __esm({ var init_define_BUILD_VERSION = __esm({
"<define:BUILD_VERSION>"() { "<define:BUILD_VERSION>"() {
define_BUILD_VERSION_default = [0, 188]; define_BUILD_VERSION_default = [0, 189];
} }
}); });
@ -14827,7 +14827,7 @@
{ {
thumbnail: import_buffer2.Buffer.from(await client.getThumbnail(id)), thumbnail: import_buffer2.Buffer.from(await client.getThumbnail(id)),
data: async () => import_buffer2.Buffer.from(await client.getFile(id)), data: async () => import_buffer2.Buffer.from(await client.getFile(id)),
filename: "file" + metas.metadata[idx].ext filename: metas.metadata[idx].hash + metas.metadata[idx].ext
} }
]; ];
})); }));

2
src/utils.ts

@ -254,7 +254,7 @@ export async function getFileFromHydrus(client: HydrusClient,
Buffer.from( Buffer.from(
await client.getFile(id)! await client.getFile(id)!
), ),
filename: 'file' + metas.metadata[idx].ext, filename: metas.metadata[idx].hash + metas.metadata[idx].ext,
}, },
] as [number, EmbeddedFile]; ] as [number, EmbeddedFile];
}) })

Loading…
Cancel
Save