commit 170c717afb605036238ba4183109554026c8dd6f
parent f7240fcff9dcca26346e6e57d0eb917f4f40a550
Author: n0tr1v <n0tr1v@protonmail.com>
Date: Fri, 3 Feb 2023 12:58:13 -0800
slightly better endpoint names
Diffstat:
3 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/cmd/dkfupload/main.go b/cmd/dkfupload/main.go
@@ -116,7 +116,7 @@ func main() {
body.Set("fileSha256", fileSha256)
body.Set("chunkSize", strconv.FormatInt(maxChunkSize, 10))
body.Set("nbChunks", strconv.FormatInt(nbChunks, 10))
- req, _ := http.NewRequest(http.MethodPost, baseUrl+"/file-drop/"+filedropUUID+"/tmp-init", strings.NewReader(body.Encode()))
+ req, _ := http.NewRequest(http.MethodPost, baseUrl+"/file-drop/"+filedropUUID+"/dkfupload-init", strings.NewReader(body.Encode()))
req.Header.Set("User-Agent", userAgent)
req.Header.Set("Content-Type", "application/x-www-form-urlencoded")
resp, err := client.Do(req)
@@ -171,7 +171,7 @@ func work(i int, wg *sync.WaitGroup, chunksCh chan int64, isLocal, dry bool, max
{
body := url.Values{}
body.Set("fileName", partFileName)
- req, _ := http.NewRequest(http.MethodPost, baseUrl+"/file-drop/"+filedropUUID+"/tmp", strings.NewReader(body.Encode()))
+ req, _ := http.NewRequest(http.MethodPost, baseUrl+"/file-drop/"+filedropUUID+"/dkfupload", strings.NewReader(body.Encode()))
req.Header.Set("User-Agent", userAgent)
req.Header.Set("Content-Type", "application/x-www-form-urlencoded")
resp, err := client.Do(req)
@@ -204,7 +204,7 @@ func work(i int, wg *sync.WaitGroup, chunksCh chan int64, isLocal, dry bool, max
return err
}
- req, _ := http.NewRequest(http.MethodPost, baseUrl+"/file-drop/"+filedropUUID+"/tmp", body)
+ req, _ := http.NewRequest(http.MethodPost, baseUrl+"/file-drop/"+filedropUUID+"/dkfupload", body)
req.Header.Set("User-Agent", userAgent)
req.Header.Set("Content-Type", w.FormDataContentType())
resp, err := client.Do(req)
diff --git a/pkg/web/handlers/handlers.go b/pkg/web/handlers/handlers.go
@@ -4317,7 +4317,7 @@ func FileDropHandler(c echo.Context) error {
return c.Render(http.StatusOK, filedropTmplName, data)
}
-func FileDropTmpReconstructHandler(c echo.Context) error {
+func FileDropDkfUploadReconstructHandler(c echo.Context) error {
filedropUUID := c.Param("uuid")
filedrop, err := database.GetFiledropByUUID(filedropUUID)
@@ -4401,7 +4401,7 @@ func FileDropTmpReconstructHandler(c echo.Context) error {
return c.NoContent(http.StatusOK)
}
-func FileDropTmpInitHandler(c echo.Context) error {
+func FileDropDkfUploadInitHandler(c echo.Context) error {
filedropUUID := c.Param("uuid")
_, err := database.GetFiledropByUUID(filedropUUID)
@@ -4440,7 +4440,7 @@ func FileDropTmpInitHandler(c echo.Context) error {
return c.NoContent(http.StatusOK)
}
-func FileDropTmpHandler(c echo.Context) error {
+func FileDropDkfUploadHandler(c echo.Context) error {
filedropUUID := c.Param("uuid")
{
diff --git a/pkg/web/web.go b/pkg/web/web.go
@@ -248,7 +248,7 @@ func getMainServer(i18nBundle *i18n.Bundle, renderer *tmp.Templates) echo.Handle
adminGroup.POST("/admin/uploads", handlers.AdminUploadsHandler)
adminGroup.GET("/admin/filedrops", handlers.AdminFiledropsHandler)
adminGroup.POST("/admin/filedrops", handlers.AdminFiledropsHandler)
- adminGroup.GET("/file-drop/:uuid/tmp-reconstruct", handlers.FileDropTmpReconstructHandler)
+ adminGroup.GET("/file-drop/:uuid/dkfupload-reconstruct", handlers.FileDropDkfUploadReconstructHandler)
adminGroup.GET("/admin/file-drop/:filename", handlers.FiledropDownloadHandler)
adminGroup.GET("/admin/downloads", handlers.AdminDownloadsHandler)
adminGroup.POST("/admin/downloads/:downloadID/delete", handlers.AdminDeleteDownloadHandler)
@@ -302,8 +302,8 @@ func getBaseServer() *echo.Echo {
e.Use(middlewares.I18nMiddleware(i18nBundle, "en"))
e.GET("/file-drop/:uuid", handlers.FileDropHandler)
e.POST("/file-drop/:uuid", handlers.FileDropHandler)
- e.POST("/file-drop/:uuid/tmp-init", handlers.FileDropTmpInitHandler)
- e.POST("/file-drop/:uuid/tmp", handlers.FileDropTmpHandler)
+ e.POST("/file-drop/:uuid/dkfupload-init", handlers.FileDropDkfUploadInitHandler)
+ e.POST("/file-drop/:uuid/dkfupload", handlers.FileDropDkfUploadHandler)
e.GET("/downloads/:fileName", handlers.FileDropDownloadHandler)
e.POST("/downloads/:fileName", handlers.FileDropDownloadHandler)
e.Any("*", getMainServer(i18nBundle, renderer))