-
-
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
Jitpack: custom domain for organization #8312
Comments
This sounds like a reasonable request. Just to flesh out how this would work a bit.. At the moment, if you request https://img.shields.io/jitpack/v/github/jitpack/maven-simple then we call https://jitpack.io/api/builds/com.github.jitpack/maven-simple/latestOk to get the version. How would your example translate to a JitPack API call? |
You may replace |
I feel like we've had some past discussions around just requesting the group id (or equivalent) as a free form route parameter instead of trying to do the version control to group id mapping, but my GitHub search skills are failing me. I would much rather we not be in the business of trying to support auto mappings |
Yeah it would be nice if we could change this so that the canonical jitpack badge URLs become:
and then set up redirects so that a request to |
@chris48s I can only think of these possible solutions (I wrote some pseudo-code, it might help): Not-at-all safeDitch the SafestImplement a new
NicestUse
Please note that points 3. and 4. might not be required, as it's unlikely that a github user has a domain starting with a TLD (it may even be disallowed, as github.com/com.google and similars lead to a blank page; no information about that in the username policies 😶). |
Its all fun games until someone turns up and says "my github username is I think I'm inclined to go with some variation of the 'safe' option. Another variation of that we could do is switch from |
I was thinking the same, so I decided to just test it, and the signup page throws the following error:
We can safely assume that usernames with dots are not allowed to be registered. With that said, I had found some old issues that talked about usernames with dots: probably GitHub disallowed them somewhere in the past, but I didn't find any reference of when it happened, but most importantly if GitHub forced users to change username or simply disabled new ones from signing up with them.
Yep, and it would also mean less risky redirects (no infinite redirect loops or similar bugs) |
I have never worked with Angular, so I would prefer if someone else could test this code (I coded a lot with JavaScript, so I know the language itself, but I have never used/setup Angular). export default [
redirector({
category: 'version',
route: {
base: 'jitpack/v',
pattern: ':groupId/:artifactId',
},
transformPath: ({ groupId, artifactId }) =>
`/jitpack/version/com.github.${groupId}/${artifactId}`, // this change is recommended (-1 redirect)
dateAdded: new Date('2022-08-21'),
}),
redirector({
category: 'version',
route: {
base: 'jitpack/v',
pattern: ':vcs(github|bitbucket|gitlab|gitee)/:user/:repo',
},
transformPath: ({ vcs, user, repo }) =>
`/jitpack/version/com.${vcs}.${user}/${repo}`,
dateAdded: new Date('2022-08-21'),
}),
] And the service would become: // ...
static route = {
base: 'jitpack/version',
pattern: ':groupId/:artifactId'
}
static examples = [
{
title: 'JitPack',
namedParams: {
groupId: 'github',
artifactId: 'maven-simple',
},
staticPreview: renderVersionBadge({ version: 'v1.1' }),
keywords: ['java', 'maven'],
},
]
static defaultBadgeData = { label: 'jitpack' }
async fetch({ groupId, artifactId }) {
const url = `https://jitpack.io/api/builds/${groupId}/${artifactId}/latestOk`
return this._requestJson({
schema,
url,
errorMessages: { 401: 'project not found or private' },
})
}
async handle({ groupId, artifactId }) {
const { version } = await this.fetch({ groupId, artifactId })
return renderVersionBadge({ version })
}
} |
That looks roughly right to me - certainly a solid basis for a PR. It will be easier to test and review if you submit a PR. The one thing I'd pick out is in your example, I think Btw, where have you got angular from? We don't use angular in shields, so fortunately that won't be a barrier :) |
I'll fork the project and make a pull request 👍
Yep, I forgot that I needed to change from the old
Oops, VS code automatically showed the Angular icon, because the file names matches |
📋 Description
Jitpack.io allows custom domains to be used, but shields.io allows only VCS ones.
It would be nice to add a "custom" or "organization" endpoint to use them (eg:
https://img.shields.io/jitpack/v/custom/com.open-meteo/open-meteo-api-kotlin.svg
).The text was updated successfully, but these errors were encountered: