diff --git a/internal/routes/mod.go b/internal/routes/mod.go index 75aa8d1..e4bbf79 100644 --- a/internal/routes/mod.go +++ b/internal/routes/mod.go @@ -70,24 +70,6 @@ func New(app *gin.Engine, version *service.Version, apiOnly bool) { }) }) - api.GET("/raw/*path", func(ctx *gin.Context) { - worker := service.NewWorkerService() - path := ctx.Param("path") - data, err := worker.Read(path) - if err != nil { - _, _ = fmt.Fprintf(os.Stderr, "%v\n", err) - ctx.Status(404) - return - } - - if data.IsDir { - ctx.String(400, "current path is not file") - return - } - - ctx.File(data.Path) - }) - api.GET("/download/*path", func(ctx *gin.Context) { worker := service.NewWorkerService() path := ctx.Param("path") diff --git a/src/components/directory/index.tsx b/src/components/directory/index.tsx index f776b8e..a68eb3d 100644 --- a/src/components/directory/index.tsx +++ b/src/components/directory/index.tsx @@ -84,7 +84,7 @@ function Readme() { useEffect(() => { async function refresh() { const pathname = location.pathname; - const res = await fetch(`/api/raw${pathname}${pathname.endsWith("/") ? "" : "/"}README.md`, { + const res = await fetch(`/api/download${pathname}${pathname.endsWith("/") ? "" : "/"}README.md`, { cache: "no-cache" });