Add sharp dep (libvips bindings) — fastest option for the per-image center-crop + Lanczos resize step. Pure-JS alternatives (jimp) and spawning ffmpeg per image were both ~5-10x slower in this hot loop. Add src/installer-rp/images.ts: - ytIdFromUrl: extracts the video ID from watch?v=, youtu.be/, and /shorts|embed/ URL forms - downloadImage: for YouTube URLs tries i.ytimg.com/vi/<id>/ maxresdefault.jpg first, falls back to hqdefault.jpg; plain image URLs go through a generic HTTP/HTTPS GET that follows 302s - normalizeToCover: center-crop to min(w,h), Lanczos resize down to 1024x1024 when larger, never upscales, writes PNG - coverFileName: returns cover_NN.png with zero-padded NN Wire step 2-3 of the install handler to download + normalize each image into <tempDir>/painting/cover_NN.png. Zip build (step 2-4) will pick those up next. Verified with synthetic 1200x800 and 2000x1500 buffers: small input stays 800x800 (no upscale), large input becomes 1024x1024. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
34 lines
1.1 KiB
JSON
34 lines
1.1 KiB
JSON
{
|
|
"name": "minecraft-music-quiz-installer",
|
|
"version": "0.1.0",
|
|
"description": "마인크래프트 음악퀴즈 간편설치기 + 관리 사이트",
|
|
"main": "dist/installer/main.js",
|
|
"scripts": {
|
|
"build": "tsc -p tsconfig.json",
|
|
"start": "tsc -p tsconfig.server.json && node dist/server/app.js",
|
|
"dev:server": "tsc -p tsconfig.server.json && node dist/server/app.js",
|
|
"installer": "tsc -p tsconfig.installer.json && electron .",
|
|
"installer:rp": "tsc -p tsconfig.installer-rp.json && electron dist/installer-rp/main.js",
|
|
"dist:win": "tsc -p tsconfig.installer.json && electron-builder --win"
|
|
},
|
|
"dependencies": {
|
|
"ejs": "^3.1.10",
|
|
"express": "^4.19.2",
|
|
"express-session": "^1.18.0",
|
|
"extract-zip": "^2.0.1",
|
|
"multer": "^1.4.5-lts.1",
|
|
"nat-upnp": "^1.1.1",
|
|
"sharp": "^0.34.5"
|
|
},
|
|
"devDependencies": {
|
|
"@types/ejs": "^3.1.5",
|
|
"@types/express": "^4.17.21",
|
|
"@types/express-session": "^1.18.0",
|
|
"@types/multer": "^1.4.11",
|
|
"@types/node": "^22.5.0",
|
|
"electron": "^31.4.0",
|
|
"electron-builder": "^24.13.3",
|
|
"typescript": "^5.5.4"
|
|
}
|
|
}
|