29 Commits

Author SHA1 Message Date
Niko Diamadis
2c653013c8 Support [Matrix] summary endpoint (#10782)
* feat: add support for Matrix summary endpoint

* docs: update Matrix documentation

* refactor: abstract logic into more functions

* refactor: revert custom timeout for tests

* test: add test for fetchMode override on matrix.org

* fix: validate the fetchMode value

* docs: extend fetchMode description

* fix: add await keywords

* clarify test description

---------

Co-authored-by: chris48s <git@chris-shaw.dev>
2025-01-03 10:20:55 +00:00
chris48s
3daef194fa cache matrix badges for 4 hours (#10778) 2025-01-01 16:07:16 +00:00
chris48s
bd3a11b4b6 upgrade to docusaurus 3 (#9820)
* 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
2024-03-23 19:54:57 +00:00
chris48s
bfa712469a migrate some services from examples to openApi part 28; affects [aur cran mastodon matrix npmstat nyc thunderstore twitter] (#9855)
* migrate some services from examples to openApi

* always use capitals in period/interval description
2023-12-31 14:14:57 +00: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
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
c2fe2ffa2e documentation html fixes (#8887)
Co-authored-by: repo-ranger[bot] <39074581+repo-ranger[bot]@users.noreply.github.com>
2023-02-12 18:47:16 +00:00
chris48s
c73072deed Remove requestOptions2GotOptions compatibility layer (#7270)
* gzip --> decompress

* strictSSL --> https.rejectUnauthorized

* auth --> username/password

* qs --> searchParams

* fix base service auth docs

* completely remove requestOptions2GotOptions layer

* update the docs

Co-authored-by: repo-ranger[bot] <39074581+repo-ranger[bot]@users.noreply.github.com>
2021-11-15 19:56:08 +00:00
J. Ryan Stinnett
8284545e22 Rename Riot to Element in Matrix badge help (#6996)
The Riot Matrix client was renamed to Element in July 2020 (https://element.io/blog/welcome-to-element/). This updates the Matrix badge help text to match.
2021-09-08 17:07:53 +00:00
Pierre-Yves B
23c0406bed Migrate from CommonJS to ESM (#6651) 2021-07-09 12:53:55 +01:00
chris48s
504015c0ba migrate hapi/joi to joi (#5624)
* update joi + joi-extension-semver

* @hapi/joi --> joi

Co-authored-by: repo-ranger[bot] <39074581+repo-ranger[bot]@users.noreply.github.com>
2020-09-30 17:51:02 +00:00
Thakur Karthik
aa171180e5 Convert [maintenance mastodon matrix mavencentral] classes to static props (#5588)
* Refactor jira,jitpack,jsdelivr,keybase service files

* refactor maintenance mastodon matric and maven-central service files

Co-authored-by: repo-ranger[bot] <39074581+repo-ranger[bot]@users.noreply.github.com>
2020-09-22 03:30:18 +00:00
chris48s
13d75e0607 upgrade to prettier 2 (#5051)
* arrowParens: avoid
* remove trailingComma setting
2020-05-05 21:07:43 +01:00
chris48s
8621fe42d7 Upgrade Joi (#3505)
* upgrade joi
* find & replace ALL THE THINGS
* update related deps
2019-06-02 21:59:55 +01:00
Paul Melnikow
f8aeb56129 Unify order of more services (#3358)
Ref #3353
2019-04-24 15:08:26 -04:00
Pierre-Yves B
25f8541e5b JSON format modernisation and _shields_test removal (#3272)
* 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
2019-04-07 18:57:55 +01:00
Pierre-Yves B
1f29c22d3d Migrated most service tests to use new expectBadge (#3122) 2019-02-28 21:43:23 +00:00
Paul Melnikow
4bd16f93e8 Sort imports and requires (#3056)
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
2019-02-21 22:14:40 -05:00
Paul Melnikow
2d7be31b0c Validate query params in BaseService (#3042)
This is a mid-sized PR that adds query param validation to BaseService and updates most of the services which use query param validation to use it. There are a couple minor tweaks I made along the way.

Fix #2676
2019-02-20 22:24:47 -05:00
Paul Melnikow
8c478d0e0a Use normalized colors to fix [dynamic matrix nexus] service tests (#2958) 2019-02-08 00:49:27 -05:00
Caleb Cartwright
855c9cd261 Remove dev dep imports in production code (#2937)
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.
2019-02-05 21:51:55 -05:00
Paul Melnikow
226fa67a02 Create shortcut for BaseService-related imports (#2809)
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.
2019-01-21 15:41:24 -05:00
Paul Melnikow
bcc9acd18f Disallow redundant example patterns (#2787) 2019-01-16 19:47:10 -05:00
Paul Melnikow
4597d77015 Refactor badge color functions (#2742)
- 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.
2019-01-15 16:43:33 -05:00
Paul Melnikow
d1c5378bf0 Integrate new path-to-regexp with trailing optionals (#2644)
Fix #2497

Ref pillarjs/path-to-regexp#176
2019-01-08 18:50:47 -05:00
Paul Melnikow
89113eee17 Migrate deprecated staticExample -> staticPreview (#2650) 2019-01-06 17:30:25 -05:00
Brendan Abolivier
da5ca7454a Improve [Matrix] badge generation (#2527)
Fixes #2524 

This PR addresses the issues expressed in #2524, in that it:

* checks if a server has advertised a FQDN it can be reached at and if that FQDN hosts Matrix's client APIs
* uses room aliases instead of room IDs, in order to avoid a badge being impossible to generate if the server that created the room leaves it

This includes a breaking change to the badge endpoint.
2018-12-20 17:00:49 -05:00
M C
9e95020b18 Add [Matrix] Badge (#2417)
* Added matrix badge

* decreased the size of the matrix logo by more than 50%

* returning the size in fetch() instead of an object

* found another way to register a throwaway account (guest account). this one actually works on matrix.org, but I kept the old way as a backup method. also changed the POST from /members to /state because guest accounts didn't work with /members

* updated logo to a recolored version of the official logo

* Removed unnecessary comments.
Added documentation on how to create the badge URL.
Added a test that hits a real room to test for API compliance.
URLs are now obtained from getter functions.
Added JSON schema for the /state API request.
Improved state response filter.
Replaced example URL room ID to a dedicated testing room.
Made some error messages more helpful.

* correctly implemented requested changes

* changed color hex codes to constants
2018-12-06 19:25:59 +00:00