From b77bebe3b1a03cecdd7e80f575452d5ce91ccfac Mon Sep 17 00:00:00 2001 From: Derrick Hammer Date: Sat, 10 Jun 2023 01:58:45 -0400 Subject: [PATCH] feat: add files/upload/limit endpoint --- controller/files.go | 4 ++++ controller/response/upload_limit.go | 5 +++++ 2 files changed, 9 insertions(+) create mode 100644 controller/response/upload_limit.go diff --git a/controller/files.go b/controller/files.go index a9e614b..5987b65 100644 --- a/controller/files.go +++ b/controller/files.go @@ -156,6 +156,10 @@ func (f *FilesController) PostPinBy(cidString string) { f.Ctx.StatusCode(iris.StatusCreated) } +func (f *FilesController) GetUploadLimit() { + f.respondJSON(&response.UploadLimit{Limit: f.Ctx.Application().ConfigurationReadOnly().GetPostMaxMemory()}) +} + func validateCid(cidString string, validateStatus bool, ctx iris.Context) (string, bool) { _, err := cid.Valid(cidString) if sendError(ctx, err, iris.StatusBadRequest) { diff --git a/controller/response/upload_limit.go b/controller/response/upload_limit.go new file mode 100644 index 0000000..73d0fe1 --- /dev/null +++ b/controller/response/upload_limit.go @@ -0,0 +1,5 @@ +package response + +type UploadLimit struct { + Limit int64 `json:"limit"` +}