Properly sanitize text on motivate
This commit is contained in:
parent
7796826057
commit
6963c44e60
1 changed files with 2 additions and 2 deletions
|
@ -15,12 +15,12 @@ exports.run = async (message, args) => {
|
||||||
const size = await gm(buffer).sizePromise();
|
const size = await gm(buffer).sizePromise();
|
||||||
await gm(buffer).coalesce().background("black").gravity("Center").extent(600, size.height + 50).writePromise(file);
|
await gm(buffer).coalesce().background("black").gravity("Center").extent(600, size.height + 50).writePromise(file);
|
||||||
const size2 = await gm(file).sizePromise();
|
const size2 = await gm(file).sizePromise();
|
||||||
await gm().background("black").out("-size", "600").fill("white").font("Times").pointSize(56).gravity("Center").out(`pango:${topText}`).gravity("South").out("-splice", bottomText ? "0x0" : "0x20").writePromise(text);
|
await gm().background("black").out("-size", "600").fill("white").font("Times").pointSize(56).gravity("Center").out(`pango:${topText.replace(/&/g, "\\&").replace(/>/g, "\\>").replace(/</g, "\\<").replace(/"/g, "\\"").replace(/'/g, "\\'")}`).gravity("South").out("-splice", bottomText ? "0x0" : "0x20").writePromise(text);
|
||||||
const size3 = await gm(text).sizePromise();
|
const size3 = await gm(text).sizePromise();
|
||||||
const command2 = gm(file).gravity("North").coalesce().background("black").extent(600, size2.height + size3.height).out("null:", "(", text, "-set", "page", `+0+${size2.height}`, ")", "-layers", "composite", "-layers", "optimize");
|
const command2 = gm(file).gravity("North").coalesce().background("black").extent(600, size2.height + size3.height).out("null:", "(", text, "-set", "page", `+0+${size2.height}`, ")", "-layers", "composite", "-layers", "optimize");
|
||||||
let resultBuffer;
|
let resultBuffer;
|
||||||
if (bottomText) {
|
if (bottomText) {
|
||||||
await gm().background("black").out("-size", "600").fill("white").font("Times").pointSize(28).gravity("Center").out(`pango:${bottomText}`).gravity("South").out("-splice", "0x20").writePromise(text2);
|
await gm().background("black").out("-size", "600").fill("white").font("Times").pointSize(28).gravity("Center").out(`pango:${bottomText.replace(/&/g, "\\&").replace(/>/g, "\\>").replace(/</g, "\\<").replace(/"/g, "\\"").replace(/'/g, "\\'")}`).gravity("South").out("-splice", "0x20").writePromise(text2);
|
||||||
const size4 = await gm(text2).sizePromise();
|
const size4 = await gm(text2).sizePromise();
|
||||||
resultBuffer = await gm(await command2.bufferPromise(image.type)).gravity("North").coalesce().background("black").extent(600, size2.height + size3.height + size4.height).out("null:", "(", text2, "-set", "page", `+0+${size2.height + size3.height}`, ")", "-layers", "composite", "-layers", "optimize").bufferPromise(image.type);
|
resultBuffer = await gm(await command2.bufferPromise(image.type)).gravity("North").coalesce().background("black").extent(600, size2.height + size3.height + size4.height).out("null:", "(", text2, "-set", "page", `+0+${size2.height + size3.height}`, ")", "-layers", "composite", "-layers", "optimize").bufferPromise(image.type);
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in a new issue