Fixed characters not being properly encoded, fixed images not being properly appended, more fixes
This commit is contained in:
parent
0bd8905829
commit
4caec5aefa
12 changed files with 14 additions and 7 deletions
|
@ -5,7 +5,7 @@ const fetch = require("node-fetch");
|
||||||
exports.run = async (message, args) => {
|
exports.run = async (message, args) => {
|
||||||
message.channel.sendTyping();
|
message.channel.sendTyping();
|
||||||
if (args.length === 0) return `${message.author.mention}, you need to provide a URL to screenshot!`;
|
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 endpoint = await getEndpoint.json();
|
||||||
const url = urlRegex.test(args[0]) ? args[0] : `http://${args[0]}`;
|
const url = urlRegex.test(args[0]) ? args[0] : `http://${args[0]}`;
|
||||||
const browser = await puppeteer.connect({
|
const browser = await puppeteer.connect({
|
||||||
|
|
|
@ -46,7 +46,7 @@ exports.run = async (message, args) => {
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "ℹ️ **Status:**",
|
"name": "ℹ️ **Status:**",
|
||||||
"value": member ? member.status : "Unknown"
|
"value": member && member.status ? member.status : "Unknown"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "🎮 **Playing:**",
|
"name": "🎮 **Playing:**",
|
||||||
|
|
|
@ -112,5 +112,6 @@
|
||||||
"Troll",
|
"Troll",
|
||||||
"ay yo the pizza here",
|
"ay yo the pizza here",
|
||||||
"100 gecs",
|
"100 gecs",
|
||||||
"with limited resources"
|
"with limited resources",
|
||||||
|
"free bjs at papa johns"
|
||||||
]
|
]
|
|
@ -16,7 +16,6 @@ class CaptionWorker : public Napi::AsyncWorker {
|
||||||
list <Image> coalesced;
|
list <Image> coalesced;
|
||||||
list <Image> captioned;
|
list <Image> captioned;
|
||||||
list <Image> result;
|
list <Image> result;
|
||||||
Blob caption_blob;
|
|
||||||
readImages(&frames, in_path);
|
readImages(&frames, in_path);
|
||||||
|
|
||||||
size_t width = frames.front().baseColumns();
|
size_t width = frames.front().baseColumns();
|
||||||
|
@ -39,6 +38,7 @@ class CaptionWorker : public Napi::AsyncWorker {
|
||||||
images.push_back(caption_image);
|
images.push_back(caption_image);
|
||||||
images.push_back(image);
|
images.push_back(image);
|
||||||
appendImages(&appended, images.begin(), images.end(), true);
|
appendImages(&appended, images.begin(), images.end(), true);
|
||||||
|
appended.repage();
|
||||||
appended.magick(type);
|
appended.magick(type);
|
||||||
captioned.push_back(appended);
|
captioned.push_back(appended);
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,6 +37,7 @@ class CaptionTwoWorker : public Napi::AsyncWorker {
|
||||||
images.push_back(image);
|
images.push_back(image);
|
||||||
images.push_back(caption_image);
|
images.push_back(caption_image);
|
||||||
appendImages(&appended, images.begin(), images.end(), true);
|
appendImages(&appended, images.begin(), images.end(), true);
|
||||||
|
appended.repage();
|
||||||
appended.magick(type);
|
appended.magick(type);
|
||||||
captioned.push_back(appended);
|
captioned.push_back(appended);
|
||||||
}
|
}
|
||||||
|
|
|
@ -47,6 +47,7 @@ class MirrorWorker : public Napi::AsyncWorker {
|
||||||
mirrored.push_front(mirror);
|
mirrored.push_front(mirror);
|
||||||
}
|
}
|
||||||
appendImages(&final, mirrored.begin(), mirrored.end(), vertical);
|
appendImages(&final, mirrored.begin(), mirrored.end(), vertical);
|
||||||
|
final.repage();
|
||||||
final.magick(type);
|
final.magick(type);
|
||||||
mid.push_back(final);
|
mid.push_back(final);
|
||||||
}
|
}
|
||||||
|
|
|
@ -54,6 +54,7 @@ class MotivateWorker : public Napi::AsyncWorker {
|
||||||
to_append.push_back(top);
|
to_append.push_back(top);
|
||||||
if (bottom_text != "") to_append.push_back(bottom);
|
if (bottom_text != "") to_append.push_back(bottom);
|
||||||
appendImages(&final, to_append.begin(), to_append.end(), true);
|
appendImages(&final, to_append.begin(), to_append.end(), true);
|
||||||
|
final.repage();
|
||||||
final.magick(type);
|
final.magick(type);
|
||||||
mid.push_back(final);
|
mid.push_back(final);
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,10 +29,12 @@ class TileWorker : public Napi::AsyncWorker {
|
||||||
duplicated.push_back(image);
|
duplicated.push_back(image);
|
||||||
}
|
}
|
||||||
appendImages(&appended, duplicated.begin(), duplicated.end());
|
appendImages(&appended, duplicated.begin(), duplicated.end());
|
||||||
|
appended.repage();
|
||||||
for (int i = 0; i < 5; ++i) {
|
for (int i = 0; i < 5; ++i) {
|
||||||
montage.push_back(appended);
|
montage.push_back(appended);
|
||||||
}
|
}
|
||||||
appendImages(&frame, montage.begin(), montage.end(), true);
|
appendImages(&frame, montage.begin(), montage.end(), true);
|
||||||
|
frame.repage();
|
||||||
frame.scale(Geometry("800x800>"));
|
frame.scale(Geometry("800x800>"));
|
||||||
mid.push_back(frame);
|
mid.push_back(frame);
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,6 +36,7 @@ class WatermarkWorker : public Napi::AsyncWorker {
|
||||||
to_append.push_back(image);
|
to_append.push_back(image);
|
||||||
to_append.push_back(watermark);
|
to_append.push_back(watermark);
|
||||||
appendImages(&final, to_append.begin(), to_append.end(), true);
|
appendImages(&final, to_append.begin(), to_append.end(), true);
|
||||||
|
final.repage();
|
||||||
} else if (mc) {
|
} else if (mc) {
|
||||||
image.backgroundColor("white");
|
image.backgroundColor("white");
|
||||||
image.extent(Geometry(image.columns(), image.rows() + 15));
|
image.extent(Geometry(image.columns(), image.rows() + 15));
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "node-gyp configure build",
|
"build": "node-gyp configure build",
|
||||||
"docker:build": "docker build -t headless-chrome-alpine --no-cache ./utils/screenshot",
|
"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"
|
"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>",
|
"author": "Essem <essem@essem.space>",
|
||||||
|
|
|
@ -8,7 +8,7 @@ module.exports = async (object, fromAPI = false) => {
|
||||||
if (process.env.API === "true" && !fromAPI) {
|
if (process.env.API === "true" && !fromAPI) {
|
||||||
const params = [];
|
const params = [];
|
||||||
for (const element of Object.keys(object)) {
|
for (const element of Object.keys(object)) {
|
||||||
params.push(`${element}=${object[element]}`);
|
params.push(`${element}=${encodeURIComponent(object[element])}`);
|
||||||
}
|
}
|
||||||
const form = new FormData();
|
const form = new FormData();
|
||||||
form.append("image", fs.createReadStream(object.path));
|
form.append("image", fs.createReadStream(object.path));
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
FROM alpine:edge
|
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"
|
ENV ALL_PROXY "http://localhost:3128"
|
||||||
RUN echo -e "\nvisible_hostname esmBot\nforwarded_for delete\nvia off\nfollow_x_forwarded_for deny all \
|
RUN echo -e "\nvisible_hostname esmBot\nforwarded_for delete\nvia off\nfollow_x_forwarded_for deny all \
|
||||||
|
|
Loading…
Reference in a new issue