language-transfer / lt-app

React Native application for Language Transfer
https://www.languagetransfer.org/
Other
291 stars 26 forks source link

License notices show strangely after switching to R2 #67

Open SyntaxBlitz opened 1 year ago

SyntaxBlitz commented 1 year ago

Used to be, the "open source licenses" section was a webview that just showed the contents of https://downloads.languagetransfer.org/NOTICE.

It still is, but after switching to Cloudflare R2 (from Linode object storage), the MIME type is application/octet-stream instead of... well, looks like there was no Content-Type header being served by Linode.

Trouble is, on Android at least, this results in the button downloading the NOTICE file instead of displaying it inline. The webview was kind of the easiest hacky solution, but we can do better by actually fetching the contents and rendering them in some UI (maybe one that's smart about not rendering that massive blob of text in one big view -- needs to be efficient to render).

We could just rename the file to NOTICE.txt, but it'd still require an app update so it knows where to look. Hmm, maybe that's what we should do, just update the URL in the app to NOTICE.txt and start uploading to both endpoints instead.

Either way, requires an app update unless I can send a new content type.

I CAN send a new content type! this is why I run everything through a shim server instead of directly to the CDN. I can just special-case the NOTICE file on the server to either send it directly from the shim lambda or to redirect to a NOTICE.txt file from R2!

lol doesn't matter, i CAN set a new content type on R2.

aws s3api put-object --bucket language-transfer --key NOTICE --body NOTICE --content-type text/plain --acl public-read --endpoint-url https://f38435e2c9280c3bd46c1155cd39ba57.r2.cloudflarestorage.com

thanks for being my rubber duck, github text box

SyntaxBlitz commented 1 year ago

whoops, never actually checked in the app that this works. looks like it doesn't. will have to investigate