logger, imageProcessing
This commit is contained in:
1 parent
83572aa12a
commit
8e44718787
4 files changed
+21
-25
No files matched your search
@@ -12,7 +12,7 @@ ESlint v9 configuration is different than v8.
|
|||||||
/** @type {import('eslint').Linter.Config[]} */
|
/** @type {import('eslint').Linter.Config[]} */
|
||||||
export default [
|
export default [
|
||||||
{
|
{
|
||||||
ignores: ["dist/**", "node_modules/**", "coverage/**"],
|
ignores: ["dist/**", "node_modules/**", "coverage/**", "test/**"],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
languageOptions: {
|
languageOptions: {
|
||||||
|
|||||||
@@ -455,10 +455,10 @@ class NetworkService implements INetworkService {
|
|||||||
|
|
||||||
// Priority-based matching to avoid ambiguity:
|
// Priority-based matching to avoid ambiguity:
|
||||||
// 1. Exact full ID match (64-char)
|
// 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)
|
// 2. Exact container name match (case-insensitive)
|
||||||
let exactNameMatch = containers.find((c: any) =>
|
const exactNameMatch = containers.find((c: any) =>
|
||||||
c.Names.some((name: string) => {
|
c.Names.some((name: string) => {
|
||||||
const cleanName = name.replace(/^\/+/, "").toLowerCase();
|
const cleanName = name.replace(/^\/+/, "").toLowerCase();
|
||||||
return cleanName === normalizedInput;
|
return cleanName === normalizedInput;
|
||||||
@@ -466,10 +466,10 @@ class NetworkService implements INetworkService {
|
|||||||
);
|
);
|
||||||
|
|
||||||
// 3. Partial ID match (fallback for backwards compatibility)
|
// 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
|
// Select container based on priority
|
||||||
let targetContainer = exactIdMatch || exactNameMatch || partialIdMatch;
|
const targetContainer = exactIdMatch || exactNameMatch || partialIdMatch;
|
||||||
|
|
||||||
// Return negative response if no container
|
// Return negative response if no container
|
||||||
if (!targetContainer) {
|
if (!targetContainer) {
|
||||||
|
|||||||
@@ -1,22 +1,18 @@
|
|||||||
import sharp from "sharp";
|
import sharp from "sharp";
|
||||||
|
|
||||||
const GenerateAvatarImage = async (file: Express.Multer.File) => {
|
const GenerateAvatarImage = async (file: Express.Multer.File) => {
|
||||||
try {
|
// Resize to target 64 * 64
|
||||||
// Resize to target 64 * 64
|
let resizedImageBuffer = await sharp(file.buffer)
|
||||||
let resizedImageBuffer = await sharp(file.buffer)
|
.resize({
|
||||||
.resize({
|
width: 64,
|
||||||
width: 64,
|
height: 64,
|
||||||
height: 64,
|
fit: "cover",
|
||||||
fit: "cover",
|
})
|
||||||
})
|
.toBuffer();
|
||||||
.toBuffer();
|
|
||||||
|
|
||||||
//Get b64 string
|
//Get b64 string
|
||||||
const base64Image = resizedImageBuffer.toString("base64");
|
const base64Image = resizedImageBuffer.toString("base64");
|
||||||
return base64Image;
|
return base64Image;
|
||||||
} catch (error) {
|
|
||||||
throw error;
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export { GenerateAvatarImage };
|
export { GenerateAvatarImage };
|
||||||
@@ -44,7 +44,7 @@ class Logger implements ILogger {
|
|||||||
this.maxCacheSize = 1000;
|
this.maxCacheSize = 1000;
|
||||||
const consoleFormat = format.printf((info: Logform.TransformableInfo) => {
|
const consoleFormat = format.printf((info: Logform.TransformableInfo) => {
|
||||||
const { level, service, method, details, timestamp, stack } = info;
|
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 formattedMessage: string = message;
|
||||||
let formattedDetails: string | undefined;
|
let formattedDetails: string | undefined;
|
||||||
|
|
||||||
@@ -57,10 +57,10 @@ class Logger implements ILogger {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let msg = `${timestamp} ${level}:`;
|
let msg = `${timestamp} ${level}:`;
|
||||||
service && (msg += ` [${service}]`);
|
if (service) msg += ` [${service}]`;
|
||||||
method && (msg += `(${method})`);
|
if (method) msg += `(${method})`;
|
||||||
formattedMessage && (msg += ` ${formattedMessage}`);
|
if (formattedMessage) msg += ` ${formattedMessage}`;
|
||||||
formattedDetails && (msg += ` (details: ${formattedDetails})`);
|
if (formattedDetails) msg += ` (details: ${formattedDetails})`;
|
||||||
|
|
||||||
if (typeof stack === "string") {
|
if (typeof stack === "string") {
|
||||||
const stackTrace = stack
|
const stackTrace = stack
|
||||||
|
|||||||
Reference in new issue
Block a user