chore(ops): cleanly purge old clube67 folder references
continuous-integration/webhook Falha no deploy de clube67_newwhats.local (VPS 4)

This commit is contained in:
VPS 4 Deploy Agent
2026-05-18 03:27:37 +02:00
parent 0dc5eefa06
commit 52f73753e7
387 changed files with 0 additions and 234641 deletions
@@ -1,60 +0,0 @@
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.ImageOptimizer = void 0;
const sharp_1 = __importDefault(require("sharp"));
class ImageOptimizer {
/**
* Optimizes an image: converts to WebP, strips metadata,
* and applies a 1:1 Smart Crop if needed.
*/
static async optimize(buffer, category = 'media', options = {}) {
try {
let pipeline = (0, sharp_1.default)(buffer);
const metadata = await pipeline.metadata();
if (!metadata.format)
return { buffer, mimetype: 'application/octet-stream' };
// 1. Identify Target Size
// Default sizes based on category
let targetSize = options.size || 1024;
if (category === 'partners' || category === 'users')
targetSize = 400;
if (category === 'benefits')
targetSize = 800;
// 2. Smart Crop 1:1 if aspect=1:1 is requested or implied by category
const shouldCrop = options.aspect === '1:1' || ['partners', 'users'].includes(category);
if (shouldCrop) {
pipeline = pipeline.resize({
width: targetSize,
height: targetSize,
fit: sharp_1.default.fit.cover,
position: sharp_1.default.strategy.entropy // Smart focal point detection
});
}
else {
// Resize without cropping if it's too large
pipeline = pipeline.resize({
width: targetSize,
withoutEnlargement: true,
fit: sharp_1.default.fit.inside
});
}
// 3. Convert to WebP & Strip Metadata
const optimizedBuffer = await pipeline
.webp({ quality: 85, effort: 4 })
.toBuffer();
return {
buffer: optimizedBuffer,
mimetype: 'image/webp'
};
}
catch (err) {
console.error('[SmartVision] Optimization failed:', err);
return { buffer, mimetype: 'image/jpeg' }; // Fallback
}
}
}
exports.ImageOptimizer = ImageOptimizer;
//# sourceMappingURL=Optimizer.js.map
@@ -1 +0,0 @@
{"version":3,"file":"Optimizer.js","sourceRoot":"","sources":["Optimizer.ts"],"names":[],"mappings":";;;;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,CAAC;YACP,CAAC;YAED,sCAAsC;YACtC,MAAM,eAAe,GAAG,MAAM,QAAQ;iBACjC,IAAI,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE,MAAM,EAAE,CAAC,EAAE,CAAC;iBAChC,QAAQ,EAAE,CAAC;YAEhB,OAAO;gBACH,MAAM,EAAE,eAAe;gBACvB,QAAQ,EAAE,YAAY;aACzB,CAAC;QACN,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACX,OAAO,CAAC,KAAK,CAAC,oCAAoC,EAAE,GAAG,CAAC,CAAC;YACzD,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,YAAY,EAAE,CAAC,CAAC,WAAW;QAC1D,CAAC;IACL,CAAC;CACJ;AAvDD,wCAuDC"}
@@ -1,63 +0,0 @@
import sharp from 'sharp';
export interface OptimizationResult {
buffer: Buffer;
mimetype: string;
}
export class ImageOptimizer {
/**
* Optimizes an image: converts to WebP, strips metadata,
* and applies a 1:1 Smart Crop if needed.
*/
static async optimize(
buffer: Buffer,
category: string = 'media',
options: { aspect?: string; size?: number } = {}
): Promise<OptimizationResult> {
try {
let pipeline = sharp(buffer);
const metadata = await pipeline.metadata();
if (!metadata.format) return { buffer, mimetype: 'application/octet-stream' };
// 1. Identify Target Size
// Default sizes based on category
let targetSize = options.size || 1024;
if (category === 'partners' || category === 'users') targetSize = 400;
if (category === 'benefits') targetSize = 800;
// 2. Smart Crop 1:1 if aspect=1:1 is requested or implied by category
const shouldCrop = options.aspect === '1:1' || ['partners', 'users'].includes(category);
if (shouldCrop) {
pipeline = pipeline.resize({
width: targetSize,
height: targetSize,
fit: sharp.fit.cover,
position: sharp.strategy.entropy // Smart focal point detection
});
} else {
// Resize without cropping if it's too large
pipeline = pipeline.resize({
width: targetSize,
withoutEnlargement: true,
fit: sharp.fit.inside
});
}
// 3. Convert to WebP & Strip Metadata
const optimizedBuffer = await pipeline
.webp({ quality: 85, effort: 4 })
.toBuffer();
return {
buffer: optimizedBuffer,
mimetype: 'image/webp'
};
} catch (err) {
console.error('[SmartVision] Optimization failed:', err);
return { buffer, mimetype: 'image/jpeg' }; // Fallback
}
}
}