logger, imageProcessing

This commit is contained in:
Alex Holliday
2026-03-03 18:26:42 +00:00
parent 83572aa12a
commit 8e44718787
4 changed files with 21 additions and 25 deletions
@@ -455,10 +455,10 @@ class NetworkService implements INetworkService {
// Priority-based matching to avoid ambiguity:
// 1. Exact full ID match (64-char)
let exactIdMatch = containers.find((c: any) => c.Id.toLowerCase() === normalizedInput);
const exactIdMatch = containers.find((c: any) => c.Id.toLowerCase() === normalizedInput);
// 2. Exact container name match (case-insensitive)
let exactNameMatch = containers.find((c: any) =>
const exactNameMatch = containers.find((c: any) =>
c.Names.some((name: string) => {
const cleanName = name.replace(/^\/+/, "").toLowerCase();
return cleanName === normalizedInput;
@@ -466,10 +466,10 @@ class NetworkService implements INetworkService {
);
// 3. Partial ID match (fallback for backwards compatibility)
let partialIdMatch = containers.find((c: any) => c.Id.toLowerCase().startsWith(normalizedInput));
const partialIdMatch = containers.find((c: any) => c.Id.toLowerCase().startsWith(normalizedInput));
// Select container based on priority
let targetContainer = exactIdMatch || exactNameMatch || partialIdMatch;
const targetContainer = exactIdMatch || exactNameMatch || partialIdMatch;
// Return negative response if no container
if (!targetContainer) {
+11 -15
View File
@@ -1,22 +1,18 @@
import sharp from "sharp";
const GenerateAvatarImage = async (file: Express.Multer.File) => {
try {
// Resize to target 64 * 64
let resizedImageBuffer = await sharp(file.buffer)
.resize({
width: 64,
height: 64,
fit: "cover",
})
.toBuffer();
// Resize to target 64 * 64
let resizedImageBuffer = await sharp(file.buffer)
.resize({
width: 64,
height: 64,
fit: "cover",
})
.toBuffer();
//Get b64 string
const base64Image = resizedImageBuffer.toString("base64");
return base64Image;
} catch (error) {
throw error;
}
//Get b64 string
const base64Image = resizedImageBuffer.toString("base64");
return base64Image;
};
export { GenerateAvatarImage };
+5 -5
View File
@@ -44,7 +44,7 @@ class Logger implements ILogger {
this.maxCacheSize = 1000;
const consoleFormat = format.printf((info: Logform.TransformableInfo) => {
const { level, service, method, details, timestamp, stack } = info;
let message = info.message as string;
const message = info.message as string;
let formattedMessage: string = message;
let formattedDetails: string | undefined;
@@ -57,10 +57,10 @@ class Logger implements ILogger {
}
let msg = `${timestamp} ${level}:`;
service && (msg += ` [${service}]`);
method && (msg += `(${method})`);
formattedMessage && (msg += ` ${formattedMessage}`);
formattedDetails && (msg += ` (details: ${formattedDetails})`);
if (service) msg += ` [${service}]`;
if (method) msg += `(${method})`;
if (formattedMessage) msg += ` ${formattedMessage}`;
if (formattedDetails) msg += ` (details: ${formattedDetails})`;
if (typeof stack === "string") {
const stackTrace = stack