Skip to content

Commit 69910ec

Browse files
committed
feat: support fumadocs
1 parent 38ad19c commit 69910ec

File tree

140 files changed

+4788
-1438
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

140 files changed

+4788
-1438
lines changed

boot/src/main/java/com/reajason/javaweb/boot/controller/ClassNameParseController.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
@CrossOrigin("*")
1818
public class ClassNameParseController {
1919

20-
@PostMapping("/className")
20+
@PostMapping("/api/className")
2121
public String className(@RequestBody String classBase64) {
2222
return ClassNameReader.getClassName(new ClassReader(Base64.getDecoder().decode(classBase64)));
2323
}

boot/src/main/java/com/reajason/javaweb/boot/controller/ConfigController.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
* @since 2024/12/13
1818
*/
1919
@RestController
20-
@RequestMapping("/config")
20+
@RequestMapping("/api/config")
2121
@CrossOrigin("*")
2222
public class ConfigController {
2323

boot/src/main/java/com/reajason/javaweb/boot/controller/MemShellGeneratorController.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
* @since 2024/12/18
2020
*/
2121
@RestController
22-
@RequestMapping("/memshell/generate")
22+
@RequestMapping("/api/memshell/generate")
2323
@CrossOrigin("*")
2424
public class MemShellGeneratorController {
2525
@PostMapping

boot/src/main/java/com/reajason/javaweb/boot/controller/ProbeShellGeneratorController.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
* @since 2025/8/10
1616
*/
1717
@RestController
18-
@RequestMapping("/probe/generate")
18+
@RequestMapping("/api/probe/generate")
1919
@CrossOrigin("*")
2020
public class ProbeShellGeneratorController {
2121
@PostMapping

boot/src/main/java/com/reajason/javaweb/boot/controller/VersionController.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
*/
2323
@RestController
2424
@CrossOrigin("*")
25-
@RequestMapping("/version")
25+
@RequestMapping("/api/version")
2626
public class VersionController {
2727

2828
@Value("${spring.application.version}")

boot/src/main/java/com/reajason/javaweb/boot/controller/ViewController.java

Lines changed: 56 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,17 @@
11
package com.reajason.javaweb.boot.controller;
22

3+
import jakarta.servlet.http.HttpServletRequest;
4+
import jakarta.servlet.http.HttpServletResponse;
5+
import org.springframework.core.io.ClassPathResource;
6+
import org.springframework.http.MediaType;
37
import org.springframework.stereotype.Controller;
8+
import org.springframework.util.FileCopyUtils;
49
import org.springframework.web.bind.annotation.GetMapping;
10+
import org.springframework.web.bind.annotation.ResponseBody;
11+
12+
import java.io.IOException;
13+
import java.io.InputStreamReader;
14+
import java.nio.charset.StandardCharsets;
515

616
/**
717
* @author ReaJason
@@ -11,6 +21,51 @@
1121
public class ViewController {
1222
@GetMapping("/")
1323
public String index(){
14-
return "index";
24+
return "redirect:/ui";
25+
}
26+
27+
@GetMapping({"/api/search", "/api/search.data"})
28+
@ResponseBody
29+
public String handleSearch(HttpServletRequest request, HttpServletResponse response) {
30+
String fullPath = request.getRequestURI();
31+
String relativePath = fullPath.substring(1);
32+
return renderFileData(relativePath, response);
33+
}
34+
35+
@GetMapping({"/ui/docs/*.data", "/ui/*.data"})
36+
@ResponseBody
37+
public String handleDataFile(HttpServletRequest request, HttpServletResponse response) throws IOException {
38+
String fullPath = request.getRequestURI();
39+
String relativePath = fullPath.substring(4);
40+
return renderFileData(relativePath, response);
41+
}
42+
43+
44+
@GetMapping("/ui/**")
45+
public String handleHtmlView(HttpServletRequest request) {
46+
String fullPath = request.getRequestURI();
47+
String viewPath = fullPath.substring(3);
48+
return viewPath + "/index";
49+
}
50+
51+
private String renderFileData(String relativePath, HttpServletResponse response) {
52+
try {
53+
String templatePath = "templates/" + relativePath;
54+
ClassPathResource resource = new ClassPathResource(templatePath);
55+
if (!resource.exists()) {
56+
response.setStatus(HttpServletResponse.SC_NOT_FOUND);
57+
return "File not found: " + relativePath;
58+
}
59+
response.setContentType(MediaType.TEXT_PLAIN_VALUE);
60+
response.setCharacterEncoding("UTF-8");
61+
InputStreamReader reader = new InputStreamReader(
62+
resource.getInputStream(),
63+
StandardCharsets.UTF_8
64+
);
65+
return FileCopyUtils.copyToString(reader);
66+
} catch (IOException e) {
67+
response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
68+
return "Error reading file: " + e.getMessage();
69+
}
1570
}
1671
}
Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
spring:
22
application:
33
name: boot
4-
version: ${version}
4+
version: ${version}
5+
mvc:
6+
pathmatch:
7+
matching-strategy: ant_path_matcher

web/.env

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
VITE_APP_API_URL=http://127.0.0.1:8080
1+
VITE_APP_API_URL=http://127.0.0.1:8889
22
VITE_APP_BASE_PATH=/

web/.env.production

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
VITE_APP_API_URL=
2-
VITE_APP_BASE_PATH=/
2+
VITE_APP_BASE_PATH=/ui

web/.gitignore

Lines changed: 5 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,7 @@
1-
# Local
21
.DS_Store
3-
*.local
4-
*.log*
2+
/node_modules/
53

6-
# Dist
7-
node_modules
8-
dist/
9-
.vinxi
10-
.output
11-
.vercel
12-
.netlify
13-
.wrangler
14-
15-
# IDE
16-
.vscode/*
17-
!.vscode/extensions.json
18-
.idea
19-
tsconfig.app.tsbuildinfo
20-
tsconfig.node.tsbuildinfo
4+
# React Router
5+
/.react-router/
6+
/build/
7+
.source

0 commit comments

Comments
 (0)