mirror of
https://github.com/Skylar-Tech/node-red-contrib-matrix-chat.git
synced 2026-08-27 20:42:03 -06:00
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:
Generated
+797
-622
File diff suppressed because it is too large
Load Diff
+5
-5
@@ -8,16 +8,16 @@
|
||||
"fake-indexeddb": "^6.2.5",
|
||||
"fluent-ffmpeg": "^2.1.2",
|
||||
"fs-extra": "^11.1.0",
|
||||
"got": "^12.0.2",
|
||||
"image-size": "^1.0.2",
|
||||
"got": "^15.0.5",
|
||||
"image-size": "^2.0.2",
|
||||
"isomorphic-webcrypto": "^2.3.8",
|
||||
"linkifyjs": "^4.3.3",
|
||||
"lodash.escape": "^4.0.1",
|
||||
"matrix-js-sdk": "^41.5.0",
|
||||
"mime": "^3.0.0",
|
||||
"mime": "^4.1.0",
|
||||
"node-fetch": "^3.3.0",
|
||||
"node-localstorage": "^2.2.1",
|
||||
"sharp": "^0.33.4",
|
||||
"node-localstorage": "^3.0.5",
|
||||
"sharp": "^0.34.4",
|
||||
"tmp": "^0.2.1",
|
||||
"utf8": "^3.0.0"
|
||||
},
|
||||
|
||||
@@ -9,7 +9,7 @@ module.exports = function(RED) {
|
||||
this.name = n.name;
|
||||
|
||||
node.on("input", async function (msg) {
|
||||
const { got } = await import('got');
|
||||
const got = (await import('got')).default;
|
||||
|
||||
if(!msg.type) {
|
||||
node.error('msg.type is required.', msg);
|
||||
|
||||
@@ -22,7 +22,7 @@ module.exports = function(RED) {
|
||||
}
|
||||
|
||||
node.on("input", async function (msg) {
|
||||
const { got } = await import('got');
|
||||
const got = (await import('got')).default;
|
||||
|
||||
if(!msg.payload.username) {
|
||||
node.error("msg.payload.username is required", msg);
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
const crypto = require("isomorphic-webcrypto");
|
||||
const ffmpeg = require('fluent-ffmpeg');
|
||||
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 fs = require('fs');
|
||||
const path = require('path');
|
||||
@@ -37,7 +38,7 @@ module.exports = function(RED) {
|
||||
});
|
||||
|
||||
async function detectFileType(filename, bufferOrPath, msg) {
|
||||
const Mime = require('mime');
|
||||
const Mime = (await import('mime')).default;
|
||||
let file = Buffer.isBuffer(bufferOrPath) ? filename : bufferOrPath;
|
||||
|
||||
try {
|
||||
@@ -216,10 +217,10 @@ module.exports = function(RED) {
|
||||
|
||||
async function addThumbnail(buffer) {
|
||||
try {
|
||||
let imageSize = getImageSize(Buffer.isBuffer(buffer) ? buffer : buffer.data);
|
||||
let thumbSize = imageSize(Buffer.isBuffer(buffer) ? buffer : buffer.data);
|
||||
msg.payload.info.thumbnail_info = {
|
||||
w: imageSize.width,
|
||||
h: imageSize.height,
|
||||
w: thumbSize.width,
|
||||
h: thumbSize.height,
|
||||
size: getFileSize(Buffer.isBuffer(buffer) ? buffer : buffer.data)
|
||||
}
|
||||
let uploadedThumbnail = await node.server.matrixClient.uploadContent(
|
||||
@@ -302,9 +303,11 @@ module.exports = function(RED) {
|
||||
if (msgtype === 'm.image') {
|
||||
// detect size of image
|
||||
try {
|
||||
let imageSize = getImageSize(bufferOrPath);
|
||||
msg.payload.info.h = imageSize.height;
|
||||
msg.payload.info.w = imageSize.width;
|
||||
let dimensions = Buffer.isBuffer(bufferOrPath)
|
||||
? imageSize(bufferOrPath)
|
||||
: await imageSizeFromFile(bufferOrPath);
|
||||
msg.payload.info.h = dimensions.height;
|
||||
msg.payload.info.w = dimensions.width;
|
||||
|
||||
// Generate thumbnail for image
|
||||
if (node.generateThumbnails) {
|
||||
|
||||
Reference in New Issue
Block a user