Compare commits

..

2 Commits

Author SHA1 Message Date
Derrick Hammer b77bebe3b1
feat: add files/upload/limit endpoint 2023-06-10 01:58:45 -04:00
Derrick Hammer 86380c7b3a
fix: wrong algo 2023-06-10 01:15:17 -04:00
3 changed files with 10 additions and 1 deletions

View File

@ -156,6 +156,10 @@ func (f *FilesController) PostPinBy(cidString string) {
f.Ctx.StatusCode(iris.StatusCreated) 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) { func validateCid(cidString string, validateStatus bool, ctx iris.Context) (string, bool) {
_, err := cid.Valid(cidString) _, err := cid.Valid(cidString)
if sendError(ctx, err, iris.StatusBadRequest) { if sendError(ctx, err, iris.StatusBadRequest) {

View File

@ -0,0 +1,5 @@
package response
type UploadLimit struct {
Limit int64 `json:"limit"`
}

View File

@ -254,7 +254,7 @@ func VerifyLoginToken(token string) (*model.Account, error) {
return nil, ErrInvalidToken return nil, ErrInvalidToken
} }
_, err = jwt.Verify(jwt.HS256, jwtKey, []byte(token), blocklist) _, err = jwt.Verify(jwt.EdDSA, jwtKey, []byte(token), blocklist)
if err != nil { if err != nil {
db.Get().Delete(&session) db.Get().Delete(&session)
return nil, err return nil, err