Bump got, image-size, mime, node-localstorage, sharp to latest

got@15 default export, mime@4 ESM-only dynamic import, image-size@2
split into imageSize/imageSizeFromFile.
This commit is contained in:
2026-05-26 13:53:59 -06:00
parent bc97c564d3
commit f62ec9834b
5 changed files with 816 additions and 638 deletions
+798 -623
View File
File diff suppressed because it is too large Load Diff
+5 -5
View File
@@ -8,16 +8,16 @@
"fake-indexeddb": "^6.2.5", "fake-indexeddb": "^6.2.5",
"fluent-ffmpeg": "^2.1.2", "fluent-ffmpeg": "^2.1.2",
"fs-extra": "^11.1.0", "fs-extra": "^11.1.0",
"got": "^12.0.2", "got": "^15.0.5",
"image-size": "^1.0.2", "image-size": "^2.0.2",
"isomorphic-webcrypto": "^2.3.8", "isomorphic-webcrypto": "^2.3.8",
"linkifyjs": "^4.3.3", "linkifyjs": "^4.3.3",
"lodash.escape": "^4.0.1", "lodash.escape": "^4.0.1",
"matrix-js-sdk": "^41.5.0", "matrix-js-sdk": "^41.5.0",
"mime": "^3.0.0", "mime": "^4.1.0",
"node-fetch": "^3.3.0", "node-fetch": "^3.3.0",
"node-localstorage": "^2.2.1", "node-localstorage": "^3.0.5",
"sharp": "^0.33.4", "sharp": "^0.34.4",
"tmp": "^0.2.1", "tmp": "^0.2.1",
"utf8": "^3.0.0" "utf8": "^3.0.0"
}, },
+1 -1
View File
@@ -9,7 +9,7 @@ module.exports = function(RED) {
this.name = n.name; this.name = n.name;
node.on("input", async function (msg) { node.on("input", async function (msg) {
const { got } = await import('got'); const got = (await import('got')).default;
if(!msg.type) { if(!msg.type) {
node.error('msg.type is required.', msg); node.error('msg.type is required.', msg);
+1 -1
View File
@@ -22,7 +22,7 @@ module.exports = function(RED) {
} }
node.on("input", async function (msg) { node.on("input", async function (msg) {
const { got } = await import('got'); const got = (await import('got')).default;
if(!msg.payload.username) { if(!msg.payload.username) {
node.error("msg.payload.username is required", msg); node.error("msg.payload.username is required", msg);
+11 -8
View File
@@ -1,7 +1,8 @@
const crypto = require("isomorphic-webcrypto"); const crypto = require("isomorphic-webcrypto");
const ffmpeg = require('fluent-ffmpeg'); const ffmpeg = require('fluent-ffmpeg');
const sharp = require('sharp'); const sharp = require('sharp');
const getImageSize = require('image-size'); const { imageSize } = require('image-size');
const { imageSizeFromFile } = require('image-size/fromFile');
const tmp = require('tmp'); const tmp = require('tmp');
const fs = require('fs'); const fs = require('fs');
const path = require('path'); const path = require('path');
@@ -37,7 +38,7 @@ module.exports = function(RED) {
}); });
async function detectFileType(filename, bufferOrPath, msg) { async function detectFileType(filename, bufferOrPath, msg) {
const Mime = require('mime'); const Mime = (await import('mime')).default;
let file = Buffer.isBuffer(bufferOrPath) ? filename : bufferOrPath; let file = Buffer.isBuffer(bufferOrPath) ? filename : bufferOrPath;
try { try {
@@ -216,10 +217,10 @@ module.exports = function(RED) {
async function addThumbnail(buffer) { async function addThumbnail(buffer) {
try { try {
let imageSize = getImageSize(Buffer.isBuffer(buffer) ? buffer : buffer.data); let thumbSize = imageSize(Buffer.isBuffer(buffer) ? buffer : buffer.data);
msg.payload.info.thumbnail_info = { msg.payload.info.thumbnail_info = {
w: imageSize.width, w: thumbSize.width,
h: imageSize.height, h: thumbSize.height,
size: getFileSize(Buffer.isBuffer(buffer) ? buffer : buffer.data) size: getFileSize(Buffer.isBuffer(buffer) ? buffer : buffer.data)
} }
let uploadedThumbnail = await node.server.matrixClient.uploadContent( let uploadedThumbnail = await node.server.matrixClient.uploadContent(
@@ -302,9 +303,11 @@ module.exports = function(RED) {
if (msgtype === 'm.image') { if (msgtype === 'm.image') {
// detect size of image // detect size of image
try { try {
let imageSize = getImageSize(bufferOrPath); let dimensions = Buffer.isBuffer(bufferOrPath)
msg.payload.info.h = imageSize.height; ? imageSize(bufferOrPath)
msg.payload.info.w = imageSize.width; : await imageSizeFromFile(bufferOrPath);
msg.payload.info.h = dimensions.height;
msg.payload.info.w = dimensions.width;
// Generate thumbnail for image // Generate thumbnail for image
if (node.generateThumbnails) { if (node.generateThumbnails) {