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

Greenfield: Add image upload for app items #6226

Merged

Conversation

dennisreimann
Copy link
Member

Upload endpoints for app item images. Follow-up to #6075.

Tested to work with the app item editor.

@dennisreimann dennisreimann added the API Questions and issues related to API label Sep 17, 2024
@dstrukt
Copy link
Member

dstrukt commented Sep 17, 2024

YES!

I was going to make an issue for this, and you already have a PR 💥💥

@dennisreimann dennisreimann force-pushed the gf-app-image-upload branch 2 times, most recently from e63b263 to 44457d2 Compare October 2, 2024 07:24
@NicolasDorier
Copy link
Member

@dennisreimann

  1. There isn't any UploadImage API for any other data stucture (for example store), as such, it shouldn't be expected for the app.
  2. Instead, you should do like we do in Store: Use the UnresolvedUri type.

A user who wants to update will need to upload the file via the API to the file service, then reference it through an UnresolvedUri.

@dennisreimann
Copy link
Member Author

Hmm, but there are dedicated upload actions for the store logo as well as the user profile picture.

@NicolasDorier
Copy link
Member

@dennisreimann this really sucks, we don't want to add a separate routes everytimes we want to upload a logo.

Let me think about it.

@dennisreimann
Copy link
Member Author

We could do it via the GreenfieldFilesController, but we'd have to relax the permission requirement. When I implemented it, I matched the original UI-based file action policies, which make it available to admins only.

@woutersamaey
Copy link
Contributor

Are you uploading the files base64 encoded or using HTTP form encoding? From an API POV, the base64 way may be more convenient?

@dennisreimann
Copy link
Member Author

HTTP form, that's also how we implemented the other upload endpoints.

@dennisreimann dennisreimann force-pushed the gf-app-image-upload branch 2 times, most recently from 72ecb6e to 9024072 Compare October 17, 2024 16:08
@dennisreimann dennisreimann force-pushed the gf-app-image-upload branch 2 times, most recently from b97b5c7 to 29cbe12 Compare October 31, 2024 11:23
Upload endpoints for app item images. Follow-up to btcpayserver#6075.
Tested to work with the app item editor.

Uses UploadImage consistently in API and UI.
@NicolasDorier NicolasDorier merged commit a129114 into btcpayserver:master Nov 7, 2024
4 checks passed
@dennisreimann dennisreimann deleted the gf-app-image-upload branch November 7, 2024 08:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API Questions and issues related to API
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants