- 최대 인원수를 보스 단위로 통합 (난이도별 → 보스 공통) - 가격 입력 시 쉼표 자동 표시 (text + inputMode=numeric) - registry 캐싱으로 sub-route 변경 시 화면 갱신 안되던 버그 수정 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
26 lines
819 B
JavaScript
26 lines
819 B
JavaScript
import sharp from 'sharp';
|
|
import { uploadObject, deleteObject } from '../../lib/s3.js';
|
|
|
|
const BOSS_IMAGE_PREFIX = 'crystal/boss';
|
|
|
|
/**
|
|
* 보스 이미지를 webp로 변환하고 RustFS의 crystal/boss/{name}.webp에 업로드
|
|
* @param {Buffer} buffer
|
|
* @param {string} bossName
|
|
* @returns {Promise<string>} S3 키 (예: crystal/boss/검은마법사.webp)
|
|
*/
|
|
export async function uploadBossImage(buffer, bossName) {
|
|
const webp = await sharp(buffer).webp({ quality: 90 }).toBuffer();
|
|
const path = `${BOSS_IMAGE_PREFIX}/${bossName}.webp`;
|
|
await uploadObject(path, webp, 'image/webp');
|
|
return path;
|
|
}
|
|
|
|
export async function deleteBossImage(path) {
|
|
if (!path) return;
|
|
try {
|
|
await deleteObject(path);
|
|
} catch (err) {
|
|
console.warn(`보스 이미지 삭제 실패 (${path}):`, err.message);
|
|
}
|
|
}
|