Commit Graph

142 Commits

Author SHA1 Message Date
Hubert Jagodziński
b9d5da66fd Update service-tests.md (#5706)
* Update service-tests.md

Added information `expectBadge()` accepts a RegExp.

* Run prettier
2020-10-15 19:19:46 +00:00
Paul Melnikow
1fab1a7140 When configured, require requests to come from Cloudflare (#5666)
This is the code part of #3027, following [this article](https://www.viget.com/articles/heroku-cloudflare-the-right-way/) and using [this middleware](https://github.com/clive-io/cloudflare-middleware).

I pulled in the `addHandlerAtIndex()` function @chris48s wrote for #5574.

The middleware isn't perfect for scoutcamp, since it relies on `req.ip` which is something set by Express. However, the other solutions I found were either explicitly deprecated ([cloudflare-ip](https://www.npmjs.com/package/cloudflare-ip)) or relied on dynamically fetching the list of Cloudflare hosts ([cloudflare-ips](https://www.npmjs.com/package/cloudflare-ips)), which seems unnecessary as this list has not changed in several years.

I've left this off to start, so we can test it in production using an env var before we make it the production default.
2020-10-12 12:36:42 -04:00
JeongHoon Byun (a.k.a Outsider)
dc32a5fc4b Fix wrong anchor for writing tests document (#5677) 2020-10-10 05:14:52 +00:00
Paul Melnikow
e1ac63d3be Finish removing server-secrets.js (#5664)
I’ve tested locally that setting `gh_token` still conditionally enables `ConditionalGithubAuthV3Service`.

Closes #3393
2020-10-07 17:29:03 -04: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
Paul Melnikow
7c226456fe Adopt static fields in [amo] and core (#5440)
Since we've upgraded production to Node 12 (#5436) we can finally adopt static fields!

This starts the process by updating core and one of the service families.
2020-08-19 14:49:29 -04:00
chris48s
0bcd7eef15 Run on node 12 in production, update test matrix (#5436)
* upgrade node/npm versions in package.json

* delete config for zeit now
zeit now is no more, vercel have decomissioned the now v1 platform

* upgrade to node 12 for (docker) self-hosting users

* update docs

* update test matrix
run tests on node 12 and node 14

* link to nodejs version support docs in package comment
we'll continue to tun the package tests on node 10
while its still maintained and drop in the next
major release

* update depcheck

* remove npm-install job
2020-08-18 19:28:58 +01:00
Pierre-Yves B
135b842946 Migrate [Discord] implementation to use bot token (#5346)
* 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
2020-07-24 18:04:12 +02:00
Paul Melnikow
8fa61ae164 Update Cloudflare access + remove OAuth app (#5295) 2020-07-08 19:12:22 -04:00
Paul Melnikow
778b146d8e Update list of who has access to production resources (#5192)
This action item was requested at the ops team meeting.

Co-authored-by: repo-ranger[bot] <39074581+repo-ranger[bot]@users.noreply.github.com>
2020-06-14 20:09:04 +00:00
Pierre-Yves B
0fd557d7bb Implement [YouTube] badge (#5132)
* Implement [YouTube] badge

* Update production-hosting.md with account owner

* Add votes badge variant

* Add links to tests

* Switch to social badge style
2020-06-10 18:44:21 +02:00
Joe Izzard
56ae094afb doc: fixed the link to badge URL spec (#5164)
Co-authored-by: Pierre-Yves B <PyvesDev@gmail.com>
2020-06-04 19:12:13 +02:00
chris48s
13d75e0607 upgrade to prettier 2 (#5051)
* arrowParens: avoid
* remove trailingComma setting
2020-05-05 21:07:43 +01:00
chris48s
171aac3c42 update production hosting/deploy docs (#5013) 2020-05-03 16:00:37 +01:00
chris48s
612a43aaa9 Update test matrix and docs (#4992)
* update test matrix

* update docs
2020-04-30 21:33:59 +01:00
chris48s
3ba05cb184 📦 version 3 (#4756)
* Validate input to BadgeFactory.create() (#3875)

* validate input to create()

* remove deprecated properties (#3881)

* remove BadgeFactory class (#3884)

* Template literal templates (#4459)

- Remove use of the doT template library and move to generating SVG output using javascript template literals.
- Drop SVGO and mostly manually implement the optimisations.
- Add a bunch more tests

Co-authored-by: Paul Melnikow <github@paulmelnikow.com>

* drop raster support in package CLI (#4523)

* drop raster support in package CLI
* update docs

* rename gh-badges package to badge-maker

* rename gh-badges dir to badge-maker

* update relative imports and other refs to in parent dir

'gh-badges' --> 'badge-maker'

* update snyk service tests

This change is only tangentially related

We've used the shields repo as an example for these tests so
moving files around in our repo has a knock-on effect on them

* add missing type hints to dev style page

* write the changelog/migration guide for v3

* use extension in README CLI example

* update CLI help

whoops - missed this in #4523

* bump version

* update for self-hosting users

* README updates

* drop .format param from CLI, always output SVG

* Change text[] to label and message, Remove JSON output

- Change text[] to label and message
- Fix message only badge
- Remove JSON output format
- Update the docs

* update package-lock

* rename 'template' to 'style'

* handle invalid styles in coalesceBadge

* ensure makeBadge is passed a string for template in coalesceBadge()

issue #4925

* fix (logo/no label text/label color specified) case

issue #4926

* add example of (logo/no label text/label color specified) to style debug page

* update type defs

* padding fix for FTB style

Co-authored-by: Paul Melnikow <github@paulmelnikow.com>
2020-04-23 20:05:48 +01:00
Joschua Becker
b2bb50234f updating node js version (#4879)
Node.js 8.x LTS Carbon is no longer actively supported!

Co-authored-by: repo-ranger[bot] <39074581+repo-ranger[bot]@users.noreply.github.com>
2020-04-08 19:30:26 +00:00
Pierre-Yves B
097bf87e41 Make it easier to benchmark and profile the code (#4780)
* Make it easier to benchmark and profile the code

* Remove unnecessary escape

* Clarify that the backend server is started without the frontend

* Add missing NODE_CONFIG_ENV environment variable

* Add error message when user has not included console.time statements

* Fix lint issue

* Handle multiple console.time statements

* Switch NODE_CONFIG_ENV to test

* Switch to const as variable never re-assigned
2020-03-22 20:45:53 +01:00
chris48s
d8831729cb Check request origin before sending credentials (#4729)
Co-authored-by: Caleb Cartwright <calebcartwright@users.noreply.github.com>
Co-authored-by: Paul Melnikow <github@paulmelnikow.com>
Co-authored-by: chris48s <chris48s@users.noreply.github.com>

Co-authored-by: Caleb Cartwright <calebcartwright@users.noreply.github.com>
Co-authored-by: Paul Melnikow <github@paulmelnikow.com>
Co-authored-by: chris48s <chris48s@users.noreply.github.com>
2020-03-04 20:42:27 +00:00
Marcin Mielnicki
0dce98b022 Typo fix (#4563) 2020-01-20 22:27:43 +01:00
chris48s
e879682e29 Add documentation for designing badge URLs (#4435)
* Add documentation for designing badge URLs
Co-authored-by: Caleb Cartwright <calebcartwright@users.noreply.github.com>
2019-12-22 17:05:00 +00:00
Paul Melnikow
4d1bec20e2 Tutorial: Update the method order to be canonical (#4267) 2019-10-30 21:57:01 -04:00
Hubert Jagodziński
b7f3f175a5 Tutorial fixes (#4229) 2019-10-24 13:22:29 +02:00
Kamontat Chantrachirathumrong
2119a01953 fix invalid link (#4152) 2019-10-10 08:37:21 -05:00
Pierre-Yves B
157a6180b2 Make search work with category names (#4103) 2019-10-02 20:03:59 +01:00
Pierre-Yves B
a3786ce327 Add Twitch and Wheelmap OAuth app owners (#4039)
* Add Twitch and Wheelmap OAuth app owners

* Update doc/production-hosting.md

Co-Authored-By: Paul Melnikow <github@paulmelnikow.com>
2019-09-18 16:55:59 +00:00
Andy Li
4b9053d2d5 add [twitch] user status badge (#3683)
* add /twitch/status/:user badge

* update comments

* use a proper schema for the Twitch API calls

* use a token to make Twitch api calls

* fix handling of rate-limit error and bad token error

* [twitch] get a token as soon as creating a Twitch service

* [twitch] start both requests to users and stream before awaiting

* [twitch] set a timeout to replace the token before it expires

* [twitch] use authHelper

* [twitch] skip tests when no credentials

* [twitch] add one more status test

* twitch: do not check whether a user exists
2019-09-09 16:41:32 -05:00
chris48s
60bd7a69a7 link to contributing.shields.io in the docs (#3957)
* link to shields-docs.netlify.com in the docs

* update links to contributing.shields.io
2019-09-09 20:37:43 +00:00
Paul Melnikow
2177eb7546 Docs: Drop .svg extensions (#3787) 2019-07-25 19:39:35 -05:00
Paul Melnikow
cfbd2c30df SVG by default (#3717)
Make cleaner badge URLs by omitting the `.svg` extension.

Closes #2674
2019-07-24 12:57:39 -05:00
Paul Melnikow
6cbc7b587a Document the production Redis hosting (#3710)
Close #3332
2019-07-13 08:39:07 -05:00
Paul Melnikow
aa135d370f Auto-annotate live and mock tests (#3661)
Close #2555
2019-07-07 17:06:01 -04:00
Paul Melnikow
9b3db0774b Deprecate shields-server.com domain (#3666)
Now that these s0.server.shields.io entries are set up through the main DNS on Cloudflare, we don't need the shields-server.com domain anymore. One less thing to maintain.
2019-07-07 16:37:42 -04:00
Paul Melnikow
66c7f13e38 Drop gif + png, and redirect png to raster.shields.io (#3644)
1. Remove rasterization support from the server. This responsibility is delegated to a raster server which proxies the SVG badges and renders them.
2. When a raster server URL is configured, 301 redirect all .png badges to the identical URL on the raster server.
    `https://img.shields.io/npm/v/express.png?style=flat-square` ↪️`https://raster.shields.io/npm/v/express.png?style=flat-square`
3. For configured redirects, redirect to the canonical URL on the raster server.
    `https://img.shields.io/vso/build/totodem/8cf3ec0e-d0c2-4fcd-8206-ad204f254a96/2.png?style=flat-square`
    ↪️`https://img.shields.io/azure-devops/build/totodem/8cf3ec0e-d0c2-4fcd-8206-ad204f254a96/2.png?style=flat-square`
4. Redirect the "legacy badge old version" to the appropriate URL on the raster server.
5. When no raster server is configured (e.g. PRs), render an SVG containing **404 | raster badges not available** for all `.png` badges. (Note that the raster server can be self-hosted; however, this is deferred to a later PR.)
5. Drop support for jpg and gif which are very infrequently used (see #3112). Render an SVG containing **410 | jpg no longer available**.
7. ~~Remove raster dependencies.~~ Remove the raster cache (which is only used in the CLI, and therefore pointless).
8. Move the LRUCache code out of the npm package.
8. A wee bit of refactoring in `server.js`.

Ref #3112
Close #3631
2019-07-06 16:41:46 -04:00
Paul Melnikow
5d06503844 Update Zeit members list (#3646) 2019-07-05 14:51:57 -04:00
Paul Melnikow
f693ef019d Document raster server production hosting (#3643)
Ref #3631
2019-07-05 13:54:05 -04:00
chris48s
d78edaf5b5 add/improve some JSDoc comments on core API (#3595) 2019-06-25 22:42:01 +01:00
Pierre-Yves B
1e207f1886 Tutorial improvements and fixes (#3593) 2019-06-23 17:52:41 +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
chris48s
52e90af310 improve docs on examples (#3496)
closes #3440
2019-05-28 18:17:59 +01:00
Josep Bernad
17446efb45 Improvements in the TUTORIAL.md file (#3435)
* Improve tutorial file with explaining how to solve an error.

* Fix typo.

* Fix typo.

* Add more information about the fix.

* Apply suggested changes.

* Add missing method in the first example

* Modify the second example that did't compile.

* Add troubleshooting for the localhost and link to the issue solving it.

* Rephrase.

* Update doc/TUTORIAL.md

Co-Authored-By: Caleb Cartwright <calebcartwright@users.noreply.github.com>

* Add get category() function explanation in both examples.

* Update doc/TUTORIAL.md

Co-Authored-By: Paul Melnikow <github@paulmelnikow.com>
2019-05-15 19:40:18 +01:00
Marcin Mielnicki
65d42d5cb1 Remove IP filtering documentation for metrics (#3406) 2019-05-01 22:50:27 +02:00
Paul Melnikow
73ed7778fd Automatically reload the server when it changes (#3401)
While working on #2428 I found myself wanting to reload the server frequently. This is working great and reducing my iteration time significantly. I should have tackled this way sooner! 🙊 

I’ve left `verbose` on which seems useful, at least in the short term while we’re tuning the configuration.

Close #2426
2019-05-01 16:39:25 -04:00
Pierre-Yves B
2806eb8a00 Legacy services clean up (#3367)
* Deleted remaining legacy service bits

* Removed badge from README

* Removed no longer needed try/catch

* Deleted refactoring script

* Switched to const

* Reinstated doc

* Ran Prettier
2019-04-27 19:25:01 +01:00
Paul Melnikow
8ad0b105b1 Make the config from env more obvious at first glance; explain cascading config (#3355) 2019-04-23 13:57:23 -04:00
Cedric van Putten
483ecf24de [Drone] Add Drone build badge (#3240)
* Add drone build badge based on travis

* Fix wrong mocked endpoint for done builder

* Refactor service tester using helper method

* Add missing failure status to red statuses

* Remove extraneous invalid svg test from drone

* Test on failure red status in build status spec

* refactor(drone): use json service instead of svg

* refactor(drone): remove status text and extraneous build path in test

* refactor(drone): allow defining self-hosted drone instances

* fix(drone): use proper urls in drone examples

* fix(drone): add drone token authorization for self-hosted instances

* refactor(drone): call render build status badge directly instead of render

* refactor(drone): use server query parameter for self-hosted instances

* fix(drone): separate url and query params in example

* fix(drone): use actual build status message in examples

* fix(drone): add missing message for status code 401

Co-Authored-By: byCedric <me@bycedric.com>

* refactor(drone): remove color from drone tests

* refactor(drone): remove extraneous comments from drone tests

* refactor(drone): remove unused static preview method

* refactor(drone): remove unused static render method

* refactor(drone): reuse render build status badge helper in static previews

* fix(drone): test inaccessible repos on new message
2019-04-16 11:33:15 -05: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
Marcin Mielnicki
e43593e3bb OVH link fix (#3207) 2019-03-17 18:10:42 +01:00
Paul Melnikow
612831a2d8 Remove legacy analytics (#3179)
We're getting good results from #3093, so there's no reason to keep maintaining this code.

Ref #1848 #2068
2019-03-08 00:05:37 -05:00
Paul Melnikow
e159d90516 Reorganize a couple of the legacy helpers [npm node jenkinsplugin dynamic] (#3163) 2019-03-05 20:43:33 -06:00