diff --git a/CMakeLists.txt b/CMakeLists.txt index 8617eba..eb8fc66 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,24 +2,34 @@ cmake_minimum_required(VERSION 3.15) cmake_policy(SET CMP0091 NEW) cmake_policy(SET CMP0042 NEW) project(image) -include_directories(${CMAKE_JS_INC}) + file(GLOB SOURCE_FILES "natives/*.cc" "natives/*.h") -add_library(${PROJECT_NAME} SHARED ${SOURCE_FILES} ${CMAKE_JS_SRC}) -set_target_properties(${PROJECT_NAME} PROPERTIES PREFIX "" SUFFIX ".node") -target_link_libraries(${PROJECT_NAME} ${CMAKE_JS_LIB}) -target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) -if(MSVC) # todo: change flags for more parity with GCC/clang, I don't know much about MSVC so pull requests are open -set(CMAKE_CXX_FLAGS "/Wall /EHsc /GS") -set(CMAKE_CXX_FLAGS_DEBUG "/Zi") -set(CMAKE_CXX_FLAGS_RELEASE "/Ox") -set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON) -set(BUILD_SHARED_LIBS TRUE) + +if (CMAKE_JS_VERSION) + include_directories(${CMAKE_JS_INC}) + add_library(${PROJECT_NAME} SHARED ${SOURCE_FILES} ${CMAKE_JS_SRC} natives/node/image.cc) + set_target_properties(${PROJECT_NAME} PROPERTIES PREFIX "" SUFFIX ".node") + target_link_libraries(${PROJECT_NAME} ${CMAKE_JS_LIB}) else() -set(CMAKE_CXX_FLAGS "-Wall -Wextra -Werror=format-security -Wno-cast-function-type -fexceptions -D_GLIBCXX_ASSERTIONS -fstack-clash-protection -pedantic -D_GLIBCXX_USE_CXX11_ABI=1") -set(CMAKE_CXX_FLAGS_DEBUG "-g") -set(CMAKE_CXX_FLAGS_RELEASE "-O3") + add_executable(${PROJECT_NAME} ${SOURCE_FILES} natives/cli/image.cc) endif() +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) + +if(MSVC) # todo: change flags for more parity with GCC/clang, I don't know much about MSVC so pull requests are open + set(CMAKE_CXX_FLAGS "/Wall /EHsc /GS") + set(CMAKE_CXX_FLAGS_DEBUG "/Zi") + set(CMAKE_CXX_FLAGS_RELEASE "/Ox") + set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON) + set(BUILD_SHARED_LIBS TRUE) +else() + set(CMAKE_CXX_FLAGS "-Wall -Wextra -Werror=format-security -Wno-cast-function-type -fexceptions -D_GLIBCXX_ASSERTIONS -fstack-clash-protection -pedantic -D_GLIBCXX_USE_CXX11_ABI=1") + set(CMAKE_CXX_FLAGS_DEBUG "-g") + set(CMAKE_CXX_FLAGS_RELEASE "-O2") +endif() + +set(CMAKE_EXPORT_COMPILE_COMMANDS ON) + find_package(ImageMagick REQUIRED COMPONENTS Magick++ MagickCore) add_definitions(-DMAGICKCORE_QUANTUM_DEPTH=16) add_definitions(-DMAGICKCORE_HDRI_ENABLE=0) @@ -31,7 +41,7 @@ include_directories(${VIPS_INCLUDE_DIRS}) link_directories(${VIPS_LIBRARY_DIRS}) target_link_libraries(${PROJECT_NAME} ${VIPS_LDFLAGS}) -if(MSVC AND CMAKE_JS_NODELIB_DEF AND CMAKE_JS_NODELIB_TARGET) +if(MSVC AND CMAKE_JS_NODELIB_DEF AND CMAKE_JS_NODELIB_TARGET AND CMAKE_JS_VERSION) # Generate node.lib execute_process(COMMAND ${CMAKE_AR} /def:${CMAKE_JS_NODELIB_DEF} /out:${CMAKE_JS_NODELIB_TARGET} ${CMAKE_STATIC_LINKER_FLAGS}) endif() diff --git a/application.yml b/application.yml index 744b708..96c4464 100644 --- a/application.yml +++ b/application.yml @@ -28,7 +28,7 @@ lavalink: plugins: - dependency: "com.github.esmBot:lava-xm-plugin:v0.2.1" repository: "https://jitpack.io" - - dependency: "com.github.TopiSenpai.LavaSrc:lavasrc-plugin:3.1.7" + - dependency: "com.github.TopiSenpai.LavaSrc:lavasrc-plugin:3.2.0" repository: "https://jitpack.io" plugins: diff --git a/assets/images/scottmap.png b/assets/images/scottmap.png new file mode 100644 index 0000000..f57e04e Binary files /dev/null and b/assets/images/scottmap.png differ diff --git a/classes/imageCommand.js b/classes/imageCommand.js index a9ba426..554a17b 100644 --- a/classes/imageCommand.js +++ b/classes/imageCommand.js @@ -25,7 +25,9 @@ class ImageCommand extends Command { const imageParams = { cmd: this.constructor.command, - params: {}, + params: { + togif: !!this.options.togif + }, id: (this.interaction ?? this.message).id }; @@ -129,6 +131,11 @@ class ImageCommand extends Command { description: "An image/GIF URL" }); } + this.flags.push({ + name: "togif", + type: 5, + description: "Force GIF output" + }); return this; } diff --git a/commands/general/eval.js b/commands/general/eval.js index 64e3bea..62b0e1f 100644 --- a/commands/general/eval.js +++ b/commands/general/eval.js @@ -17,9 +17,11 @@ class EvalCommand extends Command { const sendString = `\`\`\`js\n${cleaned}\n\`\`\``; if (sendString.length >= 2000) { return { - text: "The result was too large, so here it is as a file:", - file: cleaned, - name: "result.txt" + content: "The result was too large, so here it is as a file:", + files: [{ + contents: cleaned, + name: "result.txt" + }] }; } else { return sendString; diff --git a/commands/general/restart.js b/commands/general/restart.js index 5f4c496..a39cf2a 100644 --- a/commands/general/restart.js +++ b/commands/general/restart.js @@ -7,7 +7,7 @@ class RestartCommand extends Command { this.success = false; return "Only the bot owner can restart me!"; } - await this.message.channel.createMessage(Object.assign({ + await this.channel.createMessage(Object.assign({ content: "esmBot is restarting." }, this.reference)); process.exit(1); diff --git a/commands/image-editing/explode.js b/commands/image-editing/explode.js index a03bda2..63168f4 100644 --- a/commands/image-editing/explode.js +++ b/commands/image-editing/explode.js @@ -1,10 +1,6 @@ import ImageCommand from "../../classes/imageCommand.js"; class ExplodeCommand extends ImageCommand { - params = { - amount: -1 - }; - static description = "Explodes an image"; static aliases = ["exp"]; diff --git a/commands/image-editing/implode.js b/commands/image-editing/implode.js index 60f9909..1f05b2e 100644 --- a/commands/image-editing/implode.js +++ b/commands/image-editing/implode.js @@ -2,7 +2,7 @@ import ImageCommand from "../../classes/imageCommand.js"; class ImplodeCommand extends ImageCommand { params = { - amount: 1 + implode: true }; static description = "Implodes an image"; diff --git a/config/messages.json b/config/messages.json index d6d5d25..4c6f16f 100644 --- a/config/messages.json +++ b/config/messages.json @@ -128,7 +128,6 @@ "$19 Fortnite Card", "Wild Woody", "RDI Halcyon", - "cry about it", "KFC", "Cave Story", "YouTube ads", @@ -159,7 +158,6 @@ "Item Asylum", "TIC-80", "Ghetto Smosh", - "brought to you by the DFS project", "Splatoon 3", "changed", "Chutes and Ladders", @@ -196,6 +194,9 @@ "ANTONBLAST", "[object Object]", "Xonotic", + "Lario", + "Hi-Fi Rush", + "Calckey", "The clock is ticking." ] } diff --git a/docs/custom-commands.md b/docs/custom-commands.md index 1b8b1e7..2cce3e9 100644 --- a/docs/custom-commands.md +++ b/docs/custom-commands.md @@ -22,7 +22,7 @@ As you can see, each command is grouped into categories, which are represented b !!! tip The `message` category is special; commands in here act as right-click context menu message commands instead of "classic" or slash commands. -## Commnand Structure +## Command Structure It's recommended to use the `Command` class located in `classes/command.js` to create a new command in most cases. This class provides various parameters and fields that will likely be useful when creating a command. Here is a simple example of a working command file: ```js import Command from "../../classes/command.js"; diff --git a/events/guildCreate.js b/events/guildCreate.js new file mode 100644 index 0000000..f63ca10 --- /dev/null +++ b/events/guildCreate.js @@ -0,0 +1,6 @@ +import { log } from "../utils/logger.js"; + +// run when the bot is added to a guild +export default async (client, guild) => { + log(`[GUILD JOIN] ${guild.name} (${guild.id}) added the bot.`); +}; diff --git a/events/voiceChannelLeave.js b/events/voiceChannelLeave.js index 137b21b..00e8fdf 100644 --- a/events/voiceChannelLeave.js +++ b/events/voiceChannelLeave.js @@ -1,6 +1,7 @@ import { players, queues, skipVotes } from "../utils/soundplayer.js"; import AwaitRejoin from "../utils/awaitrejoin.js"; import { random } from "../utils/misc.js"; +import { logger } from "../utils/logger.js"; const isWaiting = new Map(); @@ -16,9 +17,10 @@ export default async (client, member, oldChannel) => { content: "🔊 Waiting 10 seconds for someone to return..." }); const awaitRejoin = new AwaitRejoin(oldChannel, true, member.id); - awaitRejoin.on("end", async (rejoined, newMember) => { + awaitRejoin.once("end", async (rejoined, newMember, cancel) => { isWaiting.delete(oldChannel.id); if (rejoined) { + if (cancel) return; connection.player.setPaused(false); if (member.id !== newMember.id) { players.set(connection.voiceChannel.guildID, { player: connection.player, type: connection.type, host: newMember.id, voiceChannel: connection.voiceChannel, originalChannel: connection.originalChannel, loop: connection.loop, shuffle: connection.shuffle, playMessage: connection.playMessage }); @@ -29,19 +31,20 @@ export default async (client, member, oldChannel) => { try { await waitMessage.delete(); } catch { - // no-op + logger.warn(`Failed to delete wait message ${waitMessage.id}`); } } } else { try { if (waitMessage.channel.messages.has(waitMessage.id)) await waitMessage.delete(); } catch { - // no-op + logger.warn(`Failed to delete wait message ${waitMessage.id}`); } + if (cancel) return; try { connection.player.node.leaveChannel(connection.originalChannel.guildID); } catch { - // no-op + logger.warn(`Failed to leave voice channel ${connection.originalChannel.guildID}`); } players.delete(connection.originalChannel.guildID); queues.delete(connection.originalChannel.guildID); @@ -58,13 +61,13 @@ export default async (client, member, oldChannel) => { content: "🔊 Waiting 10 seconds for the host to return..." }); const awaitRejoin = new AwaitRejoin(oldChannel, false, member.id); - awaitRejoin.on("end", async (rejoined) => { + awaitRejoin.once("end", async (rejoined) => { isWaiting.delete(oldChannel.id); if (rejoined) { try { if (waitMessage.channel.messages.has(waitMessage.id)) await waitMessage.delete(); } catch { - // no-op + logger.warn(`Failed to delete wait message ${waitMessage.id}`); } } else { const members = oldChannel.voiceMembers.filter((i) => i.id !== client.user.id && !i.bot); @@ -72,12 +75,12 @@ export default async (client, member, oldChannel) => { try { if (waitMessage.channel.messages.has(waitMessage.id)) await waitMessage.delete(); } catch { - // no-op + logger.warn(`Failed to delete wait message ${waitMessage.id}`); } try { connection.player.node.leaveChannel(connection.originalChannel.guildID); } catch { - // no-op + logger.warn(`Failed to leave voice channel ${connection.originalChannel.guildID}`); } players.delete(connection.originalChannel.guildID); queues.delete(connection.originalChannel.guildID); @@ -99,7 +102,7 @@ export default async (client, member, oldChannel) => { try { connection.player.node.leaveChannel(connection.originalChannel.guildID); } catch { - // no-op + logger.warn(`Failed to leave voice channel ${connection.originalChannel.guildID}`); } players.delete(connection.originalChannel.guildID); queues.delete(connection.originalChannel.guildID); diff --git a/mkdocs.yml b/mkdocs.yml index b283150..7f68add 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -2,7 +2,7 @@ site_name: esmBot docs_dir: docs/ repo_name: 'esmBot/esmBot' repo_url: 'https://github.com/esmBot/esmBot' -copyright: Copyright © 2018 - 2022 Essem +copyright: Copyright © 2018 - 2023 Essem nav: - Home: index.md - setup.md diff --git a/natives/blur.cc b/natives/blur.cc index 8cdebd4..5347f8e 100644 --- a/natives/blur.cc +++ b/natives/blur.cc @@ -7,14 +7,14 @@ using namespace std; using namespace vips; -char *Blur(string *type, char *BufferData, size_t BufferLength, +char *Blur(string type, string *outType, char *BufferData, size_t BufferLength, ArgumentMap Arguments, size_t *DataSize) { bool sharp = GetArgument(Arguments, "sharp"); VOption *options = VImage::option()->set("access", "sequential"); VImage in = VImage::new_from_buffer(BufferData, BufferLength, "", - *type == "gif" ? options->set("n", -1) : options) + type == "gif" ? options->set("n", -1) : options) .colourspace(VIPS_INTERPRETATION_sRGB); if (!in.has_alpha()) in = in.bandjoin(255); @@ -25,7 +25,7 @@ char *Blur(string *type, char *BufferData, size_t BufferLength, sharp ? in.sharpen(VImage::option()->set("sigma", 3)) : in.gaussblur(15); void *buf; - out.write_to_buffer(("." + *type).c_str(), &buf, DataSize); + out.write_to_buffer(("." + *outType).c_str(), &buf, DataSize); return (char *)buf; } diff --git a/natives/blur.h b/natives/blur.h index 8b017e2..4f4b96d 100644 --- a/natives/blur.h +++ b/natives/blur.h @@ -4,5 +4,5 @@ using std::string; -char* Blur(string* type, char* BufferData, size_t BufferLength, +char* Blur(string type, string* outType, char* BufferData, size_t BufferLength, ArgumentMap Arguments, size_t* DataSize); \ No newline at end of file diff --git a/natives/bounce.cc b/natives/bounce.cc index 7faad55..e0d27a7 100644 --- a/natives/bounce.cc +++ b/natives/bounce.cc @@ -7,28 +7,29 @@ using namespace std; using namespace vips; -char *Bounce(string *type, char *BufferData, size_t BufferLength, - ArgumentMap Arguments, size_t *DataSize) { +char *Bounce(string type, string *outType, char *BufferData, + size_t BufferLength, [[maybe_unused]] ArgumentMap Arguments, + size_t *DataSize) { VOption *options = VImage::option(); VImage in = VImage::new_from_buffer( BufferData, BufferLength, "", - *type == "gif" ? options->set("n", -1)->set("access", "sequential") - : options) + type == "gif" ? options->set("n", -1)->set("access", "sequential") + : options) .colourspace(VIPS_INTERPRETATION_sRGB); if (!in.has_alpha()) in = in.bandjoin(255); int width = in.width(); int pageHeight = vips_image_get_page_height(in.get_image()); - int nPages = *type == "gif" ? vips_image_get_n_pages(in.get_image()) : 15; + int nPages = type == "gif" ? vips_image_get_n_pages(in.get_image()) : 15; double mult = M_PI / nPages; int halfHeight = pageHeight / 2; vector img; for (int i = 0; i < nPages; i++) { VImage img_frame = - *type == "gif" ? in.crop(0, i * pageHeight, width, pageHeight) : in; + type == "gif" ? in.crop(0, i * pageHeight, width, pageHeight) : in; double height = halfHeight * ((abs(sin(i * mult)) * -1) + 1); VImage embedded = img_frame.embed(0, height, width, pageHeight + halfHeight); @@ -36,7 +37,7 @@ char *Bounce(string *type, char *BufferData, size_t BufferLength, } VImage final = VImage::arrayjoin(img, VImage::option()->set("across", 1)); final.set(VIPS_META_PAGE_HEIGHT, pageHeight + halfHeight); - if (*type != "gif") { + if (type != "gif") { vector delay(30, 50); final.set("delay", delay); } @@ -44,7 +45,7 @@ char *Bounce(string *type, char *BufferData, size_t BufferLength, void *buf; final.write_to_buffer(".gif", &buf, DataSize); - *type = "gif"; + *outType = "gif"; return (char *)buf; } \ No newline at end of file diff --git a/natives/bounce.h b/natives/bounce.h index 44a329f..0ea273a 100644 --- a/natives/bounce.h +++ b/natives/bounce.h @@ -4,5 +4,5 @@ using std::string; -char* Bounce(string* type, char* BufferData, size_t BufferLength, +char* Bounce(string type, string* outType, char* BufferData, size_t BufferLength, ArgumentMap Arguments, size_t* DataSize); \ No newline at end of file diff --git a/natives/caption.cc b/natives/caption.cc index d1824af..1979c4f 100644 --- a/natives/caption.cc +++ b/natives/caption.cc @@ -6,8 +6,8 @@ using namespace std; using namespace vips; -char *Caption(string *type, char *BufferData, size_t BufferLength, - ArgumentMap Arguments, size_t *DataSize) { +char *Caption(string type, string *outType, char *BufferData, + size_t BufferLength, ArgumentMap Arguments, size_t *DataSize) { string caption = GetArgument(Arguments, "caption"); string font = GetArgument(Arguments, "font"); string basePath = GetArgument(Arguments, "basePath"); @@ -16,7 +16,7 @@ char *Caption(string *type, char *BufferData, size_t BufferLength, VImage in = VImage::new_from_buffer(BufferData, BufferLength, "", - *type == "gif" ? options->set("n", -1) : options) + type == "gif" ? options->set("n", -1) : options) .colourspace(VIPS_INTERPRETATION_sRGB); if (!in.has_alpha()) in = in.bandjoin(255); @@ -57,7 +57,7 @@ char *Caption(string *type, char *BufferData, size_t BufferLength, vector img; for (int i = 0; i < nPages; i++) { VImage img_frame = - *type == "gif" ? in.crop(0, i * pageHeight, width, pageHeight) : in; + type == "gif" ? in.crop(0, i * pageHeight, width, pageHeight) : in; VImage frame = captionImage.join( img_frame, VIPS_DIRECTION_VERTICAL, VImage::option()->set("background", 0xffffff)->set("expand", true)); @@ -68,9 +68,10 @@ char *Caption(string *type, char *BufferData, size_t BufferLength, void *buf; final.write_to_buffer( - ("." + *type).c_str(), &buf, DataSize, - *type == "gif" ? VImage::option()->set("dither", 0)->set("reoptimise", 1) - : 0); + ("." + *outType).c_str(), &buf, DataSize, + *outType == "gif" + ? VImage::option()->set("dither", 0)->set("reoptimise", 1) + : 0); return (char *)buf; } diff --git a/natives/caption.h b/natives/caption.h index a84ccb1..6ff73c1 100644 --- a/natives/caption.h +++ b/natives/caption.h @@ -4,5 +4,5 @@ using std::string; -char* Caption(string* type, char* BufferData, size_t BufferLength, +char* Caption(string type, string* outType, char* BufferData, size_t BufferLength, ArgumentMap Arguments, size_t* DataSize); \ No newline at end of file diff --git a/natives/caption2.cc b/natives/caption2.cc index a7bf181..0b9026e 100644 --- a/natives/caption2.cc +++ b/natives/caption2.cc @@ -7,8 +7,8 @@ using namespace std; using namespace vips; -char *CaptionTwo(string *type, char *BufferData, size_t BufferLength, - ArgumentMap Arguments, size_t *DataSize) { +char *CaptionTwo(string type, string *outType, char *BufferData, + size_t BufferLength, ArgumentMap Arguments, size_t *DataSize) { bool top = GetArgument(Arguments, "top"); string caption = GetArgument(Arguments, "caption"); string font = GetArgument(Arguments, "font"); @@ -18,7 +18,7 @@ char *CaptionTwo(string *type, char *BufferData, size_t BufferLength, VImage in = VImage::new_from_buffer(BufferData, BufferLength, "", - *type == "gif" ? options->set("n", -1) : options) + type == "gif" ? options->set("n", -1) : options) .colourspace(VIPS_INTERPRETATION_sRGB); if (!in.has_alpha()) in = in.bandjoin(255); @@ -58,7 +58,7 @@ char *CaptionTwo(string *type, char *BufferData, size_t BufferLength, vector img; for (int i = 0; i < nPages; i++) { VImage img_frame = - *type == "gif" ? in.crop(0, i * pageHeight, width, pageHeight) : in; + type == "gif" ? in.crop(0, i * pageHeight, width, pageHeight) : in; VImage frame = (top ? captionImage : img_frame) .join(top ? img_frame : captionImage, VIPS_DIRECTION_VERTICAL, @@ -72,9 +72,10 @@ char *CaptionTwo(string *type, char *BufferData, size_t BufferLength, void *buf; final.write_to_buffer( - ("." + *type).c_str(), &buf, DataSize, - *type == "gif" ? VImage::option()->set("dither", 0)->set("reoptimise", 1) - : 0); + ("." + *outType).c_str(), &buf, DataSize, + *outType == "gif" + ? VImage::option()->set("dither", 0)->set("reoptimise", 1) + : 0); return (char *)buf; } diff --git a/natives/caption2.h b/natives/caption2.h index d45e2d2..6ee4790 100644 --- a/natives/caption2.h +++ b/natives/caption2.h @@ -4,5 +4,5 @@ using std::string; -char* CaptionTwo(string* type, char* BufferData, size_t BufferLength, +char* CaptionTwo(string type, string* outType, char* BufferData, size_t BufferLength, ArgumentMap Arguments, size_t* DataSize); \ No newline at end of file diff --git a/natives/circle.cc b/natives/circle.cc index 3834be3..96a1768 100644 --- a/natives/circle.cc +++ b/natives/circle.cc @@ -11,8 +11,9 @@ using namespace std; using namespace Magick; -char *Circle(string *type, char *BufferData, size_t BufferLength, - ArgumentMap Arguments, size_t *DataSize) { +char *Circle(string type, string *outType, char *BufferData, + size_t BufferLength, [[maybe_unused]] ArgumentMap Arguments, + size_t *DataSize) { Blob blob; list frames; @@ -29,13 +30,13 @@ char *Circle(string *type, char *BufferData, size_t BufferLength, for (Image &image : coalesced) { image.rotationalBlur(10); - image.magick(*type); + image.magick(*outType); blurred.push_back(image); } optimizeTransparency(blurred.begin(), blurred.end()); - if (*type == "gif") { + if (*outType == "gif") { for (Image &image : blurred) { image.quantizeDitherMethod(FloydSteinbergDitherMethod); image.quantize(); diff --git a/natives/circle.h b/natives/circle.h index 283ca79..4ee7f96 100644 --- a/natives/circle.h +++ b/natives/circle.h @@ -4,5 +4,5 @@ using std::string; -char* Circle(string* type, char* BufferData, size_t BufferLength, +char* Circle(string type, string* outType, char* BufferData, size_t BufferLength, ArgumentMap Arguments, size_t* DataSize); \ No newline at end of file diff --git a/natives/cli/image.cc b/natives/cli/image.cc new file mode 100644 index 0000000..344d0bb --- /dev/null +++ b/natives/cli/image.cc @@ -0,0 +1,26 @@ +#include +#include + +#include "../common.h" + +void showUsage(char *path) { + std::cout << "Usage: " << path << " operation [--arg=\"param\"] [...]" << std::endl; +} + +int main(int argc, char *argv[]) { + if (argc < 1 || + (argc == 1 && !strcmp(argv[1], "-h"))) { + showUsage(argv[0]); +#ifdef _WIN32 + system("PAUSE"); +#endif + return 1; + } + + char *op = argv[1]; + + //handleArguments(argc, argv); + + std::cout << "This does nothing yet, but it might in the future!" << std::endl; + return 0; +} \ No newline at end of file diff --git a/natives/colors.cc b/natives/colors.cc index 6c8fa62..b488600 100644 --- a/natives/colors.cc +++ b/natives/colors.cc @@ -10,15 +10,15 @@ using namespace vips; VImage sepia = VImage::new_matrixv(3, 3, 0.3588, 0.7044, 0.1368, 0.2990, 0.5870, 0.1140, 0.2392, 0.4696, 0.0912); -char *Colors(string *type, char *BufferData, size_t BufferLength, - ArgumentMap Arguments, size_t *DataSize) { +char *Colors(string type, string *outType, char *BufferData, + size_t BufferLength, ArgumentMap Arguments, size_t *DataSize) { string color = GetArgument(Arguments, "color"); VOption *options = VImage::option()->set("access", "sequential"); VImage in = VImage::new_from_buffer(BufferData, BufferLength, "", - *type == "gif" ? options->set("n", -1) : options) + type == "gif" ? options->set("n", -1) : options) .colourspace(VIPS_INTERPRETATION_sRGB); VImage out; @@ -30,7 +30,7 @@ char *Colors(string *type, char *BufferData, size_t BufferLength, } void *buf; - out.write_to_buffer(("." + *type).c_str(), &buf, DataSize); + out.write_to_buffer(("." + *outType).c_str(), &buf, DataSize); return (char *)buf; } diff --git a/natives/colors.h b/natives/colors.h index d0bddf5..4d00d0b 100644 --- a/natives/colors.h +++ b/natives/colors.h @@ -4,5 +4,5 @@ using std::string; -char* Colors(string* type, char* BufferData, size_t BufferLength, +char* Colors(string type, string* outType, char* BufferData, size_t BufferLength, ArgumentMap Arguments, size_t* DataSize); \ No newline at end of file diff --git a/natives/common.h b/natives/common.h index 2099433..1d71efb 100644 --- a/natives/common.h +++ b/natives/common.h @@ -12,6 +12,46 @@ using std::variant; typedef variant ArgumentVariant; typedef map ArgumentMap; +#include "blur.h" +#include "bounce.h" +#include "caption.h" +#include "caption2.h" +#include "circle.h" +#include "colors.h" +#include "crop.h" +#include "deepfry.h" +#include "explode.h" +#include "flag.h" +#include "flip.h" +#include "freeze.h" +#include "gamexplain.h" +#include "globe.h" +#include "homebrew.h" +#include "invert.h" +#include "jpeg.h" +#include "magik.h" +#include "meme.h" +#include "mirror.h" +#include "motivate.h" +#include "reddit.h" +#include "resize.h" +#include "reverse.h" +#include "scott.h" +#include "snapchat.h" +#include "sonic.h" +#include "speed.h" +#include "spin.h" +#include "squish.h" +#include "swirl.h" +#include "tile.h" +#include "togif.h" +#include "uncanny.h" +#include "uncaption.h" +#include "wall.h" +#include "watermark.h" +#include "whisper.h" +#include "zamn.h" + template T GetArgument(ArgumentMap map, string key) { try { @@ -42,4 +82,49 @@ T GetArgumentWithFallback(ArgumentMap map, string key, T fallback) { const std::unordered_map fontPaths{ {"futura", "assets/fonts/caption.otf"}, {"helvetica", "assets/fonts/caption2.ttf"}, - {"roboto", "assets/fonts/reddit.ttf"}}; \ No newline at end of file + {"roboto", "assets/fonts/reddit.ttf"}}; + +const std::map + FunctionMap = {{"blur", &Blur}, + {"bounce", &Bounce}, + {"caption", &Caption}, + {"captionTwo", &CaptionTwo}, + {"circle", &Circle}, + {"colors", &Colors}, + {"crop", &Crop}, + {"deepfry", &Deepfry}, + {"explode", &Explode}, + {"flag", &Flag}, + {"flip", &Flip}, + {"freeze", &Freeze}, + {"gamexplain", Gamexplain}, + {"globe", Globe}, + {"invert", Invert}, + {"jpeg", Jpeg}, + {"magik", Magik}, + {"meme", Meme}, + {"mirror", Mirror}, + {"motivate", Motivate}, + {"reddit", Reddit}, + {"resize", Resize}, + {"reverse", Reverse}, + {"scott", Scott}, + {"snapchat", Snapchat}, + {"speed", &Speed}, + {"spin", Spin}, + {"squish", Squish}, + {"swirl", Swirl}, + {"tile", Tile}, + {"togif", ToGif}, + {"uncanny", Uncanny}, + {"uncaption", &Uncaption}, + {"wall", Wall}, + {"watermark", &Watermark}, + {"whisper", Whisper}, + {"zamn", Zamn}}; + +const std::map + NoInputFunctionMap = {{"homebrew", Homebrew}, {"sonic", Sonic}}; \ No newline at end of file diff --git a/natives/crop.cc b/natives/crop.cc index 07cbad5..9faba5b 100644 --- a/natives/crop.cc +++ b/natives/crop.cc @@ -7,13 +7,13 @@ using namespace std; using namespace vips; -char *Crop(string *type, char *BufferData, size_t BufferLength, - ArgumentMap Arguments, size_t *DataSize) { +char *Crop(string type, string *outType, char *BufferData, size_t BufferLength, + [[maybe_unused]] ArgumentMap Arguments, size_t *DataSize) { VOption *options = VImage::option()->set("access", "sequential"); VImage in = VImage::new_from_buffer(BufferData, BufferLength, "", - *type == "gif" ? options->set("n", -1) : options) + type == "gif" ? options->set("n", -1) : options) .colourspace(VIPS_INTERPRETATION_sRGB); int width = in.width(); @@ -24,7 +24,7 @@ char *Crop(string *type, char *BufferData, size_t BufferLength, int finalHeight = 0; for (int i = 0; i < nPages; i++) { VImage img_frame = - *type == "gif" ? in.crop(0, i * pageHeight, width, pageHeight) : in; + type == "gif" ? in.crop(0, i * pageHeight, width, pageHeight) : in; int frameWidth = img_frame.width(); int frameHeight = img_frame.height(); bool widthOrHeight = frameWidth / frameHeight >= 1; @@ -42,9 +42,10 @@ char *Crop(string *type, char *BufferData, size_t BufferLength, void *buf; final.write_to_buffer( - ("." + *type).c_str(), &buf, DataSize, - *type == "gif" ? VImage::option()->set("dither", 0)->set("reoptimise", 1) - : 0); + ("." + *outType).c_str(), &buf, DataSize, + *outType == "gif" + ? VImage::option()->set("dither", 0)->set("reoptimise", 1) + : 0); return (char *)buf; } \ No newline at end of file diff --git a/natives/crop.h b/natives/crop.h index 439b4d1..c7cad96 100644 --- a/natives/crop.h +++ b/natives/crop.h @@ -4,5 +4,5 @@ using std::string; -char* Crop(string* type, char* BufferData, size_t BufferLength, +char* Crop(string type, string* outType, char* BufferData, size_t BufferLength, ArgumentMap Arguments, size_t* DataSize); \ No newline at end of file diff --git a/natives/deepfry.cc b/natives/deepfry.cc index dce5b97..9fe72a0 100644 --- a/natives/deepfry.cc +++ b/natives/deepfry.cc @@ -6,13 +6,14 @@ using namespace std; using namespace vips; -char *Deepfry(string *type, char *BufferData, size_t BufferLength, - ArgumentMap Arguments, size_t *DataSize) { +char *Deepfry(string type, string *outType, char *BufferData, + size_t BufferLength, [[maybe_unused]] ArgumentMap Arguments, + size_t *DataSize) { VOption *options = VImage::option()->set("access", "sequential"); VImage in = VImage::new_from_buffer(BufferData, BufferLength, "", - *type == "gif" ? options->set("n", -1) : options) + type == "gif" ? options->set("n", -1) : options) .colourspace(VIPS_INTERPRETATION_sRGB); if (!in.has_alpha()) in = in.bandjoin(255); @@ -25,7 +26,7 @@ char *Deepfry(string *type, char *BufferData, size_t BufferLength, VImage fried = (in * 1.3 - (255.0 * 1.3 - 255.0)) * 1.5; VImage final; - if (totalHeight > 65500 && *type == "gif") { + if (totalHeight > 65500 && type == "gif") { vector img; for (int i = 0; i < nPages; i++) { VImage img_frame = in.crop(0, i * pageHeight, width, pageHeight); @@ -48,13 +49,13 @@ char *Deepfry(string *type, char *BufferData, size_t BufferLength, VImage::option()->set("Q", 1)->set("strip", true)); final = VImage::new_from_buffer(jpgBuf, jpgLength, ""); final.set(VIPS_META_PAGE_HEIGHT, pageHeight); - if (*type == "gif") final.set("delay", fried.get_array_int("delay")); + if (type == "gif") final.set("delay", fried.get_array_int("delay")); } void *buf; final.write_to_buffer( - ("." + *type).c_str(), &buf, DataSize, - *type == "gif" ? VImage::option()->set("dither", 0) : 0); + ("." + *outType).c_str(), &buf, DataSize, + *outType == "gif" ? VImage::option()->set("dither", 0) : 0); return (char *)buf; } \ No newline at end of file diff --git a/natives/deepfry.h b/natives/deepfry.h index 00cc403..9196438 100644 --- a/natives/deepfry.h +++ b/natives/deepfry.h @@ -4,5 +4,5 @@ using std::string; -char* Deepfry(string* type, char* BufferData, size_t BufferLength, +char* Deepfry(string type, string* outType, char* BufferData, size_t BufferLength, ArgumentMap Arguments, size_t* DataSize); \ No newline at end of file diff --git a/natives/explode.cc b/natives/explode.cc index 4d6d42c..bc167e0 100644 --- a/natives/explode.cc +++ b/natives/explode.cc @@ -1,58 +1,52 @@ +#include + #include "common.h" -#include - -#include -#include -#include -#include -#include - using namespace std; -using namespace Magick; +using namespace vips; -char *Explode(string *type, char *BufferData, size_t BufferLength, - ArgumentMap Arguments, size_t *DataSize) { +char *Explode(string type, string *outType, char *BufferData, + size_t BufferLength, ArgumentMap Arguments, size_t *DataSize) { + bool implode = GetArgument(Arguments, "implode"); + string basePath = GetArgument(Arguments, "basePath"); - int amount = GetArgument(Arguments, "amount"); - int delay = GetArgumentWithFallback(Arguments, "delay", 0); + VOption *options = VImage::option(); - Blob blob; + VImage in = + VImage::new_from_buffer( + BufferData, BufferLength, "", + type == "gif" ? options->set("n", -1)->set("access", "sequential") + : options) + .colourspace(VIPS_INTERPRETATION_sRGB); + if (!in.has_alpha()) in = in.bandjoin(255); - list frames; - list coalesced; - list blurred; - try { - readImages(&frames, Blob(BufferData, BufferLength)); - } catch (Magick::WarningCoder &warning) { - cerr << "Coder Warning: " << warning.what() << endl; - } catch (Magick::Warning &warning) { - cerr << "Warning: " << warning.what() << endl; + int width = in.width(); + int pageHeight = vips_image_get_page_height(in.get_image()); + int nPages = vips_image_get_n_pages(in.get_image()); + + string distortPath = basePath + "assets/images/" + + (implode ? "linearimplode.png" : "linearexplode.png"); + VImage distort = + (VImage::new_from_file(distortPath.c_str()) + .resize(width / 500.0, VImage::option() + ->set("vscale", pageHeight / 500.0) + ->set("kernel", VIPS_KERNEL_CUBIC)) / + 65535); + + VImage distortImage = (distort[0] * width).bandjoin(distort[1] * pageHeight); + + vector img; + for (int i = 0; i < nPages; i++) { + VImage img_frame = + type == "gif" ? in.crop(0, i * pageHeight, width, pageHeight) : in; + VImage mapped = img_frame.mapim(distortImage); + img.push_back(mapped); } - coalesceImages(&coalesced, frames.begin(), frames.end()); + VImage final = VImage::arrayjoin(img, VImage::option()->set("across", 1)); + final.set(VIPS_META_PAGE_HEIGHT, pageHeight); - for (Image &image : coalesced) { - image.implode(amount); - image.magick(*type); - blurred.push_back(image); - } + void *buf; + final.write_to_buffer(("." + *outType).c_str(), &buf, DataSize); - optimizeTransparency(blurred.begin(), blurred.end()); - - if (*type == "gif") { - for (Image &image : blurred) { - image.quantizeDither(false); - image.quantize(); - if (delay != 0) image.animationDelay(delay); - } - } - - writeImages(blurred.begin(), blurred.end(), &blob); - - *DataSize = blob.length(); - - // workaround because the data is tied to the blob - char *data = (char *)malloc(*DataSize); - memcpy(data, blob.data(), *DataSize); - return data; + return (char *)buf; } \ No newline at end of file diff --git a/natives/explode.h b/natives/explode.h index 255224f..3c07169 100644 --- a/natives/explode.h +++ b/natives/explode.h @@ -4,5 +4,5 @@ using std::string; -char* Explode(string* type, char* BufferData, size_t BufferLength, +char* Explode(string type, string* outType, char* BufferData, size_t BufferLength, ArgumentMap Arguments, size_t* DataSize); \ No newline at end of file diff --git a/natives/flag.cc b/natives/flag.cc index 2c4a9a5..adfaeb2 100644 --- a/natives/flag.cc +++ b/natives/flag.cc @@ -5,7 +5,7 @@ using namespace std; using namespace vips; -char *Flag(string *type, char *BufferData, size_t BufferLength, +char *Flag(string type, string *outType, char *BufferData, size_t BufferLength, ArgumentMap Arguments, size_t *DataSize) { string overlay = GetArgument(Arguments, "overlay"); string basePath = GetArgument(Arguments, "basePath"); @@ -14,7 +14,7 @@ char *Flag(string *type, char *BufferData, size_t BufferLength, VImage in = VImage::new_from_buffer(BufferData, BufferLength, "", - *type == "gif" ? options->set("n", -1) : options) + type == "gif" ? options->set("n", -1) : options) .colourspace(VIPS_INTERPRETATION_sRGB); if (!in.has_alpha()) in = in.bandjoin(255); @@ -40,9 +40,10 @@ char *Flag(string *type, char *BufferData, size_t BufferLength, void *buf; final.write_to_buffer( - ("." + *type).c_str(), &buf, DataSize, - *type == "gif" ? VImage::option()->set("dither", 0)->set("reoptimise", 1) - : 0); + ("." + *outType).c_str(), &buf, DataSize, + *outType == "gif" + ? VImage::option()->set("dither", 0)->set("reoptimise", 1) + : 0); return (char *)buf; } \ No newline at end of file diff --git a/natives/flag.h b/natives/flag.h index 976266b..123aa73 100644 --- a/natives/flag.h +++ b/natives/flag.h @@ -4,5 +4,5 @@ using std::string; -char* Flag(string* type, char* BufferData, size_t BufferLength, +char* Flag(string type, string* outType, char* BufferData, size_t BufferLength, ArgumentMap Arguments, size_t* DataSize); \ No newline at end of file diff --git a/natives/flip.cc b/natives/flip.cc index a9eb71e..1344404 100644 --- a/natives/flip.cc +++ b/natives/flip.cc @@ -6,12 +6,12 @@ using namespace std; using namespace vips; -char *Flip(string *type, char *BufferData, size_t BufferLength, +char *Flip(string type, string *outType, char *BufferData, size_t BufferLength, ArgumentMap Arguments, size_t *DataSize) { bool flop = GetArgument(Arguments, "flop"); VImage in = VImage::new_from_buffer(BufferData, BufferLength, "", - *type == "gif" + type == "gif" ? VImage::option()->set("n", -1)->set( "access", "sequential") : 0) @@ -21,7 +21,7 @@ char *Flip(string *type, char *BufferData, size_t BufferLength, VImage out; if (flop) { out = in.flip(VIPS_DIRECTION_HORIZONTAL); - } else if (*type == "gif") { + } else if (type == "gif") { // libvips gif handling is both a blessing and a curse vector img; int pageHeight = vips_image_get_page_height(in.get_image()); @@ -39,9 +39,10 @@ char *Flip(string *type, char *BufferData, size_t BufferLength, void *buf; out.write_to_buffer( - ("." + *type).c_str(), &buf, DataSize, - *type == "gif" ? VImage::option()->set("dither", 0)->set("reoptimise", 1) - : 0); + ("." + *outType).c_str(), &buf, DataSize, + *outType == "gif" + ? VImage::option()->set("dither", 0)->set("reoptimise", 1) + : 0); return (char *)buf; } \ No newline at end of file diff --git a/natives/flip.h b/natives/flip.h index 9029498..d9ff128 100644 --- a/natives/flip.h +++ b/natives/flip.h @@ -4,5 +4,5 @@ using std::string; -char* Flip(string* type, char* BufferData, size_t BufferLength, +char* Flip(string type, string* outType, char* BufferData, size_t BufferLength, ArgumentMap Arguments, size_t* DataSize); \ No newline at end of file diff --git a/natives/freeze.cc b/natives/freeze.cc index 6174dba..2eb15c4 100644 --- a/natives/freeze.cc +++ b/natives/freeze.cc @@ -7,8 +7,8 @@ using namespace std; using namespace vips; -char *Freeze(string *type, char *BufferData, size_t BufferLength, - ArgumentMap Arguments, size_t *DataSize) { +char *Freeze(string type, string *outType, char *BufferData, + size_t BufferLength, ArgumentMap Arguments, size_t *DataSize) { bool loop = GetArgumentWithFallback(Arguments, "loop", false); int frame = GetArgumentWithFallback(Arguments, "frame", -1); @@ -46,10 +46,10 @@ char *Freeze(string *type, char *BufferData, size_t BufferLength, } else if (frame >= 0 && !loop) { VOption *options = VImage::option()->set("access", "sequential"); - VImage in = VImage::new_from_buffer( - BufferData, BufferLength, "", - *type == "gif" ? options->set("n", -1) : options) - .colourspace(VIPS_INTERPRETATION_sRGB); + VImage in = + VImage::new_from_buffer(BufferData, BufferLength, "", + type == "gif" ? options->set("n", -1) : options) + .colourspace(VIPS_INTERPRETATION_sRGB); if (!in.has_alpha()) in = in.bandjoin(255); int pageHeight = vips_image_get_page_height(in.get_image()); @@ -60,7 +60,7 @@ char *Freeze(string *type, char *BufferData, size_t BufferLength, out.set("loop", 1); void *buf; - out.write_to_buffer(("." + *type).c_str(), &buf, DataSize); + out.write_to_buffer(("." + *outType).c_str(), &buf, DataSize); return (char *)buf; } else { diff --git a/natives/freeze.h b/natives/freeze.h index dde7da9..4c0e931 100644 --- a/natives/freeze.h +++ b/natives/freeze.h @@ -4,5 +4,5 @@ using std::string; -char* Freeze(string* type, char* BufferData, size_t BufferLength, +char* Freeze(string type, string* outType, char* BufferData, size_t BufferLength, ArgumentMap Arguments, size_t* DataSize); \ No newline at end of file diff --git a/natives/gamexplain.cc b/natives/gamexplain.cc index 21c33f1..a05b371 100644 --- a/natives/gamexplain.cc +++ b/natives/gamexplain.cc @@ -5,15 +5,15 @@ using namespace std; using namespace vips; -char *Gamexplain(string *type, char *BufferData, size_t BufferLength, - ArgumentMap Arguments, size_t *DataSize) { +char *Gamexplain(string type, string *outType, char *BufferData, + size_t BufferLength, ArgumentMap Arguments, size_t *DataSize) { string basePath = GetArgument(Arguments, "basePath"); VOption *options = VImage::option()->set("access", "sequential"); VImage in = VImage::new_from_buffer(BufferData, BufferLength, "", - *type == "gif" ? options->set("n", -1) : options) + type == "gif" ? options->set("n", -1) : options) .colourspace(VIPS_INTERPRETATION_sRGB); if (!in.has_alpha()) in = in.bandjoin(255); @@ -27,7 +27,7 @@ char *Gamexplain(string *type, char *BufferData, size_t BufferLength, vector img; for (int i = 0; i < nPages; i++) { VImage img_frame = - *type == "gif" ? in.crop(0, i * pageHeight, width, pageHeight) : in; + type == "gif" ? in.crop(0, i * pageHeight, width, pageHeight) : in; VImage resized = img_frame .resize(1181.0 / (double)width, @@ -41,9 +41,10 @@ char *Gamexplain(string *type, char *BufferData, size_t BufferLength, void *buf; final.write_to_buffer( - ("." + *type).c_str(), &buf, DataSize, - *type == "gif" ? VImage::option()->set("dither", 0)->set("reoptimise", 1) - : 0); + ("." + *outType).c_str(), &buf, DataSize, + *outType == "gif" + ? VImage::option()->set("dither", 0)->set("reoptimise", 1) + : 0); return (char *)buf; } \ No newline at end of file diff --git a/natives/gamexplain.h b/natives/gamexplain.h index 42c6881..7c07c6d 100644 --- a/natives/gamexplain.h +++ b/natives/gamexplain.h @@ -4,5 +4,5 @@ using std::string; -char* Gamexplain(string* type, char* BufferData, size_t BufferLength, +char* Gamexplain(string type, string* outType, char* BufferData, size_t BufferLength, ArgumentMap Arguments, size_t* DataSize); \ No newline at end of file diff --git a/natives/globe.cc b/natives/globe.cc index cd2874d..595329e 100644 --- a/natives/globe.cc +++ b/natives/globe.cc @@ -5,7 +5,7 @@ using namespace std; using namespace vips; -char *Globe(string *type, char *BufferData, size_t BufferLength, +char *Globe(string type, string *outType, char *BufferData, size_t BufferLength, ArgumentMap Arguments, size_t *DataSize) { string basePath = GetArgument(Arguments, "basePath"); @@ -14,14 +14,14 @@ char *Globe(string *type, char *BufferData, size_t BufferLength, VImage in = VImage::new_from_buffer( BufferData, BufferLength, "", - *type == "gif" ? options->set("n", -1)->set("access", "sequential") + type == "gif" ? options->set("n", -1)->set("access", "sequential") : options) .colourspace(VIPS_INTERPRETATION_sRGB); if (!in.has_alpha()) in = in.bandjoin(255); int width = in.width(); int pageHeight = vips_image_get_page_height(in.get_image()); - int nPages = *type == "gif" ? vips_image_get_n_pages(in.get_image()) : 30; + int nPages = type == "gif" ? vips_image_get_n_pages(in.get_image()) : 30; double size = min(width, pageHeight); @@ -47,7 +47,7 @@ char *Globe(string *type, char *BufferData, size_t BufferLength, vector img; for (int i = 0; i < nPages; i++) { VImage img_frame = - *type == "gif" ? in.crop(0, i * pageHeight, width, pageHeight) : in; + type == "gif" ? in.crop(0, i * pageHeight, width, pageHeight) : in; VImage resized = img_frame.resize( size / (double)width, VImage::option()->set("vscale", size / (double)pageHeight)); @@ -61,7 +61,7 @@ char *Globe(string *type, char *BufferData, size_t BufferLength, } VImage final = VImage::arrayjoin(img, VImage::option()->set("across", 1)); final.set(VIPS_META_PAGE_HEIGHT, size); - if (*type != "gif") { + if (type != "gif") { vector delay(30, 50); final.set("delay", delay); } diff --git a/natives/globe.h b/natives/globe.h index 66a97fb..ca21889 100644 --- a/natives/globe.h +++ b/natives/globe.h @@ -4,5 +4,5 @@ using std::string; -char* Globe(string* type, char* BufferData, size_t BufferLength, +char* Globe(string type, string* outType, char* BufferData, size_t BufferLength, ArgumentMap Arguments, size_t* DataSize); \ No newline at end of file diff --git a/natives/homebrew.cc b/natives/homebrew.cc index 209630b..28f2afd 100644 --- a/natives/homebrew.cc +++ b/natives/homebrew.cc @@ -5,7 +5,8 @@ using namespace std; using namespace vips; -char *Homebrew(string *type, ArgumentMap Arguments, size_t *DataSize) { +char *Homebrew(string type, string *outType, ArgumentMap Arguments, + size_t *DataSize) { string caption = GetArgument(Arguments, "caption"); string basePath = GetArgument(Arguments, "basePath"); @@ -30,9 +31,7 @@ char *Homebrew(string *type, ArgumentMap Arguments, size_t *DataSize) { ->set("y", 300 - (text.height() / 2) - 8)); void *buf; - out.write_to_buffer(".png", &buf, DataSize); - - *type = "png"; + out.write_to_buffer(("." + *outType).c_str(), &buf, DataSize); return (char *)buf; } \ No newline at end of file diff --git a/natives/homebrew.h b/natives/homebrew.h index d6db633..3304c4e 100644 --- a/natives/homebrew.h +++ b/natives/homebrew.h @@ -4,4 +4,4 @@ using std::string; -char *Homebrew(string *type, ArgumentMap Arguments, size_t *DataSize); \ No newline at end of file +char *Homebrew(string type, string *outType, ArgumentMap Arguments, size_t *DataSize); \ No newline at end of file diff --git a/natives/invert.cc b/natives/invert.cc index 376c066..a46fc10 100644 --- a/natives/invert.cc +++ b/natives/invert.cc @@ -5,13 +5,14 @@ using namespace std; using namespace vips; -char *Invert(string *type, char *BufferData, size_t BufferLength, - ArgumentMap Arguments, size_t *DataSize) { +char *Invert(string type, string *outType, char *BufferData, + size_t BufferLength, [[maybe_unused]] ArgumentMap Arguments, + size_t *DataSize) { VOption *options = VImage::option()->set("access", "sequential"); VImage in = VImage::new_from_buffer(BufferData, BufferLength, "", - *type == "gif" ? options->set("n", -1) : options) + type == "gif" ? options->set("n", -1) : options) .colourspace(VIPS_INTERPRETATION_sRGB); if (!in.has_alpha()) in = in.bandjoin(255); @@ -21,7 +22,7 @@ char *Invert(string *type, char *BufferData, size_t BufferLength, VImage out = inverted.bandjoin(in.extract_band(3)); void *buf; - out.write_to_buffer(("." + *type).c_str(), &buf, DataSize); + out.write_to_buffer(("." + *outType).c_str(), &buf, DataSize); return (char *)buf; } \ No newline at end of file diff --git a/natives/invert.h b/natives/invert.h index 42f7ea8..7db64e3 100644 --- a/natives/invert.h +++ b/natives/invert.h @@ -4,5 +4,5 @@ using std::string; -char* Invert(string* type, char* BufferData, size_t BufferLength, +char* Invert(string type, string* outType, char* BufferData, size_t BufferLength, ArgumentMap Arguments, size_t* DataSize); \ No newline at end of file diff --git a/natives/jpeg.cc b/natives/jpeg.cc index 9dcb47d..d1eff63 100644 --- a/natives/jpeg.cc +++ b/natives/jpeg.cc @@ -5,13 +5,13 @@ using namespace std; using namespace vips; -char *Jpeg(string *type, char *BufferData, size_t BufferLength, +char *Jpeg(string type, string *outType, char *BufferData, size_t BufferLength, ArgumentMap Arguments, size_t *DataSize) { int quality = GetArgumentWithFallback(Arguments, "quality", 0); void *buf; - if (*type == "gif") { + if (type == "gif") { VImage in = VImage::new_from_buffer( BufferData, BufferLength, "", VImage::option()->set("access", "sequential")->set("n", -1)) @@ -53,13 +53,22 @@ char *Jpeg(string *type, char *BufferData, size_t BufferLength, } final.write_to_buffer( - ("." + *type).c_str(), &buf, DataSize, - *type == "gif" ? VImage::option()->set("dither", 0) : 0); + ("." + *outType).c_str(), &buf, DataSize, + *outType == "gif" ? VImage::option()->set("dither", 0) : 0); } else { VImage in = VImage::new_from_buffer(BufferData, BufferLength, ""); - in.write_to_buffer(".jpg", &buf, DataSize, + void *jpgBuf; + in.write_to_buffer(".jpg", &jpgBuf, DataSize, VImage::option()->set("Q", quality)->set("strip", true)); - *type = "jpg"; + if (*outType == "gif") { + VImage gifIn = VImage::new_from_buffer((char *)jpgBuf, *DataSize, ""); + gifIn.write_to_buffer( + ".gif", &buf, DataSize, + VImage::option()->set("Q", quality)->set("strip", true)); + } else { + *outType = "jpg"; + buf = jpgBuf; + } } return (char *)buf; diff --git a/natives/jpeg.h b/natives/jpeg.h index ed67612..2e6912c 100644 --- a/natives/jpeg.h +++ b/natives/jpeg.h @@ -4,5 +4,5 @@ using std::string; -char* Jpeg(string* type, char* BufferData, size_t BufferLength, +char* Jpeg(string type, string* outType, char* BufferData, size_t BufferLength, ArgumentMap Arguments, size_t* DataSize); \ No newline at end of file diff --git a/natives/magik.cc b/natives/magik.cc index 1cbb1b8..4aae8f6 100644 --- a/natives/magik.cc +++ b/natives/magik.cc @@ -9,8 +9,8 @@ using namespace std; using namespace Magick; -char *Magik(string *type, char *BufferData, size_t BufferLength, - ArgumentMap Arguments, size_t *DataSize) { +char *Magik(string type, string *outType, char *BufferData, size_t BufferLength, + [[maybe_unused]] ArgumentMap Arguments, size_t *DataSize) { Blob blob; list frames; @@ -29,13 +29,13 @@ char *Magik(string *type, char *BufferData, size_t BufferLength, image.scale(Geometry("350x350")); image.liquidRescale(Geometry("175x175")); image.liquidRescale(Geometry("350x350")); - image.magick(*type); + image.magick(*outType); blurred.push_back(image); } optimizeTransparency(blurred.begin(), blurred.end()); - if (*type == "gif") { + if (*outType == "gif") { for (Image &image : blurred) { image.quantizeDitherMethod(FloydSteinbergDitherMethod); image.quantize(); diff --git a/natives/magik.h b/natives/magik.h index 37013a9..b4c1639 100644 --- a/natives/magik.h +++ b/natives/magik.h @@ -4,5 +4,5 @@ using std::string; -char* Magik(string* type, char* BufferData, size_t BufferLength, +char* Magik(string type, string* outType, char* BufferData, size_t BufferLength, ArgumentMap Arguments, size_t* DataSize); \ No newline at end of file diff --git a/natives/meme.cc b/natives/meme.cc index 9b3dc5d..f7cb51a 100644 --- a/natives/meme.cc +++ b/natives/meme.cc @@ -5,7 +5,7 @@ using namespace std; using namespace vips; -char *Meme(string *type, char *BufferData, size_t BufferLength, +char *Meme(string type, string *outType, char *BufferData, size_t BufferLength, ArgumentMap Arguments, size_t *DataSize) { string top = GetArgument(Arguments, "top"); string bottom = GetArgument(Arguments, "bottom"); @@ -16,7 +16,7 @@ char *Meme(string *type, char *BufferData, size_t BufferLength, VImage in = VImage::new_from_buffer(BufferData, BufferLength, "", - *type == "gif" ? options->set("n", -1) : options) + type == "gif" ? options->set("n", -1) : options) .colourspace(VIPS_INTERPRETATION_sRGB); if (!in.has_alpha()) in = in.bandjoin(255); @@ -110,7 +110,7 @@ char *Meme(string *type, char *BufferData, size_t BufferLength, vector img; for (int i = 0; i < nPages; i++) { VImage img_frame = - *type == "gif" ? in.crop(0, i * pageHeight, width, pageHeight) : in; + type == "gif" ? in.crop(0, i * pageHeight, width, pageHeight) : in; if (top != "") { img_frame = img_frame.composite2( topText, VIPS_BLEND_MODE_OVER, @@ -130,9 +130,10 @@ char *Meme(string *type, char *BufferData, size_t BufferLength, void *buf; final.write_to_buffer( - ("." + *type).c_str(), &buf, DataSize, - *type == "gif" ? VImage::option()->set("dither", 0)->set("reoptimise", 1) - : 0); + ("." + *outType).c_str(), &buf, DataSize, + *outType == "gif" + ? VImage::option()->set("dither", 0)->set("reoptimise", 1) + : 0); return (char *)buf; } \ No newline at end of file diff --git a/natives/meme.h b/natives/meme.h index 5d7bf58..5c05a29 100644 --- a/natives/meme.h +++ b/natives/meme.h @@ -4,5 +4,5 @@ using std::string; -char* Meme(string* type, char* BufferData, size_t BufferLength, +char* Meme(string type, string* outType, char* BufferData, size_t BufferLength, ArgumentMap Arguments, size_t* DataSize); \ No newline at end of file diff --git a/natives/mirror.cc b/natives/mirror.cc index 47bf015..bb4db00 100644 --- a/natives/mirror.cc +++ b/natives/mirror.cc @@ -5,8 +5,8 @@ using namespace std; using namespace vips; -char *Mirror(string *type, char *BufferData, size_t BufferLength, - ArgumentMap Arguments, size_t *DataSize) { +char *Mirror(string type, string *outType, char *BufferData, + size_t BufferLength, ArgumentMap Arguments, size_t *DataSize) { bool vertical = GetArgumentWithFallback(Arguments, "vertical", false); bool first = GetArgumentWithFallback(Arguments, "first", false); @@ -14,14 +14,14 @@ char *Mirror(string *type, char *BufferData, size_t BufferLength, VImage in = VImage::new_from_buffer(BufferData, BufferLength, "", - *type == "gif" ? options->set("n", -1) : options) + type == "gif" ? options->set("n", -1) : options) .colourspace(VIPS_INTERPRETATION_sRGB); if (!in.has_alpha()) in = in.bandjoin(255); VImage out; if (vertical) { - if (*type == "gif") { + if (type == "gif") { // once again, libvips gif handling is both a blessing and a curse vector img; int pageHeight = vips_image_get_page_height(in.get_image()); @@ -58,7 +58,7 @@ char *Mirror(string *type, char *BufferData, size_t BufferLength, } void *buf; - out.write_to_buffer(("." + *type).c_str(), &buf, DataSize); + out.write_to_buffer(("." + *outType).c_str(), &buf, DataSize); return (char *)buf; } diff --git a/natives/mirror.h b/natives/mirror.h index 3ed6dac..419f595 100644 --- a/natives/mirror.h +++ b/natives/mirror.h @@ -4,5 +4,5 @@ using std::string; -char* Mirror(string* type, char* BufferData, size_t BufferLength, +char* Mirror(string type, string* outType, char* BufferData, size_t BufferLength, ArgumentMap Arguments, size_t* DataSize); \ No newline at end of file diff --git a/natives/motivate.cc b/natives/motivate.cc index 11c9b20..a2f48bd 100644 --- a/natives/motivate.cc +++ b/natives/motivate.cc @@ -5,8 +5,8 @@ using namespace std; using namespace vips; -char *Motivate(string *type, char *BufferData, size_t BufferLength, - ArgumentMap Arguments, size_t *DataSize) { +char *Motivate(string type, string *outType, char *BufferData, + size_t BufferLength, ArgumentMap Arguments, size_t *DataSize) { string top_text = GetArgument(Arguments, "top"); string bottom_text = GetArgument(Arguments, "bottom"); string font = GetArgument(Arguments, "font"); @@ -16,7 +16,7 @@ char *Motivate(string *type, char *BufferData, size_t BufferLength, VImage in = VImage::new_from_buffer(BufferData, BufferLength, "", - *type == "gif" ? options->set("n", -1) : options) + type == "gif" ? options->set("n", -1) : options) .colourspace(VIPS_INTERPRETATION_sRGB); if (!in.has_alpha()) in = in.bandjoin(255); @@ -69,7 +69,7 @@ char *Motivate(string *type, char *BufferData, size_t BufferLength, int height; for (int i = 0; i < nPages; i++) { VImage img_frame = - *type == "gif" ? in.crop(0, i * pageHeight, width, pageHeight) : in; + type == "gif" ? in.crop(0, i * pageHeight, width, pageHeight) : in; int borderSize = max(2, width / 66); int borderSize2 = borderSize * 0.5; @@ -116,8 +116,8 @@ char *Motivate(string *type, char *BufferData, size_t BufferLength, void *buf; final.write_to_buffer( - ("." + *type).c_str(), &buf, DataSize, - *type == "gif" ? VImage::option()->set("dither", 1) : 0); + ("." + *outType).c_str(), &buf, DataSize, + *outType == "gif" ? VImage::option()->set("dither", 1) : 0); return (char *)buf; } diff --git a/natives/motivate.h b/natives/motivate.h index 924f640..7f7624b 100644 --- a/natives/motivate.h +++ b/natives/motivate.h @@ -4,5 +4,5 @@ using std::string; -char* Motivate(string* type, char* BufferData, size_t BufferLength, +char* Motivate(string type, string* outType, char* BufferData, size_t BufferLength, ArgumentMap Arguments, size_t* DataSize); \ No newline at end of file diff --git a/natives/image.cc b/natives/node/image.cc similarity index 50% rename from natives/image.cc rename to natives/node/image.cc index b85efb6..c3ecb9f 100644 --- a/natives/image.cc +++ b/natives/node/image.cc @@ -4,46 +4,7 @@ #include #include -#include "blur.h" -#include "bounce.h" -#include "caption.h" -#include "caption2.h" -#include "circle.h" -#include "colors.h" -#include "common.h" -#include "crop.h" -#include "deepfry.h" -#include "explode.h" -#include "flag.h" -#include "flip.h" -#include "freeze.h" -#include "gamexplain.h" -#include "globe.h" -#include "homebrew.h" -#include "invert.h" -#include "jpeg.h" -#include "magik.h" -#include "meme.h" -#include "mirror.h" -#include "motivate.h" -#include "reddit.h" -#include "resize.h" -#include "reverse.h" -#include "scott.h" -#include "snapchat.h" -#include "sonic.h" -#include "speed.h" -#include "spin.h" -#include "squish.h" -#include "swirl.h" -#include "tile.h" -#include "togif.h" -#include "uncanny.h" -#include "uncaption.h" -#include "wall.h" -#include "watermark.h" -#include "whisper.h" -#include "zamn.h" +#include "../common.h" #ifdef _WIN32 #include @@ -52,51 +13,6 @@ using namespace std; -std::map - FunctionMap = {{"blur", &Blur}, - {"bounce", &Bounce}, - {"caption", &Caption}, - {"captionTwo", &CaptionTwo}, - {"circle", &Circle}, - {"colors", &Colors}, - {"crop", &Crop}, - {"deepfry", &Deepfry}, - {"explode", &Explode}, - {"flag", &Flag}, - {"flip", &Flip}, - {"freeze", &Freeze}, - {"gamexplain", Gamexplain}, - {"globe", Globe}, - {"invert", Invert}, - {"jpeg", Jpeg}, - {"magik", Magik}, - {"meme", Meme}, - {"mirror", Mirror}, - {"motivate", Motivate}, - {"reddit", Reddit}, - {"resize", Resize}, - {"reverse", Reverse}, - {"scott", Scott}, - {"snapchat", Snapchat}, - {"speed", &Speed}, - {"spin", Spin}, - {"squish", Squish}, - {"swirl", Swirl}, - {"tile", Tile}, - {"togif", ToGif}, - {"uncanny", Uncanny}, - {"uncaption", &Uncaption}, - {"wall", Wall}, - {"watermark", &Watermark}, - {"whisper", Whisper}, - {"zamn", Zamn}}; - -std::map - NoInputFunctionMap = {{"homebrew", Homebrew}, {"sonic", Sonic}}; - bool isNapiValueInt(Napi::Env& env, Napi::Value& num) { return env.Global() .Get("Number") @@ -116,7 +32,7 @@ Napi::Value ProcessImage(const Napi::CallbackInfo& info) { string command = info[0].As().Utf8Value(); Napi::Object obj = info[1].As(); string type = - obj.Has("type") ? obj.Get("type").As().Utf8Value() : NULL; + obj.Has("type") ? obj.Get("type").As().Utf8Value() : "png"; Napi::Array properties = obj.GetPropertyNames(); @@ -148,25 +64,28 @@ Napi::Value ProcessImage(const Napi::CallbackInfo& info) { } } + string outType = GetArgument(Arguments, "togif") ? "gif" : type; + size_t length = 0; char* buf; if (obj.Has("data")) { Napi::Buffer data = obj.Has("data") ? obj.Get("data").As>() : Napi::Buffer::New(env, 0); - buf = FunctionMap.at(command)(&type, data.Data(), data.Length(), + buf = FunctionMap.at(command)(type, &outType, data.Data(), data.Length(), Arguments, &length); } else { - buf = NoInputFunctionMap.at(command)(&type, Arguments, &length); + buf = NoInputFunctionMap.at(command)(type, &outType, Arguments, &length); } vips_error_clear(); vips_thread_shutdown(); - result.Set("data", Napi::Buffer::New( - env, buf, length, - [](Napi::Env env, void* data) { free(data); })); - result.Set("type", type); + result.Set("data", + Napi::Buffer::New(env, buf, length, + []([[maybe_unused]] Napi::Env env, + void* data) { free(data); })); + result.Set("type", outType); } catch (std::exception const& err) { Napi::Error::New(env, err.what()).ThrowAsJavaScriptException(); } catch (...) { diff --git a/natives/reddit.cc b/natives/reddit.cc index d4b02e7..c89b6c7 100644 --- a/natives/reddit.cc +++ b/natives/reddit.cc @@ -5,8 +5,8 @@ using namespace std; using namespace vips; -char *Reddit(string *type, char *BufferData, size_t BufferLength, - ArgumentMap Arguments, size_t *DataSize) { +char *Reddit(string type, string *outType, char *BufferData, + size_t BufferLength, ArgumentMap Arguments, size_t *DataSize) { string text = GetArgument(Arguments, "text"); string basePath = GetArgument(Arguments, "basePath"); @@ -14,7 +14,7 @@ char *Reddit(string *type, char *BufferData, size_t BufferLength, VImage in = VImage::new_from_buffer(BufferData, BufferLength, "", - *type == "gif" ? options->set("n", -1) : options) + type == "gif" ? options->set("n", -1) : options) .colourspace(VIPS_INTERPRETATION_sRGB); if (!in.has_alpha()) in = in.bandjoin(255); @@ -48,7 +48,7 @@ char *Reddit(string *type, char *BufferData, size_t BufferLength, vector img; for (int i = 0; i < nPages; i++) { VImage img_frame = - *type == "gif" ? in.crop(0, i * pageHeight, width, pageHeight) : in; + type == "gif" ? in.crop(0, i * pageHeight, width, pageHeight) : in; VImage frame = img_frame.join(watermark, VIPS_DIRECTION_VERTICAL, VImage::option()->set("expand", true)); img.push_back(frame); @@ -58,9 +58,10 @@ char *Reddit(string *type, char *BufferData, size_t BufferLength, void *buf; final.write_to_buffer( - ("." + *type).c_str(), &buf, DataSize, - *type == "gif" ? VImage::option()->set("dither", 0)->set("reoptimise", 1) - : 0); + ("." + *outType).c_str(), &buf, DataSize, + *outType == "gif" + ? VImage::option()->set("dither", 0)->set("reoptimise", 1) + : 0); return (char *)buf; } \ No newline at end of file diff --git a/natives/reddit.h b/natives/reddit.h index 7acdfd5..564341f 100644 --- a/natives/reddit.h +++ b/natives/reddit.h @@ -4,5 +4,5 @@ using std::string; -char* Reddit(string* type, char* BufferData, size_t BufferLength, +char* Reddit(string type, string* outType, char* BufferData, size_t BufferLength, ArgumentMap Arguments, size_t* DataSize); \ No newline at end of file diff --git a/natives/resize.cc b/natives/resize.cc index 595bb30..ae9f93e 100644 --- a/natives/resize.cc +++ b/natives/resize.cc @@ -5,8 +5,8 @@ using namespace std; using namespace vips; -char *Resize(string *type, char *BufferData, size_t BufferLength, - ArgumentMap Arguments, size_t *DataSize) { +char *Resize(string type, string *outType, char *BufferData, + size_t BufferLength, ArgumentMap Arguments, size_t *DataSize) { bool stretch = GetArgumentWithFallback(Arguments, "stretch", false); bool wide = GetArgumentWithFallback(Arguments, "wide", false); @@ -14,7 +14,7 @@ char *Resize(string *type, char *BufferData, size_t BufferLength, VImage in = VImage::new_from_buffer(BufferData, BufferLength, "", - *type == "gif" ? options->set("n", -1) : options) + type == "gif" ? options->set("n", -1) : options) .colourspace(VIPS_INTERPRETATION_sRGB); VImage out; @@ -37,7 +37,7 @@ char *Resize(string *type, char *BufferData, size_t BufferLength, vector img; for (int i = 0; i < nPages; i++) { VImage img_frame = - *type == "gif" ? in.crop(0, i * pageHeight, width, pageHeight) : in; + type == "gif" ? in.crop(0, i * pageHeight, width, pageHeight) : in; VImage resized = img_frame.resize(0.1).resize( 10, VImage::option()->set("kernel", VIPS_KERNEL_NEAREST)); img.push_back(resized); @@ -48,7 +48,7 @@ char *Resize(string *type, char *BufferData, size_t BufferLength, out.set(VIPS_META_PAGE_HEIGHT, finalHeight); void *buf; - out.write_to_buffer(("." + *type).c_str(), &buf, DataSize); + out.write_to_buffer(("." + *outType).c_str(), &buf, DataSize); return (char *)buf; } \ No newline at end of file diff --git a/natives/resize.h b/natives/resize.h index cb9d258..61bc26d 100644 --- a/natives/resize.h +++ b/natives/resize.h @@ -4,5 +4,5 @@ using std::string; -char* Resize(string* type, char* BufferData, size_t BufferLength, +char* Resize(string type, string* outType, char* BufferData, size_t BufferLength, ArgumentMap Arguments, size_t* DataSize); \ No newline at end of file diff --git a/natives/reverse.cc b/natives/reverse.cc index 62940b7..6444bd0 100644 --- a/natives/reverse.cc +++ b/natives/reverse.cc @@ -6,8 +6,8 @@ using namespace std; using namespace vips; -char *Reverse(string *type, char *BufferData, size_t BufferLength, - ArgumentMap Arguments, size_t *DataSize) { +char *Reverse(string type, string *outType, char *BufferData, + size_t BufferLength, ArgumentMap Arguments, size_t *DataSize) { bool soos = GetArgumentWithFallback(Arguments, "soos", false); VOption *options = @@ -53,7 +53,7 @@ char *Reverse(string *type, char *BufferData, size_t BufferLength, final.write_to_buffer(".gif", &buf, DataSize, VImage::option()->set("dither", 0)); - *type = "gif"; + *outType = "gif"; return (char *)buf; } \ No newline at end of file diff --git a/natives/reverse.h b/natives/reverse.h index a436a7f..9a7db85 100644 --- a/natives/reverse.h +++ b/natives/reverse.h @@ -4,5 +4,5 @@ using std::string; -char* Reverse(string* type, char* BufferData, size_t BufferLength, +char* Reverse(string type, string* outType, char* BufferData, size_t BufferLength, ArgumentMap Arguments, size_t* DataSize); \ No newline at end of file diff --git a/natives/scott.cc b/natives/scott.cc index e31ad71..d6e6ea6 100644 --- a/natives/scott.cc +++ b/natives/scott.cc @@ -1,64 +1,55 @@ -#include - -#include -#include -#include +#include #include "common.h" using namespace std; -using namespace Magick; +using namespace vips; -char *Scott(string *type, char *BufferData, size_t BufferLength, +char *Scott(string type, string *outType, char *BufferData, size_t BufferLength, ArgumentMap Arguments, size_t *DataSize) { string basePath = GetArgument(Arguments, "basePath"); - Blob blob; + VOption *options = VImage::option()->set("access", "sequential"); - list frames; - list coalesced; - list mid; - Image watermark; - try { - readImages(&frames, Blob(BufferData, BufferLength)); - } catch (Magick::WarningCoder &warning) { - cerr << "Coder Warning: " << warning.what() << endl; - } catch (Magick::Warning &warning) { - cerr << "Warning: " << warning.what() << endl; + VImage in = + VImage::new_from_buffer(BufferData, BufferLength, "", + type == "gif" ? options->set("n", -1) : options) + .colourspace(VIPS_INTERPRETATION_sRGB); + if (!in.has_alpha()) in = in.bandjoin(255); + + int width = in.width(); + int pageHeight = vips_image_get_page_height(in.get_image()); + int nPages = vips_image_get_n_pages(in.get_image()); + + string assetPath = basePath + "assets/images/scott.png"; + VImage bg = VImage::new_from_file(assetPath.c_str()); + + string distortPath = basePath + "assets/images/scottmap.png"; + VImage distort = VImage::new_from_file(distortPath.c_str()); + + VImage distortImage = + ((distort[1] / 255) * 414).bandjoin((distort[0] / 255) * 233); + + vector img; + for (int i = 0; i < nPages; i++) { + VImage img_frame = + type == "gif" ? in.crop(0, i * pageHeight, width, pageHeight) : in; + VImage resized = img_frame.resize( + 415 / (double)width, + VImage::option()->set("vscale", 234 / (double)pageHeight)); + VImage mapped = resized.mapim(distortImage) + .extract_band(0, VImage::option()->set("n", 3)) + .bandjoin(distort[2]); + VImage offset = mapped.embed(127, 181, 864, 481); + VImage composited = bg.composite2(offset, VIPS_BLEND_MODE_OVER); + img.push_back(composited); } - watermark.read(basePath + "assets/images/scott.png"); - coalesceImages(&coalesced, frames.begin(), frames.end()); + VImage final = VImage::arrayjoin(img, VImage::option()->set("across", 1)); + final.set(VIPS_META_PAGE_HEIGHT, 481); - for (Image &image : coalesced) { - Image watermark_new = watermark; - image.virtualPixelMethod(Magick::TransparentVirtualPixelMethod); - image.backgroundColor("none"); - image.scale(Geometry("415x234!")); - double arguments[16] = {0, 0, 129, 187, 415, 0, 517, 182, - 415, 234, 517, 465, 0, 234, 132, 418}; - image.distort(Magick::PerspectiveDistortion, 16, arguments, true); - image.extent(Geometry("864x481"), Magick::CenterGravity); - watermark_new.composite(image, Geometry("-110+83"), - Magick::OverCompositeOp); - watermark_new.magick(*type); - watermark_new.animationDelay(image.animationDelay()); - mid.push_back(watermark_new); - } - - optimizeTransparency(mid.begin(), mid.end()); - - if (*type == "gif") { - for (Image &image : mid) { - image.quantizeDitherMethod(FloydSteinbergDitherMethod); - image.quantize(); - } - } - - writeImages(mid.begin(), mid.end(), &blob); - - *DataSize = blob.length(); - - char *data = (char *)malloc(*DataSize); - memcpy(data, blob.data(), *DataSize); - return data; + void *buf; + final.write_to_buffer( + ("." + *outType).c_str(), &buf, DataSize, + *outType == "gif" ? VImage::option()->set("dither", 1) : 0); + return (char *)buf; } \ No newline at end of file diff --git a/natives/scott.h b/natives/scott.h index 6752c42..45313af 100644 --- a/natives/scott.h +++ b/natives/scott.h @@ -4,5 +4,5 @@ using std::string; -char* Scott(string* type, char* BufferData, size_t BufferLength, +char* Scott(string type, string* outType, char* BufferData, size_t BufferLength, ArgumentMap Arguments, size_t* DataSize); \ No newline at end of file diff --git a/natives/snapchat.cc b/natives/snapchat.cc index 8346b56..7b5a812 100644 --- a/natives/snapchat.cc +++ b/natives/snapchat.cc @@ -5,8 +5,8 @@ using namespace std; using namespace vips; -char *Snapchat(string *type, char *BufferData, size_t BufferLength, - ArgumentMap Arguments, size_t *DataSize) { +char *Snapchat(string type, string *outType, char *BufferData, + size_t BufferLength, ArgumentMap Arguments, size_t *DataSize) { string caption = GetArgument(Arguments, "caption"); float pos = GetArgumentWithFallback(Arguments, "pos", 0.5); string basePath = GetArgument(Arguments, "basePath"); @@ -15,7 +15,7 @@ char *Snapchat(string *type, char *BufferData, size_t BufferLength, VImage in = VImage::new_from_buffer(BufferData, BufferLength, "", - *type == "gif" ? options->set("n", -1) : options) + type == "gif" ? options->set("n", -1) : options) .colourspace(VIPS_INTERPRETATION_sRGB); if (!in.has_alpha()) in = in.bandjoin(255); @@ -52,7 +52,7 @@ char *Snapchat(string *type, char *BufferData, size_t BufferLength, vector img; for (int i = 0; i < nPages; i++) { VImage img_frame = - *type == "gif" ? in.crop(0, i * pageHeight, width, pageHeight) : in; + type == "gif" ? in.crop(0, i * pageHeight, width, pageHeight) : in; img_frame = img_frame.composite2( textIn, VIPS_BLEND_MODE_OVER, VImage::option()->set("x", 0)->set("y", pageHeight * pos)); @@ -63,9 +63,10 @@ char *Snapchat(string *type, char *BufferData, size_t BufferLength, void *buf; final.write_to_buffer( - ("." + *type).c_str(), &buf, DataSize, - *type == "gif" ? VImage::option()->set("dither", 0)->set("reoptimise", 1) - : 0); + ("." + *outType).c_str(), &buf, DataSize, + *outType == "gif" + ? VImage::option()->set("dither", 0)->set("reoptimise", 1) + : 0); return (char *)buf; } \ No newline at end of file diff --git a/natives/snapchat.h b/natives/snapchat.h index bc40397..a43a4a3 100644 --- a/natives/snapchat.h +++ b/natives/snapchat.h @@ -4,5 +4,5 @@ using std::string; -char* Snapchat(string* type, char* BufferData, size_t BufferLength, +char* Snapchat(string type, string* outType, char* BufferData, size_t BufferLength, ArgumentMap Arguments, size_t* DataSize); \ No newline at end of file diff --git a/natives/sonic.cc b/natives/sonic.cc index b4f2bea..581700c 100644 --- a/natives/sonic.cc +++ b/natives/sonic.cc @@ -5,7 +5,8 @@ using namespace std; using namespace vips; -char *Sonic(string *type, ArgumentMap Arguments, size_t *DataSize) { +char *Sonic(string type, string *outType, ArgumentMap Arguments, + size_t *DataSize) { string text = GetArgument(Arguments, "text"); string basePath = GetArgument(Arguments, "basePath"); @@ -28,9 +29,7 @@ char *Sonic(string *type, ArgumentMap Arguments, size_t *DataSize) { VImage::option()->set("x", 391)->set("y", 84)); void *buf; - out.write_to_buffer(".png", &buf, DataSize); - - *type = "png"; + out.write_to_buffer(("." + *outType).c_str(), &buf, DataSize); return (char *)buf; } \ No newline at end of file diff --git a/natives/sonic.h b/natives/sonic.h index 10ff4b4..6b3df86 100644 --- a/natives/sonic.h +++ b/natives/sonic.h @@ -4,4 +4,4 @@ using std::string; -char *Sonic(string *type, ArgumentMap Arguments, size_t *DataSize); \ No newline at end of file +char *Sonic(string type, string *outType, ArgumentMap Arguments, size_t *DataSize); \ No newline at end of file diff --git a/natives/speed.cc b/natives/speed.cc index 080904f..f7fc116 100644 --- a/natives/speed.cc +++ b/natives/speed.cc @@ -39,8 +39,8 @@ char *vipsRemove(char *data, size_t length, size_t *DataSize, int speed) { return (char *)buf; } -char *Speed(string *type, char *BufferData, size_t BufferLength, - ArgumentMap Arguments, size_t *DataSize) { +char *Speed([[maybe_unused]] string type, string *outType, char *BufferData, + size_t BufferLength, ArgumentMap Arguments, size_t *DataSize) { bool slow = GetArgumentWithFallback(Arguments, "slow", false); int speed = GetArgumentWithFallback(Arguments, "speed", 2); @@ -53,7 +53,7 @@ char *Speed(string *type, char *BufferData, size_t BufferLength, bool removeFrames = false; char *lastPos; - int amount = 0; + // int amount = 0; lastPos = (char *)memchr(fileData, '\x00', BufferLength); while (lastPos != NULL) { @@ -62,7 +62,7 @@ char *Speed(string *type, char *BufferData, size_t BufferLength, (BufferLength - (lastPos - fileData)) - 1); continue; } - ++amount; + //++amount; uint16_t old_delay; memcpy(&old_delay, lastPos + 5, 2); old_delays.push_back(old_delay); diff --git a/natives/speed.h b/natives/speed.h index 6a8afef..0c861ae 100644 --- a/natives/speed.h +++ b/natives/speed.h @@ -4,5 +4,5 @@ using std::string; -char* Speed(string* type, char* BufferData, size_t BufferLength, +char* Speed(string type, string* outType, char* BufferData, size_t BufferLength, ArgumentMap Arguments, size_t* DataSize); \ No newline at end of file diff --git a/natives/spin.cc b/natives/spin.cc index 56c14d9..2c1d07e 100644 --- a/natives/spin.cc +++ b/natives/spin.cc @@ -1,15 +1,16 @@ -#include "common.h" #include #include #include #include +#include "common.h" + using namespace std; using namespace Magick; -char *Spin(string *type, char *BufferData, size_t BufferLength, - ArgumentMap Arguments, size_t *DataSize) { +char *Spin(string type, string *outType, char *BufferData, size_t BufferLength, + [[maybe_unused]] ArgumentMap Arguments, size_t *DataSize) { int delay = GetArgumentWithFallback(Arguments, "delay", 0); Blob blob; @@ -26,7 +27,7 @@ char *Spin(string *type, char *BufferData, size_t BufferLength, } coalesceImages(&coalesced, frames.begin(), frames.end()); - if (*type != "gif") { + if (type != "gif") { list::iterator it = coalesced.begin(); for (int i = 0; i < 29; ++i) { coalesced.push_back(*it); @@ -51,7 +52,7 @@ char *Spin(string *type, char *BufferData, size_t BufferLength, optimizeTransparency(mid.begin(), mid.end()); if (delay != 0) { for_each(mid.begin(), mid.end(), animationDelayImage(delay)); - } else if (*type != "gif") { + } else if (type != "gif") { for_each(mid.begin(), mid.end(), animationDelayImage(5)); } @@ -62,7 +63,7 @@ char *Spin(string *type, char *BufferData, size_t BufferLength, writeImages(mid.begin(), mid.end(), &blob); - *type = "gif"; + *outType = "gif"; *DataSize = blob.length(); char *data = (char *)malloc(*DataSize); diff --git a/natives/spin.h b/natives/spin.h index dbd94f0..74f16b8 100644 --- a/natives/spin.h +++ b/natives/spin.h @@ -4,5 +4,5 @@ using std::string; -char* Spin(string* type, char* BufferData, size_t BufferLength, +char* Spin(string type, string* outType, char* BufferData, size_t BufferLength, ArgumentMap Arguments, size_t* DataSize); \ No newline at end of file diff --git a/natives/squish.cc b/natives/squish.cc index 868c163..a28463b 100644 --- a/natives/squish.cc +++ b/natives/squish.cc @@ -7,27 +7,28 @@ using namespace std; using namespace vips; -char *Squish(string *type, char *BufferData, size_t BufferLength, - ArgumentMap Arguments, size_t *DataSize) { +char *Squish(string type, string *outType, char *BufferData, + size_t BufferLength, [[maybe_unused]] ArgumentMap Arguments, + size_t *DataSize) { VOption *options = VImage::option(); VImage in = VImage::new_from_buffer( BufferData, BufferLength, "", - *type == "gif" ? options->set("n", -1)->set("access", "sequential") - : options) + type == "gif" ? options->set("n", -1)->set("access", "sequential") + : options) .colourspace(VIPS_INTERPRETATION_sRGB); if (!in.has_alpha()) in = in.bandjoin(255); int width = in.width(); int pageHeight = vips_image_get_page_height(in.get_image()); - int nPages = *type == "gif" ? vips_image_get_n_pages(in.get_image()) : 30; + int nPages = type == "gif" ? vips_image_get_n_pages(in.get_image()) : 30; double mult = (2 * M_PI) / nPages; vector img; for (int i = 0; i < nPages; i++) { VImage img_frame = - *type == "gif" ? in.crop(0, i * pageHeight, width, pageHeight) : in; + type == "gif" ? in.crop(0, i * pageHeight, width, pageHeight) : in; double newWidth = (sin(i * mult) / 4) + 0.75; double newHeight = (cos(i * mult) / 4) + 0.75; VImage resized = @@ -37,7 +38,7 @@ char *Squish(string *type, char *BufferData, size_t BufferLength, } VImage final = VImage::arrayjoin(img, VImage::option()->set("across", 1)); final.set(VIPS_META_PAGE_HEIGHT, pageHeight); - if (*type != "gif") { + if (type != "gif") { vector delay(30, 50); final.set("delay", delay); } @@ -45,7 +46,7 @@ char *Squish(string *type, char *BufferData, size_t BufferLength, void *buf; final.write_to_buffer(".gif", &buf, DataSize); - *type = "gif"; + *outType = "gif"; return (char *)buf; } \ No newline at end of file diff --git a/natives/squish.h b/natives/squish.h index 291b6a9..47c5118 100644 --- a/natives/squish.h +++ b/natives/squish.h @@ -4,5 +4,5 @@ using std::string; -char* Squish(string* type, char* BufferData, size_t BufferLength, +char* Squish(string type, string* outType, char* BufferData, size_t BufferLength, ArgumentMap Arguments, size_t* DataSize); \ No newline at end of file diff --git a/natives/swirl.cc b/natives/swirl.cc index 5a068ff..8ae3be4 100644 --- a/natives/swirl.cc +++ b/natives/swirl.cc @@ -5,13 +5,13 @@ using namespace std; using namespace vips; -char *Swirl(string *type, char *BufferData, size_t BufferLength, - ArgumentMap Arguments, size_t *DataSize) { +char *Swirl(string type, string *outType, char *BufferData, size_t BufferLength, + [[maybe_unused]] ArgumentMap Arguments, size_t *DataSize) { VOption *options = VImage::option()->set("access", "sequential"); VImage in = VImage::new_from_buffer(BufferData, BufferLength, "", - *type == "gif" ? options->set("n", -1) : options) + type == "gif" ? options->set("n", -1) : options) .colourspace(VIPS_INTERPRETATION_sRGB); if (!in.has_alpha()) in = in.bandjoin(255); @@ -54,7 +54,7 @@ char *Swirl(string *type, char *BufferData, size_t BufferLength, vector img; for (int i = 0; i < nPages; i++) { VImage img_frame = - *type == "gif" ? in.crop(0, i * pageHeight, width, pageHeight) : in; + type == "gif" ? in.crop(0, i * pageHeight, width, pageHeight) : in; VImage distort = img_frame @@ -70,7 +70,7 @@ char *Swirl(string *type, char *BufferData, size_t BufferLength, final.set(VIPS_META_PAGE_HEIGHT, pageHeight); void *buf; - final.write_to_buffer(".gif", &buf, DataSize); + final.write_to_buffer(("." + *outType).c_str(), &buf, DataSize); return (char *)buf; } \ No newline at end of file diff --git a/natives/swirl.h b/natives/swirl.h index eb67aff..fecb25c 100644 --- a/natives/swirl.h +++ b/natives/swirl.h @@ -4,5 +4,5 @@ using std::string; -char* Swirl(string* type, char* BufferData, size_t BufferLength, +char* Swirl(string type, string* outType, char* BufferData, size_t BufferLength, ArgumentMap Arguments, size_t* DataSize); \ No newline at end of file diff --git a/natives/tile.cc b/natives/tile.cc index ee9ab28..30feb7b 100644 --- a/natives/tile.cc +++ b/natives/tile.cc @@ -9,8 +9,8 @@ using namespace std; using namespace Magick; -char *Tile(string *type, char *BufferData, size_t BufferLength, - ArgumentMap Arguments, size_t *DataSize) { +char *Tile(string type, string *outType, char *BufferData, size_t BufferLength, + [[maybe_unused]] ArgumentMap Arguments, size_t *DataSize) { Blob blob; list frames; @@ -30,7 +30,7 @@ char *Tile(string *type, char *BufferData, size_t BufferLength, Image appended; list montage; Image frame; - image.magick(*type); + image.magick(*outType); for (int i = 0; i < 5; ++i) { duplicated.push_back(image); } @@ -48,7 +48,7 @@ char *Tile(string *type, char *BufferData, size_t BufferLength, optimizeTransparency(mid.begin(), mid.end()); - if (*type == "gif") { + if (*outType == "gif") { for (Image &image : mid) { image.quantizeDitherMethod(FloydSteinbergDitherMethod); image.quantize(); diff --git a/natives/tile.h b/natives/tile.h index 72ea5ca..a1fe22b 100644 --- a/natives/tile.h +++ b/natives/tile.h @@ -4,5 +4,5 @@ using std::string; -char* Tile(string* type, char* BufferData, size_t BufferLength, +char* Tile(string type, string* outType, char* BufferData, size_t BufferLength, ArgumentMap Arguments, size_t* DataSize); \ No newline at end of file diff --git a/natives/togif.cc b/natives/togif.cc index 16ff000..678b537 100644 --- a/natives/togif.cc +++ b/natives/togif.cc @@ -5,9 +5,9 @@ using namespace std; using namespace vips; -char *ToGif(string *type, char *BufferData, size_t BufferLength, - ArgumentMap Arguments, size_t *DataSize) { - if (*type == "gif") { +char *ToGif(string type, string *outType, char *BufferData, size_t BufferLength, + [[maybe_unused]] ArgumentMap Arguments, size_t *DataSize) { + if (type == "gif") { *DataSize = BufferLength; char *data = (char *)malloc(BufferLength); memcpy(data, BufferData, BufferLength); @@ -17,11 +17,11 @@ char *ToGif(string *type, char *BufferData, size_t BufferLength, VImage in = VImage::new_from_buffer( BufferData, BufferLength, "", - *type == "webp" ? options->set("n", -1) : options); + type == "webp" ? options->set("n", -1) : options); void *buf; in.write_to_buffer(".gif", &buf, DataSize); - *type = "gif"; + *outType = "gif"; return (char *)buf; } diff --git a/natives/togif.h b/natives/togif.h index 73b837e..5e3f8c0 100644 --- a/natives/togif.h +++ b/natives/togif.h @@ -4,5 +4,5 @@ using std::string; -char* ToGif(string* type, char* BufferData, size_t BufferLength, +char* ToGif(string type, string* outType, char* BufferData, size_t BufferLength, ArgumentMap Arguments, size_t* DataSize); \ No newline at end of file diff --git a/natives/uncanny.cc b/natives/uncanny.cc index 695acfc..16a922b 100644 --- a/natives/uncanny.cc +++ b/natives/uncanny.cc @@ -5,8 +5,8 @@ using namespace std; using namespace vips; -char *Uncanny(string *type, char *BufferData, size_t BufferLength, - ArgumentMap Arguments, size_t *DataSize) { +char *Uncanny(string type, string *outType, char *BufferData, + size_t BufferLength, ArgumentMap Arguments, size_t *DataSize) { string caption = GetArgument(Arguments, "caption"); string caption2 = GetArgument(Arguments, "caption2"); string font = GetArgument(Arguments, "font"); @@ -17,7 +17,7 @@ char *Uncanny(string *type, char *BufferData, size_t BufferLength, VImage in = VImage::new_from_buffer(BufferData, BufferLength, "", - *type == "gif" ? options->set("n", -1) : options) + type == "gif" ? options->set("n", -1) : options) .colourspace(VIPS_INTERPRETATION_sRGB) .extract_band(0, VImage::option()->set("n", 3)); @@ -79,7 +79,7 @@ char *Uncanny(string *type, char *BufferData, size_t BufferLength, vector img; for (int i = 0; i < nPages; i++) { VImage img_frame = - *type == "gif" ? in.crop(0, i * pageHeight, width, pageHeight) : in; + type == "gif" ? in.crop(0, i * pageHeight, width, pageHeight) : in; VImage resized = img_frame.resize(690.0 / (double)width); if (resized.height() > 590) { double vscale = 590.0 / (double)resized.height(); @@ -94,8 +94,8 @@ char *Uncanny(string *type, char *BufferData, size_t BufferLength, void *buf; final.write_to_buffer( - ("." + *type).c_str(), &buf, DataSize, - *type == "gif" ? VImage::option()->set("reoptimise", 1) : 0); + ("." + *outType).c_str(), &buf, DataSize, + *outType == "gif" ? VImage::option()->set("reoptimise", 1) : 0); return (char *)buf; } \ No newline at end of file diff --git a/natives/uncanny.h b/natives/uncanny.h index 018495a..d9c34e5 100644 --- a/natives/uncanny.h +++ b/natives/uncanny.h @@ -4,5 +4,5 @@ using std::string; -char* Uncanny(string* type, char* BufferData, size_t BufferLength, +char* Uncanny(string type, string* outType, char* BufferData, size_t BufferLength, ArgumentMap Arguments, size_t* DataSize); \ No newline at end of file diff --git a/natives/uncaption.cc b/natives/uncaption.cc index 9481cf0..0145d87 100644 --- a/natives/uncaption.cc +++ b/natives/uncaption.cc @@ -6,8 +6,8 @@ using namespace std; using namespace vips; -char *Uncaption(string *type, char *BufferData, size_t BufferLength, - ArgumentMap Arguments, size_t *DataSize) { +char *Uncaption(string type, string *outType, char *BufferData, + size_t BufferLength, ArgumentMap Arguments, size_t *DataSize) { float tolerance = GetArgumentWithFallback(Arguments, "tolerance", 0.5); VOption *options = VImage::option(); @@ -15,8 +15,8 @@ char *Uncaption(string *type, char *BufferData, size_t BufferLength, VImage in = VImage::new_from_buffer( BufferData, BufferLength, "", - *type == "gif" ? options->set("n", -1)->set("access", "sequential") - : options) + type == "gif" ? options->set("n", -1)->set("access", "sequential") + : options) .colourspace(VIPS_INTERPRETATION_sRGB); if (!in.has_alpha()) in = in.bandjoin(255); @@ -45,9 +45,10 @@ char *Uncaption(string *type, char *BufferData, size_t BufferLength, void *buf; final.write_to_buffer( - ("." + *type).c_str(), &buf, DataSize, - *type == "gif" ? VImage::option()->set("dither", 0)->set("reoptimise", 1) - : 0); + ("." + *outType).c_str(), &buf, DataSize, + *outType == "gif" + ? VImage::option()->set("dither", 0)->set("reoptimise", 1) + : 0); return (char *)buf; } diff --git a/natives/uncaption.h b/natives/uncaption.h index d90fcf1..74b9f4d 100644 --- a/natives/uncaption.h +++ b/natives/uncaption.h @@ -4,5 +4,5 @@ using std::string; -char* Uncaption(string* type, char* BufferData, size_t BufferLength, +char* Uncaption(string type, string* outType, char* BufferData, size_t BufferLength, ArgumentMap Arguments, size_t* DataSize); \ No newline at end of file diff --git a/natives/wall.cc b/natives/wall.cc index 88e007e..aa87fc9 100644 --- a/natives/wall.cc +++ b/natives/wall.cc @@ -9,8 +9,8 @@ using namespace std; using namespace Magick; -char *Wall(string *type, char *BufferData, size_t BufferLength, - ArgumentMap Arguments, size_t *DataSize) { +char *Wall(string type, string *outType, char *BufferData, size_t BufferLength, + [[maybe_unused]] ArgumentMap Arguments, size_t *DataSize) { Blob blob; list frames; @@ -35,13 +35,13 @@ char *Wall(string *type, char *BufferData, size_t BufferLength, 128, 0, 140, 60, 128, 128, 140, 140}; image.distort(Magick::PerspectiveDistortion, 16, arguments); image.scale(Geometry("800x800>")); - image.magick(*type); + image.magick(*outType); mid.push_back(image); } optimizeTransparency(mid.begin(), mid.end()); - if (*type == "gif") { + if (*outType == "gif") { for (Image &image : mid) { image.quantizeDitherMethod(FloydSteinbergDitherMethod); image.quantize(); diff --git a/natives/wall.h b/natives/wall.h index f90817c..93119d3 100644 --- a/natives/wall.h +++ b/natives/wall.h @@ -4,5 +4,5 @@ using std::string; -char* Wall(string* type, char* BufferData, size_t BufferLength, +char* Wall(string type, string* outType, char* BufferData, size_t BufferLength, ArgumentMap Arguments, size_t* DataSize); \ No newline at end of file diff --git a/natives/watermark.cc b/natives/watermark.cc index 208418f..7193067 100644 --- a/natives/watermark.cc +++ b/natives/watermark.cc @@ -6,8 +6,8 @@ using namespace std; using namespace vips; -char *Watermark(string *type, char *BufferData, size_t BufferLength, - ArgumentMap Arguments, size_t *DataSize) { +char *Watermark(string type, string *outType, char *BufferData, + size_t BufferLength, ArgumentMap Arguments, size_t *DataSize) { string water = GetArgument(Arguments, "water"); int gravity = GetArgument(Arguments, "gravity"); @@ -28,7 +28,7 @@ char *Watermark(string *type, char *BufferData, size_t BufferLength, VImage in = VImage::new_from_buffer(BufferData, BufferLength, "", - *type == "gif" ? options->set("n", -1) : options) + type == "gif" ? options->set("n", -1) : options) .colourspace(VIPS_INTERPRETATION_sRGB); if (!in.has_alpha()) in = in.bandjoin(255); @@ -91,7 +91,7 @@ char *Watermark(string *type, char *BufferData, size_t BufferLength, VImage frame; for (int i = 0; i < nPages; i++) { VImage img_frame = - *type == "gif" ? in.crop(0, i * pageHeight, width, pageHeight) : in; + type == "gif" ? in.crop(0, i * pageHeight, width, pageHeight) : in; if (append) { VImage appended = img_frame.join(watermark, VIPS_DIRECTION_VERTICAL, VImage::option()->set("expand", true)); @@ -121,8 +121,8 @@ char *Watermark(string *type, char *BufferData, size_t BufferLength, bg = frameAlpha.new_from_image({0, 0, 0}).copy(VImage::option()->set( "interpretation", VIPS_INTERPRETATION_sRGB)); frame = bg.bandjoin(frameAlpha); - if (*type == "jpg" || *type == "jpeg") { - *type = "png"; + if (*outType == "jpg" || *outType == "jpeg") { + *outType = "png"; } } VImage content = @@ -145,9 +145,10 @@ char *Watermark(string *type, char *BufferData, size_t BufferLength, void *buf; final.write_to_buffer( - ("." + *type).c_str(), &buf, DataSize, - *type == "gif" ? VImage::option()->set("dither", 0)->set("reoptimise", 1) - : 0); + ("." + *outType).c_str(), &buf, DataSize, + *outType == "gif" + ? VImage::option()->set("dither", 0)->set("reoptimise", 1) + : 0); return (char *)buf; } diff --git a/natives/watermark.h b/natives/watermark.h index c7bec04..da102dc 100644 --- a/natives/watermark.h +++ b/natives/watermark.h @@ -4,5 +4,5 @@ using std::string; -char* Watermark(string* type, char* BufferData, size_t BufferLength, +char* Watermark(string type, string* outType, char* BufferData, size_t BufferLength, ArgumentMap Arguments, size_t* DataSize); \ No newline at end of file diff --git a/natives/whisper.cc b/natives/whisper.cc index 61f833a..da96542 100644 --- a/natives/whisper.cc +++ b/natives/whisper.cc @@ -5,8 +5,8 @@ using namespace std; using namespace vips; -char *Whisper(string *type, char *BufferData, size_t BufferLength, - ArgumentMap Arguments, size_t *DataSize) { +char *Whisper(string type, string *outType, char *BufferData, + size_t BufferLength, ArgumentMap Arguments, size_t *DataSize) { string caption = GetArgument(Arguments, "caption"); string basePath = GetArgument(Arguments, "basePath"); @@ -14,7 +14,7 @@ char *Whisper(string *type, char *BufferData, size_t BufferLength, VImage in = VImage::new_from_buffer(BufferData, BufferLength, "", - *type == "gif" ? options->set("n", -1) : options) + type == "gif" ? options->set("n", -1) : options) .colourspace(VIPS_INTERPRETATION_sRGB); if (!in.has_alpha()) in = in.bandjoin(255); @@ -64,7 +64,7 @@ char *Whisper(string *type, char *BufferData, size_t BufferLength, vector img; for (int i = 0; i < nPages; i++) { VImage img_frame = - *type == "gif" ? in.crop(0, i * pageHeight, width, pageHeight) : in; + type == "gif" ? in.crop(0, i * pageHeight, width, pageHeight) : in; img_frame = img_frame.composite2( textImg, VIPS_BLEND_MODE_OVER, VImage::option() @@ -77,9 +77,10 @@ char *Whisper(string *type, char *BufferData, size_t BufferLength, void *buf; final.write_to_buffer( - ("." + *type).c_str(), &buf, DataSize, - *type == "gif" ? VImage::option()->set("dither", 0)->set("reoptimise", 1) - : 0); + ("." + *outType).c_str(), &buf, DataSize, + *outType == "gif" + ? VImage::option()->set("dither", 0)->set("reoptimise", 1) + : 0); return (char *)buf; } \ No newline at end of file diff --git a/natives/whisper.h b/natives/whisper.h index 3cf3840..df9160e 100644 --- a/natives/whisper.h +++ b/natives/whisper.h @@ -4,5 +4,5 @@ using std::string; -char* Whisper(string* type, char* BufferData, size_t BufferLength, +char* Whisper(string type, string* outType, char* BufferData, size_t BufferLength, ArgumentMap Arguments, size_t* DataSize); \ No newline at end of file diff --git a/natives/zamn.cc b/natives/zamn.cc index 28c0ee4..55173c3 100644 --- a/natives/zamn.cc +++ b/natives/zamn.cc @@ -5,7 +5,7 @@ using namespace std; using namespace vips; -char *Zamn(string *type, char *BufferData, size_t BufferLength, +char *Zamn(string type, string *outType, char *BufferData, size_t BufferLength, ArgumentMap Arguments, size_t *DataSize) { string basePath = GetArgument(Arguments, "basePath"); @@ -13,7 +13,7 @@ char *Zamn(string *type, char *BufferData, size_t BufferLength, VImage in = VImage::new_from_buffer(BufferData, BufferLength, "", - *type == "gif" ? options->set("n", -1) : options) + type == "gif" ? options->set("n", -1) : options) .colourspace(VIPS_INTERPRETATION_sRGB); if (!in.has_alpha()) in = in.bandjoin(255); @@ -27,7 +27,7 @@ char *Zamn(string *type, char *BufferData, size_t BufferLength, vector img; for (int i = 0; i < nPages; i++) { VImage img_frame = - *type == "gif" ? in.crop(0, i * pageHeight, width, pageHeight) : in; + type == "gif" ? in.crop(0, i * pageHeight, width, pageHeight) : in; VImage composited = tmpl.insert( img_frame.extract_band(0, VImage::option()->set("n", 3)) .bandjoin(255) @@ -41,7 +41,7 @@ char *Zamn(string *type, char *BufferData, size_t BufferLength, final.set(VIPS_META_PAGE_HEIGHT, 516); void *buf; - final.write_to_buffer(("." + *type).c_str(), &buf, DataSize); + final.write_to_buffer(("." + *outType).c_str(), &buf, DataSize); return (char *)buf; } \ No newline at end of file diff --git a/natives/zamn.h b/natives/zamn.h index e18f384..0eec42c 100644 --- a/natives/zamn.h +++ b/natives/zamn.h @@ -4,5 +4,5 @@ using std::string; -char* Zamn(string* type, char* BufferData, size_t BufferLength, +char* Zamn(string type, string* outType, char* BufferData, size_t BufferLength, ArgumentMap Arguments, size_t* DataSize); \ No newline at end of file diff --git a/package.json b/package.json index 27a8d59..8eff11b 100644 --- a/package.json +++ b/package.json @@ -29,37 +29,37 @@ "dependencies": { "dotenv": "^16.0.3", "emoji-regex": "^10.2.1", - "file-type": "^18.0.0", - "format-duration": "^2.0.0", + "file-type": "^18.2.1", + "format-duration": "^3.0.2", "jsqr": "^1.4.0", - "node-addon-api": "^5.0.0", + "node-addon-api": "^5.1.0", "node-emoji": "^1.11.0", - "oceanic.js": "1.3.2", + "oceanic.js": "1.5.1", "qrcode": "^1.5.1", - "sharp": "^0.31.2", - "shoukaku": "^3.2.2", - "undici": "^5.14.0", + "sharp": "^0.31.3", + "shoukaku": "^3.3.1", + "undici": "^5.20.0", "winston": "^3.8.2", "winston-daily-rotate-file": "^4.7.1" }, "devDependencies": { - "@babel/core": "^7.20.5", + "@babel/core": "^7.21.0", "@babel/eslint-parser": "^7.19.1", "@babel/eslint-plugin": "^7.19.1", "@babel/plugin-proposal-class-properties": "^7.18.6", - "cmake-js": "^7.0.0", - "eslint": "^8.29.0", - "eslint-plugin-unicorn": "^45.0.2" + "cmake-js": "^7.2.1", + "eslint": "^8.35.0", + "eslint-plugin-unicorn": "^46.0.0" }, "optionalDependencies": { - "better-sqlite3": "^8.0.1", + "better-sqlite3": "^8.1.0", "bufferutil": "^4.0.7", "erlpack": "^0.1.4", "pm2": "^5.2.2", - "postgres": "^3.3.2", + "postgres": "^3.3.4", "uuid": "^9.0.0", - "ws": "^8.11.0", - "zlib-sync": "^0.1.7" + "ws": "^8.12.1", + "zlib-sync": "^0.1.8" }, "binary": { "napi_versions": [ diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 8272822..4f4f486 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -1,70 +1,70 @@ lockfileVersion: 5.4 specifiers: - '@babel/core': ^7.20.5 + '@babel/core': ^7.21.0 '@babel/eslint-parser': ^7.19.1 '@babel/eslint-plugin': ^7.19.1 '@babel/plugin-proposal-class-properties': ^7.18.6 - better-sqlite3: ^8.0.1 + better-sqlite3: ^8.1.0 bufferutil: ^4.0.7 - cmake-js: ^7.0.0 + cmake-js: ^7.2.1 dotenv: ^16.0.3 emoji-regex: ^10.2.1 erlpack: ^0.1.4 - eslint: ^8.29.0 - eslint-plugin-unicorn: ^45.0.2 - file-type: ^18.0.0 - format-duration: ^2.0.0 + eslint: ^8.35.0 + eslint-plugin-unicorn: ^46.0.0 + file-type: ^18.2.1 + format-duration: ^3.0.2 jsqr: ^1.4.0 - node-addon-api: ^5.0.0 + node-addon-api: ^5.1.0 node-emoji: ^1.11.0 - oceanic.js: 1.3.2 + oceanic.js: 1.5.1 pm2: ^5.2.2 - postgres: ^3.3.2 + postgres: ^3.3.4 qrcode: ^1.5.1 - sharp: ^0.31.2 - shoukaku: ^3.2.2 - undici: ^5.14.0 + sharp: ^0.31.3 + shoukaku: ^3.3.1 + undici: ^5.20.0 uuid: ^9.0.0 winston: ^3.8.2 winston-daily-rotate-file: ^4.7.1 - ws: ^8.11.0 - zlib-sync: ^0.1.7 + ws: ^8.12.1 + zlib-sync: ^0.1.8 dependencies: dotenv: 16.0.3 emoji-regex: 10.2.1 - file-type: 18.0.0 - format-duration: 2.0.0 + file-type: 18.2.1 + format-duration: 3.0.2 jsqr: 1.4.0 - node-addon-api: 5.0.0 + node-addon-api: 5.1.0 node-emoji: 1.11.0 - oceanic.js: 1.3.2_bufferutil@4.0.7 + oceanic.js: 1.5.1_bufferutil@4.0.7 qrcode: 1.5.1 - sharp: 0.31.2 - shoukaku: 3.2.2_bufferutil@4.0.7 - undici: 5.14.0 + sharp: 0.31.3 + shoukaku: 3.3.1_bufferutil@4.0.7 + undici: 5.20.0 winston: 3.8.2 winston-daily-rotate-file: 4.7.1_winston@3.8.2 optionalDependencies: - better-sqlite3: 8.0.1 + better-sqlite3: 8.1.0 bufferutil: 4.0.7 erlpack: 0.1.4 pm2: 5.2.2_bufferutil@4.0.7 - postgres: 3.3.2 + postgres: 3.3.4 uuid: 9.0.0 - ws: 8.11.0_bufferutil@4.0.7 - zlib-sync: 0.1.7 + ws: 8.12.1_bufferutil@4.0.7 + zlib-sync: 0.1.8 devDependencies: - '@babel/core': 7.20.5 - '@babel/eslint-parser': 7.19.1_xthtwe2nrrwct2fnasddpvoro4 - '@babel/eslint-plugin': 7.19.1_iw4s3en7fyyxs2py43hgzzlham - '@babel/plugin-proposal-class-properties': 7.18.6_@babel+core@7.20.5 - cmake-js: 7.0.0 - eslint: 8.29.0 - eslint-plugin-unicorn: 45.0.2_eslint@8.29.0 + '@babel/core': 7.21.0 + '@babel/eslint-parser': 7.19.1_zt6cfucldurvbyn2isj445jria + '@babel/eslint-plugin': 7.19.1_zsxfaf6nk6oxn6rgpeszjpjh6i + '@babel/plugin-proposal-class-properties': 7.18.6_@babel+core@7.21.0 + cmake-js: 7.2.1 + eslint: 8.35.0 + eslint-plugin-unicorn: 46.0.0_eslint@8.35.0 packages: @@ -83,66 +83,67 @@ packages: '@babel/highlight': 7.18.6 dev: true - /@babel/compat-data/7.20.5: - resolution: {integrity: sha512-KZXo2t10+/jxmkhNXc7pZTqRvSOIvVv/+lJwHS+B2rErwOyjuVRh60yVpb7liQ1U5t7lLJ1bz+t8tSypUZdm0g==} + /@babel/compat-data/7.21.0: + resolution: {integrity: sha512-gMuZsmsgxk/ENC3O/fRw5QY8A9/uxQbbCEypnLIiYYc/qVJtEV7ouxC3EllIIwNzMqAQee5tanFabWsUOutS7g==} engines: {node: '>=6.9.0'} dev: true - /@babel/core/7.20.5: - resolution: {integrity: sha512-UdOWmk4pNWTm/4DlPUl/Pt4Gz4rcEMb7CY0Y3eJl5Yz1vI8ZJGmHWaVE55LoxRjdpx0z259GE9U5STA9atUinQ==} + /@babel/core/7.21.0: + resolution: {integrity: sha512-PuxUbxcW6ZYe656yL3EAhpy7qXKq0DmYsrJLpbB8XrsCP9Nm+XCg9XFMb5vIDliPD7+U/+M+QJlH17XOcB7eXA==} engines: {node: '>=6.9.0'} dependencies: '@ampproject/remapping': 2.2.0 '@babel/code-frame': 7.18.6 - '@babel/generator': 7.20.5 - '@babel/helper-compilation-targets': 7.20.0_@babel+core@7.20.5 - '@babel/helper-module-transforms': 7.20.2 - '@babel/helpers': 7.20.6 - '@babel/parser': 7.20.5 - '@babel/template': 7.18.10 - '@babel/traverse': 7.20.5 - '@babel/types': 7.20.5 + '@babel/generator': 7.21.1 + '@babel/helper-compilation-targets': 7.20.7_@babel+core@7.21.0 + '@babel/helper-module-transforms': 7.21.2 + '@babel/helpers': 7.21.0 + '@babel/parser': 7.21.2 + '@babel/template': 7.20.7 + '@babel/traverse': 7.21.2 + '@babel/types': 7.21.2 convert-source-map: 1.9.0 debug: 4.3.4 gensync: 1.0.0-beta.2 - json5: 2.2.1 + json5: 2.2.3 semver: 6.3.0 transitivePeerDependencies: - supports-color dev: true - /@babel/eslint-parser/7.19.1_xthtwe2nrrwct2fnasddpvoro4: + /@babel/eslint-parser/7.19.1_zt6cfucldurvbyn2isj445jria: resolution: {integrity: sha512-AqNf2QWt1rtu2/1rLswy6CDP7H9Oh3mMhk177Y67Rg8d7RD9WfOLLv8CGn6tisFvS2htm86yIe1yLF6I1UDaGQ==} engines: {node: ^10.13.0 || ^12.13.0 || >=14.0.0} peerDependencies: '@babel/core': '>=7.11.0' eslint: ^7.5.0 || ^8.0.0 dependencies: - '@babel/core': 7.20.5 + '@babel/core': 7.21.0 '@nicolo-ribaudo/eslint-scope-5-internals': 5.1.1-v1 - eslint: 8.29.0 + eslint: 8.35.0 eslint-visitor-keys: 2.1.0 semver: 6.3.0 dev: true - /@babel/eslint-plugin/7.19.1_iw4s3en7fyyxs2py43hgzzlham: + /@babel/eslint-plugin/7.19.1_zsxfaf6nk6oxn6rgpeszjpjh6i: resolution: {integrity: sha512-ElGPkQPapKMa3zVqXHkZYzuL7I5LbRw9UWBUArgWsdWDDb9XcACqOpBib5tRPA9XvbVZYrFUkoQPbiJ4BFvu4w==} engines: {node: ^10.13.0 || ^12.13.0 || >=14.0.0} peerDependencies: '@babel/eslint-parser': '>=7.11.0' eslint: '>=7.5.0' dependencies: - '@babel/eslint-parser': 7.19.1_xthtwe2nrrwct2fnasddpvoro4 - eslint: 8.29.0 + '@babel/eslint-parser': 7.19.1_zt6cfucldurvbyn2isj445jria + eslint: 8.35.0 eslint-rule-composer: 0.3.0 dev: true - /@babel/generator/7.20.5: - resolution: {integrity: sha512-jl7JY2Ykn9S0yj4DQP82sYvPU+T3g0HFcWTqDLqiuA9tGRNIj9VfbtXGAYTTkyNEnQk1jkMGOdYka8aG/lulCA==} + /@babel/generator/7.21.1: + resolution: {integrity: sha512-1lT45bAYlQhFn/BHivJs43AiW2rg3/UbLyShGfF3C0KmHvO5fSghWd5kBJy30kpRRucGzXStvnnCFniCR2kXAA==} engines: {node: '>=6.9.0'} dependencies: - '@babel/types': 7.20.5 + '@babel/types': 7.21.2 '@jridgewell/gen-mapping': 0.3.2 + '@jridgewell/trace-mapping': 0.3.17 jsesc: 2.5.2 dev: true @@ -150,35 +151,37 @@ packages: resolution: {integrity: sha512-duORpUiYrEpzKIop6iNbjnwKLAKnJ47csTyRACyEmWj0QdUrm5aqNJGHSSEQSUAvNW0ojX0dOmK9dZduvkfeXA==} engines: {node: '>=6.9.0'} dependencies: - '@babel/types': 7.20.5 + '@babel/types': 7.21.2 dev: true - /@babel/helper-compilation-targets/7.20.0_@babel+core@7.20.5: - resolution: {integrity: sha512-0jp//vDGp9e8hZzBc6N/KwA5ZK3Wsm/pfm4CrY7vzegkVxc65SgSn6wYOnwHe9Js9HRQ1YTCKLGPzDtaS3RoLQ==} + /@babel/helper-compilation-targets/7.20.7_@babel+core@7.21.0: + resolution: {integrity: sha512-4tGORmfQcrc+bvrjb5y3dG9Mx1IOZjsHqQVUz7XCNHO+iTmqxWnVg3KRygjGmpRLJGdQSKuvFinbIb0CnZwHAQ==} engines: {node: '>=6.9.0'} peerDependencies: '@babel/core': ^7.0.0 dependencies: - '@babel/compat-data': 7.20.5 - '@babel/core': 7.20.5 - '@babel/helper-validator-option': 7.18.6 - browserslist: 4.21.4 + '@babel/compat-data': 7.21.0 + '@babel/core': 7.21.0 + '@babel/helper-validator-option': 7.21.0 + browserslist: 4.21.5 + lru-cache: 5.1.1 semver: 6.3.0 dev: true - /@babel/helper-create-class-features-plugin/7.20.5_@babel+core@7.20.5: - resolution: {integrity: sha512-3RCdA/EmEaikrhayahwToF0fpweU/8o2p8vhc1c/1kftHOdTKuC65kik/TLc+qfbS8JKw4qqJbne4ovICDhmww==} + /@babel/helper-create-class-features-plugin/7.21.0_@babel+core@7.21.0: + resolution: {integrity: sha512-Q8wNiMIdwsv5la5SPxNYzzkPnjgC0Sy0i7jLkVOCdllu/xcVNkr3TeZzbHBJrj+XXRqzX5uCyCoV9eu6xUG7KQ==} engines: {node: '>=6.9.0'} peerDependencies: '@babel/core': ^7.0.0 dependencies: - '@babel/core': 7.20.5 + '@babel/core': 7.21.0 '@babel/helper-annotate-as-pure': 7.18.6 '@babel/helper-environment-visitor': 7.18.9 - '@babel/helper-function-name': 7.19.0 - '@babel/helper-member-expression-to-functions': 7.18.9 + '@babel/helper-function-name': 7.21.0 + '@babel/helper-member-expression-to-functions': 7.21.0 '@babel/helper-optimise-call-expression': 7.18.6 - '@babel/helper-replace-supers': 7.19.1 + '@babel/helper-replace-supers': 7.20.7 + '@babel/helper-skip-transparent-expression-wrappers': 7.20.0 '@babel/helper-split-export-declaration': 7.18.6 transitivePeerDependencies: - supports-color @@ -189,37 +192,37 @@ packages: engines: {node: '>=6.9.0'} dev: true - /@babel/helper-function-name/7.19.0: - resolution: {integrity: sha512-WAwHBINyrpqywkUH0nTnNgI5ina5TFn85HKS0pbPDfxFfhyR/aNQEn4hGi1P1JyT//I0t4OgXUlofzWILRvS5w==} + /@babel/helper-function-name/7.21.0: + resolution: {integrity: sha512-HfK1aMRanKHpxemaY2gqBmL04iAPOPRj7DxtNbiDOrJK+gdwkiNRVpCpUJYbUT+aZyemKN8brqTOxzCaG6ExRg==} engines: {node: '>=6.9.0'} dependencies: - '@babel/template': 7.18.10 - '@babel/types': 7.20.5 + '@babel/template': 7.20.7 + '@babel/types': 7.21.2 dev: true /@babel/helper-hoist-variables/7.18.6: resolution: {integrity: sha512-UlJQPkFqFULIcyW5sbzgbkxn2FKRgwWiRexcuaR8RNJRy8+LLveqPjwZV/bwrLZCN0eUHD/x8D0heK1ozuoo6Q==} engines: {node: '>=6.9.0'} dependencies: - '@babel/types': 7.20.5 + '@babel/types': 7.21.2 dev: true - /@babel/helper-member-expression-to-functions/7.18.9: - resolution: {integrity: sha512-RxifAh2ZoVU67PyKIO4AMi1wTenGfMR/O/ae0CCRqwgBAt5v7xjdtRw7UoSbsreKrQn5t7r89eruK/9JjYHuDg==} + /@babel/helper-member-expression-to-functions/7.21.0: + resolution: {integrity: sha512-Muu8cdZwNN6mRRNG6lAYErJ5X3bRevgYR2O8wN0yn7jJSnGDu6eG59RfT29JHxGUovyfrh6Pj0XzmR7drNVL3Q==} engines: {node: '>=6.9.0'} dependencies: - '@babel/types': 7.20.5 + '@babel/types': 7.21.2 dev: true /@babel/helper-module-imports/7.18.6: resolution: {integrity: sha512-0NFvs3VkuSYbFi1x2Vd6tKrywq+z/cLeYC/RJNFrIX/30Bf5aiGYbtvGXolEktzJH8o5E5KJ3tT+nkxuuZFVlA==} engines: {node: '>=6.9.0'} dependencies: - '@babel/types': 7.20.5 + '@babel/types': 7.21.2 dev: true - /@babel/helper-module-transforms/7.20.2: - resolution: {integrity: sha512-zvBKyJXRbmK07XhMuujYoJ48B5yvvmM6+wcpv6Ivj4Yg6qO7NOZOSnvZN9CRl1zz1Z4cKf8YejmCMh8clOoOeA==} + /@babel/helper-module-transforms/7.21.2: + resolution: {integrity: sha512-79yj2AR4U/Oqq/WOV7Lx6hUjau1Zfo4cI+JLAVYeMV5XIlbOhmjEk5ulbTc9fMpmlojzZHkUUxAiK+UKn+hNQQ==} engines: {node: '>=6.9.0'} dependencies: '@babel/helper-environment-visitor': 7.18.9 @@ -227,9 +230,9 @@ packages: '@babel/helper-simple-access': 7.20.2 '@babel/helper-split-export-declaration': 7.18.6 '@babel/helper-validator-identifier': 7.19.1 - '@babel/template': 7.18.10 - '@babel/traverse': 7.20.5 - '@babel/types': 7.20.5 + '@babel/template': 7.20.7 + '@babel/traverse': 7.21.2 + '@babel/types': 7.21.2 transitivePeerDependencies: - supports-color dev: true @@ -238,7 +241,7 @@ packages: resolution: {integrity: sha512-HP59oD9/fEHQkdcbgFCnbmgH5vIQTJbxh2yf+CdM89/glUNnuzr87Q8GIjGEnOktTROemO0Pe0iPAYbqZuOUiA==} engines: {node: '>=6.9.0'} dependencies: - '@babel/types': 7.20.5 + '@babel/types': 7.21.2 dev: true /@babel/helper-plugin-utils/7.20.2: @@ -246,15 +249,16 @@ packages: engines: {node: '>=6.9.0'} dev: true - /@babel/helper-replace-supers/7.19.1: - resolution: {integrity: sha512-T7ahH7wV0Hfs46SFh5Jz3s0B6+o8g3c+7TMxu7xKfmHikg7EAZ3I2Qk9LFhjxXq8sL7UkP5JflezNwoZa8WvWw==} + /@babel/helper-replace-supers/7.20.7: + resolution: {integrity: sha512-vujDMtB6LVfNW13jhlCrp48QNslK6JXi7lQG736HVbHz/mbf4Dc7tIRh1Xf5C0rF7BP8iiSxGMCmY6Ci1ven3A==} engines: {node: '>=6.9.0'} dependencies: '@babel/helper-environment-visitor': 7.18.9 - '@babel/helper-member-expression-to-functions': 7.18.9 + '@babel/helper-member-expression-to-functions': 7.21.0 '@babel/helper-optimise-call-expression': 7.18.6 - '@babel/traverse': 7.20.5 - '@babel/types': 7.20.5 + '@babel/template': 7.20.7 + '@babel/traverse': 7.21.2 + '@babel/types': 7.21.2 transitivePeerDependencies: - supports-color dev: true @@ -263,14 +267,21 @@ packages: resolution: {integrity: sha512-+0woI/WPq59IrqDYbVGfshjT5Dmk/nnbdpcF8SnMhhXObpTq2KNBdLFRFrkVdbDOyUmHBCxzm5FHV1rACIkIbA==} engines: {node: '>=6.9.0'} dependencies: - '@babel/types': 7.20.5 + '@babel/types': 7.21.2 + dev: true + + /@babel/helper-skip-transparent-expression-wrappers/7.20.0: + resolution: {integrity: sha512-5y1JYeNKfvnT8sZcK9DVRtpTbGiomYIHviSP3OQWmDPU3DeH4a1ZlT/N2lyQ5P8egjcRaT/Y9aNqUxK0WsnIIg==} + engines: {node: '>=6.9.0'} + dependencies: + '@babel/types': 7.21.2 dev: true /@babel/helper-split-export-declaration/7.18.6: resolution: {integrity: sha512-bde1etTx6ZyTmobl9LLMMQsaizFVZrquTEHOqKeQESMKo4PlObf+8+JA25ZsIpZhT/WEd39+vOdLXAFG/nELpA==} engines: {node: '>=6.9.0'} dependencies: - '@babel/types': 7.20.5 + '@babel/types': 7.21.2 dev: true /@babel/helper-string-parser/7.19.4: @@ -283,18 +294,18 @@ packages: engines: {node: '>=6.9.0'} dev: true - /@babel/helper-validator-option/7.18.6: - resolution: {integrity: sha512-XO7gESt5ouv/LRJdrVjkShckw6STTaB7l9BrpBaAHDeF5YZT+01PCwmR0SJHnkW6i8OwW/EVWRShfi4j2x+KQw==} + /@babel/helper-validator-option/7.21.0: + resolution: {integrity: sha512-rmL/B8/f0mKS2baE9ZpyTcTavvEuWhTTW8amjzXNvYG4AwBsqTLikfXsEofsJEfKHf+HQVQbFOHy6o+4cnC/fQ==} engines: {node: '>=6.9.0'} dev: true - /@babel/helpers/7.20.6: - resolution: {integrity: sha512-Pf/OjgfgFRW5bApskEz5pvidpim7tEDPlFtKcNRXWmfHGn9IEI2W2flqRQXTFb7gIPTyK++N6rVHuwKut4XK6w==} + /@babel/helpers/7.21.0: + resolution: {integrity: sha512-XXve0CBtOW0pd7MRzzmoyuSj0e3SEzj8pgyFxnTT1NJZL38BD1MK7yYrm8yefRPIDvNNe14xR4FdbHwpInD4rA==} engines: {node: '>=6.9.0'} dependencies: - '@babel/template': 7.18.10 - '@babel/traverse': 7.20.5 - '@babel/types': 7.20.5 + '@babel/template': 7.20.7 + '@babel/traverse': 7.21.2 + '@babel/types': 7.21.2 transitivePeerDependencies: - supports-color dev: true @@ -308,56 +319,56 @@ packages: js-tokens: 4.0.0 dev: true - /@babel/parser/7.20.5: - resolution: {integrity: sha512-r27t/cy/m9uKLXQNWWebeCUHgnAZq0CpG1OwKRxzJMP1vpSU4bSIK2hq+/cp0bQxetkXx38n09rNu8jVkcK/zA==} + /@babel/parser/7.21.2: + resolution: {integrity: sha512-URpaIJQwEkEC2T9Kn+Ai6Xe/02iNaVCuT/PtoRz3GPVJVDpPd7mLo+VddTbhCRU9TXqW5mSrQfXZyi8kDKOVpQ==} engines: {node: '>=6.0.0'} hasBin: true dependencies: - '@babel/types': 7.20.5 + '@babel/types': 7.21.2 dev: true - /@babel/plugin-proposal-class-properties/7.18.6_@babel+core@7.20.5: + /@babel/plugin-proposal-class-properties/7.18.6_@babel+core@7.21.0: resolution: {integrity: sha512-cumfXOF0+nzZrrN8Rf0t7M+tF6sZc7vhQwYQck9q1/5w2OExlD+b4v4RpMJFaV1Z7WcDRgO6FqvxqxGlwo+RHQ==} engines: {node: '>=6.9.0'} peerDependencies: '@babel/core': ^7.0.0-0 dependencies: - '@babel/core': 7.20.5 - '@babel/helper-create-class-features-plugin': 7.20.5_@babel+core@7.20.5 + '@babel/core': 7.21.0 + '@babel/helper-create-class-features-plugin': 7.21.0_@babel+core@7.21.0 '@babel/helper-plugin-utils': 7.20.2 transitivePeerDependencies: - supports-color dev: true - /@babel/template/7.18.10: - resolution: {integrity: sha512-TI+rCtooWHr3QJ27kJxfjutghu44DLnasDMwpDqCXVTal9RLp3RSYNh4NdBrRP2cQAoG9A8juOQl6P6oZG4JxA==} + /@babel/template/7.20.7: + resolution: {integrity: sha512-8SegXApWe6VoNw0r9JHpSteLKTpTiLZ4rMlGIm9JQ18KiCtyQiAMEazujAHrUS5flrcqYZa75ukev3P6QmUwUw==} engines: {node: '>=6.9.0'} dependencies: '@babel/code-frame': 7.18.6 - '@babel/parser': 7.20.5 - '@babel/types': 7.20.5 + '@babel/parser': 7.21.2 + '@babel/types': 7.21.2 dev: true - /@babel/traverse/7.20.5: - resolution: {integrity: sha512-WM5ZNN3JITQIq9tFZaw1ojLU3WgWdtkxnhM1AegMS+PvHjkM5IXjmYEGY7yukz5XS4sJyEf2VzWjI8uAavhxBQ==} + /@babel/traverse/7.21.2: + resolution: {integrity: sha512-ts5FFU/dSUPS13tv8XiEObDu9K+iagEKME9kAbaP7r0Y9KtZJZ+NGndDvWoRAYNpeWafbpFeki3q9QoMD6gxyw==} engines: {node: '>=6.9.0'} dependencies: '@babel/code-frame': 7.18.6 - '@babel/generator': 7.20.5 + '@babel/generator': 7.21.1 '@babel/helper-environment-visitor': 7.18.9 - '@babel/helper-function-name': 7.19.0 + '@babel/helper-function-name': 7.21.0 '@babel/helper-hoist-variables': 7.18.6 '@babel/helper-split-export-declaration': 7.18.6 - '@babel/parser': 7.20.5 - '@babel/types': 7.20.5 + '@babel/parser': 7.21.2 + '@babel/types': 7.21.2 debug: 4.3.4 globals: 11.12.0 transitivePeerDependencies: - supports-color dev: true - /@babel/types/7.20.5: - resolution: {integrity: sha512-c9fst/h2/dcF7H+MJKZ2T0KjEQ8hY/BNnDk/H3XY8C4Aw/eWQXWn/lWntHF9ooUBnGmEvbfGrTgLWc+um0YDUg==} + /@babel/types/7.21.2: + resolution: {integrity: sha512-3wRZSs7jiFaB8AjxiiD+VqN5DTG2iRvJGQ+qYFrs/654lg6kGTQWIOFjlBo5RaXuAZjBmP3+OQH4dmhqiiyYxw==} engines: {node: '>=6.9.0'} dependencies: '@babel/helper-string-parser': 7.19.4 @@ -378,16 +389,16 @@ packages: kuler: 2.0.0 dev: false - /@discordjs/voice/0.13.0_bufferutil@4.0.7: - resolution: {integrity: sha512-ZzwDmVINaLgkoDUeTJfpN9TkjINMLfTVoLMtEygm0YC5jTTw7AvKGqhc+Ae/2kNLywd0joyFVNrLp94yCkQ9SA==} + /@discordjs/voice/0.14.0_bufferutil@4.0.7: + resolution: {integrity: sha512-/LV8LSFuJ1c4OEW1ubPg3al2QNpUpwX8ZL+KL+LORmnUFVCtehSaEh+38uDfWg1O/TgiGI5vOLj4ZKql43drcw==} engines: {node: '>=16.9.0'} requiresBuild: true dependencies: - '@types/ws': 8.5.3 - discord-api-types: 0.37.22 - prism-media: 1.3.4 - tslib: 2.4.1 - ws: 8.11.0_bufferutil@4.0.7 + '@types/ws': 8.5.4 + discord-api-types: 0.37.35 + prism-media: 1.3.5 + tslib: 2.5.0 + ws: 8.12.1_bufferutil@4.0.7 transitivePeerDependencies: - '@discordjs/opus' - bufferutil @@ -398,25 +409,25 @@ packages: dev: false optional: true - /@eslint-community/eslint-utils/4.1.2_eslint@8.29.0: - resolution: {integrity: sha512-7qELuQWWjVDdVsFQ5+beUl+KPczrEDA7S3zM4QUd/bJl7oXgsmpXaEVqrRTnOBqenOV4rWf2kVZk2Ot085zPWA==} + /@eslint-community/eslint-utils/4.2.0_eslint@8.35.0: + resolution: {integrity: sha512-gB8T4H4DEfX2IV9zGDJPOBgP1e/DbfCPDTtEqUMckpvzS1OYtva8JdFYBqMwYk7xAQ429WGF/UPqn8uQ//h2vQ==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} peerDependencies: - eslint: ^6.0.0 || ^7.0.0 || ^8.0.0 + eslint: ^6.0.0 || ^7.0.0 || >=8.0.0 dependencies: - eslint: 8.29.0 + eslint: 8.35.0 eslint-visitor-keys: 3.3.0 dev: true - /@eslint/eslintrc/1.3.3: - resolution: {integrity: sha512-uj3pT6Mg+3t39fvLrj8iuCIJ38zKO9FpGtJ4BBJebJhEwjoT+KLVNCcHT5QC9NGRIEi7fZ0ZR8YRb884auB4Lg==} + /@eslint/eslintrc/2.0.0: + resolution: {integrity: sha512-fluIaaV+GyV24CCu/ggiHdV+j4RNh85yQnAYS/G2mZODZgGmmlrgCydjUcV3YvxCm9x8nMAfThsqTni4KiXT4A==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} dependencies: ajv: 6.12.6 debug: 4.3.4 espree: 9.4.1 - globals: 13.19.0 - ignore: 5.2.1 + globals: 13.20.0 + ignore: 5.2.4 import-fresh: 3.3.0 js-yaml: 4.1.0 minimatch: 3.1.2 @@ -425,8 +436,13 @@ packages: - supports-color dev: true - /@humanwhocodes/config-array/0.11.7: - resolution: {integrity: sha512-kBbPWzN8oVMLb0hOUYXhmxggL/1cJE6ydvjDIGi9EnAGUyA7cLVKQg+d/Dsm+KZwx2czGHrCmMVLiyg8s5JPKw==} + /@eslint/js/8.35.0: + resolution: {integrity: sha512-JXdzbRiWclLVoD8sNUjR443VVlYqiYmDVT6rGUEIEHU5YJW0gaVZwV2xgM7D4arkvASqD0IlLUVjHiFuxaftRw==} + engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} + dev: true + + /@humanwhocodes/config-array/0.11.8: + resolution: {integrity: sha512-UybHIJzJnR5Qc/MsD9Kr+RpO2h+/P1GhOwdiLPXK5TWk5sgTdu88bTD9UP+CKbPPh5Rni1u0GjAdYQLemG8g+g==} engines: {node: '>=10.10.0'} dependencies: '@humanwhocodes/object-schema': 1.2.1 @@ -507,7 +523,7 @@ packages: engines: {node: '>= 8'} dependencies: '@nodelib/fs.scandir': 2.1.5 - fastq: 1.14.0 + fastq: 1.15.0 dev: true /@opencensus/core/0.0.8: @@ -620,8 +636,8 @@ packages: dev: false optional: true - /@types/node/18.11.13: - resolution: {integrity: sha512-IASpMGVcWpUsx5xBOrxMj7Bl8lqfuTY7FKAnPmu5cHkfQVWF8GulWS1jbRqA934qZL35xh5xN/+Xe/i26Bod4w==} + /@types/node/18.14.6: + resolution: {integrity: sha512-93+VvleD3mXwlLI/xASjw0FzKcwzl3OdTCzm1LaRfqgS21gfFtK3zDXM5Op9TeeMsJVOaJ2VRDpT9q4Y3d0AvA==} dev: false optional: true @@ -629,19 +645,23 @@ packages: resolution: {integrity: sha512-Gj7cI7z+98M282Tqmp2K5EIsoouUEzbBJhQQzDE3jSIRk6r9gsz0oUokqIUR4u1R3dMHo0pDHM7sNOHyhulypw==} dev: true - /@types/ws/8.5.3: - resolution: {integrity: sha512-6YOoWjruKj1uLf3INHH7D3qTXwFfEsg1kf3c0uDdSBJwfa/llkwIjrAGV7j7mVgGNbzTQ3HiHKKDXl6bJPD97w==} + /@types/triple-beam/1.3.2: + resolution: {integrity: sha512-txGIh+0eDFzKGC25zORnswy+br1Ha7hj5cMVwKIU7+s0U2AxxJru/jZSMU6OC9MJWP6+pc/hc6ZjyZShpsyY2g==} + dev: false + + /@types/ws/8.5.4: + resolution: {integrity: sha512-zdQDHKUgcX/zBc4GrwsE/7dVdAD8JR4EuiAXiiUhhfyIJXXb2+PrGshFyeXWQPMmmZ2XxgaqclgpIC7eTXc1mg==} dependencies: - '@types/node': 18.11.13 + '@types/node': 18.14.6 dev: false optional: true - /acorn-jsx/5.3.2_acorn@8.8.1: + /acorn-jsx/5.3.2_acorn@8.8.2: resolution: {integrity: sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==} peerDependencies: acorn: ^6.0.0 || ^7.0.0 || ^8.0.0 dependencies: - acorn: 8.8.1 + acorn: 8.8.2 dev: true /acorn-walk/8.2.0: @@ -650,8 +670,8 @@ packages: dev: false optional: true - /acorn/8.8.1: - resolution: {integrity: sha512-7zFpHzhnqYKrkYdUjF1HI1bzd0VygEGX8lFk4k5zVMqHEoES+P+7TKI+EvLO9WVMJ8eekdO0aDEK044xTXwPPA==} + /acorn/8.8.2: + resolution: {integrity: sha512-xjIYgE8HBrkpd/sJqOGNspf8uHG+NOHGOw6a/Urj8taM2EXfdNAH2oFcPeIFfsv3+kz/mJrS5VuMqbNLjCa2vw==} engines: {node: '>=0.4.0'} hasBin: true @@ -727,7 +747,7 @@ packages: engines: {node: ^12.13.0 || ^14.15.0 || >=16.0.0} dependencies: delegates: 1.0.0 - readable-stream: 3.6.0 + readable-stream: 3.6.1 dev: true /argparse/1.0.10: @@ -745,7 +765,7 @@ packages: resolution: {integrity: sha512-x1FCFnFifvYDDzTaLII71vG5uvDwgtmDTEVWAxrgeiR8VjMONcCXJx7E+USjDtHlwFmt9MysbqgF9b9Vjr6w+w==} engines: {node: '>=4'} dependencies: - tslib: 2.4.1 + tslib: 2.5.0 dev: false optional: true @@ -782,11 +802,12 @@ packages: dev: false optional: true - /axios/0.27.2_debug@4.3.4: - resolution: {integrity: sha512-t+yRIyySRTp/wua5xEr+z1q60QmLq8ABsS5O9Me1AsE5dfKqgnCFzwiCZZ/cGNd1lq4/7akDWMxdhVlucjmnOQ==} + /axios/1.3.4_debug@4.3.4: + resolution: {integrity: sha512-toYm+Bsyl6VC5wSkfkbbNB6ROv7KY93PEBBL6xyDczaIHasAiv4wPqQ/c4RjoQzipxRD2W5g21cOqQulZ7rHwQ==} dependencies: follow-redirects: 1.15.2_debug@4.3.4 form-data: 4.0.0 + proxy-from-env: 1.1.0 transitivePeerDependencies: - debug dev: true @@ -798,8 +819,8 @@ packages: resolution: {integrity: sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==} dev: false - /better-sqlite3/8.0.1: - resolution: {integrity: sha512-JhTZjpyapA1icCEjIZB4TSSgkGdFgpWZA2Wszg7Cf4JwJwKQmbvuNnJBeR+EYG/Z29OXvR4G//Rbg31BW/Z7Yg==} + /better-sqlite3/8.1.0: + resolution: {integrity: sha512-p1m09H+Oi8R9TPj810pdNswMFuVgRNgCJEWypp6jlkOgSwMIrNyuj3hW78xEuBRGok5RzeaUW8aBtTWF3l/TQA==} requiresBuild: true dependencies: bindings: 1.5.0 @@ -825,7 +846,7 @@ packages: dependencies: buffer: 5.7.1 inherits: 2.0.4 - readable-stream: 3.6.0 + readable-stream: 3.6.1 dev: false /blessed/0.1.81: @@ -854,15 +875,15 @@ packages: dev: false optional: true - /browserslist/4.21.4: - resolution: {integrity: sha512-CBHJJdDmgjl3daYjN5Cp5kbTf1mUhZoS+beLklHIvkOWscs83YAhLlF3Wsh/lciQYAcbBJgTOD44VtG31ZM4Hw==} + /browserslist/4.21.5: + resolution: {integrity: sha512-tUkiguQGW7S3IhB7N+c2MV/HZPSCPAAiYBZXLsBhFB/PCy6ZKKsZrmBayHV9fdGV/ARIfJ14NkxKzRDjvp7L6w==} engines: {node: ^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7} hasBin: true dependencies: - caniuse-lite: 1.0.30001439 - electron-to-chromium: 1.4.284 - node-releases: 2.0.6 - update-browserslist-db: 1.0.10_browserslist@4.21.4 + caniuse-lite: 1.0.30001462 + electron-to-chromium: 1.4.325 + node-releases: 2.0.10 + update-browserslist-db: 1.0.10_browserslist@4.21.5 dev: true /buffer-from/1.1.2: @@ -882,7 +903,7 @@ packages: engines: {node: '>=6.14.2'} requiresBuild: true dependencies: - node-gyp-build: 4.5.0 + node-gyp-build: 4.6.0 dev: false /builtin-modules/3.3.0: @@ -913,8 +934,8 @@ packages: engines: {node: '>=6'} dev: false - /caniuse-lite/1.0.30001439: - resolution: {integrity: sha512-1MgUzEkoMO6gKfXflStpYgZDlFM7M/ck/bgfVCACO5vnAf0fXoNVHdWtqGU+MYca+4bL9Z5bpOVmR33cWW9G2A==} + /caniuse-lite/1.0.30001462: + resolution: {integrity: sha512-PDd20WuOBPiasZ7KbFnmQRyuLE7cFXW2PVd7dmALzbkUXEP46upAuCDm9eY9vho8fgNMGmbAX92QBZHzcnWIqw==} dev: true /chalk/2.4.2: @@ -973,8 +994,8 @@ packages: engines: {node: '>=10'} dev: true - /ci-info/3.7.0: - resolution: {integrity: sha512-2CpRNYmImPx+RXKLq6jko/L07phmS9I02TyqkcNU20GCF/GgaWvc58hPtjxDX8lPpkdwc9sNh72V9k00S7ezog==} + /ci-info/3.8.0: + resolution: {integrity: sha512-eXTggHWSooYhq49F2opQhuHWgzucfF2YgODK4e1566GQs5BIfP30B0oenwBJHfWxAs2fyPB1s7Mg949zLf61Yw==} engines: {node: '>=8'} dev: true @@ -1010,24 +1031,24 @@ packages: wrap-ansi: 7.0.0 dev: true - /cmake-js/7.0.0: - resolution: {integrity: sha512-Xmti54GzAg+70lsPRKsuw18ktAB+NwPS3m+b6dLzh3Zi+7k8QSVi857UWXzn9sjPXGz5BfSfo3vNISRaTVU/4A==} + /cmake-js/7.2.1: + resolution: {integrity: sha512-AdPSz9cSIJWdKvm0aJgVu3X8i0U3mNTswJkSHzZISqmYVjZk7Td4oDFg0mCBA383wO+9pG5Ix7pEP1CZH9x2BA==} engines: {node: '>= 14.15.0'} hasBin: true dependencies: - axios: 0.27.2_debug@4.3.4 + axios: 1.3.4_debug@4.3.4 debug: 4.3.4 fs-extra: 10.1.0 lodash.isplainobject: 4.0.6 memory-stream: 1.0.0 - node-api-headers: 0.0.1 + node-api-headers: 0.0.2 npmlog: 6.0.2 rc: 1.2.8 semver: 7.3.8 tar: 6.1.13 url-join: 4.0.1 which: 2.0.2 - yargs: 17.6.2 + yargs: 17.7.1 transitivePeerDependencies: - supports-color dev: true @@ -1203,7 +1224,7 @@ packages: ast-types: 0.13.4 escodegen: 1.14.3 esprima: 4.0.1 - vm2: 3.9.13 + vm2: 3.9.14 dev: false optional: true @@ -1231,8 +1252,8 @@ packages: resolution: {integrity: sha512-QV6PMaHTCNmKSeP6QoXhVTw9snc9VD8MulTT0Bd99Pacp4SS1cjcrYPgBPmibqKVtMJJfqC6XvOXgPMEEPH/fg==} dev: false - /discord-api-types/0.37.22: - resolution: {integrity: sha512-1FSm5hIUaxt3e+3H6lhY5Hg32DTJCPp3Q5gf3CM2CPSr95ZnqkSNEV0s7EdiBrlv5QoPrpcPIDYC3hWqZT2mIg==} + /discord-api-types/0.37.35: + resolution: {integrity: sha512-iyKZ/82k7FX3lcmHiAvvWu5TmyfVo78RtghBV/YsehK6CID83k5SI03DKKopBcln+TiEIYw5MGgq7SJXSpNzMg==} dev: false optional: true @@ -1248,8 +1269,8 @@ packages: engines: {node: '>=12'} dev: false - /electron-to-chromium/1.4.284: - resolution: {integrity: sha512-M8WEXFuKXMYMVr45fo8mq0wUrrJHheiKZf6BArTKk9ZBYCKJEOU5H8cdWgDT+qCVZf7Na4lVUaZsA+h6uA9+PA==} + /electron-to-chromium/1.4.325: + resolution: {integrity: sha512-K1C03NT4I7BuzsRdCU5RWkgZxtswnKDYM6/eMhkEXqKu4e5T+ck610x3FPzu1y7HVFSiQKZqP16gnJzPpji1TQ==} dev: true /emitter-listener/1.1.2: @@ -1331,20 +1352,20 @@ packages: dev: false optional: true - /eslint-plugin-unicorn/45.0.2_eslint@8.29.0: - resolution: {integrity: sha512-Y0WUDXRyGDMcKLiwgL3zSMpHrXI00xmdyixEGIg90gHnj0PcHY4moNv3Ppje/kDivdAy5vUeUr7z211ImPv2gw==} + /eslint-plugin-unicorn/46.0.0_eslint@8.35.0: + resolution: {integrity: sha512-j07WkC+PFZwk8J33LYp6JMoHa1lXc1u6R45pbSAipjpfpb7KIGr17VE2D685zCxR5VL4cjrl65kTJflziQWMDA==} engines: {node: '>=14.18'} peerDependencies: eslint: '>=8.28.0' dependencies: '@babel/helper-validator-identifier': 7.19.1 - '@eslint-community/eslint-utils': 4.1.2_eslint@8.29.0 - ci-info: 3.7.0 + '@eslint-community/eslint-utils': 4.2.0_eslint@8.35.0 + ci-info: 3.8.0 clean-regexp: 1.0.0 - eslint: 8.29.0 - esquery: 1.4.0 + eslint: 8.35.0 + esquery: 1.5.0 indent-string: 4.0.0 - is-builtin-module: 3.2.0 + is-builtin-module: 3.2.1 jsesc: 3.0.2 lodash: 4.17.21 pluralize: 8.0.0 @@ -1377,13 +1398,13 @@ packages: estraverse: 5.3.0 dev: true - /eslint-utils/3.0.0_eslint@8.29.0: + /eslint-utils/3.0.0_eslint@8.35.0: resolution: {integrity: sha512-uuQC43IGctw68pJA1RgbQS8/NP7rch6Cwd4j3ZBtgo4/8Flj4eGE7ZYSZRN3iq5pVUv6GPdW5Z1RFleo84uLDA==} engines: {node: ^10.0.0 || ^12.0.0 || >= 14.0.0} peerDependencies: eslint: '>=5' dependencies: - eslint: 8.29.0 + eslint: 8.35.0 eslint-visitor-keys: 2.1.0 dev: true @@ -1397,13 +1418,14 @@ packages: engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} dev: true - /eslint/8.29.0: - resolution: {integrity: sha512-isQ4EEiyUjZFbEKvEGJKKGBwXtvXX+zJbkVKCgTuB9t/+jUBcy8avhkEwWJecI15BkRkOYmvIM5ynbhRjEkoeg==} + /eslint/8.35.0: + resolution: {integrity: sha512-BxAf1fVL7w+JLRQhWl2pzGeSiGqbWumV4WNvc9Rhp6tiCtm4oHnyPBSEtMGZwrQgudFQ+otqzWoPB7x+hxoWsw==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} hasBin: true dependencies: - '@eslint/eslintrc': 1.3.3 - '@humanwhocodes/config-array': 0.11.7 + '@eslint/eslintrc': 2.0.0 + '@eslint/js': 8.35.0 + '@humanwhocodes/config-array': 0.11.8 '@humanwhocodes/module-importer': 1.0.1 '@nodelib/fs.walk': 1.2.8 ajv: 6.12.6 @@ -1413,23 +1435,23 @@ packages: doctrine: 3.0.0 escape-string-regexp: 4.0.0 eslint-scope: 7.1.1 - eslint-utils: 3.0.0_eslint@8.29.0 + eslint-utils: 3.0.0_eslint@8.35.0 eslint-visitor-keys: 3.3.0 espree: 9.4.1 - esquery: 1.4.0 + esquery: 1.5.0 esutils: 2.0.3 fast-deep-equal: 3.1.3 file-entry-cache: 6.0.1 find-up: 5.0.0 glob-parent: 6.0.2 - globals: 13.19.0 + globals: 13.20.0 grapheme-splitter: 1.0.4 - ignore: 5.2.1 + ignore: 5.2.4 import-fresh: 3.3.0 imurmurhash: 0.1.4 is-glob: 4.0.3 is-path-inside: 3.0.3 - js-sdsl: 4.2.0 + js-sdsl: 4.3.0 js-yaml: 4.1.0 json-stable-stringify-without-jsonify: 1.0.1 levn: 0.4.1 @@ -1449,8 +1471,8 @@ packages: resolution: {integrity: sha512-XwctdmTO6SIvCzd9810yyNzIrOrqNYV9Koizx4C/mRhf9uq0o4yHoCEU/670pOxOL/MSraektvSAji79kX90Vg==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} dependencies: - acorn: 8.8.1 - acorn-jsx: 5.3.2_acorn@8.8.1 + acorn: 8.8.2 + acorn-jsx: 5.3.2_acorn@8.8.2 eslint-visitor-keys: 3.3.0 dev: true @@ -1461,8 +1483,8 @@ packages: dev: false optional: true - /esquery/1.4.0: - resolution: {integrity: sha512-cCDispWt5vHHtwMY2YrAQ4ibFkAL8RbH5YGBnZBc90MolvvfkkQcJro/aZiAQUlQ3qgrYS6D6v8Gc5G5CQsc9w==} + /esquery/1.5.0: + resolution: {integrity: sha512-YQLXUplAwJgCydQ78IMJywZCceoqk1oH01OERdSAJc/7U2AylwjhSCLDEtqwg811idIS/9fIU5GjG73IgjKMVg==} engines: {node: '>=0.10'} dependencies: estraverse: 5.3.0 @@ -1524,8 +1546,8 @@ packages: /fast-levenshtein/2.0.6: resolution: {integrity: sha512-DCXu6Ifhqcks7TZKY3Hxp3y6qphY5SJZmrWMDrKcERSOXWQdMhU9Ig/PYrzyw/ul9jOIyh0N4M0tbC5hodg8dw==} - /fastq/1.14.0: - resolution: {integrity: sha512-eR2D+V9/ExcbF9ls441yIuN6TI2ED1Y2ZcA5BmMtJsOkWOFRJQ0Jt0g1UwqXJJVAb+V+umH5Dfr8oh4EVP7VVg==} + /fastq/1.15.0: + resolution: {integrity: sha512-wBrocU2LCXXa+lWBt8RoIRD89Fi8OdABODa/kEnyeyjS5aZO5/GNvI5sEINADqP/h8M29UHTHUb53sUu5Ihqdw==} dependencies: reusify: 1.0.4 dev: true @@ -1552,8 +1574,8 @@ packages: moment: 2.29.4 dev: false - /file-type/18.0.0: - resolution: {integrity: sha512-jjMwFpnW8PKofLE/4ohlhqwDk5k0NC6iy0UHAJFKoY1fQeGMN0GDdLgHQrvCbSpMwbqzoCZhRI5dETCZna5qVA==} + /file-type/18.2.1: + resolution: {integrity: sha512-Yw5MtnMv7vgD2/6Bjmmuegc8bQEVA9GmAyaR18bMYWKqsWDG9wgYZ1j4I6gNMF5Y5JBDcUcjRQqNQx7Y8uotcg==} engines: {node: '>=14.16'} dependencies: readable-web-to-node-stream: 3.0.2 @@ -1631,8 +1653,8 @@ packages: mime-types: 2.1.35 dev: true - /format-duration/2.0.0: - resolution: {integrity: sha512-ARqJ9qXm71pw3SGAY7bibf8lRLvltOXLjWjzzR3UrUjHu1zdeYpA/Z+u+ltdhrfRa440OjEsHNzdmuZViqqQWQ==} + /format-duration/3.0.2: + resolution: {integrity: sha512-pKzJDSRgK2lqAiPW3uizDaIJaJnataZclsahz25UMwfdryBGDa+1HlbXGjzpMvX/2kMh4O0sNevFXKaEfCjHsA==} dev: false /fs-constants/1.0.0: @@ -1777,8 +1799,8 @@ packages: engines: {node: '>=4'} dev: true - /globals/13.19.0: - resolution: {integrity: sha512-dkQ957uSRWHw7CFXLUtUHQI3g3aWApYhfNR2O6jn/907riyTYKVBmxYVROkBcY614FSSeSJh7Xm7SrUWCxvJMQ==} + /globals/13.20.0: + resolution: {integrity: sha512-Qg5QtVkCy/kv3FUSlu4ukeZDVf9ee0iXLAUYX13gbR17bnejFTzr4iS9bY7kwCf1NztRNm1t91fjOiyx4CSwPQ==} engines: {node: '>=8'} dependencies: type-fest: 0.20.2 @@ -1861,8 +1883,8 @@ packages: resolution: {integrity: sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==} dev: false - /ignore/5.2.1: - resolution: {integrity: sha512-d2qQLzTJ9WxQftPAuEQpSPmKqzxePjzVbpAVv62AQ64NTL+wR4JkrVqR/LqFsFEUsHDAiId52mJteHDFuDkElA==} + /ignore/5.2.4: + resolution: {integrity: sha512-MAb38BcSbH0eHNBxn7ql2NH/kX33OkB3lZ1BNdh7ENeRChHTYsTvWrMubiIAMNS2llXEEgZ1MUOBtXChP3kaFQ==} engines: {node: '>= 4'} dev: true @@ -1922,8 +1944,8 @@ packages: dev: false optional: true - /is-builtin-module/3.2.0: - resolution: {integrity: sha512-phDA4oSGt7vl1n5tJvTWooWWAsXLY+2xCnxNqvKhGEzujg+A43wPlPOyDg3C8XQHN+6k/JTQWJ/j0dQh/qr+Hw==} + /is-builtin-module/3.2.1: + resolution: {integrity: sha512-BSLE3HnV2syZ0FK0iMA/yUGplUeMmNz4AW5fnTunbCIqZi4vG3WjJT9FHMy5D69xmAYBHXQhJdALdpwVxV501A==} engines: {node: '>=6'} dependencies: builtin-modules: 3.3.0 @@ -1983,8 +2005,8 @@ packages: dev: false optional: true - /js-sdsl/4.2.0: - resolution: {integrity: sha512-dyBIzQBDkCqCu+0upx25Y2jGdbTGxE9fshMsCdK0ViOongpV+n5tXRcZY9v7CaVQ79AGS9KA1KHtojxiM7aXSQ==} + /js-sdsl/4.3.0: + resolution: {integrity: sha512-mifzlm2+5nZ+lEcLJMoBK0/IH/bDg8XnJfd/Wq6IP+xoCjLZsTOnV2QpxlVbX9bMnkl5PdEjNtBJ9Cj1NjifhQ==} dev: true /js-tokens/4.0.0: @@ -2032,8 +2054,8 @@ packages: dev: false optional: true - /json5/2.2.1: - resolution: {integrity: sha512-1hqLFMSrGHRHxav9q9gNjJ5EXznIxGVO09xQRrwplcS8qs28pZ8s8hupZAmqDwZUmVZ2Qb2jnyPOWcDH8m8dlA==} + /json5/2.2.3: + resolution: {integrity: sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg==} engines: {node: '>=6'} hasBin: true dev: true @@ -2118,13 +2140,14 @@ packages: dev: false optional: true - /logform/2.4.2: - resolution: {integrity: sha512-W4c9himeAwXEdZ05dQNerhFz2XG80P9Oj0loPUMV23VC2it0orMHQhJm4hdnnor3rd1HsGf6a2lPwBM1zeXHGw==} + /logform/2.5.1: + resolution: {integrity: sha512-9FyqAm9o9NKKfiAKfZoYo9bGXXuwMkxQiQttkT4YjjVtQVIQtK6LmVtlxmCaFswo6N4AfEkHqZTV0taDtPotNg==} dependencies: '@colors/colors': 1.5.0 + '@types/triple-beam': 1.3.2 fecha: 4.2.3 ms: 2.1.3 - safe-stable-stringify: 2.4.1 + safe-stable-stringify: 2.4.2 triple-beam: 1.3.0 dev: false @@ -2132,8 +2155,6 @@ packages: resolution: {integrity: sha512-KpNARQA3Iwv+jTA0utUVVbrh+Jlrr1Fv0e56GGzAFOXN7dk/FviaDW8LHmK52DlcH4WP2n6gI8vN1aesBFgo9w==} dependencies: yallist: 3.1.1 - dev: false - optional: true /lru-cache/6.0.0: resolution: {integrity: sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==} @@ -2144,7 +2165,7 @@ packages: /memory-stream/1.0.0: resolution: {integrity: sha512-Wm13VcsPIMdG96dzILfij09PvuS3APtcKNh7M28FsCA/w6+1mjR7hhPmfFNoilX9xU7wTdhsH5lJAm6XNzdtww==} dependencies: - readable-stream: 3.6.0 + readable-stream: 3.6.1 dev: true /mime-db/1.52.0: @@ -2174,8 +2195,8 @@ packages: dependencies: brace-expansion: 1.1.11 - /minimist/1.2.7: - resolution: {integrity: sha512-bzfL1YUZsP41gmu/qjrEk0Q6i2ix/cVeAhbCbqH9u3zYutS1cLg00qhrD0M2MVdCcx4Sc0UpP2eBWo9rotpq6g==} + /minimist/1.2.8: + resolution: {integrity: sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==} /minipass/3.3.6: resolution: {integrity: sha512-DxiNidxSEK+tHG6zOIklvNOwm3hvCrbUrdtzY74U6HKTJxvIDfOUL5W5P2Ghd3DTkhhKPYGqeNUIh5qcM4YBfw==} @@ -2184,11 +2205,9 @@ packages: yallist: 4.0.0 dev: true - /minipass/4.0.0: - resolution: {integrity: sha512-g2Uuh2jEKoht+zvO6vJqXmYpflPqzRBT+Th2h01DKh5z7wbY/AZ2gCQ78cP70YoHPyFdY30YBV5WxgLOEwOykw==} + /minipass/4.2.4: + resolution: {integrity: sha512-lwycX3cBMTvcejsHITUgYj6Gy6A7Nh4Q6h9NP4sTHY1ccJlC7yKzDmiShEHsJ16Jf1nKGDEaiHxiltsJEvk0nQ==} engines: {node: '>=8'} - dependencies: - yallist: 4.0.0 dev: true /minizlib/2.1.2: @@ -2261,19 +2280,19 @@ packages: dev: false optional: true - /node-abi/3.30.0: - resolution: {integrity: sha512-qWO5l3SCqbwQavymOmtTVuCWZE23++S+rxyoHjXqUmPyzRcaoI4lA2gO55/drddGnedAyjA7sk76SfQ5lfUMnw==} + /node-abi/3.33.0: + resolution: {integrity: sha512-7GGVawqyHF4pfd0YFybhv/eM9JwTtPqx0mAanQ146O3FlSh3pA24zf9IRQTOsfTSqXTNzPSP5iagAJ94jjuVog==} engines: {node: '>=10'} dependencies: semver: 7.3.8 dev: false - /node-addon-api/5.0.0: - resolution: {integrity: sha512-CvkDw2OEnme7ybCykJpVcKH+uAOLV2qLqiyla128dN9TkEWfrYmxG6C2boDe5KcNQqZF3orkqzGgOMvZ/JNekA==} + /node-addon-api/5.1.0: + resolution: {integrity: sha512-eh0GgfEkpnoWDq+VY8OyvYhFEzBk6jIYbRKdIlyTiAXIVJ8PyBaKb0rp7oDtoddbdoHWhq8wwr+XZ81F1rpNdA==} dev: false - /node-api-headers/0.0.1: - resolution: {integrity: sha512-eRxckUSXMRQRV69h+ksfleQzR3BdRwkJuc/Y65KFFwhibC5G1y6wgytYW2WWTB/oG1bt+pf2RwjZDYC0xKqgqQ==} + /node-api-headers/0.0.2: + resolution: {integrity: sha512-YsjmaKGPDkmhoNKIpkChtCsPVaRE0a274IdERKnuc/E8K1UJdBZ4/mvI006OijlQZHCfpRNOH3dfHQs92se8gg==} dev: true /node-emoji/1.11.0: @@ -2282,13 +2301,25 @@ packages: lodash: 4.17.21 dev: false - /node-gyp-build/4.5.0: - resolution: {integrity: sha512-2iGbaQBV+ITgCz76ZEjmhUKAKVf7xfY1sRl4UiKQspfZMH2h06SyhNsnSVy50cwkFQDGLyif6m/6uFXHkOZ6rg==} + /node-fetch/2.6.9: + resolution: {integrity: sha512-DJm/CJkZkRjKKj4Zi4BsKVZh3ValV5IR5s7LVZnW+6YMh0W1BfNA8XSs6DLMGYlId5F3KnA70uu2qepcR08Qqg==} + engines: {node: 4.x || >=6.0.0} + peerDependencies: + encoding: ^0.1.0 + peerDependenciesMeta: + encoding: + optional: true + dependencies: + whatwg-url: 5.0.0 + dev: false + + /node-gyp-build/4.6.0: + resolution: {integrity: sha512-NTZVKn9IylLwUzaKjkas1e4u2DLNcV4rdYagA4PWdPwW87Bi7z+BznyKSRwS/761tV/lzCGXplWsiaMjLqP2zQ==} hasBin: true dev: false - /node-releases/2.0.6: - resolution: {integrity: sha512-PiVXnNuFm5+iYkLBNeq5211hvO38y63T0i2KKh2KnUs3RpzJ+JtODFjkD8yjLwnDkTYF1eKXheUwdssR+NRZdg==} + /node-releases/2.0.10: + resolution: {integrity: sha512-5GFldHPXVG/YZmFzJvKK2zDSzPKhEp0+ZR5SVaoSag9fsL5YgHbUHDfnG5494ISANDcK4KwPXAx2xqVEydmd7w==} dev: true /normalize-package-data/2.5.0: @@ -2330,14 +2361,14 @@ packages: engines: {node: '>= 6'} dev: false - /oceanic.js/1.3.2_bufferutil@4.0.7: - resolution: {integrity: sha512-nLedv0gmtMTnAVJQWIePWf7nz/7fRzYpoQndiwsn8X9CGRDAYDgtmdCtUD+EylkIN5zRNg+aWm6EcriKEXCZUg==} + /oceanic.js/1.5.1_bufferutil@4.0.7: + resolution: {integrity: sha512-N4c25J8UCxYJ5BtqTc2EVmcRLyBO/ZGhMhwsIiodYBwBen9AX4ipqwAsAhoosOJi8+WrWiDzAI3mSJ4Lxt2Mww==} engines: {node: '>=16.16.0'} dependencies: - undici: 5.14.0 - ws: 8.11.0_bufferutil@4.0.7 + undici: 5.20.0 + ws: 8.12.1_bufferutil@4.0.7 optionalDependencies: - '@discordjs/voice': 0.13.0_bufferutil@4.0.7 + '@discordjs/voice': 0.14.0_bufferutil@4.0.7 transitivePeerDependencies: - '@discordjs/opus' - bufferutil @@ -2424,7 +2455,7 @@ packages: http-proxy-agent: 4.0.1 https-proxy-agent: 5.0.1 pac-resolver: 5.0.1 - raw-body: 2.5.1 + raw-body: 2.5.2 socks-proxy-agent: 5.0.1 transitivePeerDependencies: - supports-color @@ -2561,7 +2592,7 @@ packages: async: 3.2.4 debug: 4.3.4 pidusage: 2.0.21 - systeminformation: 5.16.6 + systeminformation: 5.17.12 tx2: 1.0.5 transitivePeerDependencies: - supports-color @@ -2617,8 +2648,8 @@ packages: engines: {node: '>=10.13.0'} dev: false - /postgres/3.3.2: - resolution: {integrity: sha512-NaPqFpUC6C7aCQkJXLvuO/3RKNKL4en8opY53YrcXK3//xXra6CZ2qX6290lxuQ1dW1LbRGYCmsawRlCxSBonQ==} + /postgres/3.3.4: + resolution: {integrity: sha512-XVu0+d/Y56pl2lSaf0c7V19AhAEfpVrhID1IENWN8nf0xch6hFq6dAov5dtUX6ZD46wfr1TxvLhxLtV8WnNsOg==} requiresBuild: true dev: false optional: true @@ -2631,10 +2662,10 @@ packages: detect-libc: 2.0.1 expand-template: 2.0.3 github-from-package: 0.0.0 - minimist: 1.2.7 + minimist: 1.2.8 mkdirp-classic: 0.5.3 napi-build-utils: 1.0.2 - node-abi: 3.30.0 + node-abi: 3.33.0 pump: 3.0.0 rc: 1.2.8 simple-get: 4.0.1 @@ -2653,10 +2684,10 @@ packages: engines: {node: '>= 0.8.0'} dev: true - /prism-media/1.3.4: - resolution: {integrity: sha512-eW7LXORkTCQznZs+eqe9VjGOrLBxcBPXgNyHXMTSRVhphvd/RrxgIR7WaWt4fkLuhshcdT5KHL88LAfcvS3f5g==} + /prism-media/1.3.5: + resolution: {integrity: sha512-IQdl0Q01m4LrkN1EGIE9lphov5Hy7WWlH6ulf5QdGePLlPas9p2mhgddTEHrlaXYjjFToM1/rWuwF37VF4taaA==} peerDependencies: - '@discordjs/opus': ^0.8.0 + '@discordjs/opus': '>=0.8.0 <1.0.0' ffmpeg-static: ^5.0.2 || ^4.2.7 || ^3.0.0 || ^2.4.0 node-opus: ^0.3.3 opusscript: ^0.0.8 @@ -2698,8 +2729,6 @@ packages: /proxy-from-env/1.1.0: resolution: {integrity: sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==} - dev: false - optional: true /pump/3.0.0: resolution: {integrity: sha512-LwZy+p3SFs1Pytd/jYct4wpv49HiYCqd9Rlc5ZVdk0V+8Yzv6jR5Blk3TRmPL1ft69TxP0IMZGJ+WPFU2BFhww==} @@ -2708,8 +2737,8 @@ packages: once: 1.4.0 dev: false - /punycode/2.1.1: - resolution: {integrity: sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==} + /punycode/2.3.0: + resolution: {integrity: sha512-rRV+zQD8tVFys26lAGR9WUuS4iUAngJScM+ZRSKtvl5tKeZ2t5bvdNFdNHBW9FWR4guGHlgmsZ1G7BSm2wTbuA==} engines: {node: '>=6'} dev: true @@ -2728,8 +2757,8 @@ packages: resolution: {integrity: sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==} dev: true - /raw-body/2.5.1: - resolution: {integrity: sha512-qqJBtEyVgS0ZmPGdCFPWJ3FreoqvG4MVQln/kCgF7Olq95IbOp0/BWyMwbdtn4VTvkM8Y7khCQ2Xgk/tcrCXig==} + /raw-body/2.5.2: + resolution: {integrity: sha512-8zGqypfENjCIqGhgXToC8aB2r7YrBX+AQAfIPs/Mlk+BtPTztOvTS01NRW/3Eh60J+a48lt8qsCzirQ6loCVfA==} engines: {node: '>= 0.8'} dependencies: bytes: 3.1.2 @@ -2745,7 +2774,7 @@ packages: dependencies: deep-extend: 0.6.0 ini: 1.3.8 - minimist: 1.2.7 + minimist: 1.2.8 strip-json-comments: 2.0.1 /read-pkg-up/7.0.1: @@ -2785,8 +2814,8 @@ packages: dev: false optional: true - /readable-stream/3.6.0: - resolution: {integrity: sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==} + /readable-stream/3.6.1: + resolution: {integrity: sha512-+rQmrWMYGA90yenhTYsLWAsLsqVC8osOw6PKE1HDYiO0gdPeKe/xDHNzIAIn4C91YQ6oenEhfYqqc1883qHbjQ==} engines: {node: '>= 6'} dependencies: inherits: 2.0.4 @@ -2797,7 +2826,7 @@ packages: resolution: {integrity: sha512-ePeK6cc1EcKLEhJFt/AebMCLL+GgSKhuygrZ/GLaKZYEecIgIECf4UaUuaByiGtzckwR4ain9VzUh95T1exYGw==} engines: {node: '>=8'} dependencies: - readable-stream: 3.6.0 + readable-stream: 3.6.1 dev: false /readdirp/3.6.0: @@ -2890,8 +2919,8 @@ packages: regexp-tree: 0.1.24 dev: true - /safe-stable-stringify/2.4.1: - resolution: {integrity: sha512-dVHE6bMtS/bnL2mwualjc6IxEv1F+OCUpA46pKUj6F8uDbUM0jCCulPqRNPSnWwGNKx5etqMjZYdXtrm5KJZGA==} + /safe-stable-stringify/2.4.2: + resolution: {integrity: sha512-gMxvPJYhP0O9n2pvcfYfIuYgbledAOJFcqRThtPRmjscaipiwcwPPKLytpVzMkG2HAN87Qmo2d4PtGiri1dSLA==} engines: {node: '>=10'} dev: false @@ -2935,14 +2964,14 @@ packages: dev: false optional: true - /sharp/0.31.2: - resolution: {integrity: sha512-DUdNVEXgS5A97cTagSLIIp8dUZ/lZtk78iNVZgHdHbx1qnQR7JAHY0BnXnwwH39Iw+VKhO08CTYhIg0p98vQ5Q==} + /sharp/0.31.3: + resolution: {integrity: sha512-XcR4+FCLBFKw1bdB+GEhnUNXNXvnt0tDo4WsBsraKymuo/IAuPuCBVAL2wIkUw2r/dwFW5Q5+g66Kwl2dgDFVg==} engines: {node: '>=14.15.0'} requiresBuild: true dependencies: color: 4.2.3 detect-libc: 2.0.1 - node-addon-api: 5.0.0 + node-addon-api: 5.1.0 prebuild-install: 7.1.1 semver: 7.3.8 simple-get: 4.0.1 @@ -2967,14 +2996,15 @@ packages: dev: false optional: true - /shoukaku/3.2.2_bufferutil@4.0.7: - resolution: {integrity: sha512-GhgjV4i3gbN9cnX+RtbvIcLk4/dVJqOQFId33Quu5H9Pkm7kYi1ISqjIel4G4gJo4x3hdxAncvTiKCctcgQeaQ==} + /shoukaku/3.3.1_bufferutil@4.0.7: + resolution: {integrity: sha512-oyM+fs+6CFjzIsespf6Ajp7780ZwKwMDV1mRnFzCex22MK4ydbIK3IlCY4KjWurgxJz+8DvLVL/8/Xw4NmpdqQ==} engines: {node: '>=16.0.0', npm: '>=7.0.0'} dependencies: - undici: 5.14.0 - ws: 8.11.0_bufferutil@4.0.7 + node-fetch: 2.6.9 + ws: 8.12.1_bufferutil@4.0.7 transitivePeerDependencies: - bufferutil + - encoding - utf-8-validate dev: false @@ -3040,8 +3070,8 @@ packages: dev: false optional: true - /spdx-correct/3.1.1: - resolution: {integrity: sha512-cOYcUWwhCuHCXi49RhFRCyJEK3iPj1Ziz9DpViV3tbZOwXD49QzIN3MpOLJNxh2qwq2lJJZaKMVw9qNi4jTC0w==} + /spdx-correct/3.2.0: + resolution: {integrity: sha512-kN9dJbvnySHULIluDHy32WHRUu3Og7B9sbY7tsFLctQkIqnMh3hErYgdMjTYuqmcXX+lK5T1lnUt3G7zNswmZA==} dependencies: spdx-expression-parse: 3.0.1 spdx-license-ids: 3.0.12 @@ -3152,8 +3182,8 @@ packages: resolution: {integrity: sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==} engines: {node: '>= 0.4'} - /systeminformation/5.16.6: - resolution: {integrity: sha512-FLljCM7UmCVnilpQvX9b1SptMjuxPrtlqqSsFPI/3nQ19ZDJSalpph/9K707y5N6gT1loJwG42j+xVhX0RwuFw==} + /systeminformation/5.17.12: + resolution: {integrity: sha512-I3pfMW2vue53u+X08BNxaJieaHkRoMMKjWetY9lbYJeWFaeWPO6P4FkNc4XOCX8F9vbQ0HqQ25RJoz3U/B7liw==} engines: {node: '>=8.0.0'} os: [darwin, linux, win32, freebsd, openbsd, netbsd, sunos, android] hasBin: true @@ -3177,7 +3207,7 @@ packages: end-of-stream: 1.4.4 fs-constants: 1.0.0 inherits: 2.0.4 - readable-stream: 3.6.0 + readable-stream: 3.6.1 dev: false /tar/6.1.13: @@ -3186,7 +3216,7 @@ packages: dependencies: chownr: 2.0.0 fs-minipass: 2.1.0 - minipass: 4.0.0 + minipass: 4.2.4 minizlib: 2.1.2 mkdirp: 1.0.4 yallist: 4.0.0 @@ -3227,6 +3257,10 @@ packages: ieee754: 1.2.1 dev: false + /tr46/0.0.3: + resolution: {integrity: sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==} + dev: false + /triple-beam/1.3.0: resolution: {integrity: sha512-XrHUvV5HpdLmIj4uVMxHggLbFSZYIn7HEWsqePZcI50pco+MPqJ50wMGY794X7AOOhxOBAjbkqfAbEe/QMp2Lw==} dev: false @@ -3236,8 +3270,8 @@ packages: dev: false optional: true - /tslib/2.4.1: - resolution: {integrity: sha512-tGyy4dAjRIEwI7BzsB0lynWgOpfqjUdq91XXAlIWD2OwKBH7oCl/GZG/HT4BOHrTlPMOASlMQ7veyTqpmRcrNA==} + /tslib/2.5.0: + resolution: {integrity: sha512-336iVw3rtn2BUK7ORdIAHTyxHGRIHVReokCR3XjbckJMK7ms8FysBfhLR8IXnAgy7T0PTPNBWKiH514FOW/WSg==} dev: false optional: true @@ -3290,8 +3324,8 @@ packages: engines: {node: '>=8'} dev: true - /undici/5.14.0: - resolution: {integrity: sha512-yJlHYw6yXPPsuOH0x2Ib1Km61vu4hLiRRQoafs+WUgX1vO64vgnxiCEN9dpIrhZyHFsai3F0AEj4P9zy19enEQ==} + /undici/5.20.0: + resolution: {integrity: sha512-J3j60dYzuo6Eevbawwp1sdg16k5Tf768bxYK4TUJRH7cBM4kFCbf3mOnM/0E3vQYXvpxITbbWmBafaDbxLDz3g==} engines: {node: '>=12.18'} dependencies: busboy: 1.6.0 @@ -3314,13 +3348,13 @@ packages: dev: false optional: true - /update-browserslist-db/1.0.10_browserslist@4.21.4: + /update-browserslist-db/1.0.10_browserslist@4.21.5: resolution: {integrity: sha512-OztqDenkfFkbSG+tRxBeAnCVPckDBcvibKd35yDONx6OU8N7sqgwc7rCbkJ/WcYtVRZ4ba68d6byhC21GFh7sQ==} hasBin: true peerDependencies: browserslist: '>= 4.21.0' dependencies: - browserslist: 4.21.4 + browserslist: 4.21.5 escalade: 3.1.1 picocolors: 1.0.0 dev: true @@ -3328,7 +3362,7 @@ packages: /uri-js/4.4.1: resolution: {integrity: sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==} dependencies: - punycode: 2.1.1 + punycode: 2.3.0 dev: true /url-join/4.0.1: @@ -3355,7 +3389,7 @@ packages: /validate-npm-package-license/3.0.4: resolution: {integrity: sha512-DpKm2Ui/xN7/HQKCtpZxoRWBhZ9Z0kqtygG8XCgNQ8ZlDnxuQmWhj566j8fN4Cu3/JmbhsDo7fcAJq4s9h27Ew==} dependencies: - spdx-correct: 3.1.1 + spdx-correct: 3.2.0 spdx-expression-parse: 3.0.1 dev: true @@ -3370,16 +3404,27 @@ packages: dev: false optional: true - /vm2/3.9.13: - resolution: {integrity: sha512-0rvxpB8P8Shm4wX2EKOiMp7H2zq+HUE/UwodY0pCZXs9IffIKZq6vUti5OgkVCTakKo9e/fgO4X1fkwfjWxE3Q==} + /vm2/3.9.14: + resolution: {integrity: sha512-HgvPHYHeQy8+QhzlFryvSteA4uQLBCOub02mgqdR+0bN/akRZ48TGB1v0aCv7ksyc0HXx16AZtMHKS38alc6TA==} engines: {node: '>=6.0'} hasBin: true dependencies: - acorn: 8.8.1 + acorn: 8.8.2 acorn-walk: 8.2.0 dev: false optional: true + /webidl-conversions/3.0.1: + resolution: {integrity: sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==} + dev: false + + /whatwg-url/5.0.0: + resolution: {integrity: sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==} + dependencies: + tr46: 0.0.3 + webidl-conversions: 3.0.1 + dev: false + /which-module/2.0.0: resolution: {integrity: sha512-B+enWhmw6cjfVC7kS8Pj9pCrKSc5txArRyaYGe088shv/FGWH+0Rjx/xPgtsWfsUtS27FkP697E4DDhgrgoc0Q==} dev: false @@ -3415,8 +3460,8 @@ packages: resolution: {integrity: sha512-YpZzcUzBedhlTAfJg6vJDlyEai/IFMIVcaEZZyl3UXIl4gmqRpU7AE89AHLkbzLUsv0NVmw7ts+iztqKxxPW1Q==} engines: {node: '>= 6.4.0'} dependencies: - logform: 2.4.2 - readable-stream: 3.6.0 + logform: 2.5.1 + readable-stream: 3.6.1 triple-beam: 1.3.0 dev: false @@ -3428,10 +3473,10 @@ packages: '@dabh/diagnostics': 2.0.3 async: 3.2.4 is-stream: 2.0.1 - logform: 2.4.2 + logform: 2.5.1 one-time: 1.0.0 - readable-stream: 3.6.0 - safe-stable-stringify: 2.4.1 + readable-stream: 3.6.1 + safe-stable-stringify: 2.4.2 stack-trace: 0.0.10 triple-beam: 1.3.0 winston-transport: 4.5.0 @@ -3494,12 +3539,12 @@ packages: dev: false optional: true - /ws/8.11.0_bufferutil@4.0.7: - resolution: {integrity: sha512-HPG3wQd9sNQoT9xHyNCXoDUa+Xw/VevmY9FoHyQ+g+rrMn4j6FB4np7Z0OhdTgjx6MgQLK7jwSy1YecU1+4Asg==} + /ws/8.12.1_bufferutil@4.0.7: + resolution: {integrity: sha512-1qo+M9Ba+xNhPB+YTWUlK6M17brTut5EXbcBaMRN5pH5dFrXz7lzz1ChFSUq3bOUl8yEvSenhHmYUNJxFzdJew==} engines: {node: '>=10.0.0'} peerDependencies: bufferutil: ^4.0.1 - utf-8-validate: ^5.0.2 + utf-8-validate: '>=5.0.2' peerDependenciesMeta: bufferutil: optional: true @@ -3525,8 +3570,6 @@ packages: /yallist/3.1.1: resolution: {integrity: sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==} - dev: false - optional: true /yallist/4.0.0: resolution: {integrity: sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==} @@ -3570,8 +3613,8 @@ packages: yargs-parser: 18.1.3 dev: false - /yargs/17.6.2: - resolution: {integrity: sha512-1/9UrdHjDZc0eOU0HxOHoS78C69UD3JRMvzlJ7S79S2nTaWRA/whGCTV8o9e/N/1Va9YIV7Q4sOxD8VV4pCWOw==} + /yargs/17.7.1: + resolution: {integrity: sha512-cwiTb08Xuv5fqF4AovYacTFNxk62th7LKJ6BL9IGUpTJrWoU7/7WdQGTP2SjKf1dUNBGzDd28p/Yfs/GI6JrLw==} engines: {node: '>=12'} dependencies: cliui: 8.0.1 @@ -3588,8 +3631,8 @@ packages: engines: {node: '>=10'} dev: true - /zlib-sync/0.1.7: - resolution: {integrity: sha512-UmciU6ZrIwtwPC8noMzq+kGMdiWwNRZ3wC0SbED4Ew5Ikqx14MqDPRs/Pbk+3rZPh5SzsOgUBs1WRE0iieddpg==} + /zlib-sync/0.1.8: + resolution: {integrity: sha512-Xbu4odT5SbLsa1HFz8X/FvMgUbJYWxJYKB2+bqxJ6UOIIPaVGrqHEB3vyXDltSA6tTqBhSGYLgiVpzPQHYi3lA==} requiresBuild: true dependencies: nan: 2.17.0 diff --git a/utils/pagination/pagination.js b/utils/pagination/pagination.js index 1c12c86..4b2ba7f 100644 --- a/utils/pagination/pagination.js +++ b/utils/pagination/pagination.js @@ -138,7 +138,7 @@ export default async (client, info, pages, timeout = 120000) => { } catch { // no-op } - page = Number(response.data.values[0]); + page = Number(response.data.values.raw[0]); currentPage = await currentPage.edit(Object.assign(pages[page], options, components)); ended = true; dropdownCollector.stop();