Add enable/disable management for book tools (characters, worlds, and locations)

- Introduced toggling functionality for managing `characters`, `worlds`, and `locations` tool availability per book.
- Updated `CharacterComponent`, `WorldSetting`, and `LocationComponent` with toggle switches for tool enablement.
- Added `book_tools` database table and related schema migration for storing tool settings.
- Extended API calls, models, and IPC handlers to support tool enablement states.
- Localized new strings for English with supporting descriptions and messages.
- Adjusted conditional rendering logic across components to respect tool enablement.
This commit is contained in:
natreex
2026-01-14 17:42:59 -05:00
parent 7215ac5c4f
commit e45a15225b
19 changed files with 782 additions and 341 deletions

View File

@@ -1,7 +1,7 @@
import {getUserEncryptionKey} from "../keyManager.js";
import System from "../System.js";
import {CompleteBook} from "./Book.js";
import BookRepo, {EritBooksTable} from "../repositories/book.repository.js";
import BookRepo, {EritBooksTable, BookToolsTable} from "../repositories/book.repository.js";
import ChapterRepo, {
BookChapterInfosTable,
BookChaptersTable
@@ -192,9 +192,14 @@ export default class Download {
});
if (!guidelinesInserted) return false;
return data.issues.every((issue: BookIssuesTable): boolean => {
const issuesInserted: boolean = data.issues.every((issue: BookIssuesTable): boolean => {
const encryptedIssueName: string = System.encryptDataWithUserKey(issue.name, userEncryptionKey);
return IssueRepository.insertSyncIssue(issue.issue_id, userId, issue.book_id, encryptedIssueName, issue.hashed_issue_name, issue.last_update, lang);
});
if (!issuesInserted) return false;
return data.bookTools.every((bookTool: BookToolsTable): boolean => {
return BookRepo.insertSyncBookTools(bookTool.book_id, userId, bookTool.characters_enabled, bookTool.worlds_enabled, bookTool.locations_enabled, lang);
});
}
}