Commit Graph

64 Commits

Author SHA1 Message Date
grumbulon 60b7d67550 test nonsense 2023-03-18 14:38:58 -04:00
grumbulon b5302bdc8c remove unused code and file. 2023-03-11 06:54:09 -05:00
grumbulon e06e8c4e25 make tests fully table driven and increase coverage by a lot 2023-03-10 22:37:25 -05:00
grumbulon 9d79f5e878 occam's razor moment 2023-03-07 21:24:37 +00:00
grumbulon e0d72ef13b add test stuff 2023-03-07 21:24:37 +00:00
Sam Therapy 76e5144729 Merge pull request 'chore: make generic API errors and logging easier' (#42) from change-generics-again into master
Reviewed-on: https://git.freecumextremist.com/grumbulon/pomme/pulls/42
2023-02-28 15:48:52 +00:00
grumbulon 9892433e3c messed with les generics again 2023-02-28 00:45:57 -05:00
grumbulon d168b52184 piss 2023-02-24 22:36:53 -05:00
Sam Therapy 5d52caab70
fix(backend): make cookie more strict
THIS IS STILL NOT ENOUGH!

Signed-off-by: Sam Therapy <sam@samtherapy.net>
2023-02-20 18:05:09 +01:00
Sam Therapy f0fdd15473
use new import URL
Signed-off-by: Sam Therapy <sam@samtherapy.net>
2023-02-17 19:42:48 +01:00
Sam Therapy 12b219bf45 Small nitpicks
gitignore: add default zones directory
upload: fix typo in swagger docs
config: simplify default save location
Signed-off-by: Sam Therapy <sam@samtherapy.net>
2023-02-06 14:39:08 +00:00
grumbulon b8d4af58c8 adding sys.go and using /x/sys/unix for killing pomme, because syscall package is deprecated. Added small wrapper for killPomme(). 2023-02-06 14:39:08 +00:00
grumbulon 25229f9c81 removed unnecessary byte slice conversions 2023-02-06 14:39:08 +00:00
grumbulon cf1071b389 remove rawFileName from Zone db schema as no longer necessary, removed not needed code, and documentation. Made tests work with new zone file route consolidation. 2023-02-06 14:39:08 +00:00
grumbulon bca521eb4e wow woah, we don't need to save locally actually 2023-02-06 14:39:08 +00:00
grumbulon f7f0a49512 update swagger docs 2023-02-06 14:39:08 +00:00
grumbulon ae3e7a1ae6 capture error on defer, doc string, lint 2023-02-06 14:39:08 +00:00
grumbulon 92100e27a0 add fs.go to internal, make makeLocal do the majority of lifting for tmp and perm files, made save() call makeLocal 2023-02-06 14:39:08 +00:00
grumbulon 2426a8b393 turn into one route 2023-02-06 14:39:08 +00:00
grumbulon a572f6841f remove tmp file after saving to permanent directory 2023-02-06 14:39:08 +00:00
grumbulon 08eab3e6cb lint 2023-02-06 14:39:08 +00:00
grumbulon ae488eb7d2 add ndr interface for handling dns reqs, add zonedir to config, add /save route to save zfs to zonedir, fix make local, and other small changes 2023-02-06 14:39:08 +00:00
grumbulon 21db5c4166 add server death if cannot acccess DB with clean shutdown (drains connections), and other error handling, linting. 2023-02-02 18:02:22 -05:00
grumbulon 473597682c remove unnecessary code, added switch fallthroughs for cleanup. remove status code from response (is in header) 2023-02-01 19:50:41 -05:00
grumbulon 295360fd05 swagger updates, moved structs and types into types.go, and made helpers.go for custom handlers 2023-02-01 19:41:38 -05:00
grumbulon 9d87ae4728 internal.response doesn't includes http status, api tests use header status code now, new generic APIError function 2023-02-01 15:59:34 -05:00
grumbulon 277de26561 updated swagger docs to look more like Gitea, moved all structs to types.go, removed username from response struct, removed other unnecessary code 2023-02-01 00:36:17 -05:00
Sam Therapy 3e839fdf5f
fix(api): 401 on bad auth
Signed-off-by: Sam Therapy <sam@samtherapy.net>
2023-01-31 19:09:17 +01:00
grumbulon b4af648156 make test JWT expire in a minute 2023-01-30 23:24:44 -05:00
grumbulon 78671549c3 I <3 TESTS 2023-01-30 23:23:35 -05:00
grumbulon 5e8ba819bc added read DB path from config, add DB paths to sample config, added render library for JSON responses, removed plaintext password from User struct, made error handler funcs return json and their calls to include http.Request, and made API tests use httptest server 2023-01-30 19:49:52 -05:00
grumbulon 849f5d28fa small oops 2023-01-28 23:41:53 -05:00
grumbulon 9412d8ec28 added user creation, login, and logout test. Linted. Go mod. Adding http.StatusOK const in a few places I noticed it was not in. 2023-01-28 23:39:26 -05:00
grumbulon 7e6594f3c7 move defer file.Close() to before validateContentType because that could cause problems 2023-01-21 11:21:41 -05:00
grumbulon 320f757917 add confirmation of zonefile upload and add mimetype validation to only allow users to upload text/plain 2023-01-21 11:19:29 -05:00
grumbulon 27fd45a1f9 documented rate limiting, added check if file already exists and error out if it does, and small swagger edits 2023-01-20 20:33:56 -05:00
grumbulon 6c709b97a1 add rate limiting 2023-01-20 18:29:33 -05:00
grumbulon 4e11746c32 small doc fixes 2023-01-20 16:55:59 -05:00
grumbulon c59553184a added swagger docs, turn nolintlint OFF, and documented API routes in Swagger 2023-01-20 16:53:11 -05:00
grumbulon 1e5ba290c4 make jwt expiration consistent with cookies 2023-01-20 10:10:27 -05:00
grumbulon 002787c1fc add logging to internal server error 2023-01-20 09:34:01 -05:00
grumbulon a22ad3ec37 added a handler function for common stuff like 500 error, and changed the auth failure handler. Added error handling in a few places. Unexported setDBMiddleware handler 2023-01-19 23:56:38 -05:00
Sam Therapy 16de4f0a43
I am stupid
Signed-off-by: Sam Therapy <sam@samtherapy.net>
2023-01-19 15:41:29 +01:00
Sam Therapy a21c93555e
fix misspell
Signed-off-by: Sam Therapy <sam@samtherapy.net>
2023-01-19 15:30:23 +01:00
Sam Therapy a1f848d423
nit: fix comment to make correct
Signed-off-by: Sam Therapy <sam@samtherapy.net>
2023-01-09 19:28:04 +01:00
grumbulon a3230fbc72 fix login oppsie, fix zonefile query to check filename and username, and linting 2023-01-09 18:19:07 +00:00
grumbulon da5bd54b3e amended the Zone schema, fixed file upload size too small issue, refactoring, and zone file parsing works now 2023-01-09 18:19:07 +00:00
grumbulon e363c83009 if already logged in return on login func and generate cookie for newly created users -- ensure all redirect to index 2023-01-09 18:19:07 +00:00
grumbulon 6e8f401e70 refactor, lint, refactor, lint, refactor, etc. Added config path for hashing secret, and a few other things 2023-01-09 18:19:07 +00:00
grumbulon 53e8d01cb9 handle file upload, create temp file, write that request made to DB using user/zone_file relation in DB, do other shit I forgot, linting 2023-01-09 18:19:07 +00:00