remove: deprecated /api/raw/*
This commit is contained in:
parent
015f401a70
commit
7c487f6f1b
2 changed files with 1 additions and 19 deletions
|
@ -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")
|
||||
|
|
|
@ -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"
|
||||
});
|
||||
|
||||
|
|
Loading…
Reference in a new issue