Skip to content
This repository has been archived by the owner on Sep 2, 2023. It is now read-only.

Change Backends Request::Import api #13

Closed
Septias opened this issue Jul 22, 2021 · 7 comments
Closed

Change Backends Request::Import api #13

Septias opened this issue Jul 22, 2021 · 7 comments

Comments

@Septias
Copy link
Collaborator

Septias commented Jul 22, 2021

The current api needs two strings from the frontend, an email, and a path to the backup file. The problem is that the current browser file-API does not generate full paths of files because of privacy issues, instead, you get something like C:\\fakepath\\IMG_0138.JPG with which you can't open the backup file from the backend.
Because of this, I request that we change the api and either send the full file from frontend->backend or we remove the path field from the request and open a file-explorer from within the backend to choose the backup file. In this scenario, the frontend would only play the role of a "notifier".
What do you think is the best solution?

@dignifiedquire
Copy link
Member

probably uploading the file and sending it to the backend is the most reliable to work

@Septias
Copy link
Collaborator Author

Septias commented Jul 22, 2021

Yeah, that's what I would go with.
I just checked the other option but since rust does not natively support opening a file picker we would need to depend on something like nfd-rs which is probably not the way to go.
I'll just implement the other way.

@Septias Septias closed this as completed Jul 22, 2021
@Septias
Copy link
Collaborator Author

Septias commented Jul 22, 2021

It would need a new deltachat-core API to support our use case because we currently only have a function to import by file-path and not with a blob. Since it's literally just 5 lines of code with ndf-rs instead of implementing a new core-API with WebSockets etc. I would prefer to implement the second option I explained here.

@Septias Septias reopened this Jul 22, 2021
@dignifiedquire
Copy link
Member

While that is a nice option it will prevent us from using this in the browser remotely, which is why I think we should do the work of sending the file

@Septias
Copy link
Collaborator Author

Septias commented Jul 22, 2021

Holga told me we are pretty far away from compiling dc-core to web assembly, so we will still need the backend. If that's the case then there is no difference in sending the file from frontend vs. opening it from the backend, right?

@dignifiedquire
Copy link
Member

there is, when we serve the frontend from a mobile device, we can only use the backend on the phone, and the browsers capabilities

@Septias
Copy link
Collaborator Author

Septias commented Jul 22, 2021

yeah makes sense - didn't know we want to support devices other then desktop

@Septias Septias closed this as completed Jul 22, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants