IPC channels
Every channel between the renderer and the main process, from the *_CHANNELS constants in src/main/ipc/ and the window.tankobon API in src/preload.ts (whose type is TankobonApi).
| Channel | Direction | Preload API | Handler | Description |
|---|---|---|---|---|
achievements:list | renderer → main (invoke) | window.tankobon.achievements.list | ACHIEVEMENT_CHANNELS.list in src/main/ipc/achievements.ts | Every achievement earned so far, with the moment it was earned. |
achievements:unlock | renderer → main (invoke) | window.tankobon.achievements.unlock | ACHIEVEMENT_CHANNELS.unlock in src/main/ipc/achievements.ts | Records achievements as earned (the renderer evaluates the rules); ones already earned are left as they are, an unknown id is refused. Resolves with those that are new, which data:changed announces too. |
app:check-update | renderer → main (invoke) | window.tankobon.app.checkUpdate | APP_CHANNELS.checkUpdate in src/main/ipc/app.ts | Asks GitHub whether a release newer than the running version is published; a network failure comes back as an error result, not a rejection. |
app:get-info | renderer → main (invoke) | window.tankobon.app.getInfo | APP_CHANNELS.getInfo in src/main/ipc/app.ts | Versions of the app, Electron, Chromium, Node.js and V8, and the OS and CPU architecture. |
app:get-system-languages | renderer → main (invoke) | window.tankobon.app.getSystemLanguages | APP_CHANNELS.getSystemLanguages in src/main/ipc/app.ts | The OS's preferred languages (BCP 47 tags, most preferred first), to resolve the system language setting as the main process does. |
app:launch-file | main → renderer (push) | window.tankobon.app.onLaunchFile | APP_CHANNELS.launchFile in src/main/ipc/app.ts | Subscribes to the main process's app:launch-file push, sent when such a comic is waiting (call takeLaunchFile then); returns the unsubscribe function. |
app:open-link | renderer → main (invoke) | window.tankobon.app.openLink | APP_CHANNELS.openLink in src/main/ipc/app.ts | Opens one of the project's pages (repository, documentation…) in the default browser. |
app:take-launch-file | renderer → main (invoke) | window.tankobon.app.takeLaunchFile | APP_CHANNELS.takeLaunchFile in src/main/ipc/app.ts | The token of the comic the operating system asked to open (double click in the file explorer, "Open with…", a second launch with a file), or null; it is handed out once and opens like a comic.pickFile token. |
comic:close | renderer → main (invoke) | window.tankobon.comic.close | COMIC_CHANNELS.close in src/main/ipc/comic.ts | Closes a comic opened with open, releasing its archive in the main process. |
comic:open | renderer → main (invoke) | window.tankobon.comic.open | COMIC_CHANNELS.open in src/main/ipc/comic.ts | Opens a comic and registers it in the library (or refreshes its entry); resolves with its saved page. ref is a library entry id or a token from pickFile, never a path. A file that can't be opened (moved, deleted, corrupted, unsupported) resolves to an error result with a message in the interface language, rather than rejecting. |
comic:pick-file | renderer → main (invoke) | window.tankobon.comic.pickFile | COMIC_CHANNELS.pickFile in src/main/ipc/comic.ts | Opens a native file picker; resolves to an opaque token for the chosen file (to pass to open), or null if cancelled. The renderer never learns the path. addToLibrary is true for the library's "add a file" (opening the token then always adds the book) and false for the reader's "open a file" (the book is added only if the addOpenedBooksToLibrary setting is on). |
comic:read-page | renderer → main (invoke) | window.tankobon.comic.readPage | COMIC_CHANNELS.readPage in src/main/ipc/comic.ts | Reads one page (0-based) of a comic opened with open, as image bytes. |
data:changed | main → renderer (push) | window.tankobon.data.onChanged | DATA_CHANGE_CHANNELS.changed in src/main/ipc/data-changes.ts | Subscribes to the main process's data:changed push, sent after every database write (library, reading lists, settings); returns the unsubscribe function. |
data:clear-cache | renderer → main (invoke) | window.tankobon.data.clearCache | DATA_CHANNELS.clearCache in src/main/ipc/data.ts | Deletes the cover thumbnails kept in the application's cache folder (they are made again on demand); the library, the settings and the covers beside the comics are left untouched. A failure comes back as an error result. |
data:clear-library | renderer → main (invoke) | window.tankobon.data.clearLibrary | DATA_CHANNELS.clearLibrary in src/main/ipc/data.ts | Empties the library (entries, credits, people) and deletes every reading list and cover thumbnail; the comic files and the settings are left untouched. A failure comes back as an error result. |
data:export | renderer → main (invoke) | window.tankobon.data.export | DATA_CHANNELS.export in src/main/ipc/data.ts | Opens a native save dialog and writes a JSON export there; an error (full or read-only disk…) comes back as a result, not a rejection. |
data:import | renderer → main (invoke) | window.tankobon.data.import | DATA_CHANNELS.import in src/main/ipc/data.ts | Opens a native file picker and merges the chosen JSON export into the local database. |
database:cancel-restore | renderer → main (invoke) | window.tankobon.database.cancelRestore | DATABASE_CHANNELS.cancelRestore in src/main/ipc/database.ts | Cancels a restoration that has not been applied yet. |
database:choose-location | renderer → main (invoke) | window.tankobon.database.chooseLocation | DATABASE_CHANNELS.chooseLocation in src/main/ipc/database.ts | Opens a native directory picker; the new location only takes effect on the next start. |
database:create-backup | renderer → main (invoke) | window.tankobon.database.createBackup | DATABASE_CHANNELS.createBackup in src/main/ipc/database.ts | Makes a copy of the database now (and deletes the ones beyond the number to keep). |
database:get-location | renderer → main (invoke) | window.tankobon.database.getLocation | DATABASE_CHANNELS.getLocation in src/main/ipc/database.ts | Where the database file currently lives. |
database:list-backups | renderer → main (invoke) | window.tankobon.database.listBackups | DATABASE_CHANNELS.listBackups in src/main/ipc/database.ts | The copies of the database kept beside it, most recent first, and the one waiting to be restored. |
database:relaunch | renderer → main (invoke) | window.tankobon.database.relaunch | DATABASE_CHANNELS.relaunch in src/main/ipc/database.ts | Restarts the app, e.g. to open the database from its new location. |
database:reset-location | renderer → main (invoke) | window.tankobon.database.resetLocation | DATABASE_CHANNELS.resetLocation in src/main/ipc/database.ts | Points the app back at the default location; takes effect on the next start. |
database:restore-backup | renderer → main (invoke) | window.tankobon.database.restoreBackup | DATABASE_CHANNELS.restoreBackup in src/main/ipc/database.ts | Schedules the restoration of a copy (by its name): the database file is overwritten at the next start. |
database:set-file-name | renderer → main (invoke) | window.tankobon.database.setFileName | DATABASE_CHANNELS.setFileName in src/main/ipc/database.ts | Names the database file (.db is added when missing; null goes back to tankobon.db); an invalid name comes back as an error result. Like the folder, it takes effect on the next start and the existing file is not renamed. |
library:add-file | renderer → main (invoke) | window.tankobon.library.addFile | LIBRARY_CHANNELS.addFile in src/main/ipc/library.ts | Opens a native file picker, then adds the chosen comic to the library without opening it; an unreadable file resolves to an error result rather than rejecting. The library organization then moves it, or offers to (organization). |
library:add-folder | renderer → main (invoke) | window.tankobon.library.addFolder | LIBRARY_CHANNELS.addFolder in src/main/ipc/library.ts | Opens a native directory picker, then adds every comic found under it, recursively. The library organization then moves them, or offers to (organization). |
library:analyze-cleanup | renderer → main (invoke) | window.tankobon.library.analyzeCleanup | LIBRARY_CHANNELS.analyzeCleanup in src/main/ipc/library.ts | First step of cleaning the books: lists the files that are not images in the CBZ of ids (the whole library when empty), grouped by extension, without touching anything. Progress goes over onScanProgress. The result's token is what applyCleanup() takes. |
library:apply-cleanup | renderer → main (invoke) | window.tankobon.library.applyCleanup | LIBRARY_CHANNELS.applyCleanup in src/main/ipc/library.ts | Second step: rewrites the archives of the analysis token without those files, except the kinds whose extension (.xml, empty for none) is in keptExtensions. The original is replaced only once the new archive has been checked. The token works once. |
library:clean-folders | renderer → main (invoke) | window.tankobon.library.cleanFolders | LIBRARY_CHANNELS.cleanFolders in src/main/ipc/library.ts | Moves those orphan folders to the .deletedByTankobon folder of the organized folder; progress arrives through onScanProgress. The folders books are added from are never touched. |
library:convert-cbr | renderer → main (invoke) | window.tankobon.library.convertCbr | LIBRARY_CHANNELS.convertCbr in src/main/ipc/library.ts | Writes each CBR of the organized folder as a CBZ beside it, points the book at it (progress, rating, tags and lists are kept) and moves the CBR to .deletedByTankobon at the root of the organized folder. Progress goes over onScanProgress. |
library:count-convertible | renderer → main (invoke) | window.tankobon.library.countConvertible | LIBRARY_CHANNELS.countConvertible in src/main/ipc/library.ts | How many CBR of the organized folder convertCbr() would convert, and what its .deletedByTankobon folder holds; an error when the organization is off or its folder unreachable. |
library:count-orphan-folders | renderer → main (invoke) | window.tankobon.library.countOrphanFolders | LIBRARY_CHANNELS.countOrphanFolders in src/main/ipc/library.ts | How many folders of the organized folder cleanFolders() would move: those holding no book, only .nfo files and cover images; an error when the organization is off or its folder unreachable. |
library:count-unorganized | renderer → main (invoke) | window.tankobon.library.countUnorganized | LIBRARY_CHANNELS.countUnorganized in src/main/ipc/library.ts | How many library comics aren't in their place in the organized folder yet; an error result when the organization is off or its folder unreachable. |
library:empty-deleted | renderer → main (invoke) | window.tankobon.library.emptyDeleted | LIBRARY_CHANNELS.emptyDeleted in src/main/ipc/library.ts | Deletes for good everything in the .deletedByTankobon folder of the organized folder. |
library:image-scan-progress | main → renderer (push) | window.tankobon.library.onImageScanProgress | LIBRARY_CHANNELS.imageScanProgress in src/main/ipc/library.ts | Subscribes to the progress of that background measure; returns the unsubscribe function. |
library:image-scan-status | renderer → main (invoke) | window.tankobon.library.imageScanStatus | LIBRARY_CHANNELS.imageScanStatus in src/main/ipc/library.ts | Where the background measure of the books' page sizes is now (it runs after an import, a resync or the first opening of a book); resolves with the state a window that loads late missed. |
library:list | renderer → main (invoke) | window.tankobon.library.list | LIBRARY_CHANNELS.list in src/main/ipc/library.ts | Every library entry, most recently opened first. |
library:list-folders | renderer → main (invoke) | window.tankobon.library.listFolders | LIBRARY_CHANNELS.listFolders in src/main/ipc/library.ts | The folders added with addFolder, which resync walks again, in the order they were added. |
library:list-unlinked-folders | renderer → main (invoke) | window.tankobon.library.listUnlinkedFolders | LIBRARY_CHANNELS.listUnlinkedFolders in src/main/ipc/library.ts | The library folders that have no path on this machine yet (the library was made on another one): their comics are listed but their files can't be found until relinkFolder. |
library:organize | renderer → main (invoke) | window.tankobon.library.organize | LIBRARY_CHANNELS.organize in src/main/ipc/library.ts | Moves into the organized folder the comics an addition offered to move (organization.pending.token of its result), each into its own subfolder; a token works once. |
library:organize-all | renderer → main (invoke) | window.tankobon.library.organizeAll | LIBRARY_CHANNELS.organizeAll in src/main/ipc/library.ts | Moves every library comic not in its place yet into the organized folder (its own subfolder each), whenever it was added. Reports through onScanProgress; an error result when the organization is off, its folder unreachable, or a resynchronization or another organization is running. |
library:pick-organization-folder | renderer → main (invoke) | window.tankobon.library.pickOrganizationFolder | LIBRARY_CHANNELS.pickOrganizationFolder in src/main/ipc/library.ts | Opens a native directory picker and makes the chosen folder the library organization's folder (the libraryOrganizationFolder setting, which settings.set refuses), also remembered among the folders resync walks. |
library:relink-folder | renderer → main (invoke) | window.tankobon.library.relinkFolder | LIBRARY_CHANNELS.relinkFolder in src/main/ipc/library.ts | Opens a native directory picker to say where an unlinked folder (an id returned by listUnlinkedFolders) is on this machine; the comics stored relative to it are found again. |
library:remove | renderer → main (invoke) | window.tankobon.library.remove | LIBRARY_CHANNELS.remove in src/main/ipc/library.ts | Removes an entry from the library. The file on disk is left untouched, unless deleteFile is true: it (and its cover and .nfo sidecars) then goes to the trash. An error result means the entry is gone from the library but the file could not be trashed. |
library:remove-folder | renderer → main (invoke) | window.tankobon.library.removeFolder | LIBRARY_CHANNELS.removeFolder in src/main/ipc/library.ts | Forgets one of those folders (a path returned by listFolders); its comics stay in the library. |
library:remove-many | renderer → main (invoke) | window.tankobon.library.removeMany | LIBRARY_CHANNELS.removeMany in src/main/ipc/library.ts | Removes several entries from the library; with deleteFiles, their files (and the covers beside them) are also moved to the system trash. A file that can't be trashed is counted as failed, its entry is removed anyway. |
library:resync | renderer → main (invoke) | window.tankobon.library.resync | LIBRARY_CHANNELS.resync in src/main/ipc/library.ts | Walks the remembered folders (and the organized folder, when the organization is on) again: new comics are added (then moved or offered by the organization, a comic dropped in the organized folder being moved into place), and comics whose file no longer exists are removed from the library (with their progress, rating, tags and reading-list places; the files on disk are never touched). A folder that can't be read is skipped and counted as unreachable. Comics of those folders without a .nfo get one written from their library information (an existing one is never overwritten), counted as nfoWritten, and the missing cover thumbnails of those comics are extracted, counted as coversExtracted. Stores the date as the lastResyncAt setting. Reports through onScanProgress; an error result when one is already running. |
library:scan-progress | main → renderer (push) | window.tankobon.library.onScanProgress | LIBRARY_CHANNELS.scanProgress in src/main/ipc/library.ts | Subscribes to the progress of addFolder, resync, organizeAll, convertCbr and cleanFolders; returns the unsubscribe function. |
library:set-cover | renderer → main (invoke) | window.tankobon.library.setCover | LIBRARY_CHANNELS.setCover in src/main/ipc/library.ts | Replaces the cover thumbnail of a library entry with image (PNG, JPEG or WebP, at most 8 MiB, already cropped to the cover's 2:3 proportions by the caller); the main process shrinks it to the thumbnail size and writes it beside the comic (or in the local cache). A picture that can't be decoded comes back as an error result and leaves the current cover as it was. |
library:thumbnail | renderer → main (invoke) | window.tankobon.library.thumbnail | LIBRARY_CHANNELS.thumbnail in src/main/ipc/library.ts | Cover thumbnail (first page, shrunk) of a library entry as WebP bytes, generated and cached first when missing; null if the entry is unknown or unreadable. |
library:update-metadata | renderer → main (invoke) | window.tankobon.library.updateMetadata | LIBRARY_CHANNELS.updateMetadata in src/main/ipc/library.ts | Writes the given metadata fields (title, series, credits…) of a library entry; resolves with the updated entry, or null if it is gone. |
library:update-metadata-many | renderer → main (invoke) | window.tankobon.library.updateMetadataMany | LIBRARY_CHANNELS.updateMetadataMany in src/main/ipc/library.ts | Writes the same metadata fields on several library entries at once (all or none); resolves with the number of entries updated (unknown ids are skipped). |
library:update-progress | renderer → main (invoke) | window.tankobon.library.updateProgress | LIBRARY_CHANNELS.updateProgress in src/main/ipc/library.ts | Saves the last page read (0-based) of a library entry. |
library:update-rating | renderer → main (invoke) | window.tankobon.library.updateRating | LIBRARY_CHANNELS.updateRating in src/main/ipc/library.ts | Sets the rating of a library entry: 0 (unrated) to 5. |
library:update-tags | renderer → main (invoke) | window.tankobon.library.updateTags | LIBRARY_CHANNELS.updateTags in src/main/ipc/library.ts | Replaces the tags of a library entry. |
metadata:apply | renderer → main (invoke) | window.tankobon.metadata.apply | METADATA_CHANNELS.apply in src/main/ipc/metadata.ts | Saves what the user accepted in the lookup dialog: updates the library entry, rewrites the .nfo beside the file and makes the cover thumbnail if it has none, or replaces it with the picture at coverUrl (an address of the sources' cover hosts, else ignored; a picture that can't be downloaded keeps the current cover); resolves with the updated entry, or null if it is gone. |
metadata:cancel | renderer → main (invoke) | window.tankobon.metadata.cancel | METADATA_CHANNELS.cancel in src/main/ipc/metadata.ts | Stops the lookup this window is waiting for (search() or fromPage()): its requests are aborted and the call fails. Does nothing when none is under way. |
metadata:from-page | renderer → main (invoke) | window.tankobon.metadata.fromPage | METADATA_CHANNELS.fromPage in src/main/ipc/metadata.ts | Reads a book from the page at url, a link the user pasted (Bédéthèque album, BDfugue product or Nautiljon volume). |
metadata:search | renderer → main (invoke) | window.tankobon.metadata.search | METADATA_CHANNELS.search in src/main/ipc/metadata.ts | Looks a book up in the public APIs enabled in the settings (Comic Vine, Google Books), or only in those named by query.sources. |
reading-lists:add-entries | renderer → main (invoke) | window.tankobon.readingLists.addEntries | READING_LIST_CHANNELS.addEntries in src/main/ipc/reading-lists.ts | Appends several library entries to a reading list, in the order given: books already in it are skipped, and once it holds 50 books the rest are left out (the result counts each case). |
reading-lists:add-entry | renderer → main (invoke) | window.tankobon.readingLists.addEntry | READING_LIST_CHANNELS.addEntry in src/main/ipc/reading-lists.ts | Appends a library entry to a reading list; refused when the list already holds 50 books. |
reading-lists:create | renderer → main (invoke) | window.tankobon.readingLists.create | READING_LIST_CHANNELS.create in src/main/ipc/reading-lists.ts | Creates an empty reading list; refused when the name is empty. |
reading-lists:list | renderer → main (invoke) | window.tankobon.readingLists.list | READING_LIST_CHANNELS.list in src/main/ipc/reading-lists.ts | Every reading list, in the user's order (new lists last), each with its library entry ids in reading order. |
reading-lists:remove | renderer → main (invoke) | window.tankobon.readingLists.remove | READING_LIST_CHANNELS.remove in src/main/ipc/reading-lists.ts | Deletes a reading list; its books stay in the library. |
reading-lists:remove-entry | renderer → main (invoke) | window.tankobon.readingLists.removeEntry | READING_LIST_CHANNELS.removeEntry in src/main/ipc/reading-lists.ts | Takes a library entry out of a reading list. |
reading-lists:rename | renderer → main (invoke) | window.tankobon.readingLists.rename | READING_LIST_CHANNELS.rename in src/main/ipc/reading-lists.ts | Renames a reading list; refused when the name is empty. |
reading-lists:reorder | renderer → main (invoke) | window.tankobon.readingLists.reorder | READING_LIST_CHANNELS.reorder in src/main/ipc/reading-lists.ts | Stores a new order for a reading list; entryIds must hold exactly the list's current entries. |
reading-lists:reorder-lists | renderer → main (invoke) | window.tankobon.readingLists.reorderLists | READING_LIST_CHANNELS.reorderLists in src/main/ipc/reading-lists.ts | Stores a new order for the reading lists themselves; listIds must hold exactly the current lists. |
settings:get-all | renderer → main (invoke) | window.tankobon.settings.getAll | SETTINGS_CHANNELS.getAll in src/main/ipc/settings.ts | Every setting except the API keys, with defaults for the ones never stored. |
settings:get-api-keys | renderer → main (invoke) | window.tankobon.settings.getApiKeys | SETTINGS_CHANNELS.getApiKeys in src/main/ipc/settings.ts | The metadata sources' API keys, kept out of getAll() so only the page that edits them loads them. |
settings:set | renderer → main (invoke) | window.tankobon.settings.set | SETTINGS_CHANNELS.set in src/main/ipc/settings.ts | Stores one setting; the main process refuses an unknown key or a value its validator rejects. |
stats:add-reading-time | renderer → main (invoke) | window.tankobon.stats.addReadingTime | STATS_CHANNELS.addReadingTime in src/main/ipc/stats.ts | Adds seconds (1 to 3600) of reading time on a library entry to today; the reader reports it every few minutes while a book is open. |
stats:clear-history | renderer → main (invoke) | window.tankobon.stats.clearHistory | STATS_CHANNELS.clearHistory in src/main/ipc/stats.ts | Deletes the active user's reading history (the time spent per book and day, hence the statistics' reading time too); books, progress and completion dates are kept. |
stats:get | renderer → main (invoke) | window.tankobon.stats.get | STATS_CHANNELS.get in src/main/ipc/stats.ts | The reading history: the dates at which books were finished and the reading time per day, oldest first. |
stats:history | renderer → main (invoke) | window.tankobon.stats.history | STATS_CHANNELS.history in src/main/ipc/stats.ts | The active user's reading history for the profile page: reading time per day and book, most recent first, at most 200 lines. |
users:create | renderer → main (invoke) | window.tankobon.users.create | USER_CHANNELS.create in src/main/ipc/users.ts | Adds a user (nickname trimmed, not empty, unique ignoring case) with the default picture; it doesn't switch to them. |
users:list | renderer → main (invoke) | window.tankobon.users.list | USER_CHANNELS.list in src/main/ipc/users.ts | Every user and the active one's id. |
users:pick-avatar | renderer → main (invoke) | window.tankobon.users.pickAvatar | USER_CHANNELS.pickAvatar in src/main/ipc/users.ts | Opens a native picker for the active user's picture and returns the picked file's bytes (a PNG, JPEG or WebP), for the renderer to shrink before setAvatar(). |
users:remove | renderer → main (invoke) | window.tankobon.users.remove | USER_CHANNELS.remove in src/main/ipc/users.ts | Deletes the active user and all their personal data (progress, ratings, tags, lists, statistics, achievements, settings); the library is untouched. Refused for the last remaining user. On success the result is the user the app switched to. |
users:remove-avatar | renderer → main (invoke) | window.tankobon.users.removeAvatar | USER_CHANNELS.removeAvatar in src/main/ipc/users.ts | Puts the active user's default picture back. |
users:rename | renderer → main (invoke) | window.tankobon.users.rename | USER_CHANNELS.rename in src/main/ipc/users.ts | Changes the active user's nickname. |
users:set-avatar | renderer → main (invoke) | window.tankobon.users.setAvatar | USER_CHANNELS.setAvatar in src/main/ipc/users.ts | Stores the active user's picture (PNG, JPEG or WebP of at most 256 KiB). |
users:switch | renderer → main (invoke) | window.tankobon.users.switch | USER_CHANNELS.switch in src/main/ipc/users.ts | Makes another user the active one: everything personal, and the interface language, follow. data:changed announces it to every window. |