StickerSpoof: fix small resolutions; AnonymiseFiles: fix extension logic
This commit is contained in:
parent
b032e9b6e3
commit
e0450531ef
2 changed files with 6 additions and 4 deletions
|
@ -67,7 +67,9 @@ export default definePlugin({
|
||||||
|
|
||||||
anonymise(file: string) {
|
anonymise(file: string) {
|
||||||
let name = "image";
|
let name = "image";
|
||||||
const ext = file.match(/\..+$/g)?.[0] ?? "";
|
const extIdx = file.lastIndexOf(".");
|
||||||
|
const ext = extIdx !== -1 ? file.slice(extIdx) : "";
|
||||||
|
|
||||||
switch (Settings.plugins.AnonymiseFileNames.method) {
|
switch (Settings.plugins.AnonymiseFileNames.method) {
|
||||||
case Methods.Random:
|
case Methods.Random:
|
||||||
const chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
|
const chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
|
||||||
|
|
|
@ -169,14 +169,14 @@ export default definePlugin({
|
||||||
const resolution = Settings.plugins.NitroBypass.stickerSize;
|
const resolution = Settings.plugins.NitroBypass.stickerSize;
|
||||||
|
|
||||||
const canvas = document.createElement("canvas");
|
const canvas = document.createElement("canvas");
|
||||||
canvas.width = width;
|
canvas.width = resolution;
|
||||||
canvas.height = height;
|
canvas.height = resolution;
|
||||||
|
|
||||||
const ctx = canvas.getContext("2d", {
|
const ctx = canvas.getContext("2d", {
|
||||||
willReadFrequently: true
|
willReadFrequently: true
|
||||||
})!;
|
})!;
|
||||||
|
|
||||||
const scale = resolution / width;
|
const scale = resolution / Math.max(width, height);
|
||||||
ctx.scale(scale, scale);
|
ctx.scale(scale, scale);
|
||||||
|
|
||||||
let lastImg: HTMLImageElement | null = null;
|
let lastImg: HTMLImageElement | null = null;
|
||||||
|
|
Loading…
Reference in a new issue