Commit Graph

9 Commits

Author SHA1 Message Date
Daniel Lockyer
1fd155d56a Fixed extra arguments being supplied to function calls
- identified by tsc, this shouldn't change any functionality because
  there were extra arguments being supplied and were unused
2024-05-07 11:44:07 +02:00
Daniel Lockyer
265a8dd16f Added function names to more middleware
refs 319f251ad2

- this helps debugging because all middleware in the stack will have a
  function name, so it'll show up instead of `<anonymous>`
2024-05-06 17:51:39 +02:00
Naz
3010d498ca Added query string trimming from the original URL
refs https://github.com/TryGhost/Toolbox/issues/292

- There are couple of reasons why we don't want to include the query string information in the outgoing notification emails:
- 1. Security - we can expose the Content API key to an unauthorized person. The emails go out to administrators, so they have access to this data anyway. But for example they might forward full email content to someone from “tech team” or whoever is not really authorized to see it.
2. It looks a bit ugly and could be waaay to long breaking the email layou
2022-05-11 10:40:09 +08:00
Naz
09594cb5e1 Updated version mismatch middleware to handle API keys
refs https://github.com/TryGhost/Toolbox/issues/292

- The version mismatch middleware middleware is the best place where the information can be assembled for the  APIVersionCompatibilityService to handle. We need API key identification information to be able to pick up the integration name when sending a notification email to the administrators
2022-05-10 16:44:18 +08:00
Naz
e2c7c21e86 Added typings to the middleware to imporve checks
refs https://github.com/TryGhost/Toolbox/issues/292

- Having types would potentially have prevented a bug from a parent commit with mistyped property name
2022-05-09 15:35:09 +08:00
Naz
7419ff2c4f Fixed requestURL value passed to the APIVersionCompatibilityService
refs https://github.com/TryGhost/Toolbox/issues/292

- There was a typo in the variable name - req.originalURL is NOT does not exist on express' reqest object
- Added tests to avoid similar mistake again
2022-05-09 15:35:09 +08:00
Naz
fc7e1c383e Added requestURL handling in version mismatch middleware
refs https://github.com/TryGhost/Toolbox/issues/292

- We need to pass this data so that emails include this bit of information
2022-05-05 17:56:18 +08:00
Naz
4873303658 Added handling for version missmatch as a midleware
refs https://github.com/TryGhost/Toolbox/issues/292

- This middleware is meant to deal with version missmatch erros and call a service that does all the business logic. Having this handling in a separate module allows for thisngs to be loosely coupled
2022-04-21 15:57:43 +08:00
Naz
786f5429db Bootstrapped api version mismatch middleware
refs https://github.com/TryGhost/Toolbox/issues/292

- Fresh package out of Super Slimer and removed outdated patters, like using "should"
2022-04-21 15:57:43 +08:00