remove: deprecated /api/raw/*

This commit is contained in:
Project_IO 2025-03-18 17:09:54 +09:00
parent 015f401a70
commit 7c487f6f1b
2 changed files with 1 additions and 19 deletions

View file

@ -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")

View file

@ -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"
});