port: upstream PR #1342 - Book Info screen, richer metadata, safer controls
Ports upstream PR #1342 (feat: Add Book Info screen, richer metadata, and safer file-browser controls) with mod-specific adaptations: - Parse and cache series, seriesIndex, description from EPUB OPF - Bump book.bin cache version to 6 for new metadata fields - Add BookInfoActivity (new screen) accessible via Right button in FileBrowser - Add ManageBook menu via Left button in FileBrowser (replaces upstream hidden delete) - Guard all delete/archive actions with ConfirmationActivity (10 call sites) - Add inputArmed gating to ConfirmationActivity to prevent accidental confirmation - Safe deserialization: readString now returns bool with MAX_STRING_LENGTH guard - Add series field to RecentBooksStore with JSON and binary serialization - Add i18n keys: STR_BOOK_INFO, STR_AUTHOR, STR_SERIES, STR_FILE_SIZE, etc. Made-with: Cursor
This commit is contained in:
@@ -36,17 +36,23 @@ static void writeString(FsFile& file, const std::string& s) {
|
||||
file.write(reinterpret_cast<const uint8_t*>(s.data()), len);
|
||||
}
|
||||
|
||||
static void readString(std::istream& is, std::string& s) {
|
||||
static constexpr uint32_t MAX_STRING_LENGTH = 4096;
|
||||
|
||||
static bool readString(std::istream& is, std::string& s) {
|
||||
uint32_t len;
|
||||
readPod(is, len);
|
||||
if (len > MAX_STRING_LENGTH) return false;
|
||||
s.resize(len);
|
||||
is.read(&s[0], len);
|
||||
return true;
|
||||
}
|
||||
|
||||
static void readString(FsFile& file, std::string& s) {
|
||||
static bool readString(FsFile& file, std::string& s) {
|
||||
uint32_t len;
|
||||
readPod(file, len);
|
||||
if (len > MAX_STRING_LENGTH) return false;
|
||||
s.resize(len);
|
||||
file.read(&s[0], len);
|
||||
return true;
|
||||
}
|
||||
} // namespace serialization
|
||||
|
||||
Reference in New Issue
Block a user