Fixed characters not being properly encoded, fixed images not being properly appended, more fixes

This commit is contained in:
TheEssem 2020-09-09 21:36:20 -05:00
parent 0bd8905829
commit 4caec5aefa
12 changed files with 14 additions and 7 deletions

View file

@ -5,7 +5,7 @@ const fetch = require("node-fetch");
exports.run = async (message, args) => {
message.channel.sendTyping();
if (args.length === 0) return `${message.author.mention}, you need to provide a URL to screenshot!`;
const getEndpoint = await fetch(`http://${process.env.NODE_ENV === "development" ? "192.168.99.100" : "172.17.0.2"}:9222/json/version`);
const getEndpoint = await fetch("http://172.17.0.1:9222/json/version");
const endpoint = await getEndpoint.json();
const url = urlRegex.test(args[0]) ? args[0] : `http://${args[0]}`;
const browser = await puppeteer.connect({

View file

@ -46,7 +46,7 @@ exports.run = async (message, args) => {
},
{
"name": " **Status:**",
"value": member ? member.status : "Unknown"
"value": member && member.status ? member.status : "Unknown"
},
{
"name": "🎮 **Playing:**",

View file

@ -112,5 +112,6 @@
"Troll",
"ay yo the pizza here",
"100 gecs",
"with limited resources"
"with limited resources",
"free bjs at papa johns"
]

View file

@ -16,7 +16,6 @@ class CaptionWorker : public Napi::AsyncWorker {
list <Image> coalesced;
list <Image> captioned;
list <Image> result;
Blob caption_blob;
readImages(&frames, in_path);
size_t width = frames.front().baseColumns();
@ -39,6 +38,7 @@ class CaptionWorker : public Napi::AsyncWorker {
images.push_back(caption_image);
images.push_back(image);
appendImages(&appended, images.begin(), images.end(), true);
appended.repage();
appended.magick(type);
captioned.push_back(appended);
}

View file

@ -37,6 +37,7 @@ class CaptionTwoWorker : public Napi::AsyncWorker {
images.push_back(image);
images.push_back(caption_image);
appendImages(&appended, images.begin(), images.end(), true);
appended.repage();
appended.magick(type);
captioned.push_back(appended);
}

View file

@ -47,6 +47,7 @@ class MirrorWorker : public Napi::AsyncWorker {
mirrored.push_front(mirror);
}
appendImages(&final, mirrored.begin(), mirrored.end(), vertical);
final.repage();
final.magick(type);
mid.push_back(final);
}

View file

@ -54,6 +54,7 @@ class MotivateWorker : public Napi::AsyncWorker {
to_append.push_back(top);
if (bottom_text != "") to_append.push_back(bottom);
appendImages(&final, to_append.begin(), to_append.end(), true);
final.repage();
final.magick(type);
mid.push_back(final);
}

View file

@ -29,10 +29,12 @@ class TileWorker : public Napi::AsyncWorker {
duplicated.push_back(image);
}
appendImages(&appended, duplicated.begin(), duplicated.end());
appended.repage();
for (int i = 0; i < 5; ++i) {
montage.push_back(appended);
}
appendImages(&frame, montage.begin(), montage.end(), true);
frame.repage();
frame.scale(Geometry("800x800>"));
mid.push_back(frame);
}

View file

@ -36,6 +36,7 @@ class WatermarkWorker : public Napi::AsyncWorker {
to_append.push_back(image);
to_append.push_back(watermark);
appendImages(&final, to_append.begin(), to_append.end(), true);
final.repage();
} else if (mc) {
image.backgroundColor("white");
image.extent(Geometry(image.columns(), image.rows() + 15));

View file

@ -9,7 +9,7 @@
"scripts": {
"build": "node-gyp configure build",
"docker:build": "docker build -t headless-chrome-alpine --no-cache ./utils/screenshot",
"docker:run-ss": "docker run --rm --shm-size=128m headless-chrome-alpine",
"docker:run-ss": "docker run --rm --network=host --shm-size=128m headless-chrome-alpine",
"docker:run-lava": "docker run --rm --network host -v \"$(pwd)\"/application.yml:/opt/Lavalink/application.yml -v \"$(pwd)\"/assets:/opt/Lavalink/assets fredboat/lavalink:dev"
},
"author": "Essem <essem@essem.space>",

View file

@ -8,7 +8,7 @@ module.exports = async (object, fromAPI = false) => {
if (process.env.API === "true" && !fromAPI) {
const params = [];
for (const element of Object.keys(object)) {
params.push(`${element}=${object[element]}`);
params.push(`${element}=${encodeURIComponent(object[element])}`);
}
const form = new FormData();
form.append("image", fs.createReadStream(object.path));

View file

@ -4,7 +4,7 @@
FROM alpine:edge
RUN apk --no-cache upgrade && apk add --no-cache chromium squid sudo libstdc++ harfbuzz nss freetype ttf-freefont wqy-zenhei zlib-dev wait4ports dbus chromium-chromedriver grep
RUN apk --no-cache upgrade && apk add --no-cache chromium squid sudo libstdc++ harfbuzz nss freetype ttf-freefont zlib-dev wait4ports dbus chromium-chromedriver grep
ENV ALL_PROXY "http://localhost:3128"
RUN echo -e "\nvisible_hostname esmBot\nforwarded_for delete\nvia off\nfollow_x_forwarded_for deny all \