diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index ff77c73..2f9eb21 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -4,10 +4,10 @@
-
+
-
-
+
+
@@ -148,12 +148,21 @@
1776260511168
-
+
+
+ 1776692795089
+
+
+
+ 1776692795089
+
+
-
+
+
\ No newline at end of file
diff --git a/src/main/java/com/pandoli365/bibimbap/config/WebMvcConfig.java b/src/main/java/com/pandoli365/bibimbap/config/WebMvcConfig.java
deleted file mode 100644
index 793e490..0000000
--- a/src/main/java/com/pandoli365/bibimbap/config/WebMvcConfig.java
+++ /dev/null
@@ -1,14 +0,0 @@
-package com.pandoli365.bibimbap.config;
-
-import org.springframework.context.annotation.Configuration;
-import org.springframework.web.servlet.config.annotation.ViewControllerRegistry;
-import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
-
-@Configuration
-public class WebMvcConfig implements WebMvcConfigurer {
-
- @Override
- public void addViewControllers(ViewControllerRegistry registry) {
- registry.addViewController("/").setViewName("index");
- }
-}
diff --git a/src/main/java/com/pandoli365/bibimbap/controller/WebMvcController.java b/src/main/java/com/pandoli365/bibimbap/controller/WebMvcController.java
new file mode 100644
index 0000000..c0ad33b
--- /dev/null
+++ b/src/main/java/com/pandoli365/bibimbap/controller/WebMvcController.java
@@ -0,0 +1,74 @@
+package com.pandoli365.bibimbap.controller;
+
+import com.pandoli365.bibimbap.game.GameCatalog;
+import jakarta.servlet.http.HttpServletRequest;
+import jakarta.servlet.http.HttpSession;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.ui.Model;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.servlet.ModelAndView;
+import org.springframework.web.servlet.config.annotation.ViewControllerRegistry;
+import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
+
+import java.util.Arrays;
+
+@Configuration
+public class WebMvcController implements WebMvcConfigurer {
+
+ @RequestMapping("/{pageName}")
+ public ModelAndView mainView(@PathVariable("pageName") String pageName,
+ @RequestParam(required = false) String id,
+ HttpSession session,
+ HttpServletRequest request) {
+ ModelAndView mv = new ModelAndView();
+// if (!ALLOWED_PAGES.contains(keyword)) {
+// return new ModelAndView("redirect:/main");
+// }
+ switch (pageName) {
+ default:
+ mv.setViewName("/index");
+ break;
+ }
+
+ return mv;
+ }
+
+ public static String webglUrlForGame(int gameId) {
+ return "/webgl/game-" + gameId + "/index.html";
+ }
+
+ @GetMapping("/game/{id}")
+ public String gameDetail(@PathVariable("id") int id, Model model) {
+ if (!GameCatalog.isValidId(id)) {
+ return "redirect:/";
+ }
+ int idx = GameCatalog.toIndex(id);
+ model.addAttribute("gameId", id);
+ model.addAttribute("gameName", GameCatalog.NAMES[idx]);
+ model.addAttribute("creator", GameCatalog.CREATORS[idx]);
+ model.addAttribute("likeCount", GameCatalog.LIKE_COUNTS[idx]);
+ model.addAttribute("likeCountFormatted", String.format("%,d", GameCatalog.LIKE_COUNTS[idx]));
+ model.addAttribute("creatorNote", GameCatalog.CREATOR_NOTES[idx]);
+ model.addAttribute("gitUrl", GameCatalog.GIT_URLS[idx]);
+ /* 데모: 공통 플레이스홀더. 실제 빌드는 static/webgl/game-{id}/ 에 두고 아래 한 줄을 webglUrlForGame(id) 로 바꾸면 됩니다. */
+ model.addAttribute("webglUrl", "/webgl/placeholder/index.html");
+ model.addAttribute("webglDeployPath", webglUrlForGame(id));
+ return "game-detail";
+ }
+
+ private boolean isMobileDevice(HttpServletRequest request) {
+ String userAgent = request.getHeader("User-Agent");
+ if (userAgent == null) {
+ return false; // User-Agent가 없는 경우 기본값은 false
+ }
+
+ // 모바일 User-Agent 리스트 (대표적인 기기들)
+ String[] mobileKeywords = {"Android", "iPhone", "iPad", "iPod", "Windows Phone", "Mobile", "Opera Mini", "BlackBerry"};
+
+ // User-Agent 문자열이 모바일 기기를 포함하는지 검사
+ return Arrays.stream(mobileKeywords).anyMatch(userAgent::contains);
+ }
+}
diff --git a/src/main/java/com/pandoli365/bibimbap/web/GameController.java b/src/main/java/com/pandoli365/bibimbap/web/GameController.java
index 9d53bd4..b9a71cd 100644
--- a/src/main/java/com/pandoli365/bibimbap/web/GameController.java
+++ b/src/main/java/com/pandoli365/bibimbap/web/GameController.java
@@ -9,26 +9,5 @@ import org.springframework.web.bind.annotation.PathVariable;
@Controller
public class GameController {
- public static String webglUrlForGame(int gameId) {
- return "/webgl/game-" + gameId + "/index.html";
- }
- @GetMapping("/game/{id}")
- public String gameDetail(@PathVariable("id") int id, Model model) {
- if (!GameCatalog.isValidId(id)) {
- return "redirect:/";
- }
- int idx = GameCatalog.toIndex(id);
- model.addAttribute("gameId", id);
- model.addAttribute("gameName", GameCatalog.NAMES[idx]);
- model.addAttribute("creator", GameCatalog.CREATORS[idx]);
- model.addAttribute("likeCount", GameCatalog.LIKE_COUNTS[idx]);
- model.addAttribute("likeCountFormatted", String.format("%,d", GameCatalog.LIKE_COUNTS[idx]));
- model.addAttribute("creatorNote", GameCatalog.CREATOR_NOTES[idx]);
- model.addAttribute("gitUrl", GameCatalog.GIT_URLS[idx]);
- /* 데모: 공통 플레이스홀더. 실제 빌드는 static/webgl/game-{id}/ 에 두고 아래 한 줄을 webglUrlForGame(id) 로 바꾸면 됩니다. */
- model.addAttribute("webglUrl", "/webgl/placeholder/index.html");
- model.addAttribute("webglDeployPath", webglUrlForGame(id));
- return "game-detail";
- }
}