Commit graph

80 commits

Author SHA1 Message Date
9f9e59b450
refactor epPicker into smaller functions using ExceptT 2026-07-11 15:47:00 +01:00
8be29359fc
add Html and PlainText types, improved type safety 2026-07-07 13:33:51 +01:00
6ca9e43520
keybinds: toggling paginated/scrolling, focus/unfocus search bar 2026-07-06 17:44:39 +01:00
4170a958d1
feature: add split page, scrolled or paginated tracking 2026-07-06 17:44:24 +01:00
4e990f19cd
add book-wide text search 2026-07-06 01:16:57 +01:00
da70b3ccf2
add LRU cache 2026-07-05 01:45:47 +01:00
81c2caaf67
add worker thread tracking
add stGen which gets bumped for every worker thread spawned by
loadBook

every thread captures stGen when it spawns and before actually loading
the book in the main thread, and in the worker thread it checks if
myGen == stGen

this throws away stale requests, meaning if you try and load another
book while one is still loading, it will ignore the one still loading
and start loading the latest request
2026-07-02 02:50:31 +01:00
f6ec5c20d8
allow loading of new epub through file picker
ctxRender changed to a TVar to allow mutability of the render

make loadBook reset stCache and stIndex

write render TVar right before handing off to main thread

remove everything from the sidebar ListBox before populating it again
2026-07-01 20:05:04 +01:00
05fdac1253
add header bar 2026-06-30 23:21:55 +01:00
2011d638b0
refactor: streaming loader, hierarchical TOC, parser robustness
Rework the reader around a clean BookInfo interface and lazy chapter loading.

Types/parser:
- BookInfo now splits into loadStructure (cheap: spine refs + TOC tree) and renderChapter (one chapter on demand). EpubEnv carries the parsed archive.
- resolveZipPath collapses ./.. and strips #fragments (normalise does not), so relative hrefs like ../Images/x.jpg resolve; used for chapters and images.
- decodeEntry tolerates encodings: UTF-8/UTF-16 BOMs, Latin-1 fallback instead of throwing on invalid bytes.
- Skip spine items with no manifest entry instead of throwing an error.
- Scan the zip for a .opf if container.xml is missing.
- Image inlining rewrites the src URL string, not the whole <img> tag (scalpel
  re-serialises tags, so a whole-tag replace silently missed self-closing imgs).

Navigation:
- Hierarchical TOC: ncxToc (EPUB 2), navToc (EPUB 3), guideToc (<guide> fallback). Nested scrapers use atDepth 1 to take only direct children.

UI:
- Streaming: render the opened chapter on demand, cache it, preload neighbours so arrow paging is instant with a placeholder that covers uncached jumps.
- Sidebar shows the TOC tree with CSS styling. Clicks scroll to #fragments.
- wrapHtml wraps each body in a full HTML document for reliable WebKit render.

Test: 'svitak-test <book> <idx>' dumps one rendered chapter. cabal test stanza fixed to list all needed modules/deps.
2026-06-26 03:45:29 +01:00
269c2055f1
fix: build outside the guix container, run the binary inside
The dev shell (guix shell -D) has the full toolchain and network, so the build happens there.
The isolated 'guix shell -C -N' container only runs the already-compiled binary, which needs just the GTK/WebKit C libraries via LD_LIBRARY_PATH.
Also export WEBKIT_DISABLE_COMPOSITING_MODE and WEBKIT_DISABLE_DMABUF_RENDERER, without which WebKit renders a blank surface inside the sandbox.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-26 03:44:18 +01:00
f17f6a63e2
improve chapter name sanitization 2026-06-25 22:08:53 +01:00
237d653d69
fix guix dev setup, add hls to dev env 2026-06-23 23:50:49 +01:00
16cde4bbac
remove flake 2026-03-28 09:04:20 +00:00
dcf7ce2971
remove redundant imports 2026-03-23 01:42:44 +00:00
9784b7c7de
improve error handling 2026-03-22 03:24:56 +00:00
5266e68d0b
fix: explicitly export environment in shell
cabal has weird quirks which requires this to be done
2026-03-21 17:31:38 +00:00
a5f227fc7a
finish navigation implementation in epubparser 2026-03-19 02:31:01 +00:00
36d6d46c57
remove repeated function 2026-03-19 02:31:01 +00:00
ec47012b5f
add epub3 navigation parsing 2026-03-19 02:31:01 +00:00
2fd5982020
improve environment setup for guix users 2026-03-19 02:30:51 +00:00
37ee16bcf8
refactor ui 2026-02-27 21:57:46 +00:00
5f9369e882
add ghc flags
gtk multithreading doesn't work properly without passing -threaded
added -O for performance
2026-02-27 21:54:44 +00:00
fd05214fee
epub version awareness 2026-02-23 02:28:02 +00:00
acd221be28
epub version detection 2026-02-23 01:30:54 +00:00
c7850d3ad1
fix imports 2026-02-22 23:50:45 +00:00
0aefe97fbf
manifest 2026-02-22 23:50:44 +00:00
3001f66d64
update flake 2026-02-22 05:33:34 +00:00
41201ebb58
temporary change 2026-02-20 22:57:46 +00:00
ff6772c7c1
add flake file 2026-02-20 16:42:34 +00:00
80be08965e implement generic bookinfo and move logic to parser 2026-02-12 12:47:01 +00:00
55b04ecf44 explicit types 2026-02-12 11:17:36 +00:00
7cd9e79c94 add navigation module 2026-02-11 06:22:09 +00:00
96924df78f compressed function rewrite 2026-02-11 03:50:42 +00:00
0a43a51205 epub3 nav support 2026-02-11 03:07:49 +00:00
8ebfc59d2b page tracking 2026-02-09 04:11:59 +00:00
be79979183 safe indexing 2026-02-09 03:31:09 +00:00
d65a483878 nxc parsing 2026-02-09 03:15:06 +00:00
4ddb090b2f table of contents integration 2026-02-08 03:02:54 +00:00
eb479d0ae3 break up UI into different functions 2026-02-07 03:07:14 +00:00
de7a64cade replace tagsoup with scalpel 2026-02-04 06:15:20 +00:00
b24288eb70 add seperate types module 2026-02-05 03:25:31 +00:00
4c6c181e65 implement consistent formatting 2026-02-04 05:07:48 +00:00
1cab6a9bab seperate state handling logic 2026-02-04 03:51:47 +00:00
28e5d6ec36 seperate pure functions from IO 2026-02-04 02:38:17 +00:00
a53ef52902 Documentation 2026-02-04 02:12:28 +00:00
a41828dbbd Eager parsing on seperate thread 2026-01-28 19:21:10 +00:00
e1682a861a Implement STM Concurrency
add stm to project file
2026-01-28 18:18:41 +00:00
018e5290a3 feature:MVar Implementation
Replace IORef

Branch created to replace the use of IORef with MVar
2026-01-26 13:44:06 +00:00
83a767968b refactor:remove gui.hs 2026-01-27 21:38:28 +00:00