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

Replace the repo.sourcify.dev static file access endpoints with sourcify.dev/server/repository/contracts #1330

Closed
Tracked by #1328
kuzdogan opened this issue Apr 5, 2024 · 1 comment
Assignees

Comments

@kuzdogan
Copy link
Member

kuzdogan commented Apr 5, 2024

Our repository UI (h5ai-nginx) is a simple interface on top of our repository filesystem. It both gives an interface to explore the files, view .json and .sol files and other text files, plus to download the individual files as static files.

Example:
https://repo.sourcify.dev/contracts/full_match/11155111/0x2738d13E81e30bC615766A0410e7cF199FD59A83/metadata.json
https://repo.sourcify.dev/contracts/full_match/11155111/0x2738d13E81e30bC615766A0410e7cF199FD59A83/sources/contracts/1_Storage.sol

We actually don't want people to access files over this endpoint but people started using it this way and there's no going back 😬

With #1328 when we get rid of the repoV1, it will no longer be possible to simply mount the filesystem and give access to these files to the users, because there won't be the same filesystem existing anymore. Since we can't remove this file access method overnight, we need to work around this.

The changes in #1328 will entail doing the workarounds and keeping the API the same for the Server's file access methods. E.g. the repoV1 will be removed but the worked-around endpoints internally will send the exact same API response but this time using repoV2 or the DB (TBD). So for the repo.sourcify.dev static file endpoints we can just redirect people to these server endpoints and the workaround will be handled there.

Since setting up the redirect is independent from actually removing the repoV1 and implementing the workarounds, we can already do this.

The Task

In short, the repo.sourcify.dev static file access endpoints should be redirected to the /server/repository endpoints through its nginx config.

Right now the nginx instance will first try to directly access a file given in the URI and return that:
https://github.com/sourcifyeth/h5ai-nginx/blob/aa211ecb4454be61547c9723617e61f7dd5b4fc7/h5ai-nginx.conf#L15-L17

Otherwise it will let the h5ai handle the request: https://github.com/sourcifyeth/h5ai-nginx/blob/aa211ecb4454be61547c9723617e61f7dd5b4fc7/formatAddress.php#L50

In a PHP script or directly inside the nginx config, we can simply redirect the requests accessing static files to the /server/repository (for staging and production).

@marcocastignoli
Copy link
Member

Fixed with sourcifyeth/h5ai-nginx#3

@github-project-automation github-project-automation bot moved this from In Progress to Done in Sourcify Public Apr 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

No branches or pull requests

2 participants