Files
clube67_newwhats.local/newwhats.clube67.com/newwhats.local/plugins/SmartVision/index.js
T
VPS 4 Deploy Agent 2f8c04a0a7
continuous-integration/webhook Falha no deploy de clube67_newwhats.local (VPS 4)
chore(ops): restore all source files in newwhats.clube67.com
2026-05-18 03:28:29 +02:00

33 lines
1.3 KiB
JavaScript

"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const Optimizer_1 = require("./backend/Optimizer");
const manifest_json_1 = __importDefault(require("./manifest.json"));
const plugin = {
manifest: manifest_json_1.default,
async activate(ctx) {
// Register for the upload:transform hook
ctx.hooks.register('upload:transform', async (payload) => {
const { buffer, mimetype, category } = payload;
// Only process common image formats
const imageTypes = ['image/jpeg', 'image/png', 'image/webp', 'image/avif'];
if (!imageTypes.includes(mimetype)) {
return null; // Skip non-images
}
ctx.logger.info(`[SmartVision] Optimizing image for category: ${category}`);
const result = await Optimizer_1.ImageOptimizer.optimize(buffer, category);
return {
buffer: result.buffer,
mimetype: result.mimetype
};
});
ctx.logger.info('SmartVision Optimizer activated');
},
async deactivate(ctx) {
ctx.logger.info('SmartVision Optimizer deactivated');
}
};
exports.default = plugin;
//# sourceMappingURL=index.js.map