Commit Graph

250 Commits

Author SHA1 Message Date
chris48s
880c1fb49c call [docker] with auth (#9803)
* allow user to set dockerhub credentials

* add withJwtAuth function to AuthHelper

* use withJwtAuth in DockerHub badges

* add unit tests for JWT auth

* use auth when calling docker cloud

* refactor and assert fetch helpers call withJwtAuth

* store token for a max duration (defaults to 1 hour)

* tangent: update test example
2023-12-31 14:55:18 +00:00
chris48s
e548414edd convert 'style' param to enum (#9853)
* convert 'style' param to enum

* update test
2023-12-30 17:38:42 +00:00
Pierre-Yves Bigourdan
5676ec5b81 Fix typo in queryParams documentation (#9840) 2023-12-24 20:28:25 +00:00
CanisHelix
8f1f787ceb [GITEA] add new gitea service (release/languages) (#9781)
* add gitea service based on gitlab

* update gitea to use mocks

* add gitea release test

* move tests to use public repo on codeberg and fixes

* add pagination, update tests to live, set gitea_url as required

* add auth test (wip)

* fix base auth test

* fix required optionalUrl, remove default, assume semver from firstpage

* update example to use stable repository
2023-12-18 12:39:17 +00:00
chris48s
45bb786147 log 429s to sentry (attempt 2); affects [dynamic endpoint uptimerobot weblate opencollective discord github] (#9546)
* 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
2023-12-04 13:37:58 +00:00
chris48s
19b50a66a6 call [pepy] with auth (#9748) 2023-11-19 19:24:56 +00:00
Kurt McKee
9874db7841 Fix several typos (#9658) 2023-10-13 15:40:57 +00:00
chris48s
75affcac13 fix rSt code example (#9528)
* fix rSt code example

* update tests
2023-09-04 09:45:56 +00:00
Piepmatz
170d29efcc Add dynamic TOML support via [DynamicToml] Service (#9517)
* exported BaseTomlService

* added dynamic-toml service

* added dynamic-toml tester

* fixed dynamic-toml tests
2023-08-30 17:38:57 +00:00
chris48s
e8157100b8 migrate examples to openApi part 11: enums; affects [codefactor conda depfu homebrew jsdelivr reddit sourceforge testspace vaadin github] (#9437)
* WIP enums

* WIP moar enums

* add a helper function for extracting enum from route pattern

* add enum schemas to services

* review and improve service names

* convert some more services with enums

* review and improve service names

* fix issue/pull request detail
2023-08-30 16:14:18 +00:00
chris48s
fdeda3e3f9 Revert "log an error to sentry if an upstream service responds with 429 Too Many Requests (#9505)" (#9523)
This reverts commit 53537822de.
2023-08-29 18:57:42 +00:00
chris48s
53537822de log an error to sentry if an upstream service responds with 429 Too Many Requests (#9505)
* log an error to sentry if an upstream service responds with 429 Too Many Requests

* fix tests
2023-08-27 20:37:56 +00:00
chris48s
8f76982e1c Switch [OpenCollective] badges to use GraphQL and auth (#9387)
* [OpenCollective] update opencollective to api v2 (#9346)

* update opencollective to api v2

* fix tests

* fix: do not filter by accountType for opencollective/all

* remove 404

* remove required in schema

* cnt -> count

* keep by-tier code as-is

---------

Co-authored-by: repo-ranger[bot] <39074581+repo-ranger[bot]@users.noreply.github.com>

* allow calling OpenCollective api with an auth token

* add test for opencollective auth

* cache OpenCollective badges for longer

---------

Co-authored-by: xxchan <xxchan22f@gmail.com>
Co-authored-by: repo-ranger[bot] <39074581+repo-ranger[bot]@users.noreply.github.com>
2023-08-20 18:24:38 +00:00
jNullj
61b8446189 Add TOML support with BaseTomlService (#9438)
* Add TOML support with [BaseTomlService]

Add base toml service to enable fetch of toml files
Add spec file for the new toml service for automated testing
This was added to allow a new way to retrive python version from pyproject.toml as described in issue #9410

* Fix typo

Co-authored-by: chris48s <chris48s@users.noreply.github.com>

* refactor: improve code readability

solve code review https://github.com/badges/shields/pull/9438#discussion_r1291503340

---------

Co-authored-by: chris48s <chris48s@users.noreply.github.com>
2023-08-16 20:12:21 +00:00
Sandro Marques
96e9e130de Add [CurseForge] badges (#9252)
* add curseforge downloads badge

* Add more [CurseForge] badges

Adds the following badges:
 - /curseforge/dt/:projectId (downloads)
 - /curseforge/game-versions/:projectId (game versions)
 - /curseforge/v/:projectId (version)

The following secret:
 - CURSEFORGE_API_KEY (yml: private.curseforge_api_key)

* Remove default logo from badges

* Linter fixes

* Rename `errorMessages` to `httpErrors`

* Remove namedLogo from ModrinthGameVersions badge

* Remove namedLogo from ModrinthVersion badge

* Remove namedLogo from ModrinthFollowers badge

---------

Co-authored-by: Minecraftschurli <minecraftschurli@gmail.com>
Co-authored-by: Pierre-Yves Bigourdan <10694593+PyvesB@users.noreply.github.com>
2023-08-13 18:00:40 +00:00
chris48s
57c2ba0d68 Convert examples arrays to openApi objects (part 1) (#9320)
* add helper functions for generating Open API path/query params with defaults

* tweak Open API schema

- make description optional
- allow null example + allowEmptyValue (for boolean query params)

* convert examples --> openApi in amo

* convert examples --> openApi in ansible

* convert examples --> openApi in appveyor build/job

* add re-usable Open API query param for test-results badges

we can use these for all the 'test results' badges

* convert examples --> openApi in appveyor tests

* DRY up existing dynamic/endpoint param definitions

* DRY up queryParam

* allow enum param in serviceDefinition schema

* improve misleading param name

* check route and openApi are consistent on service load

* fix mistake in ansible role route

* documentation --> description

* add pathParams and queryParams helpers +docstrings

* give everything a search-friendly summary, check for duplicate summary

* prettier fixup
2023-07-31 12:22:33 +01:00
chris48s
c7efb27086 exclude assets dir from raster redirects (#9409) 2023-07-24 13:15:05 +01:00
chris48s
d882433fd9 move some docs to the website (#9347)
* move some docs to the website

* update expected test value

* link to new documentation locations
2023-07-24 12:20:43 +01:00
dependabot[bot]
b9d96755ec chore(deps-dev): bump prettier from 2.8.8 to 3.0.0 (#9357)
* chore(deps-dev): bump prettier from 2.8.8 to 3.0.0

Bumps [prettier](https://github.com/prettier/prettier) from 2.8.8 to 3.0.0.
- [Release notes](https://github.com/prettier/prettier/releases)
- [Changelog](https://github.com/prettier/prettier/blob/main/CHANGELOG.md)
- [Commits](https://github.com/prettier/prettier/compare/2.8.8...3.0.0)

---
updated-dependencies:
- dependency-name: prettier
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

* reformat all the things (prettier 3)

* update tests to await calls to prettier.format()

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: chris48s <git@chris-shaw.dev>
2023-07-10 09:27:51 +00:00
chris48s
1e85cf7926 upgrade to graphql 16 (#9290)
* upgrade to graphql 16

* update base graphql tests
2023-06-23 19:47:40 +01:00
chris48s
50ea7068a8 migrate frontend to docusaurus (#9014)
* delete loads of really important stuff that we definitely need

* v basic MVP smoosh docusaurus PoC into repo

* TODO

* delete more really important stuff

* TODO

* tidyup: use run-s

* don't redirect images used in frontend to raster proxy

* fix routing

* preserve the /endpoint link

* delete the blog (for now)

I would quite like to re-add this at some point
but its not really the top priority thing right now

* content edits

* appease the lint gods

* update danger rules

* remove placeholder

* cypress tests

* dockerhub --> ghcr

* Revert "dockerhub --> ghcr"

This reverts commit ef74cbb26b.

* downgrade lockfile format

* implement defs/BASE_URL

* fix e2e build

* actually fix cypress tests

* always run cypress tests on build

* this never worked

* add command for docusaurus:clear

* delete more code we don't need any more

* update ESLint/prettier config

* delete unsused exports

* documentation updates

* delete a fairly large chunk of our dependency tree

* allow base_url as build arg to Dockerfile

* fixup dockerfile

* work out base url at runtime if not set

doing this at image build time is not the right approach

* remove gatsby monorepo from closebot

* rename HomepageFeatures to homepage-features
2023-06-17 10:59:07 +01:00
chris48s
14892e3943 Implement a pattern for dealing with upstream APIs which are slow on the first hit; affects [endpoint] (#9233)
* 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
2023-06-13 21:08:43 +01:00
chris48s
e3154f67be set a custom error on 429 (#9159)
Co-authored-by: repo-ranger[bot] <39074581+repo-ranger[bot]@users.noreply.github.com>
2023-05-18 23:44:05 +00:00
chris48s
388459a8ca fail to start server if there are duplicate service names (#9099)
* fail to start server if there are duplicate service names

* update class names in loader test fixtures

---------

Co-authored-by: repo-ranger[bot] <39074581+repo-ranger[bot]@users.noreply.github.com>
2023-05-01 18:07:13 +00:00
chris48s
b96192eec6 remove redis token persistence backend (#9065)
* remove redis token persistence backend

* error and exit if redis_url is set
2023-04-15 20:17:35 +01:00
chris48s
148b51d554 Export OpenAPI definitions from service examples; affects [dynamic endpoint static] (#8966)
* WIP export OpenAPI definitions from service examples

* allow services to optionally define an OpenApi Paths Object instead of examples

* make use of param descriptions and required query params

* convert other 'core' services to declare openApi..

..instead of examples

* tweak descriptions for standard query params

* move stuff around, add a high-level integration test for category2openapi

* update simple-icons text refs #9054

* remove legacy param names
2023-04-11 18:37:16 +01:00
chris48s
fab3fd7a93 sort service path matches (#8968) 2023-03-06 15:58:16 +00:00
dependabot[bot]
a5480d5a8c chore(deps): bump glob from 8.1.0 to 9.2.1 (#8952)
* chore(deps): bump glob from 8.1.0 to 9.2.1

Bumps [glob](https://github.com/isaacs/node-glob) from 8.1.0 to 9.2.1.
- [Release notes](https://github.com/isaacs/node-glob/releases)
- [Changelog](https://github.com/isaacs/node-glob/blob/main/changelog.md)
- [Commits](https://github.com/isaacs/node-glob/compare/v8.1.0...v9.2.1)

---
updated-dependencies:
- dependency-name: glob
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

* update glob usage

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: chris48s <git@chris-shaw.dev>
Co-authored-by: repo-ranger[bot] <39074581+repo-ranger[bot]@users.noreply.github.com>
2023-03-06 12:09:48 +00:00
chris48s
565139660d only try to close pool if one exists (#8947)
Co-authored-by: repo-ranger[bot] <39074581+repo-ranger[bot]@users.noreply.github.com>
2023-03-04 17:05:38 +00:00
chris48s
091ccfdbcd migrate token pooling to postgres (#8922)
* add ability to store token pool in Postgres DB

* update transitive ansi-regex dependencies
2023-02-23 17:18:39 +00:00
chris48s
e8c42e9ec1 migrate service tests to GH actions (#8421)
* run service tests with GHA

* rename GithubGist services to Gist

* completely delete circle ci config
2023-01-17 20:55:57 +00:00
chris48s
f67fe525c2 fix service test loader on windows, add tests (#8786)
Co-authored-by: repo-ranger[bot] <39074581+repo-ranger[bot]@users.noreply.github.com>
2023-01-14 00:37:25 +00:00
Prashant Rawat
5e6583c530 Docstrings for php-version service (#8766)
* add docstrings for php-version service

* update docstring for resource-cache service

* update docstring param type
2023-01-06 21:01:59 +00:00
chris48s
c3d08f7f8b Send X-GitHub-Api-Version when calling [GitHub] v3 API (#8669)
* send X-GitHub-Api-Version when calling GitHub v3 API

* TODO: invesitgate

* read baseUrl from config.service.baseUri

* add workflow to check for new GH api releases on schedule

* format config/default.yml to match yaml.dump() format

Co-authored-by: repo-ranger[bot] <39074581+repo-ranger[bot]@users.noreply.github.com>
2022-12-31 15:56:04 +00:00
chris48s
f67251a9ca don't try to call .entries on null or undefined (#8757) 2022-12-29 16:54:11 +00:00
chris48s
00f35c67e8 fix debug logging of undefined query params (#8540) 2022-12-28 19:54:11 +00:00
chris48s
53c5cfa94d allow passing key to [stackexchange] (#8539)
* refactoring groundwork

* add stackapps_api_key setting

* add test for stackexchange auth

* clarify docs

Co-authored-by: repo-ranger[bot] <39074581+repo-ranger[bot]@users.noreply.github.com>
2022-12-04 10:53:59 +00:00
Sébastien Règne
bcc39200ae fix: support logoColor to shield icons. (#8263)
* fix: support logoColor to shield icons.

* FIXUP: Use 'travis-ci' to 'travis'

* FIXUP: Update docs.

* docs tweak

Co-authored-by: chris48s <chris.shaw480@gmail.com>
Co-authored-by: repo-ranger[bot] <39074581+repo-ranger[bot]@users.noreply.github.com>
2022-11-26 13:48:34 +00:00
chris48s
b95e60bace don't call external services in core tests (#8643)
* don't call external services in core tests

* remove duplicate test
2022-11-24 17:57:53 +00:00
chris48s
5305e11f79 Remove 'suggest badges' feature (#8311)
* remove 'suggest badges' feature

* remove allowedOrigin/ALLOWED_ORIGIN setting

* keep allowedOrigin for now

Co-authored-by: repo-ranger[bot] <39074581+repo-ranger[bot]@users.noreply.github.com>
2022-11-09 18:15:59 +00:00
chris48s
d78a2f4155 allow/validate bitbucket_username / bitbucket_password in private config schema (#8472)
Co-authored-by: repo-ranger[bot] <39074581+repo-ranger[bot]@users.noreply.github.com>
2022-10-08 10:37:05 +00:00
chris48s
b624179b8d get the tests passing on windows (#8350)
* run the core tests on windows

* fix glob with windows path seperator

* always use slash when slicing serviceClass matches

..and add comment explaining why we need to do this

* strip line endings (+ any other whitspace) before base64 encoding

Co-authored-by: repo-ranger[bot] <39074581+repo-ranger[bot]@users.noreply.github.com>
2022-08-29 19:58:10 +00:00
Caleb Cartwright
65d12efe32 ci: support new circle PR url variable (#8135) 2022-06-28 06:03:17 -05:00
Paul Melnikow
d6d5c02ed5 Remove obsolete monitor.html (#7878) 2022-04-22 18:09:55 -04:00
chris48s
8821ff85fc handle missing 'fly-client-ip' (#7814) 2022-04-05 20:29:28 +01:00
chris48s
ca1e77436b allow requireCloudflare setting to work when hosted on fly.io (#7781) 2022-03-26 20:08:22 +00:00
chris48s
ace5e03221 set a higher default cacheLength on rating/star category (#7587)
Co-authored-by: repo-ranger[bot] <39074581+repo-ranger[bot]@users.noreply.github.com>
2022-02-10 21:02:22 +00:00
dependabot[bot]
f2d88e76fb chore(deps): bump fast-xml-parser from 3.21.1 to 4.0.1
* chore(deps): bump fast-xml-parser from 3.21.1 to 4.0.1
* update for fast-xml-parser v4
* fix maven and jetbrains badges

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: chris48s <chris.shaw480@gmail.com>
Co-authored-by: chris48s <chris48s@users.noreply.github.com>
2022-01-29 20:10:07 +00:00
dependabot[bot]
0f288a42fc chore(deps): bump got from 11.8.3 to 12.0.1 (#7370)
* chore(deps): bump got from 11.8.3 to 12.0.1
* update limit syntax
* update CancelError import
* update timeout syntax
* set missing user/pass to empty string for basic auth
* fix opm badge

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: chris48s <chris.shaw480@gmail.com>
Co-authored-by: chris48s <chris48s@users.noreply.github.com>
2022-01-29 20:04:11 +00:00
chris48s
015c39336b throw on unexpected keys in expectBadge() (#7354)
* throw on unexpected object keys

* fix docs.rs tests

Co-authored-by: repo-ranger[bot] <39074581+repo-ranger[bot]@users.noreply.github.com>
2021-12-10 21:26:41 +00:00