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

Upload of files #12

Open
wittmeis opened this issue Aug 2, 2023 · 8 comments
Open

Upload of files #12

wittmeis opened this issue Aug 2, 2023 · 8 comments

Comments

@wittmeis
Copy link

wittmeis commented Aug 2, 2023

Hi, first of all "Thank you" for this cool little tool. I use it on a regular basis to automatically convert my notes and store them in my Obsidian vault.

However, I have frequently the use case that I want to review scientific papers on the Remarkable. Currently, I copy them using the web interface. However, there is already some specific tooling for that (see here) that is using the rmapi library and I am unsure whether rmapi works for the latest 3.5.2 release of the Remarkable.

Hence, I thought that a good alternative would be to use your tool and to extend the API by an upload function. I could then pre-process the PDFs to reduce the file size and upload them to the RM2 using the USB interface or even create an adapted version of paper2remarkable that is using your API for the upload.

Have you ever checked whether the upload would be easy to implement? I checked the network trace in Google Chrome and it looked as if it would be manageable but I am not really familiar with REST APIs and the treatment of the PDF content as the payload. I also do not know whether I could break something on the device by using the REST API in an erroneous way.

@LinusCDE
Copy link
Owner

LinusCDE commented Aug 2, 2023

I think I wanted to make some upload script but didn't deem it needed. Issue is you can't specify where it is uploaded. It always goes into the root when I tested. So I didn't see a reason to make a script that does the same as one dropping the file in the browser interface.

The rmapi would likely use the REST API of reMarkable. So the cloud services and pretend to be a syncing app. These tools only center around the webui and the api that is exposed for that locally from the reMarkable.

The restriction of the directory being root might have changed though. If that is the case making a upload file would probably cool.

@wittmeis
Copy link
Author

wittmeis commented Aug 2, 2023

I just tried it, it stores the uploaded file in the chosen folder. The way it works is that it first executes a POST request with the folder uuid (e.g. http://10.11.99.1/documents/99fd617e-7b0f-4a80-ae05-db4900ebd78c) and then once you drop the file it initiates another POST request to http://10.11.99.1/upload with a binary payload containing the PDF. I would assume that this should be pretty straight forward to add right?

As for rmapi. Is the REST API also available when you do not use the subscription or cloud service of the RM2? Would that mean I could use rmapi as a replacement for rmWebUiTools to perform the same actions without the USB connection? Cause what currently troubles me that often the toggle switch to enable the USB connection is not shown when I connect my Linux laptop and I first have to restart the Remarkable.

@LinusCDE
Copy link
Owner

LinusCDE commented Aug 2, 2023

Ah cool. Seems they added the possibility to drop a document into a specific folder then. It used to drop the document into the root folder, no matter what directory was selected when I tested it. I should add that at some point.

Afaik, rmapi focuses on their cloud api and can act kinda similar to the apps they provided. So you'd need to have the device connected to the internet for changes to work, however as you said, you don't need a USB connection and the enabled webinterface on the upside.

@wittmeis
Copy link
Author

wittmeis commented Aug 4, 2023

I started to work on this and the code is pretty much complete (it is just a minor addition anyway). But I am still a little afraid of testing it with the real device though! The RM2 is simply to expensive to brick it! ;-) How did you test the remainder of rmWebUiTools when you developed it initally?

@LinusCDE
Copy link
Owner

LinusCDE commented Aug 4, 2023

I just tested it on the device. It should not be possible to do any permanent harm when using their API I hope.

The only issues I got was freezes and crashes when I was exporting a lot which I was why I added the disclaimer.

Just look in the Dev tool what request is made when uploading a file using their WebUI (you probably did that anyway). If your request is pretty close to that, I doubt there would be much that can go wrong anyway.

@bzm3r
Copy link

bzm3r commented Feb 13, 2024

I started to work on this and the code is pretty much complete (it is just a minor addition anyway). But I am still a little afraid of testing it with the real device though! The RM2 is simply to expensive to brick it! ;-) How did you test the remainder of rmWebUiTools when you developed it initally?

Hi! Would you be willing to share the code you came up with?

The one aspect of all this that I am new to is reverse engineering is the requests being sent between the computer and the RM2. @LinusCDE mention's the "Dev tool": would this be Firefox/Chrome's dev tool?

@Moppelpanda
Copy link

Hi the upload works fine for single files. Is it somehow possible to upload whole directories/folders?

@LinusCDE
Copy link
Owner

LinusCDE commented Apr 29, 2024

Last I used the WebInterface, there didn't seem to be a way. Multiple files can work by just doing many uploads, but there was no option to make or select directories. They would always get placed in the root.

That said, this might long have changed. I wouldn't even be surprised if, how this repo uses the WebInterface, is no longer working anymore or as intended.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants