Files
mintel.me/apps/web/src/utils/imgproxy.verify.ts
Marc Mintel 7c774f65bc
Some checks failed
Build & Deploy / 🔍 Prepare (push) Successful in 36s
Build & Deploy / 🧪 QA (push) Successful in 4m2s
Build & Deploy / 🏗️ Build (push) Successful in 10m53s
Build & Deploy / 🚀 Deploy (push) Successful in 27s
Build & Deploy / 🩺 Health Check (push) Failing after 11s
Build & Deploy / 🔔 Notify (push) Successful in 2s
chore: integrate local imgproxy sidecar and unify list components
- Added imgproxy service to docker-compose.dev.yml with URL mapping
- Implemented robust Base64 encoding for imgproxy source URLs
- Synchronized NEXT_PUBLIC_IMGPROXY_URL and NEXT_PUBLIC_BASE_URL
- Refactored About page to use existing marc-mintel.png asset
- Created shared IconList component and unified list styles project-wide
- Fixed vertical alignment issues in IconList items
- Updated dev script with aggressive port 3000 and lock file cleanup
2026-02-13 22:03:35 +01:00

63 lines
1.7 KiB
TypeScript

import { getImgproxyUrl } from "./imgproxy";
/**
* Verification script for imgproxy URL generation
*/
function testImgproxyUrl() {
const testCases = [
{
src: "https://picsum.photos/800/800",
options: { width: 400, height: 300, resizing_type: "fill" as const },
description: "Remote URL with fill resizing",
},
{
src: "/images/avatar.jpg",
options: { width: 100, extension: "webp" },
description: "Local path with extension conversion",
},
{
src: "https://example.com/image.png",
options: { gravity: "no" },
description: "Remote URL with custom gravity",
},
];
console.log("🧪 Testing imgproxy URL generation...\n");
testCases.forEach((tc, i) => {
const url = getImgproxyUrl(tc.src, tc.options);
console.log(`Test Case ${i + 1}: ${tc.description}`);
console.log(`Source: ${tc.src}`);
console.log(`Result: ${url}`);
// Basic validation
if (url.startsWith("https://img.infra.mintel.me/unsafe/")) {
console.log("✅ Base URL and unsafe path correct");
} else {
console.log("❌ Base URL or unsafe path mismatch");
}
if (
tc.options.width &&
url.includes(
`rs:${tc.options.resizing_type || "fit"}:${tc.options.width}`,
)
) {
console.log("✅ Resizing options present");
}
console.log("-------------------\n");
});
}
// Mock environment for testing if not set
if (!process.env.NEXT_PUBLIC_IMGPROXY_URL) {
process.env.NEXT_PUBLIC_IMGPROXY_URL = "https://img.infra.mintel.me";
}
if (!process.env.NEXT_PUBLIC_BASE_URL) {
process.env.NEXT_PUBLIC_BASE_URL = "http://mintel.localhost";
}
testImgproxyUrl();