feat: add burger menu for file renaming and relocation#619
feat: add burger menu for file renaming and relocation#619LZando wants to merge 13 commits intocrosspoint-reader:masterfrom
Conversation
|
Closes #559 |
daveallie
left a comment
There was a problem hiding this comment.
Small nit, fixed up a small bug when testing. Will fix this up to get it merged into this release
src/util/BookCacheManager.cpp
Outdated
| if (CrossPointState::getInstance().openEpubPath == oldPath.c_str()) { | ||
| CrossPointState::getInstance().openEpubPath = newPath.c_str(); | ||
| CrossPointState::getInstance().saveToFile(); | ||
| } |
There was a problem hiding this comment.
For consistency, we should use APP_STATE instead of CrossPointState::getInstance() here.
|
After reading both implementations, going to merge #630. If you'd like to update this to focus on the index migration, that can be done, otherwise, we can consider this solved and close it. |
## Summary * **What is the goal of this PR?** (e.g., Implements the new feature for file uploading.) This adds renaming and moving files to the File Manager * **What changes are included?** New `/move` and `/rename` endpoints, and corresponding modals and icons added. Uses the `file.rename()` function, after sanity checking. ## Additional Context * Add any other information that might be helpful for the reviewer (e.g., performance implications, potential risks, specific areas to focus on). Fixes #559, #661, #663. Only touches the File Manager, so low risk of affecting other systems. Simpler than #619, at the cost of not migrating the cache of renamed books. <img width="870" height="437" alt="image" src="https://github.com/user-attachments/assets/73e0e750-dfc8-48e0-a7a6-9694470b7ded" /> <img width="575" height="318" alt="image" src="https://github.com/user-attachments/assets/38c5fb19-c38a-436b-b3ad-75c1be7375ab" /> <img width="574" height="293" alt="image" src="https://github.com/user-attachments/assets/1d2a2403-765d-473f-8c4f-c6968e9bbfeb" /> --- ### AI Usage While CrossPoint doesn't have restrictions on AI tools in contributing, please be transparent about their usage as it helps set the right context for reviewers. Did you use AI tools to help write this code? _**YES**_ I used Codex for the implementation itself, and then carefully reviewed the code myself. As this is a simple change and only to the webserver, it is low risk.
|
Great @LZando should we work together on adding updated cache management on rename and move? |
I would love to work together, even though my availability for the next three weeks will be limited due to work, is it a problem? |
|
no worries, just ping me when you're ready! Though I don't think I can contribute much, you are more familiar with the cache stuff. |
I will be back with some architecture ideas |
I’m back with two approaches.
I tried to run a small script using a sparse hash, which uses the file size + the beginning and the end of the file. (in my test 4k of the head and 8kn of the tail where there is the ZIP Central Directory, which is unique to every specific compilation of a file.) Pros of this approach:
Cons of this approach:
Shouldn’t be a big deal on a enik device, but obv is important to pay attention to performance on ESP32.
Probably the first one is better because easier, what do you think? |
|
Good points. For such a low powered device, I don't think we should worry about collisions. For 10^-9, you'd need ~100 million samples to even have 10% chance of a collision. Given that there have only been ~130 million books written EVER, I think that should be fine. |
|
Will move this one into draft while you two continue to collaborate, just so that that myself and other reviewers it's clear that this doesn't need additional review eyes. |
Great! Give me two weeks and I will try to scratch the first version |
## Summary * **What is the goal of this PR?** (e.g., Implements the new feature for file uploading.) This adds renaming and moving files to the File Manager * **What changes are included?** New `/move` and `/rename` endpoints, and corresponding modals and icons added. Uses the `file.rename()` function, after sanity checking. ## Additional Context * Add any other information that might be helpful for the reviewer (e.g., performance implications, potential risks, specific areas to focus on). Fixes crosspoint-reader#559, crosspoint-reader#661, crosspoint-reader#663. Only touches the File Manager, so low risk of affecting other systems. Simpler than crosspoint-reader#619, at the cost of not migrating the cache of renamed books. <img width="870" height="437" alt="image" src="https://github.com/user-attachments/assets/73e0e750-dfc8-48e0-a7a6-9694470b7ded" /> <img width="575" height="318" alt="image" src="https://github.com/user-attachments/assets/38c5fb19-c38a-436b-b3ad-75c1be7375ab" /> <img width="574" height="293" alt="image" src="https://github.com/user-attachments/assets/1d2a2403-765d-473f-8c4f-c6968e9bbfeb" /> --- ### AI Usage While CrossPoint doesn't have restrictions on AI tools in contributing, please be transparent about their usage as it helps set the right context for reviewers. Did you use AI tools to help write this code? _**YES**_ I used Codex for the implementation itself, and then carefully reviewed the code myself. As this is a simple change and only to the webserver, it is low risk.
What is the goal of this PR?
Introduce a burger (overflow) menu that allows users to rename files and change their location directly from the file item actions.
UI / Frontend
(e.g.,
Philosophy of sd.epub).Backend / Logic
(metadata, reading progress, pre-rendered chapters) when a book’s path changes.
AI Usage
While CrossPoint does not restrict the use of AI tools for contributions, transparency is encouraged to provide proper context for reviewers.
Did you use AI tools to help write this code?
Answer: PARTIALLY