Skip to content
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

Looking up files by sha256 #9

Closed
MartinKolarik opened this issue Apr 12, 2018 · 4 comments
Closed

Looking up files by sha256 #9

MartinKolarik opened this issue Apr 12, 2018 · 4 comments

Comments

@MartinKolarik
Copy link
Member

See kiboit/phast#57.

@apeschar
Copy link

Yup, this is exactly what we need and would be great to have indeed.

As discussed in the referenced issue for Phast, we'll use the hashes of files on a user's website to find the corresponding files on jsDelivr. If there's a match, we rewrite the reference so that the file is loaded from the CDN.

If we can do this search without crawling your (or someone else's) API, that would be epic.

I'm looking forward to your update on this.

@apeschar
Copy link

One thing is that a single hash might match many files. In that case it probably makes sense to use the oldest (earliest) available file on your CDN, so that the URLs remain stable.

@MartinKolarik
Copy link
Member Author

MartinKolarik commented Apr 13, 2018

This is now available at /v1/lookup/hash/:hash. Example here.

@apeschar it'll take a few more hours until our DB has all the hashes, so some requests will return 404 until then. Once the DB is complete, you should be able to find any file, which was previously accessed via our CDN. When there are multiple files with the same hash, we return the one which was accessed first.

I'm going to keep this undocumented for a while so that you can test it.

@apeschar
Copy link

Cool. Seems to work well.

It'll take a while until we actually get around to implementing this in our project. I'll keep you posted.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants