* update packages
* add plugin to strip autolinks in code blocks
* fix all the documentation for MDXv3
* remove check-docusaurus-versions
in docusaurus 3 this is now a hard error, not just a warning
* port upstream change to Curl component
fixes performing the 'execute' action when pressing enter
* improve stackexchange auth testing
Change auth tests to include all shields of the base class.
The code is formated to be used in more general cases and increases code reuseability.
* Remove dummy auth test
We already test all existing classes, no need for a dummy
* Add getBadgeExampleCall to test-helpers
Add getBadgeExampleCall to extract the first OpenAPI example then reformat it for service invoke function.
* Use getBadgeExampleCall in stackexchange-base tests
* Fix getBadgeExampleCall Errors
* Add testAuth to test-helpers
Add the testAuth function which tests auth of a service (badge) using a provided dummy response.
* Refactor stackexchange-base.spec.js to use testAuth from test-helpers
* Split stackexchange-base.spec into per service test file
* Add all auth methods to testAuth
Add all auth methods used to testAuth to be generic and used by all services.
Add helper functions to make testAuth more readable
* Handle non-default bearer and api headers
* Add discord.spec.js as first attempt for bearer auth
* Fix basic auth user
* Add dynamic authorizedOrigins
* Add header optional argument
* Add obs as basicAuth example
* Use apiHeaderKey and bearerHeaderKey function params
Use apiHeaderKey & bearerHeaderKey as function params rather then extracting them with regex from function strings.
Those options are now part of an options object param joined with the contentType that replaces header.
header was originaly added for setting content type of the reply, so it makes more sense to directly set the content type
* Remove old comment
* Allow any pass & user key for QueryStringAuth
Before this commit the QueryStringAuth would only work for the key of stackexchange.
This commit makes the testAuth function generic and allows passing user and pass keys.
* Add auth test for PepyDownloads
* Fix wrong header for jwt login
Might set wrong header for jwt login request.
This commit fixes that.
* Support multiple authOrigins in testAuth
Some services might have more then one authOrigin.
This commit makes sure we test for redundent authOrigins as well as support requests to them if needed.
* Add docker-automated auth test
* Fix JwtAuth testing by introducing mandatory jwtLoginEndpoint
Prior to this change, JwtAuth testing would lead to erros due to the absence of a specified login endpoint,
Nock would be dumplicated for both login and non login hosts and indicate a missing request.
This commit enforces the requirement for a new jwtLoginEndpoint argument when testing JwtAuth.
The argument seperates the endpoint nock scope from the behavior of the request nock.
* Fix type test in generateFakeConfig
* log to sentry if upstream service responds with 429
* allow services to decide which error(s) to log, default to 429
* don't log 429s from endpoint or dynamic badges
* supress 429s from uptime robot badges
* supress 429s from weblate if not calling default server
* cache opencollective badges for longer
* cache discord badges for longer
* cache github workflow badges for longer
* allow serviceData to override cacheSeconds with a longer value
* prevent [endpoint] json cacheSeconds property exceeding service default
* allow ShieldsRuntimeError to specify a cacheSeconds property
By default error responses use the cacheLength of
the service class throwing the error.
This allows error to tell the handling layer the maxAge
that should be set on the error badge response.
* add customExceptions param
This
1. allows us to specify custom properties to pass to the exception
constructor if we throw any of the standard got errors
e.g: `ETIMEDOUT`, `ECONNRESET`, etc
2. uses a custom `cacheSeconds` property (if set on the exception)
to set the response maxAge
* customExceptions --> systemErrors
* errorMessages --> httpErrors
* Migrate [Discord] implementation to use bot token
* Rework authorization field creation
* Revert "Rework authorization field creation"
This reverts commit caf65bde5d.
* Add LGTM exclusion for hardcoded credentials
* Modernised JSON format and removed _shields_test style
* Added logoWidth and labelColor fields to JSON response
* Reinstated and updated comment
* Extended expectBadge to accept Joi schemas for all fields
This will definitely save time, and ensure more uniformity.
It moves the `createServiceTester()` calls to a different place from where I'd like them, though I'm happy to have them checked by the linter.
Closes#2701
Fixes#2876 with @paulmelnikow's suggestion
Moved imports of `ServiceTester` and `createServiceTester` to a separate file so that dev dependencies are not imported by service classes.
Continue to implement #2698:
- Add `core/base-service/index.js` (but hold off on moving the things it imports)
- Add shortcuts in `services/index.js` for Base*Service, errors, and deprecatedService. This file will be streamlined later to avoid cluttering it with rarely used bits.
- Apply consistent ordering of imports and use of `module.exports` in testers.
- Remove some renaming of imports.
- Remove obsolete tests here and there.
- Replace the idea of color schemes with the idea of named colors (since none of our colorschemes have used `colorA`)
- Pass through the normalized color to `_shields_test` to harmonize with BaseService and simplify testing
- Update service tests
- Move responsibility for color generation into the npm package
- Remove several color helper functions and their tests
- Update gh-badge public API to accept `color` and `labelColor`
This is a precursor to refactoring some of the logo code for #2473.
Close#2334
To avoid merge conflicts, I've deferred removing the aliasing logic in `prepareExamples`. That whole function will be refactored momentarily, and there's also #2339 open.
The term “url” is overloaded in services, to refer to the Shields route and also the API URL. Calling the Shields URL a “route” is on the whole more descriptive, and makes it clearer and more obvious which one of these we’re talking about. It’s a small thing, though seems like an improvement.
We have a few functions called `buildUrl`. I’ve renamed them to `buildRoute` when they refer to routes, and left them as `buildUrl` when they refer to API URLs.
I included a minor style tweak and some formatting cleanup in `TUTORIAL.md`.