1
0
forked from crony/UpFast

Print file names when curling /files/ path.

This commit is contained in:
CronyAkatsuki 2024-03-03 11:24:30 +01:00
parent 821c0c91c8
commit 9d9acbe7d3

17
main.go
View File

@ -122,6 +122,23 @@ func Files(c echo.Context) error {
log.Fatal(err)
}
UserAgent := c.Request().UserAgent()
log.Print(UserAgent)
match, err := regexp.MatchString("^curl/.*", UserAgent)
if err != nil {
log.Fatal(err)
}
if match {
out := ""
for _, f := range filelist {
out += f.Name() + "\n"
}
return c.String(http.StatusOK, out)
}
var Type string
var Content string