279 Commits

Author SHA1 Message Date
chris48s
5fb5a30188 tweak default cache lengths by category (#10919) 2025-03-06 17:30:49 +00:00
chris48s
8a98824e5e use SVG2 hrefs (#10918)
* use SVG2 hrefs

* add note to badge-maker changelog
2025-03-03 17:58:48 +00:00
jNullj
42e78083ab remove logoWidth param (#10878)
* remove `logoWidth` param
Fixes #10285

* remove `logoWidth` param
Fixes #10285

* fix: add `logoWidth` parameter to BaseService test
2025-03-02 11:16:02 +00:00
chris48s
954147f7d9 URL validator tidyup; affects [discourse dynamic endpoint gerrit jira maven nexus osslifecycle python vpm website] securityheaders sonar swagger w3c (#10810)
* add a required url validator

* replace occurrences of optionalUrl.required() with url

* use standard validators in server.js
2025-01-18 19:16:41 +00:00
Pierre-Yves Bigourdan
4a75cf09a7 Add auth support to [Reddit] badges (#10790)
* Add auth support to [Reddit] badges

* Simplify token response schema
2025-01-18 16:13:53 +01:00
LitoMore
85b44b9152 feat(endpoint-badge): add logoSize support (#10132) 2024-12-31 15:45:39 +00:00
chris48s
c567f6cde4 Migrate to ESLint 9 (#10762)
* update ESLint related packages

* migrate to flat config format

* Fix prefer-const error

Fixes
'overrideLogoSize' is never reassigned. Use 'const' instead

* remove irrelevant eslint-disable comment

These comments came from a swizzled upstream
component but never did anything in our codebase.

ESLint 9 does not allow disable comments
for rules that are not registered.

* remove irrelevant eslint-disable comments

These were here because in the past we were applying
mocha lint rules to files which contained no tests

ESLint 9 now flags eslint-disable comments
that aren't doing anythings

* remove irrelevant eslint-disable comment

ESLint 9 now flags eslint-disable comments
that aren't doing anything

* there are no .tsx files in our code any more

* include .mjs files in linting and formatting

* update sort-class-members rule for openApi property

and update the handful of files violating it
2024-12-31 13:54:25 +00:00
chris48s
fb816ecf93 Upgrade to Chai 5.x (#10732)
* remove chai-string plugin

* upgrade chai and sinon-chai

* update chai imports

* migrate badge-maker tests to ESM
2024-12-11 19:28:45 +00:00
chris48s
62430392f8 add content security policy header to SVG responses (#10642) 2024-10-27 15:09:26 +00:00
chris48s
9eaa2ed507 deprecate [wheelmap] service (#10538)
* deprecate [wheelmap] service

* remove app.json
2024-09-15 15:20:22 +00:00
dependabot[bot]
8cd2718525 chore(deps-dev): bump sinon from 18.0.0 to 19.0.2 (#10536)
* chore(deps-dev): bump sinon from 18.0.0 to 19.0.2

Bumps [sinon](https://github.com/sinonjs/sinon) from 18.0.0 to 19.0.2.
- [Release notes](https://github.com/sinonjs/sinon/releases)
- [Changelog](https://github.com/sinonjs/sinon/blob/main/docs/changelog.md)
- [Commits](https://github.com/sinonjs/sinon/compare/v18.0.0...v19.0.2)

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

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

* only mock setInterval timer in influx test

---------

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>
2024-09-14 15:37:04 +00:00
chris48s
c67c8f0505 send Cross-Origin-Resource-Policy header on all responses (#10420)
* send Cross-Origin-Resource-Policy header on all responses

* don't re-add Access-Control-Allow-Origin on json responses

this is re-adding a header we've already set earlier in the process

* update tests
2024-07-28 08:22:24 +00:00
chris48s
2dc7184f3e Cache text only static badges for longer (#10403)
* cache text only static badges for longer

* explaining cache-control header on redirects more clearly
2024-07-26 09:17:51 +00:00
Pierre-Yves Bigourdan
1e4c8f54d7 Sunsetting Shields custom logos (#10347)
* Sunsetting Shields custom logos

* Reinstate info to contribute to SimpleIcons

* Mention that no changes are required
2024-07-13 19:14:54 +00:00
Pierre-Yves Bigourdan
9d31aa057e Add CF-Ray header value to Sentry errors if available (#10339) 2024-07-09 15:57:22 +00:00
chris48s
e6c8d079c9 include gituhb contributors badge in docs site (#10337) 2024-07-09 14:11:14 +00:00
chris48s
677e713310 Remove logoPosition (#10284)
* remove logoPosition param

* finish the job of removing logoPosition

---------

Co-authored-by: Sergey Kupletsky <s.kupletsky@gmail.com>
2024-06-24 13:26:48 +00:00
dependabot[bot]
c60e3dc418 chore(deps): bump @sentry/node from 7.114.0 to 8.2.1 (#10171)
* chore(deps): bump @sentry/node from 7.114.0 to 8.2.1

Bumps [@sentry/node](https://github.com/getsentry/sentry-javascript) from 7.114.0 to 8.2.1.
- [Release notes](https://github.com/getsentry/sentry-javascript/releases)
- [Changelog](https://github.com/getsentry/sentry-javascript/blob/develop/CHANGELOG.md)
- [Commits](https://github.com/getsentry/sentry-javascript/compare/7.114.0...8.2.1)

---
updated-dependencies:
- dependency-name: "@sentry/node"
  dependency-type: direct:production
  update-type: version-update:semver-major
...

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

* update imports

---------

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>
2024-05-19 19:20:39 +00:00
chris48s
d6dde3f135 add logoSize to globalQueryParams (#10110) 2024-04-22 13:29:40 +01:00
LitoMore
915ab742d9 feat(logos): support auto-sizing mode (#9191)
Co-authored-by: chris48s <git@chris-shaw.dev>
2024-04-22 11:46:00 +00:00
Leo Q
e8671be7f2 support setting pypiBaseUrl by environment variables and queryParameters; affects [pypi] (#10044)
* support setting pypiBaseUrl by environment variables

* Add support for pypiBaseUrl configuration

* Update Pypi services to include pypiBaseUrl parameter

* change package name example to a more well-known package

* Update custom-environment-variables.yml

* Update Pypi services to include pypiBaseUrl parameter

* fix openapi mismatch

* Update doc/server-secrets.md

---------

Co-authored-by: chris48s <chris48s@users.noreply.github.com>
2024-04-21 16:33:42 +00:00
dependabot[bot]
d8e3452fd2 chore(deps-dev): bump eslint-plugin-mocha from 10.4.1 to 10.4.2 (#10085)
* chore(deps-dev): bump eslint-plugin-mocha from 10.4.1 to 10.4.2

Bumps [eslint-plugin-mocha](https://github.com/lo1tuma/eslint-plugin-mocha) from 10.4.1 to 10.4.2.
- [Release notes](https://github.com/lo1tuma/eslint-plugin-mocha/releases)
- [Changelog](https://github.com/lo1tuma/eslint-plugin-mocha/blob/10.4.2/CHANGELOG.md)
- [Commits](https://github.com/lo1tuma/eslint-plugin-mocha/compare/10.4.1...10.4.2)

---
updated-dependencies:
- dependency-name: eslint-plugin-mocha
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

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

* fix mocha/prefer-arrow-callback errors

---------

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>
2024-04-17 19:16:10 +00:00
chris48s
49a91720d7 randomize tokens on token pool init (#9980) 2024-02-24 18:14:52 +00:00
chris48s
9cfd301b82 Complete the examples --> openApi migration; affects [node sonar travis wordpress visualstudio librariesio] (#9977)
* you missed one

* remove examples from deprecatedService()

I'm not going to replace this with openApi
We have zero examples of deprecated services that declare examples

* remove examples from redirector()

* update test

* remove compatibility code for converting examples to openApi

* remove all the code for handling examples

* remove a few bits of redundant code

* improve docs for openApi property

* last one, I promise
2024-02-24 18:14:44 +00:00
chris48s
095e4f889a migrate some services from examples to openApi part 45; affects [github coveralls visualstudiomarketplace] (#9930)
* migrate some services from examples to openApi

* update e2e test to use simpler example
2024-02-11 13:04:42 +00:00
chris48s
1b91ef57c1 migrate some services from examples to openApi part 39; affects [maven gradle] (#9902)
* allow redirectors to define a openApi property

* migrate some services from examples to openApi

* Update services/gradle-plugin-portal/gradle-plugin-portal.service.js

Co-authored-by: Pierre-Yves Bigourdan <10694593+PyvesB@users.noreply.github.com>

* Update services/gradle-plugin-portal/gradle-plugin-portal.service.js

Co-authored-by: Pierre-Yves Bigourdan <10694593+PyvesB@users.noreply.github.com>

* Update services/maven-central/maven-central.service.js

Co-authored-by: Pierre-Yves Bigourdan <10694593+PyvesB@users.noreply.github.com>

* Update services/maven-central/maven-central.service.js

Co-authored-by: Pierre-Yves Bigourdan <10694593+PyvesB@users.noreply.github.com>

* Update services/maven-metadata/maven-metadata.service.js

Co-authored-by: Pierre-Yves Bigourdan <10694593+PyvesB@users.noreply.github.com>

* Update services/maven-metadata/maven-metadata.service.js

Co-authored-by: Pierre-Yves Bigourdan <10694593+PyvesB@users.noreply.github.com>

---------

Co-authored-by: Pierre-Yves Bigourdan <10694593+PyvesB@users.noreply.github.com>
2024-01-24 20:36:32 +00:00
chris48s
dc84d09732 sort categories by title (except core) (#9888) 2024-01-13 18:24:18 +00:00
chris48s
26ae5a0cf4 fix default style docs for social badges (#9869)
* fix default style docs for social badges

* Update core/base-service/openapi.js

Co-authored-by: Pierre-Yves Bigourdan <10694593+PyvesB@users.noreply.github.com>

* update test

---------

Co-authored-by: Pierre-Yves Bigourdan <10694593+PyvesB@users.noreply.github.com>
2024-01-04 20:23:27 +00:00
Aliaksei Hrynko
b1f5aecf36 Fix typo in OpenAPI service documentation (#9868) 2024-01-02 18:00:28 +00:00
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