-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
badge to show downloads count from jetbrains plugin repository #896
Conversation
|
||
request(url, function(err, res, buffer) { | ||
if (err) { | ||
badgeData.text[1] = 'inaccessible'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can handle status code 404 here, this will give users better feedback:
if (res.statusCode === 404) {
badgeData.text[1] = 'plugin not found';
} else {
badgeData.text[1] = 'inaccessible';
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good idea, thank you
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unfortunately, XML API does not return 404 when plugin is not found. Sorry, I didn't check this before.
> curl "https://plugins.jetbrains.com/plugins/list?pluginId=PLUGIN_NOT_FOUND"
<?xml version="1.0" encoding="UTF-8"?><plugin-repository></plugin-repository>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's ok, I've just made fix for this
As their xml API doesn't support 404 code for wrong plugin id needed to add a bit more complex check |
8954599
to
3baddb1
Compare
Guys something went wrong as most pull requests start to fail on travis |
@mskonovalov Fixed in 522e09f. |
Closed and reopened to trigger rebuild |
I would like to use this badge. Can I somehow help with this PR? |
Same for me. |
Hi, thanks for this contribution. Sorry for the delay. As you can see there is a large backlog, which we're slowly working through. This looks good. I will leave a couple comments. |
<tr><th data-keywords='jetbrains plugin'> Jetbrains plugins: </th> | ||
<td><img src='https://img.shields.io/jetbrainsplugins/org.intellij.scala/d.svg?maxAge=2592000' alt=''/></td> | ||
<td><code>https://img.shields.io/jetbrainsplugins/PLUGIN_XML_ID/d.svg</code></td> | ||
</tr> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
index.html
has been removed in master. Could you merge master into this branch and remove it here too?
@@ -5769,6 +5769,49 @@ cache(function(data, match, sendBadge, request) { | |||
}); | |||
})); | |||
|
|||
// Jetbrains Plugins repository integration | |||
camp.route(/^\/jetbrainsplugins\/([^\/]+)\/(d)\.(svg|png|gif|jpg|json)$/, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could I ask you to make the URI consistent with https://img.shields.io/wordpress/plugin/v/akismet.svg
?
i.e. /jetbrains/plugin/d/name.of.plugin.svg
As a bonus, you could add tests: https://github.com/badges/shields/blob/master/service-tests/README.md |
Let's continue this in #1025. |
Add badge with dynamic retrieve download counts of Jetbrains plugins from https://plugins.jetbrains.com/
#895
Xml API is used.
You need to provide Xml Id of plugin to get its data