feat: launcher.exe와 game.zip 별도 업로드/서빙 분리
All checks were successful
Server CI/CD / deploy (push) Successful in 36s
All checks were successful
Server CI/CD / deploy (push) Successful in 36s
- POST /api/download/upload/game - 게임 zip 업로드 - POST /api/download/upload/launcher - launcher.exe 업로드 - GET /api/download/launcher - launcher.exe 서빙 - Info 모델에 LauncherURL, LauncherSize 필드 추가 - Content-Disposition 헤더로 올바른 파일명 설정 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -45,5 +45,29 @@ func (h *Handler) ServeFile(c *fiber.Ctx) error {
|
||||
if _, err := os.Stat(path); err != nil {
|
||||
return c.Status(fiber.StatusNotFound).JSON(fiber.Map{"error": "파일이 없습니다"})
|
||||
}
|
||||
info, _ := h.svc.GetInfo()
|
||||
filename := "game.zip"
|
||||
if info != nil && info.FileName != "" {
|
||||
filename = info.FileName
|
||||
}
|
||||
c.Set("Content-Disposition", `attachment; filename="`+filename+`"`)
|
||||
return c.SendFile(path)
|
||||
}
|
||||
|
||||
func (h *Handler) UploadLauncher(c *fiber.Ctx) error {
|
||||
body := c.Request().BodyStream()
|
||||
info, err := h.svc.UploadLauncher(body, h.baseURL)
|
||||
if err != nil {
|
||||
return c.Status(fiber.StatusInternalServerError).JSON(fiber.Map{"error": "업로드 실패: " + err.Error()})
|
||||
}
|
||||
return c.JSON(info)
|
||||
}
|
||||
|
||||
func (h *Handler) ServeLauncher(c *fiber.Ctx) error {
|
||||
path := h.svc.LauncherFilePath()
|
||||
if _, err := os.Stat(path); err != nil {
|
||||
return c.Status(fiber.StatusNotFound).JSON(fiber.Map{"error": "파일이 없습니다"})
|
||||
}
|
||||
c.Set("Content-Disposition", `attachment; filename="launcher.exe"`)
|
||||
return c.SendFile(path)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user