rufuspollock / s3-bucket-listing

Create nice directory listings for s3 buckets with javascript and HTML.
689 stars 300 forks source link

Does this tool support CloudFlare R2? #118

Closed Kapsztajn closed 1 week ago

Kapsztajn commented 1 year ago

Does anyone make it work with CloudFlare R2 storage? I tried to do that but getting 400 Bad Request with different configurations. image

rufuspollock commented 1 year ago

@Kapsztajn thanks for asking and would be great if it did. No reason it should not but haven't tried yet personally.

Kapsztajn commented 1 year ago

@rufuspollock I managed to make it work, but it required some changes. Firstly, CloudFlare does not allow any access to the API for public buckets you always need to provide keys or have a presigned URL. I have added the function generatePresignedURL, changed the function createS3QueryUrl, modified index.html to provide read-only API keys, removed region as CloudFlare does not support that, and removed some CloudFlare unused values. Im not very good at JS, so all the changes could be terrible implemented.

How do I proceed with that now? My changes break S3 functionality to make R2 work. Should I create a fork and mention you and the s3-bucket-listing tool there, or should I try to implement some if statements and prepare a PR?

rufuspollock commented 12 months ago

@Kapsztajn great work.

Best would be to fork this repo, create a branch "r2", switch to that branch. Push your changes for now with some details about the differences in, say, README.R2.md. I think that is better than if statements for now.

Kapsztajn commented 1 week ago

I had emails about the solution I created, so I finally forked it. https://github.com/Kapsztajn/r2-bucket-listing It is pretty basic but solid web developer can tweek it with some CSS and proper JS. I will close this issue as it is not an issue any more ;)