The Discord API occasionally returns Cloudflare HTML errors or invalid JSON, so in those cases it will fallback to the standard 'inaccessible' message. Some of the returned errors have uppercase letters, so toLowerCase() is used to stay consistent with the rest of shields.
Close#981
Implements #1113.
Removed extra space in 2 cases (failing tests without this change):
1) Github downloads for latest release
[ GET http://localhost:1111/github/downloads/photonstorm/phaser/latest/total.json ]:
ValidationError: child "value" fails because ["value" with value "63k " fails to match the required pattern: /^[0-9]+[kMGTPEZY]?$/]
--
2) Github downloads-pre for latest release
[ GET http://localhost:1111/github/downloads-pre/photonstorm/phaser/latest/total.json ]:
ValidationError: child "value" fails because ["value" with value "34 " fails to match the required pattern: /^[0-9]+[kMGTPEZY]?$/]
--
3) Github downloads for specific asset from latest release
[ GET http://localhost:1111/github/downloads/atom/atom/latest/atom-amd64.deb.json ]:
ValidationError: child "value" fails because ["value" with value "3k [atom-amd64.deb]" fails to match the required pattern: /^[0-9]+[kMGTPEZY]? \[atom-amd64\.deb\]$/]
--
4) Github downloads-pre for specific asset from latest release
[ GET http://localhost:1111/github/downloads-pre/atom/atom/latest/atom-amd64.deb.json ]:
ValidationError: child "value" fails because ["value" with value "372 [atom-amd64.deb]" fails to match the required pattern: /^[0-9]+[kMGTPEZY]? \[atom-amd64\.deb\]$/]
This adds badges for Github issues and pull requests. You can display the state, title, username, number of comments, age, time since last update, and state of checks.
Provides an endpoint the Shields CI can use to fetch PR titles for #979 and resolves#1011.
- Except for social badges, omit logos by default (#983)
- Omit the logo from a social badge using the query string: `?logo=`
(#983)
- Opt in to named logos using the query string: `?logo=appveyor`
- Provide custom logo data as before: `?logo=data:image/png;base64,...`
- Rewrite badge data functions, with unit tests
Unit tests are covering the new code very well, though the underlying
functionality (logos) is untested.
Close#983
- Update 'downloads'->'users' as label,
- added `/u/` as option
- kept `/d/` as an option for backwards compatibility
- moved example from 'Downloads'->'Misc' section
Closes#1016
The original code has been simplified as well, but commented out.
I don't think we need the original code using the issues API, as it has
some limitations (no label support, only up to 30, or 100 issues).
- use `const` instead of `var` where possible
- use `'` instead of `"` consistently
- replace `forEach` loop with `reduce` call
Thanks to @Daniel15 for review!