dlxj commited on
Commit
4e1096a
·
1 Parent(s): 98cbcde
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. .dockerignore +31 -0
  2. .editorconfig +3 -0
  3. .gitattributes +2 -0
  4. .github/FUNDING.yml +15 -0
  5. .github/ISSUE_TEMPLATE/feature-request.md +23 -0
  6. .github/ISSUE_TEMPLATE/report-bug.md +35 -0
  7. .github/dependabot.yml +13 -0
  8. .github/workflows/pull-request.yml +93 -0
  9. .github/workflows/release.yml +401 -0
  10. .github/workflows/retry-workflow.yml +18 -0
  11. .github/workflows/upload-to-r2.yml +77 -0
  12. .github/workflows/vercel-merge.yml +23 -0
  13. .gitignore +49 -0
  14. .gitmodules +12 -0
  15. .prettierignore +34 -0
  16. .prettierrc.json +10 -0
  17. .vscode/extensions.json +8 -0
  18. .vscode/settings.json +31 -0
  19. CONTRIBUTING.md +104 -0
  20. Cargo.lock +0 -0
  21. Cargo.toml +42 -0
  22. Dockerfile +40 -0
  23. LICENSE +661 -0
  24. README.md +362 -0
  25. apps/readest-app/.env +12 -0
  26. apps/readest-app/.env.local.example +32 -0
  27. apps/readest-app/.env.tauri +3 -0
  28. apps/readest-app/.env.tauri.example +2 -0
  29. apps/readest-app/.env.web +1 -0
  30. apps/readest-app/.env.web.example +3 -0
  31. apps/readest-app/.gitignore +62 -0
  32. apps/readest-app/components.json +22 -0
  33. apps/readest-app/eslint.config.mjs +35 -0
  34. apps/readest-app/extensions/windows-thumbnail/Cargo.lock +588 -0
  35. apps/readest-app/extensions/windows-thumbnail/Cargo.toml +31 -0
  36. apps/readest-app/extensions/windows-thumbnail/README.md +134 -0
  37. apps/readest-app/extensions/windows-thumbnail/src/com_provider.rs +506 -0
  38. apps/readest-app/extensions/windows-thumbnail/src/extraction.rs +648 -0
  39. apps/readest-app/extensions/windows-thumbnail/src/mod.rs +13 -0
  40. apps/readest-app/i18next-scanner.config.js +60 -0
  41. apps/readest-app/next.config.mjs +106 -0
  42. apps/readest-app/open-next.config.ts +6 -0
  43. apps/readest-app/package.json +198 -0
  44. apps/readest-app/postcss.config.mjs +9 -0
  45. apps/readest-app/public/.well-known/apple-app-site-association +17 -0
  46. apps/readest-app/public/.well-known/assetlinks.json +16 -0
  47. apps/readest-app/public/.well-known/org.flathub.VerifiedApps.txt +1 -0
  48. apps/readest-app/public/apple-touch-icon.png +3 -0
  49. apps/readest-app/public/favicon.ico +0 -0
  50. apps/readest-app/public/fonts/InterVariable-Italic.woff2 +3 -0
.dockerignore ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Dependencies
2
+ node_modules
3
+ **/node_modules
4
+
5
+ # Rust build artifacts
6
+ target
7
+ **/target
8
+
9
+ # Git
10
+ .git
11
+ .gitignore
12
+
13
+ # Build outputs
14
+ .next
15
+ **/.next
16
+ out
17
+ **/out
18
+
19
+ # IDE
20
+ .idea
21
+ .vscode
22
+ *.swp
23
+
24
+ # OS files
25
+ .DS_Store
26
+ Thumbs.db
27
+
28
+ # Logs
29
+ *.log
30
+ npm-debug.log*
31
+
.editorconfig ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ [*.{ts,tsx}]
2
+ indent_style = space
3
+ indent_size = 2
.gitattributes CHANGED
@@ -1,4 +1,6 @@
1
  *.7z filter=lfs diff=lfs merge=lfs -text
 
 
2
  *.arrow filter=lfs diff=lfs merge=lfs -text
3
  *.avro filter=lfs diff=lfs merge=lfs -text
4
  *.bin filter=lfs diff=lfs merge=lfs -text
 
1
  *.7z filter=lfs diff=lfs merge=lfs -text
2
+ *.woff2 filter=lfs diff=lfs merge=lfs -text
3
+ *.icns filter=lfs diff=lfs merge=lfs -text
4
  *.arrow filter=lfs diff=lfs merge=lfs -text
5
  *.avro filter=lfs diff=lfs merge=lfs -text
6
  *.bin filter=lfs diff=lfs merge=lfs -text
.github/FUNDING.yml ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # These are supported funding model platforms
2
+
3
+ github: ['readest']
4
+ patreon: # Replace with a single Patreon username
5
+ open_collective: # Replace with a single Open Collective username
6
+ ko_fi: # Replace with a single Ko-fi username
7
+ tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
8
+ community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
9
+ liberapay: # Replace with a single Liberapay username
10
+ issuehunt: # Replace with a single IssueHunt username
11
+ lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry
12
+ polar: # Replace with a single Polar username
13
+ buy_me_a_coffee: # Replace with a single Buy Me a Coffee username
14
+ thanks_dev: # Replace with a single thanks.dev username
15
+ custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
.github/ISSUE_TEMPLATE/feature-request.md ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ name: Feature request
3
+ about: Share an idea or suggestion
4
+ title: 'FR: describing your feature request'
5
+ labels: enhancement
6
+ assignees: ''
7
+ ---
8
+
9
+ **Does your feature request involve difficulty for you to complete a task? Please describe.**
10
+
11
+ > A clear and concise description of what the problem is. Ex. I think it takes too many steps to [...]
12
+
13
+ **Describe the solution you'd like**
14
+
15
+ > A clear and concise description of what you'd like to happen.
16
+
17
+ **Describe alternatives you've considered**
18
+
19
+ > A clear and concise description of any alternative solutions or features you've considered.
20
+
21
+ **Additional context**
22
+
23
+ > Add any additional context or screenshots about the feature request here.
.github/ISSUE_TEMPLATE/report-bug.md ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ name: Report a bug
3
+ about: Report a bug or a functional regression
4
+ title: 'Example: In DarkMode, a blank square appears in bottom right corner while scrolling'
5
+ labels: ['type: bug']
6
+ assignees: ''
7
+ ---
8
+
9
+ ## Bug Description
10
+
11
+ A clear and concise description of what the current behavior is.
12
+ Please also add **screenshots** of the existing application.
13
+
14
+ > **Example:**
15
+ > In DarkMode, when scrollbar are displayed (for example on Companies page, with enough companies in the list), we see a blank square in the bottom right corner
16
+ > [screenshot]
17
+
18
+ ## Expected behavior
19
+
20
+ A clear and concise description of what the expected behavior is.
21
+
22
+ > **Example:**
23
+ > The blank square should be transparent (invisible)
24
+
25
+ ## Technical inputs
26
+
27
+ Operating System:
28
+
29
+ Readest Version:
30
+
31
+ > **Example:**
32
+ > Operating System: Android 14 (WebView 135.0)
33
+ > Readest Version: 0.9.0
34
+ > We are displaying custom scrollbars that disappear when the user is not scrolling. See ScrollWrapper.
35
+ > Probably fixable with CSS
.github/dependabot.yml ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Keep GitHub Actions up to date with GitHub's Dependabot...
2
+ # https://docs.github.com/en/code-security/dependabot/working-with-dependabot/keeping-your-actions-up-to-date-with-dependabot
3
+ # https://docs.github.com/en/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file#package-ecosystem
4
+ version: 2
5
+ updates:
6
+ - package-ecosystem: github-actions
7
+ directory: /
8
+ groups:
9
+ github-actions:
10
+ patterns:
11
+ - '*' # Group all Actions updates into a single larger pull request
12
+ schedule:
13
+ interval: weekly
.github/workflows/pull-request.yml ADDED
@@ -0,0 +1,93 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ name: PR checks
2
+ on:
3
+ pull_request:
4
+ branches: [main]
5
+ permissions:
6
+ contents: write
7
+ pull-requests: write
8
+ jobs:
9
+ rust_lint:
10
+ runs-on: ubuntu-latest
11
+ env:
12
+ RUSTFLAGS: '-C target-cpu=skylake'
13
+ steps:
14
+ - uses: actions/checkout@v6
15
+ with:
16
+ submodules: 'true'
17
+ - name: Install minimal stable with clippy and rustfmt
18
+ uses: actions-rust-lang/setup-rust-toolchain@v1
19
+ with:
20
+ toolchain: stable
21
+ override: true
22
+ components: rustfmt, clippy
23
+ - name: Install system dependencies
24
+ run: |
25
+ sudo apt-get update
26
+ sudo apt-get install -y pkg-config libfontconfig-dev libglib2.0-dev libgtk-3-dev libwebkit2gtk-4.1-dev libappindicator3-dev librsvg2-dev libsoup-3.0-dev
27
+ - name: Format
28
+ working-directory: apps/readest-app/src-tauri
29
+ run: cargo fmt --check
30
+ - name: Clippy Check
31
+ working-directory: apps/readest-app/src-tauri
32
+ run: cargo clippy -p Readest --no-deps -- -D warnings
33
+
34
+ build_web_app:
35
+ runs-on: ubuntu-latest
36
+ strategy:
37
+ matrix:
38
+ config:
39
+ - platform: 'web'
40
+ - platform: 'tauri'
41
+ steps:
42
+ - uses: actions/checkout@v6
43
+ with:
44
+ submodules: 'true'
45
+
46
+ - name: setup pnpm
47
+ uses: pnpm/action-setup@v4
48
+
49
+ - name: setup node
50
+ uses: actions/setup-node@v6
51
+ with:
52
+ node-version: 22
53
+ cache: pnpm
54
+
55
+ - name: cache Next.js build
56
+ uses: actions/cache@v5
57
+ with:
58
+ path: apps/readest-app/.next/cache
59
+ key: nextjs-${{ matrix.config.platform }}-${{ github.sha }}-${{ hashFiles('pnpm-lock.yaml') }}
60
+ restore-keys: |
61
+ nextjs-${{ matrix.config.platform }}-${{ github.sha }}-
62
+ nextjs-${{ matrix.config.platform }}-
63
+
64
+ - name: install Dependencies
65
+ working-directory: apps/readest-app
66
+ run: |
67
+ pnpm install && pnpm setup-vendors
68
+
69
+ - name: run format check
70
+ run: |
71
+ pnpm format:check || (pnpm format && git diff && exit 1)
72
+
73
+ - name: run tests
74
+ working-directory: apps/readest-app
75
+ run: |
76
+ pnpm test -- --watch=false
77
+
78
+ - name: run lint
79
+ working-directory: apps/readest-app
80
+ run: |
81
+ pnpm lint
82
+
83
+ - name: build the web App
84
+ if: matrix.config.platform == 'web'
85
+ working-directory: apps/readest-app
86
+ run: |
87
+ pnpm build-web && pnpm check:all
88
+
89
+ - name: build the Tauri App
90
+ if: matrix.config.platform == 'tauri'
91
+ working-directory: apps/readest-app
92
+ run: |
93
+ pnpm build && pnpm check:all
.github/workflows/release.yml ADDED
@@ -0,0 +1,401 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ name: Release Readest
2
+
3
+ on:
4
+ workflow_dispatch:
5
+ release:
6
+ types: [published]
7
+
8
+ jobs:
9
+ get-release:
10
+ permissions:
11
+ contents: write
12
+ runs-on: ubuntu-latest
13
+ outputs:
14
+ release_id: ${{ steps.get-release.outputs.release_id }}
15
+ release_tag: ${{ steps.get-release.outputs.release_tag }}
16
+ release_note: ${{ steps.get-release-notes.outputs.release_note }}
17
+ release_version: ${{ steps.get-release-notes.outputs.release_version }}
18
+
19
+ steps:
20
+ - uses: actions/checkout@v6
21
+ - name: setup node
22
+ uses: actions/setup-node@v6
23
+ - name: get version
24
+ run: echo "PACKAGE_VERSION=$(node -p "require('./apps/readest-app/package.json').version")" >> $GITHUB_ENV
25
+ - name: get release
26
+ id: get-release
27
+ uses: actions/github-script@v8
28
+ with:
29
+ script: |
30
+ const { data } = await github.rest.repos.getLatestRelease({
31
+ owner: context.repo.owner,
32
+ repo: context.repo.repo,
33
+ })
34
+ core.setOutput('release_id', data.id);
35
+ core.setOutput('release_tag', data.tag_name);
36
+ - name: get release notes
37
+ id: get-release-notes
38
+ uses: actions/github-script@v8
39
+ with:
40
+ script: |
41
+ const fs = require('fs');
42
+ const version = require('./apps/readest-app/package.json').version;
43
+ const releaseNotesFileContent = fs.readFileSync('./apps/readest-app/release-notes.json', 'utf8');
44
+ const releaseNotes = JSON.parse(releaseNotesFileContent).releases[version] || {};
45
+ const notes = releaseNotes.notes || [];
46
+ const releaseNote = notes.map((note, index) => `${index + 1}. ${note}`).join(' ');
47
+ console.log('Formatted release note:', releaseNote);
48
+ core.setOutput('release_version', version);
49
+ core.setOutput('release_note', releaseNote);
50
+
51
+ update-release:
52
+ permissions:
53
+ contents: write
54
+ runs-on: ubuntu-latest
55
+ needs: get-release
56
+
57
+ steps:
58
+ - name: update release
59
+ id: update-release
60
+ uses: actions/github-script@v8
61
+ env:
62
+ release_id: ${{ needs.get-release.outputs.release_id }}
63
+ release_tag: ${{ needs.get-release.outputs.release_tag }}
64
+ release_note: ${{ needs.get-release.outputs.release_note }}
65
+ with:
66
+ script: |
67
+ const { data } = await github.rest.repos.generateReleaseNotes({
68
+ owner: context.repo.owner,
69
+ repo: context.repo.repo,
70
+ tag_name: process.env.release_tag,
71
+ })
72
+ const notes = process.env.release_note.split(/\d+\.\s/).filter(Boolean);
73
+ const formattedNotes = notes.map(note => `* ${note.trim()}`).join("\n");
74
+ const body = `## Release Highlight\n${formattedNotes}\n\n${data.body}`;
75
+ github.rest.repos.updateRelease({
76
+ owner: context.repo.owner,
77
+ repo: context.repo.repo,
78
+ release_id: process.env.release_id,
79
+ body: body,
80
+ draft: false,
81
+ prerelease: false
82
+ })
83
+
84
+ build-koreader-plugin:
85
+ needs: get-release
86
+ permissions:
87
+ contents: write
88
+ runs-on: ubuntu-latest
89
+ steps:
90
+ - uses: actions/checkout@v6
91
+
92
+ - name: create KOReader plugin zip
93
+ env:
94
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
95
+ run: |
96
+ version=${{ needs.get-release.outputs.release_version }}
97
+ plugin_zip="Readest-${version}-1.koplugin.zip"
98
+ meta_file="apps/readest.koplugin/_meta.lua"
99
+ perl -i -pe "s/^}/ version = \"${version}\",\n}/" "${meta_file}"
100
+
101
+ cd apps
102
+ zip -r ../${plugin_zip} readest.koplugin
103
+ cd ..
104
+
105
+ echo "Uploading ${plugin_zip} to GitHub release"
106
+ gh release upload ${{ needs.get-release.outputs.release_tag }} ${plugin_zip} --clobber
107
+
108
+ build-tauri:
109
+ needs: get-release
110
+ permissions:
111
+ contents: write
112
+ strategy:
113
+ fail-fast: false
114
+ matrix:
115
+ config:
116
+ - os: ubuntu-latest
117
+ release: android
118
+ rust_target: aarch64-linux-android,armv7-linux-androideabi,i686-linux-android,x86_64-linux-android
119
+ - os: ubuntu-22.04
120
+ release: linux
121
+ arch: x86_64
122
+ rust_target: x86_64-unknown-linux-gnu
123
+ - os: ubuntu-22.04-arm
124
+ release: linux
125
+ arch: aarch64
126
+ rust_target: aarch64-unknown-linux-gnu
127
+ - os: ubuntu-22.04-arm
128
+ release: linux
129
+ arch: armhf
130
+ rust_target: arm-unknown-linux-gnueabihf
131
+ args: '--target arm-unknown-linux-gnueabihf --bundles deb'
132
+ - os: macos-latest
133
+ release: macos
134
+ arch: aarch64
135
+ rust_target: x86_64-apple-darwin,aarch64-apple-darwin
136
+ args: '--target universal-apple-darwin'
137
+ - os: windows-latest
138
+ release: windows
139
+ arch: x86_64
140
+ rust_target: x86_64-pc-windows-msvc
141
+ args: '--target x86_64-pc-windows-msvc --bundles nsis'
142
+ - os: windows-latest
143
+ release: windows
144
+ arch: aarch64
145
+ rust_target: aarch64-pc-windows-msvc
146
+ args: '--target aarch64-pc-windows-msvc --bundles nsis'
147
+
148
+ runs-on: ${{ matrix.config.os }}
149
+ timeout-minutes: 60
150
+ steps:
151
+ - uses: actions/checkout@v6
152
+
153
+ - name: initialize git submodules
154
+ run: git submodule update --init --recursive
155
+
156
+ - name: setup pnpm
157
+ uses: pnpm/action-setup@v4
158
+
159
+ - name: setup node
160
+ uses: actions/setup-node@v6
161
+ with:
162
+ node-version: 22
163
+ cache: pnpm
164
+
165
+ - name: setup Java (for Android build only)
166
+ if: matrix.config.release == 'android'
167
+ uses: actions/setup-java@v5
168
+ with:
169
+ distribution: 'zulu'
170
+ java-version: '17'
171
+
172
+ - name: setup Android SDK (for Android build only)
173
+ if: matrix.config.release == 'android'
174
+ uses: android-actions/setup-android@v3
175
+
176
+ - name: install NDK (for Android build only)
177
+ if: matrix.config.release == 'android'
178
+ run: sdkmanager "ndk;28.2.13676358"
179
+
180
+ - name: install dependencies
181
+ run: pnpm install
182
+
183
+ - name: copy pdfjs-dist and simplecc-dist to public directory
184
+ run: pnpm --filter @readest/readest-app setup-vendors
185
+
186
+ - name: install Rust stable
187
+ uses: dtolnay/rust-toolchain@stable
188
+ with:
189
+ targets: ${{ matrix.config.rust_target }}
190
+
191
+ - uses: Swatinem/rust-cache@v2
192
+ with:
193
+ key: ${{ matrix.config.os }}-${{ matrix.config.release }}-${{ matrix.config.arch }}-cargo
194
+
195
+ - name: install dependencies (ubuntu only)
196
+ if: contains(matrix.config.os, 'ubuntu') && matrix.config.release != 'android' && matrix.config.arch != 'armhf'
197
+ run: |
198
+ sudo apt-get update
199
+ sudo apt-get install -y pkg-config libfontconfig-dev libgtk-3-dev libwebkit2gtk-4.1-dev libappindicator3-dev librsvg2-dev patchelf xdg-utils
200
+
201
+ - name: install dependencies (ubuntu only - armhf specific)
202
+ if: contains(matrix.config.os, 'ubuntu') && matrix.config.arch == 'armhf'
203
+ run: |
204
+ sudo dpkg --add-architecture armhf
205
+ sudo apt-get update
206
+ sudo apt-get install -y pkg-config libfontconfig-dev:armhf libgtk-3-dev:armhf libwebkit2gtk-4.1-dev:armhf libappindicator3-dev:armhf librsvg2-dev:armhf gcc-arm-linux-gnueabihf g++-arm-linux-gnueabihf
207
+ echo 'PKG_CONFIG_ALLOW_CROSS=1' >> $GITHUB_ENV
208
+ echo 'PKG_CONFIG_PATH=/usr/lib/arm-linux-gnueabihf/pkgconfig:/usr/share/pkgconfig' >> $GITHUB_ENV
209
+ echo 'PKG_CONFIG_SYSROOT_DIR=/usr/arm-linux-gnueabihf' >> $GITHUB_ENV
210
+ echo 'CARGO_TARGET_ARM_UNKNOWN_LINUX_GNUEABIHF_LINKER=arm-linux-gnueabihf-gcc' >> $GITHUB_ENV
211
+
212
+ - name: create .env.local file for Next.js
213
+ run: |
214
+ echo "NEXT_PUBLIC_POSTHOG_KEY=${{ secrets.NEXT_PUBLIC_POSTHOG_KEY }}" >> .env.local
215
+ echo "NEXT_PUBLIC_POSTHOG_HOST=${{ secrets.NEXT_PUBLIC_POSTHOG_HOST }}" >> .env.local
216
+ echo "NEXT_PUBLIC_SUPABASE_URL=${{ secrets.NEXT_PUBLIC_SUPABASE_URL }}" >> .env.local
217
+ echo "NEXT_PUBLIC_SUPABASE_ANON_KEY=${{ secrets.NEXT_PUBLIC_SUPABASE_ANON_KEY }}" >> .env.local
218
+ echo "NEXT_PUBLIC_APP_PLATFORM=tauri" >> .env.local
219
+ cp .env.local apps/readest-app/.env.local
220
+
221
+ - name: build and upload Android apks
222
+ if: matrix.config.release == 'android'
223
+ env:
224
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
225
+ NDK_HOME: ${{ env.ANDROID_HOME }}/ndk/28.2.13676358
226
+ TAURI_PRIVATE_KEY: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY }}
227
+ TAURI_PRIVATE_KEY_PASSWORD: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY_PASSWORD }}
228
+ run: |
229
+ cd apps/readest-app/
230
+ rm -rf src-tauri/gen/android
231
+ pnpm tauri android init
232
+ pnpm tauri icon ../../data/icons/readest-book.png
233
+ git checkout .
234
+
235
+ pushd src-tauri/gen/android
236
+ echo "keyAlias=${{ secrets.ANDROID_KEY_ALIAS }}" > keystore.properties
237
+ echo "password=${{ secrets.ANDROID_KEY_PASSWORD }}" >> keystore.properties
238
+ base64 -d <<< "${{ secrets.ANDROID_KEY_BASE64 }}" > $RUNNER_TEMP/keystore.jks
239
+ echo "storeFile=$RUNNER_TEMP/keystore.jks" >> keystore.properties
240
+
241
+ popd
242
+ version=${{ needs.get-release.outputs.release_version }}
243
+ apk_path=src-tauri/gen/android/app/build/outputs/apk/universal/release
244
+ universial_apk=Readest_${version}_universal.apk
245
+ arm64_apk=Readest_${version}_arm64.apk
246
+ pnpm tauri android build
247
+ cp ${apk_path}/app-universal-release.apk $universial_apk
248
+ pnpm tauri android build -t aarch64
249
+ cp ${apk_path}/app-universal-release.apk $arm64_apk
250
+
251
+ echo "Uploading $universial_apk to GitHub release"
252
+ gh release upload ${{ needs.get-release.outputs.release_tag }} $universial_apk --clobber
253
+ echo "Uploading $arm64_apk to GitHub release"
254
+ gh release upload ${{ needs.get-release.outputs.release_tag }} $arm64_apk --clobber
255
+ echo "Uploading signatures to GitHub release"
256
+ pnpm tauri signer sign $universial_apk
257
+ pnpm tauri signer sign $arm64_apk
258
+ gh release upload ${{ needs.get-release.outputs.release_tag }} $universial_apk.sig --clobber
259
+ gh release upload ${{ needs.get-release.outputs.release_tag }} $arm64_apk.sig --clobber
260
+
261
+ - name: download and update latest.json for Android release
262
+ if: matrix.config.release == 'android'
263
+ env:
264
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
265
+ run: |
266
+ cd apps/readest-app/
267
+ curl -sL https://github.com/readest/readest/releases/latest/download/latest.json -o latest.json
268
+
269
+ version=${{ needs.get-release.outputs.release_version }}
270
+ universial_apk_url="https://github.com/readest/readest/releases/download/${{ needs.get-release.outputs.release_tag }}/Readest_${version}_universal.apk"
271
+ arm64_apk_url="https://github.com/readest/readest/releases/download/${{ needs.get-release.outputs.release_tag }}/Readest_${version}_arm64.apk"
272
+
273
+ universial_sig=$(cat Readest_${version}_universal.apk.sig)
274
+ arm64_sig=$(cat Readest_${version}_arm64.apk.sig)
275
+
276
+ jq --arg url "$universial_apk_url" \
277
+ --arg sig "$universial_sig" \
278
+ '.platforms["android-universal"] = {signature: $sig, url: $url}' latest.json > tmp.$$.json && mv tmp.$$.json latest.json
279
+
280
+ jq --arg url "$arm64_apk_url" \
281
+ --arg sig "$arm64_sig" \
282
+ '.platforms["android-arm64"] = {signature: $sig, url: $url}' latest.json > tmp.$$.json && mv tmp.$$.json latest.json
283
+
284
+ echo "Uploading updated latest.json to GitHub release"
285
+ gh release upload ${{ needs.get-release.outputs.release_tag }} latest.json --clobber
286
+
287
+ - name: Override tauri-cli with custom AppImage format (Linux)
288
+ if: matrix.config.release == 'linux'
289
+ run: cargo install tauri-cli --git https://github.com/tauri-apps/tauri --branch feat/truly-portable-appimage --force
290
+
291
+ - uses: tauri-apps/tauri-action@v0
292
+ if: matrix.config.release != 'android'
293
+ env:
294
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
295
+ TAURI_BUNDLER_NEW_APPIMAGE_FORMAT: 'true'
296
+ TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY }}
297
+ TAURI_SIGNING_PRIVATE_KEY_PASSWORD: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY_PASSWORD }}
298
+ APPLE_CERTIFICATE: ${{ secrets.APPLE_CERTIFICATE }}
299
+ APPLE_CERTIFICATE_PASSWORD: ${{ secrets.APPLE_CERTIFICATE_PASSWORD }}
300
+ APPLE_SIGNING_IDENTITY: ${{ secrets.APPLE_SIGNING_IDENTITY }}
301
+ APPLE_ID: ${{ secrets.APPLE_ID }}
302
+ APPLE_PASSWORD: ${{ secrets.APPLE_PASSWORD }}
303
+ APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}
304
+ NODE_OPTIONS: '--max-old-space-size=8192'
305
+ with:
306
+ projectPath: apps/readest-app
307
+ releaseId: ${{ needs.get-release.outputs.release_id }}
308
+ releaseBody: ${{ needs.get-release.outputs.release_note }}
309
+ args: ${{ matrix.config.args || '' }}
310
+
311
+ - name: upload release notes to GitHub release
312
+ env:
313
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
314
+ run: |
315
+ echo "Uploading release notes to GitHub release"
316
+ gh release upload ${{ needs.get-release.outputs.release_tag }} apps/readest-app/release-notes.json --clobber
317
+
318
+ - name: build and upload portable binaries (Windows only)
319
+ if: matrix.config.os == 'windows-latest'
320
+ env:
321
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
322
+ TAURI_PRIVATE_KEY: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY }}
323
+ TAURI_PRIVATE_KEY_PASSWORD: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY_PASSWORD }}
324
+ TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY }}
325
+ TAURI_SIGNING_PRIVATE_KEY_PASSWORD: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY_PASSWORD }}
326
+ shell: bash
327
+ run: |
328
+ echo "Building Portable Binaries"
329
+ pushd apps/readest-app/
330
+ echo "NEXT_PUBLIC_PORTABLE_APP=true" >> .env.local
331
+ pnpm tauri build ${{ matrix.config.args }}
332
+
333
+ popd
334
+ echo "Uploading Portable Binaries"
335
+ arch=${{ matrix.config.arch }}
336
+ version=${{ needs.get-release.outputs.release_version }}
337
+
338
+ if [ "$arch" = "x86_64" ]; then
339
+ bin_file="Readest_${version}_x64-portable.exe"
340
+ elif [ "$arch" = "aarch64" ]; then
341
+ bin_file="Readest_${version}_arm64-portable.exe"
342
+ else
343
+ echo "Unknown architecture: $arch"
344
+ exit 1
345
+ fi
346
+
347
+ exe_file="target/${{ matrix.config.rust_target }}/release/readest.exe"
348
+ # Browsers on Windows won't download zip files that contain exe files
349
+ # so upload the exe files instead. This is totally stupid.
350
+ # powershell.exe -Command "Compress-Archive -Path $exe_file -DestinationPath $bin_file -Force"
351
+ cp $exe_file $bin_file
352
+
353
+ echo "Uploading $bin_file to GitHub release"
354
+ gh release upload ${{ needs.get-release.outputs.release_tag }} $bin_file --clobber
355
+
356
+ echo "Signing portable binary"
357
+ pushd apps/readest-app/
358
+ pnpm tauri signer sign "../../$bin_file"
359
+ popd
360
+ echo "Uploading signature to GitHub release"
361
+ gh release upload ${{ needs.get-release.outputs.release_tag }} $bin_file.sig --clobber
362
+
363
+ - name: download and update latest.json for Windows portable release
364
+ if: matrix.config.os == 'windows-latest'
365
+ env:
366
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
367
+ shell: bash
368
+ run: |
369
+ curl -sL https://github.com/readest/readest/releases/latest/download/latest.json -o latest.json
370
+
371
+ version=${{ needs.get-release.outputs.release_version }}
372
+ arch=${{ matrix.config.arch }}
373
+
374
+ if [ "$arch" = "x86_64" ]; then
375
+ bin_file="Readest_${version}_x64-portable.exe"
376
+ platform_key="windows-x86_64-portable"
377
+ elif [ "$arch" = "aarch64" ]; then
378
+ bin_file="Readest_${version}_arm64-portable.exe"
379
+ platform_key="windows-aarch64-portable"
380
+ else
381
+ echo "Unknown architecture: $arch"
382
+ exit 1
383
+ fi
384
+
385
+ portable_url="https://github.com/readest/readest/releases/download/${{ needs.get-release.outputs.release_tag }}/$bin_file"
386
+ portable_sig=$(cat $bin_file.sig)
387
+
388
+ jq --arg url "$portable_url" \
389
+ --arg sig "$portable_sig" \
390
+ --arg key "$platform_key" \
391
+ '.platforms[$key] = {signature: $sig, url: $url}' latest.json > tmp.$$.json && mv tmp.$$.json latest.json
392
+
393
+ echo "Uploading updated latest.json to GitHub release"
394
+ gh release upload ${{ needs.get-release.outputs.release_tag }} latest.json --clobber
395
+
396
+ upload-to-r2:
397
+ needs: [get-release, build-tauri]
398
+ uses: ./.github/workflows/upload-to-r2.yml
399
+ with:
400
+ tag: ${{ needs.get-release.outputs.release_tag }}
401
+ secrets: inherit
.github/workflows/retry-workflow.yml ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ name: Retry workflow
2
+
3
+ on:
4
+ workflow_dispatch:
5
+ inputs:
6
+ run_id:
7
+ required: true
8
+ jobs:
9
+ rerun:
10
+ runs-on: ubuntu-latest
11
+ steps:
12
+ - name: rerun ${{ inputs.run_id }}
13
+ env:
14
+ GH_REPO: ${{ github.repository }}
15
+ GH_TOKEN: ${{ github.token }}
16
+ run: |
17
+ gh run watch ${{ inputs.run_id }} > /dev/null 2>&1
18
+ gh run rerun ${{ inputs.run_id }} --failed
.github/workflows/upload-to-r2.yml ADDED
@@ -0,0 +1,77 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ name: Upload Release Assets to R2
2
+
3
+ on:
4
+ workflow_call:
5
+ inputs:
6
+ tag:
7
+ required: true
8
+ type: string
9
+
10
+ workflow_dispatch:
11
+ inputs:
12
+ tag:
13
+ description: 'Release tag name (e.g., v1.2.3)'
14
+ required: true
15
+ type: string
16
+
17
+ jobs:
18
+ upload-to-r2:
19
+ runs-on: ubuntu-latest
20
+ timeout-minutes: 3
21
+ strategy:
22
+ fail-fast: false
23
+ env:
24
+ RELEASE_R2_BUCKET: readest-releases
25
+ RELEASE_R2_ACCOUNT_ID: ${{ secrets.RELEASE_R2_ACCOUNT_ID }}
26
+ RELEASE_R2_ACCESS_KEY_ID: ${{ secrets.RELEASE_R2_ACCESS_KEY_ID }}
27
+ RELEASE_R2_SECRET_ACCESS_KEY: ${{ secrets.RELEASE_R2_SECRET_ACCESS_KEY }}
28
+
29
+ steps:
30
+ - name: Download release assets
31
+ run: |
32
+ gh release download "${{ inputs.tag }}" --repo readest/readest --dir ./release-assets
33
+ env:
34
+ GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
35
+
36
+ - name: Install rclone
37
+ run: curl https://rclone.org/install.sh | sudo bash
38
+
39
+ - name: Configure rclone
40
+ run: |
41
+ mkdir -p ~/.config/rclone
42
+ cat > ~/.config/rclone/rclone.conf <<EOF
43
+ [r2]
44
+ type = s3
45
+ provider = Cloudflare
46
+ access_key_id = $RELEASE_R2_ACCESS_KEY_ID
47
+ secret_access_key = $RELEASE_R2_SECRET_ACCESS_KEY
48
+ endpoint = https://${RELEASE_R2_ACCOUNT_ID}.r2.cloudflarestorage.com
49
+ EOF
50
+
51
+ - name: Modify latest.json download URLs
52
+ run: |
53
+ GITHUB_BASE_URL="https://github.com/readest/readest/releases/download"
54
+ READEST_BASE_URL="https://download.readest.com/releases"
55
+ sed -i "s#${GITHUB_BASE_URL}#${READEST_BASE_URL}#g" ./release-assets/latest.json
56
+
57
+ - name: Upload to R2
58
+ run: |
59
+ mkdir releases
60
+ mv ./release-assets/latest.json releases
61
+ mv ./release-assets/release-notes.json releases
62
+ rclone copy ./release-assets r2:${RELEASE_R2_BUCKET}/releases/${{ inputs.tag }}/
63
+ rclone copy ./releases r2:${RELEASE_R2_BUCKET}/releases/
64
+
65
+ - name: Upload successful
66
+ if: success()
67
+ run: echo "Upload completed successfully"
68
+
69
+ retry-on-failure:
70
+ if: failure() && fromJSON(github.run_attempt) < 3
71
+ needs: [upload-to-r2]
72
+ runs-on: ubuntu-latest
73
+ steps:
74
+ - env:
75
+ GH_REPO: ${{ github.repository }}
76
+ GH_TOKEN: ${{ github.token }}
77
+ run: gh workflow run retry-workflow.yml -F run_id=${{ github.run_id }}
.github/workflows/vercel-merge.yml ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ name: Deploy to vercel on merge
2
+ on:
3
+ push:
4
+ branches:
5
+ - main
6
+ permissions:
7
+ contents: write
8
+ deployments: write
9
+ pull-requests: write
10
+ jobs:
11
+ build_and_deploy:
12
+ runs-on: ubuntu-latest
13
+ steps:
14
+ - uses: actions/checkout@v6
15
+ with:
16
+ submodules: 'true'
17
+ - uses: amondnet/vercel-action@v25
18
+ with:
19
+ vercel-token: ${{ secrets.VERCEL_TOKEN }}
20
+ github-token: ${{ secrets.GITHUB_TOKEN }}
21
+ vercel-args: '--prod'
22
+ vercel-org-id: ${{ secrets.ORG_ID}}
23
+ vercel-project-id: ${{ secrets.PROJECT_ID}}
.gitignore ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2
+ docker/.env
3
+
4
+ # dependencies
5
+ /node_modules
6
+ /.pnp
7
+ .pnp.js
8
+ .yarn/install-state.gz
9
+
10
+ # testing
11
+ /coverage
12
+
13
+ # next.js
14
+ /.next/
15
+ /out/
16
+
17
+ # production
18
+ /build
19
+
20
+ # misc
21
+ .DS_Store
22
+ *.pem
23
+ /certs
24
+
25
+ # debug
26
+ npm-debug.log*
27
+ yarn-debug.log*
28
+ yarn-error.log*
29
+
30
+ # local env files
31
+ .env*.local
32
+
33
+ # vercel
34
+ .vercel
35
+
36
+ # typescript
37
+ *.tsbuildinfo
38
+ next-env.d.ts
39
+
40
+ # Rust build
41
+ target
42
+
43
+ fastlane/report.xml
44
+
45
+ *.koplugin.zip
46
+
47
+ # nix
48
+ result*
49
+ .playwright-mcp/
.gitmodules ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [submodule "packages/foliate-js"]
2
+ path = packages/foliate-js
3
+ url = https://github.com/readest/foliate-js.git
4
+ [submodule "packages/tauri"]
5
+ path = packages/tauri
6
+ url = https://github.com/readest/tauri.git
7
+ [submodule "packages/tauri-plugins"]
8
+ path = packages/tauri-plugins
9
+ url = https://github.com/readest/tauri-plugins-workspace.git
10
+ [submodule "packages/simplecc-wasm"]
11
+ path = packages/simplecc-wasm
12
+ url = https://github.com/readest/simplecc-wasm.git
.prettierignore ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Dependencies
2
+ node_modules
3
+ pnpm-lock.yaml
4
+
5
+ # Build Artifacts (Web & Rust)
6
+ .next
7
+ .open-next
8
+ .build
9
+ .tauri
10
+ out
11
+ build
12
+ dist
13
+ target
14
+ fastlane
15
+ .wrangler
16
+
17
+ # Autogenerated Tauri files
18
+ gen
19
+ **/autogenerated
20
+ **/schemas
21
+
22
+ # Submodules (External Repos)
23
+ packages
24
+
25
+ # Vendored Assets (Generated/External Code)
26
+ apps/readest-app/public/*.js
27
+ apps/readest-app/public/vendor
28
+
29
+ # Environment & Editor
30
+ .env
31
+ .env.*
32
+ .vscode
33
+ .idea
34
+ *.log
.prettierrc.json ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "trailingComma": "all",
3
+ "printWidth": 100,
4
+ "semi": true,
5
+ "tabWidth": 2,
6
+ "singleQuote": true,
7
+ "jsxSingleQuote": true,
8
+ "endOfLine": "lf",
9
+ "plugins": ["prettier-plugin-tailwindcss"]
10
+ }
.vscode/extensions.json ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "recommendations": [
3
+ "ms-vscode.vscode-typescript-next",
4
+ "dbaeumer.vscode-eslint",
5
+ "esbenp.prettier-vscode",
6
+ "rust-lang.rust-analyzer"
7
+ ]
8
+ }
.vscode/settings.json ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "typescript.tsdk": "node_modules/typescript/lib",
3
+ "rust-analyzer.linkedProjects": [
4
+ "packages/tauri/Cargo.toml",
5
+ "apps/readest-app/src-tauri/Cargo.toml"
6
+ ],
7
+ // "editor.formatOnSave": true, // uncomment to add format on save
8
+ "typescript.inlayHints.parameterNames.enabled": "all",
9
+ "typescript.inlayHints.variableTypes.enabled": true,
10
+ "typescript.inlayHints.propertyDeclarationTypes.enabled": true,
11
+ "typescript.inlayHints.functionLikeReturnTypes.enabled": true,
12
+ "typescript.inlayHints.enumMemberValues.enabled": true,
13
+ "javascript.validate.enable": false,
14
+ "javascript.format.enable": false,
15
+ "typescript.format.enable": false,
16
+ "editor.defaultFormatter": "esbenp.prettier-vscode",
17
+ "editor.codeActionsOnSave": {
18
+ "source.fixAll.eslint": "explicit"
19
+ },
20
+ "[css]": {
21
+ "editor.defaultFormatter": "esbenp.prettier-vscode"
22
+ },
23
+ "[typescript]": {
24
+ "editor.defaultFormatter": "esbenp.prettier-vscode"
25
+ },
26
+ "[typescriptreact]": {
27
+ "editor.defaultFormatter": "esbenp.prettier-vscode"
28
+ },
29
+ "prettier.requireConfig": true,
30
+ "prettier.documentSelectors": ["**/*.{js,jsx,ts,tsx,css,json,md,html,yml}"]
31
+ }
CONTRIBUTING.md ADDED
@@ -0,0 +1,104 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Contribution Guidelines
2
+
3
+ When contributing to `Readest`, whether on GitHub or in other community spaces:
4
+
5
+ - Be respectful, civil, and open-minded.
6
+ - Before opening a new pull request, try searching through the [issue tracker](https://github.com/readest/readest/issues) for known issues or fixes.
7
+ - If you want to make code changes based on your personal opinion(s), make sure you open an issue first describing the changes you want to make, and open a pull request only when your suggestions get approved by maintainers.
8
+
9
+ ## How to Contribute
10
+
11
+ ### Prerequisites
12
+
13
+ In order to not waste your time implementing a change that has already been declined, or is generally not needed, start by [opening an issue](https://github.com/readest/readest/issues/new/choose) describing the problem you would like to solve.
14
+
15
+ For the best experience to build Readest for yourself, use a recent version of Node.js and Rust. Refer to the [Tauri documentation](https://v2.tauri.app/start/prerequisites/) for details on setting up the development environment prerequisites on different platforms.
16
+
17
+ Basically you need to install or update the following development tools:
18
+
19
+ - **Node.js** and **pnpm** for Next.js development
20
+ - **Rust** and **Cargo** for Tauri development
21
+
22
+ ```bash
23
+ nvm install v22
24
+ nvm use v22
25
+ npm install -g pnpm
26
+ rustup update
27
+ ```
28
+
29
+ ### Getting Started
30
+
31
+ To get started with Readest, follow these steps to clone and build the project.
32
+
33
+ #### 1. Clone the Repository
34
+
35
+ ```bash
36
+ git clone https://github.com/readest/readest.git
37
+ cd readest
38
+ git submodule update --init --recursive
39
+ ```
40
+
41
+ #### 2. Install Dependencies
42
+
43
+ ```bash
44
+ # might need to rerun this when code is updated
45
+ pnpm install
46
+ # copy vendors dist libs to public directory
47
+ pnpm --filter @readest/readest-app setup-vendors
48
+ ```
49
+
50
+ #### 3. Verify Dependencies Installation
51
+
52
+ To confirm that all dependencies are correctly installed, run the following command:
53
+
54
+ ```bash
55
+ pnpm tauri info
56
+ ```
57
+
58
+ This command will display information about the installed Tauri dependencies and configuration on your platform. Note that the output may vary depending on the operating system and environment setup. Please review the output specific to your platform for any potential issues.
59
+
60
+ For Windows targets, “Build Tools for Visual Studio 2022” (or a higher edition of Visual Studio) and the “Desktop development with C++” workflow must be installed. For Windows ARM64 targets, the “VS 2022 C++ ARM64 build tools” and "C++ Clang Compiler for Windows" components must be installed. And make sure `clang` can be found in the path by adding `C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\Llvm\x64\bin` for example in the environment variable `Path`.
61
+
62
+ #### 4. Build for Development
63
+
64
+ ```bash
65
+ pnpm tauri dev
66
+ ```
67
+
68
+ #### 5. Build for Production
69
+
70
+ ```bash
71
+ pnpm tauri build
72
+ ```
73
+
74
+ Now you're all setup and can start implementing your changes.
75
+
76
+ ### Implement your changes
77
+
78
+ This project is a monorepo. The code for the `readest-app` is in the `apps/readest-app` directory. Here are some useful scripts for developing the frontend only without compiling Tauri:
79
+
80
+ | Command | Description |
81
+ | ---------------- | -------------------------------------------------- |
82
+ | `pnpm dev-web` | Starts the development server for the web app only |
83
+ | `pnpm build-web` | Builds the web app |
84
+
85
+ Recommended Visual Studio Code plugins for development:
86
+
87
+ - JavaScript and TypeScript Nightly (ms-vscode.vscode-typescript-next)
88
+ - VS Code ESLint extension (dbaeumer.vscode-eslint)
89
+ - Prettier - Code formatter (esbenp.prettier-vscode)
90
+ - rust-analyzer (rust-lang.rust-analyzer) (for Tauri development only)
91
+
92
+ ### When you're done
93
+
94
+ Check that your code follows the project's style guidelines by running:
95
+
96
+ ```bash
97
+ pnpm build
98
+ ```
99
+
100
+ Please also make a manual, functional test of your changes. When all that's done, it's time to file a pull request to upstream and fill out the title and body appropriately.
101
+
102
+ ## Credits
103
+
104
+ This documented was inspired by the contributing guidelines for [cloudflare/wrangler2](https://github.com/cloudflare/wrangler2/blob/main/CONTRIBUTING.md).
Cargo.lock ADDED
The diff for this file is too large to render. See raw diff
 
Cargo.toml ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [workspace]
2
+ members = [
3
+ "apps/readest-app/src-tauri",
4
+ "packages/tauri/crates/tauri",
5
+ "packages/tauri/crates/tauri-utils",
6
+ "packages/tauri/crates/tauri-build",
7
+ "packages/tauri-plugins/plugins/deep-link",
8
+ "packages/tauri-plugins/plugins/single-instance"
9
+ ]
10
+ resolver = "2"
11
+
12
+ [workspace.dependencies]
13
+ serde = { version = "1", features = ["derive"] }
14
+ tracing = "0.1"
15
+ log = "0.4"
16
+ tauri = { version = "2", default-features = false }
17
+ tauri-build = "2"
18
+ tauri-plugin = "2"
19
+ tauri-utils = "2"
20
+ schemars = "0.8"
21
+ serde_json = "1"
22
+ thiserror = "2"
23
+ glob = "0.3"
24
+ zbus = "5.9"
25
+ dunce = "1"
26
+ url = "2"
27
+
28
+ [workspace.package]
29
+ authors = ["Bilingify LLC"]
30
+ homepage = "https://readest.com"
31
+ license = "AGPL-3.0"
32
+ repository = "https://github.com/readest/readest"
33
+ categories = []
34
+ edition = "2021"
35
+ rust-version = "1.77.2"
36
+
37
+ [patch.crates-io]
38
+ tauri = { path = "packages/tauri/crates/tauri" }
39
+ tauri-utils = { path = "packages/tauri/crates/tauri-utils" }
40
+ tauri-build = { path = "packages/tauri/crates/tauri-build" }
41
+ tauri-plugin-deep-link = { path = "packages/tauri-plugins/plugins/deep-link" }
42
+ tauri-plugin-single-instance = { path = "packages/tauri-plugins/plugins/single-instance" }
Dockerfile ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ FROM docker.io/node:22-slim AS base
2
+ ENV PNPM_HOME="/pnpm"
3
+ ENV PATH="$PNPM_HOME:$PATH"
4
+ RUN corepack enable
5
+ RUN corepack prepare pnpm@10.29.3 --activate
6
+ WORKDIR /app
7
+ COPY package.json pnpm-lock.yaml pnpm-workspace.yaml ./
8
+ COPY apps/readest-app/package.json ./apps/readest-app/
9
+ COPY patches/ ./patches/
10
+ COPY packages/ ./packages/
11
+
12
+ FROM base AS dependencies
13
+ RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --frozen-lockfile
14
+ RUN pnpm --filter @readest/readest-app setup-vendors
15
+
16
+ FROM dependencies AS development-stage
17
+ COPY . .
18
+ WORKDIR /app/apps/readest-app
19
+ EXPOSE 3000
20
+ ENTRYPOINT ["pnpm", "dev-web", "-H", "0.0.0.0"]
21
+
22
+ FROM base AS build
23
+ ARG NEXT_PUBLIC_SUPABASE_URL
24
+ ARG NEXT_PUBLIC_SUPABASE_ANON_KEY
25
+ ARG NEXT_PUBLIC_APP_PLATFORM
26
+ ARG NEXT_PUBLIC_API_BASE_URL
27
+ ARG NEXT_PUBLIC_OBJECT_STORAGE_TYPE
28
+ ARG NEXT_PUBLIC_STORAGE_FIXED_QUOTA
29
+ ARG NEXT_PUBLIC_TRANSLATION_FIXED_QUOTA
30
+ COPY --from=dependencies /app/node_modules /app/node_modules
31
+ COPY --from=dependencies /app/apps/readest-app/node_modules /app/apps/readest-app/node_modules
32
+ COPY --from=dependencies /app/apps/readest-app/public/vendor /app/apps/readest-app/public/vendor
33
+ COPY --from=dependencies /app/packages/foliate-js/node_modules /app/packages/foliate-js/node_modules
34
+ COPY . .
35
+ WORKDIR /app/apps/readest-app
36
+ RUN pnpm build-web
37
+
38
+ FROM build as production-stage
39
+ ENTRYPOINT ["pnpm", "start-web", "-H", "0.0.0.0"]
40
+ EXPOSE 3000
LICENSE ADDED
@@ -0,0 +1,661 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ GNU AFFERO GENERAL PUBLIC LICENSE
2
+ Version 3, 19 November 2007
3
+
4
+ Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
5
+ Everyone is permitted to copy and distribute verbatim copies
6
+ of this license document, but changing it is not allowed.
7
+
8
+ Preamble
9
+
10
+ The GNU Affero General Public License is a free, copyleft license for
11
+ software and other kinds of works, specifically designed to ensure
12
+ cooperation with the community in the case of network server software.
13
+
14
+ The licenses for most software and other practical works are designed
15
+ to take away your freedom to share and change the works. By contrast,
16
+ our General Public Licenses are intended to guarantee your freedom to
17
+ share and change all versions of a program--to make sure it remains free
18
+ software for all its users.
19
+
20
+ When we speak of free software, we are referring to freedom, not
21
+ price. Our General Public Licenses are designed to make sure that you
22
+ have the freedom to distribute copies of free software (and charge for
23
+ them if you wish), that you receive source code or can get it if you
24
+ want it, that you can change the software or use pieces of it in new
25
+ free programs, and that you know you can do these things.
26
+
27
+ Developers that use our General Public Licenses protect your rights
28
+ with two steps: (1) assert copyright on the software, and (2) offer
29
+ you this License which gives you legal permission to copy, distribute
30
+ and/or modify the software.
31
+
32
+ A secondary benefit of defending all users' freedom is that
33
+ improvements made in alternate versions of the program, if they
34
+ receive widespread use, become available for other developers to
35
+ incorporate. Many developers of free software are heartened and
36
+ encouraged by the resulting cooperation. However, in the case of
37
+ software used on network servers, this result may fail to come about.
38
+ The GNU General Public License permits making a modified version and
39
+ letting the public access it on a server without ever releasing its
40
+ source code to the public.
41
+
42
+ The GNU Affero General Public License is designed specifically to
43
+ ensure that, in such cases, the modified source code becomes available
44
+ to the community. It requires the operator of a network server to
45
+ provide the source code of the modified version running there to the
46
+ users of that server. Therefore, public use of a modified version, on
47
+ a publicly accessible server, gives the public access to the source
48
+ code of the modified version.
49
+
50
+ An older license, called the Affero General Public License and
51
+ published by Affero, was designed to accomplish similar goals. This is
52
+ a different license, not a version of the Affero GPL, but Affero has
53
+ released a new version of the Affero GPL which permits relicensing under
54
+ this license.
55
+
56
+ The precise terms and conditions for copying, distribution and
57
+ modification follow.
58
+
59
+ TERMS AND CONDITIONS
60
+
61
+ 0. Definitions.
62
+
63
+ "This License" refers to version 3 of the GNU Affero General Public License.
64
+
65
+ "Copyright" also means copyright-like laws that apply to other kinds of
66
+ works, such as semiconductor masks.
67
+
68
+ "The Program" refers to any copyrightable work licensed under this
69
+ License. Each licensee is addressed as "you". "Licensees" and
70
+ "recipients" may be individuals or organizations.
71
+
72
+ To "modify" a work means to copy from or adapt all or part of the work
73
+ in a fashion requiring copyright permission, other than the making of an
74
+ exact copy. The resulting work is called a "modified version" of the
75
+ earlier work or a work "based on" the earlier work.
76
+
77
+ A "covered work" means either the unmodified Program or a work based
78
+ on the Program.
79
+
80
+ To "propagate" a work means to do anything with it that, without
81
+ permission, would make you directly or secondarily liable for
82
+ infringement under applicable copyright law, except executing it on a
83
+ computer or modifying a private copy. Propagation includes copying,
84
+ distribution (with or without modification), making available to the
85
+ public, and in some countries other activities as well.
86
+
87
+ To "convey" a work means any kind of propagation that enables other
88
+ parties to make or receive copies. Mere interaction with a user through
89
+ a computer network, with no transfer of a copy, is not conveying.
90
+
91
+ An interactive user interface displays "Appropriate Legal Notices"
92
+ to the extent that it includes a convenient and prominently visible
93
+ feature that (1) displays an appropriate copyright notice, and (2)
94
+ tells the user that there is no warranty for the work (except to the
95
+ extent that warranties are provided), that licensees may convey the
96
+ work under this License, and how to view a copy of this License. If
97
+ the interface presents a list of user commands or options, such as a
98
+ menu, a prominent item in the list meets this criterion.
99
+
100
+ 1. Source Code.
101
+
102
+ The "source code" for a work means the preferred form of the work
103
+ for making modifications to it. "Object code" means any non-source
104
+ form of a work.
105
+
106
+ A "Standard Interface" means an interface that either is an official
107
+ standard defined by a recognized standards body, or, in the case of
108
+ interfaces specified for a particular programming language, one that
109
+ is widely used among developers working in that language.
110
+
111
+ The "System Libraries" of an executable work include anything, other
112
+ than the work as a whole, that (a) is included in the normal form of
113
+ packaging a Major Component, but which is not part of that Major
114
+ Component, and (b) serves only to enable use of the work with that
115
+ Major Component, or to implement a Standard Interface for which an
116
+ implementation is available to the public in source code form. A
117
+ "Major Component", in this context, means a major essential component
118
+ (kernel, window system, and so on) of the specific operating system
119
+ (if any) on which the executable work runs, or a compiler used to
120
+ produce the work, or an object code interpreter used to run it.
121
+
122
+ The "Corresponding Source" for a work in object code form means all
123
+ the source code needed to generate, install, and (for an executable
124
+ work) run the object code and to modify the work, including scripts to
125
+ control those activities. However, it does not include the work's
126
+ System Libraries, or general-purpose tools or generally available free
127
+ programs which are used unmodified in performing those activities but
128
+ which are not part of the work. For example, Corresponding Source
129
+ includes interface definition files associated with source files for
130
+ the work, and the source code for shared libraries and dynamically
131
+ linked subprograms that the work is specifically designed to require,
132
+ such as by intimate data communication or control flow between those
133
+ subprograms and other parts of the work.
134
+
135
+ The Corresponding Source need not include anything that users
136
+ can regenerate automatically from other parts of the Corresponding
137
+ Source.
138
+
139
+ The Corresponding Source for a work in source code form is that
140
+ same work.
141
+
142
+ 2. Basic Permissions.
143
+
144
+ All rights granted under this License are granted for the term of
145
+ copyright on the Program, and are irrevocable provided the stated
146
+ conditions are met. This License explicitly affirms your unlimited
147
+ permission to run the unmodified Program. The output from running a
148
+ covered work is covered by this License only if the output, given its
149
+ content, constitutes a covered work. This License acknowledges your
150
+ rights of fair use or other equivalent, as provided by copyright law.
151
+
152
+ You may make, run and propagate covered works that you do not
153
+ convey, without conditions so long as your license otherwise remains
154
+ in force. You may convey covered works to others for the sole purpose
155
+ of having them make modifications exclusively for you, or provide you
156
+ with facilities for running those works, provided that you comply with
157
+ the terms of this License in conveying all material for which you do
158
+ not control copyright. Those thus making or running the covered works
159
+ for you must do so exclusively on your behalf, under your direction
160
+ and control, on terms that prohibit them from making any copies of
161
+ your copyrighted material outside their relationship with you.
162
+
163
+ Conveying under any other circumstances is permitted solely under
164
+ the conditions stated below. Sublicensing is not allowed; section 10
165
+ makes it unnecessary.
166
+
167
+ 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
168
+
169
+ No covered work shall be deemed part of an effective technological
170
+ measure under any applicable law fulfilling obligations under article
171
+ 11 of the WIPO copyright treaty adopted on 20 December 1996, or
172
+ similar laws prohibiting or restricting circumvention of such
173
+ measures.
174
+
175
+ When you convey a covered work, you waive any legal power to forbid
176
+ circumvention of technological measures to the extent such circumvention
177
+ is effected by exercising rights under this License with respect to
178
+ the covered work, and you disclaim any intention to limit operation or
179
+ modification of the work as a means of enforcing, against the work's
180
+ users, your or third parties' legal rights to forbid circumvention of
181
+ technological measures.
182
+
183
+ 4. Conveying Verbatim Copies.
184
+
185
+ You may convey verbatim copies of the Program's source code as you
186
+ receive it, in any medium, provided that you conspicuously and
187
+ appropriately publish on each copy an appropriate copyright notice;
188
+ keep intact all notices stating that this License and any
189
+ non-permissive terms added in accord with section 7 apply to the code;
190
+ keep intact all notices of the absence of any warranty; and give all
191
+ recipients a copy of this License along with the Program.
192
+
193
+ You may charge any price or no price for each copy that you convey,
194
+ and you may offer support or warranty protection for a fee.
195
+
196
+ 5. Conveying Modified Source Versions.
197
+
198
+ You may convey a work based on the Program, or the modifications to
199
+ produce it from the Program, in the form of source code under the
200
+ terms of section 4, provided that you also meet all of these conditions:
201
+
202
+ a) The work must carry prominent notices stating that you modified
203
+ it, and giving a relevant date.
204
+
205
+ b) The work must carry prominent notices stating that it is
206
+ released under this License and any conditions added under section
207
+ 7. This requirement modifies the requirement in section 4 to
208
+ "keep intact all notices".
209
+
210
+ c) You must license the entire work, as a whole, under this
211
+ License to anyone who comes into possession of a copy. This
212
+ License will therefore apply, along with any applicable section 7
213
+ additional terms, to the whole of the work, and all its parts,
214
+ regardless of how they are packaged. This License gives no
215
+ permission to license the work in any other way, but it does not
216
+ invalidate such permission if you have separately received it.
217
+
218
+ d) If the work has interactive user interfaces, each must display
219
+ Appropriate Legal Notices; however, if the Program has interactive
220
+ interfaces that do not display Appropriate Legal Notices, your
221
+ work need not make them do so.
222
+
223
+ A compilation of a covered work with other separate and independent
224
+ works, which are not by their nature extensions of the covered work,
225
+ and which are not combined with it such as to form a larger program,
226
+ in or on a volume of a storage or distribution medium, is called an
227
+ "aggregate" if the compilation and its resulting copyright are not
228
+ used to limit the access or legal rights of the compilation's users
229
+ beyond what the individual works permit. Inclusion of a covered work
230
+ in an aggregate does not cause this License to apply to the other
231
+ parts of the aggregate.
232
+
233
+ 6. Conveying Non-Source Forms.
234
+
235
+ You may convey a covered work in object code form under the terms
236
+ of sections 4 and 5, provided that you also convey the
237
+ machine-readable Corresponding Source under the terms of this License,
238
+ in one of these ways:
239
+
240
+ a) Convey the object code in, or embodied in, a physical product
241
+ (including a physical distribution medium), accompanied by the
242
+ Corresponding Source fixed on a durable physical medium
243
+ customarily used for software interchange.
244
+
245
+ b) Convey the object code in, or embodied in, a physical product
246
+ (including a physical distribution medium), accompanied by a
247
+ written offer, valid for at least three years and valid for as
248
+ long as you offer spare parts or customer support for that product
249
+ model, to give anyone who possesses the object code either (1) a
250
+ copy of the Corresponding Source for all the software in the
251
+ product that is covered by this License, on a durable physical
252
+ medium customarily used for software interchange, for a price no
253
+ more than your reasonable cost of physically performing this
254
+ conveying of source, or (2) access to copy the
255
+ Corresponding Source from a network server at no charge.
256
+
257
+ c) Convey individual copies of the object code with a copy of the
258
+ written offer to provide the Corresponding Source. This
259
+ alternative is allowed only occasionally and noncommercially, and
260
+ only if you received the object code with such an offer, in accord
261
+ with subsection 6b.
262
+
263
+ d) Convey the object code by offering access from a designated
264
+ place (gratis or for a charge), and offer equivalent access to the
265
+ Corresponding Source in the same way through the same place at no
266
+ further charge. You need not require recipients to copy the
267
+ Corresponding Source along with the object code. If the place to
268
+ copy the object code is a network server, the Corresponding Source
269
+ may be on a different server (operated by you or a third party)
270
+ that supports equivalent copying facilities, provided you maintain
271
+ clear directions next to the object code saying where to find the
272
+ Corresponding Source. Regardless of what server hosts the
273
+ Corresponding Source, you remain obligated to ensure that it is
274
+ available for as long as needed to satisfy these requirements.
275
+
276
+ e) Convey the object code using peer-to-peer transmission, provided
277
+ you inform other peers where the object code and Corresponding
278
+ Source of the work are being offered to the general public at no
279
+ charge under subsection 6d.
280
+
281
+ A separable portion of the object code, whose source code is excluded
282
+ from the Corresponding Source as a System Library, need not be
283
+ included in conveying the object code work.
284
+
285
+ A "User Product" is either (1) a "consumer product", which means any
286
+ tangible personal property which is normally used for personal, family,
287
+ or household purposes, or (2) anything designed or sold for incorporation
288
+ into a dwelling. In determining whether a product is a consumer product,
289
+ doubtful cases shall be resolved in favor of coverage. For a particular
290
+ product received by a particular user, "normally used" refers to a
291
+ typical or common use of that class of product, regardless of the status
292
+ of the particular user or of the way in which the particular user
293
+ actually uses, or expects or is expected to use, the product. A product
294
+ is a consumer product regardless of whether the product has substantial
295
+ commercial, industrial or non-consumer uses, unless such uses represent
296
+ the only significant mode of use of the product.
297
+
298
+ "Installation Information" for a User Product means any methods,
299
+ procedures, authorization keys, or other information required to install
300
+ and execute modified versions of a covered work in that User Product from
301
+ a modified version of its Corresponding Source. The information must
302
+ suffice to ensure that the continued functioning of the modified object
303
+ code is in no case prevented or interfered with solely because
304
+ modification has been made.
305
+
306
+ If you convey an object code work under this section in, or with, or
307
+ specifically for use in, a User Product, and the conveying occurs as
308
+ part of a transaction in which the right of possession and use of the
309
+ User Product is transferred to the recipient in perpetuity or for a
310
+ fixed term (regardless of how the transaction is characterized), the
311
+ Corresponding Source conveyed under this section must be accompanied
312
+ by the Installation Information. But this requirement does not apply
313
+ if neither you nor any third party retains the ability to install
314
+ modified object code on the User Product (for example, the work has
315
+ been installed in ROM).
316
+
317
+ The requirement to provide Installation Information does not include a
318
+ requirement to continue to provide support service, warranty, or updates
319
+ for a work that has been modified or installed by the recipient, or for
320
+ the User Product in which it has been modified or installed. Access to a
321
+ network may be denied when the modification itself materially and
322
+ adversely affects the operation of the network or violates the rules and
323
+ protocols for communication across the network.
324
+
325
+ Corresponding Source conveyed, and Installation Information provided,
326
+ in accord with this section must be in a format that is publicly
327
+ documented (and with an implementation available to the public in
328
+ source code form), and must require no special password or key for
329
+ unpacking, reading or copying.
330
+
331
+ 7. Additional Terms.
332
+
333
+ "Additional permissions" are terms that supplement the terms of this
334
+ License by making exceptions from one or more of its conditions.
335
+ Additional permissions that are applicable to the entire Program shall
336
+ be treated as though they were included in this License, to the extent
337
+ that they are valid under applicable law. If additional permissions
338
+ apply only to part of the Program, that part may be used separately
339
+ under those permissions, but the entire Program remains governed by
340
+ this License without regard to the additional permissions.
341
+
342
+ When you convey a copy of a covered work, you may at your option
343
+ remove any additional permissions from that copy, or from any part of
344
+ it. (Additional permissions may be written to require their own
345
+ removal in certain cases when you modify the work.) You may place
346
+ additional permissions on material, added by you to a covered work,
347
+ for which you have or can give appropriate copyright permission.
348
+
349
+ Notwithstanding any other provision of this License, for material you
350
+ add to a covered work, you may (if authorized by the copyright holders of
351
+ that material) supplement the terms of this License with terms:
352
+
353
+ a) Disclaiming warranty or limiting liability differently from the
354
+ terms of sections 15 and 16 of this License; or
355
+
356
+ b) Requiring preservation of specified reasonable legal notices or
357
+ author attributions in that material or in the Appropriate Legal
358
+ Notices displayed by works containing it; or
359
+
360
+ c) Prohibiting misrepresentation of the origin of that material, or
361
+ requiring that modified versions of such material be marked in
362
+ reasonable ways as different from the original version; or
363
+
364
+ d) Limiting the use for publicity purposes of names of licensors or
365
+ authors of the material; or
366
+
367
+ e) Declining to grant rights under trademark law for use of some
368
+ trade names, trademarks, or service marks; or
369
+
370
+ f) Requiring indemnification of licensors and authors of that
371
+ material by anyone who conveys the material (or modified versions of
372
+ it) with contractual assumptions of liability to the recipient, for
373
+ any liability that these contractual assumptions directly impose on
374
+ those licensors and authors.
375
+
376
+ All other non-permissive additional terms are considered "further
377
+ restrictions" within the meaning of section 10. If the Program as you
378
+ received it, or any part of it, contains a notice stating that it is
379
+ governed by this License along with a term that is a further
380
+ restriction, you may remove that term. If a license document contains
381
+ a further restriction but permits relicensing or conveying under this
382
+ License, you may add to a covered work material governed by the terms
383
+ of that license document, provided that the further restriction does
384
+ not survive such relicensing or conveying.
385
+
386
+ If you add terms to a covered work in accord with this section, you
387
+ must place, in the relevant source files, a statement of the
388
+ additional terms that apply to those files, or a notice indicating
389
+ where to find the applicable terms.
390
+
391
+ Additional terms, permissive or non-permissive, may be stated in the
392
+ form of a separately written license, or stated as exceptions;
393
+ the above requirements apply either way.
394
+
395
+ 8. Termination.
396
+
397
+ You may not propagate or modify a covered work except as expressly
398
+ provided under this License. Any attempt otherwise to propagate or
399
+ modify it is void, and will automatically terminate your rights under
400
+ this License (including any patent licenses granted under the third
401
+ paragraph of section 11).
402
+
403
+ However, if you cease all violation of this License, then your
404
+ license from a particular copyright holder is reinstated (a)
405
+ provisionally, unless and until the copyright holder explicitly and
406
+ finally terminates your license, and (b) permanently, if the copyright
407
+ holder fails to notify you of the violation by some reasonable means
408
+ prior to 60 days after the cessation.
409
+
410
+ Moreover, your license from a particular copyright holder is
411
+ reinstated permanently if the copyright holder notifies you of the
412
+ violation by some reasonable means, this is the first time you have
413
+ received notice of violation of this License (for any work) from that
414
+ copyright holder, and you cure the violation prior to 30 days after
415
+ your receipt of the notice.
416
+
417
+ Termination of your rights under this section does not terminate the
418
+ licenses of parties who have received copies or rights from you under
419
+ this License. If your rights have been terminated and not permanently
420
+ reinstated, you do not qualify to receive new licenses for the same
421
+ material under section 10.
422
+
423
+ 9. Acceptance Not Required for Having Copies.
424
+
425
+ You are not required to accept this License in order to receive or
426
+ run a copy of the Program. Ancillary propagation of a covered work
427
+ occurring solely as a consequence of using peer-to-peer transmission
428
+ to receive a copy likewise does not require acceptance. However,
429
+ nothing other than this License grants you permission to propagate or
430
+ modify any covered work. These actions infringe copyright if you do
431
+ not accept this License. Therefore, by modifying or propagating a
432
+ covered work, you indicate your acceptance of this License to do so.
433
+
434
+ 10. Automatic Licensing of Downstream Recipients.
435
+
436
+ Each time you convey a covered work, the recipient automatically
437
+ receives a license from the original licensors, to run, modify and
438
+ propagate that work, subject to this License. You are not responsible
439
+ for enforcing compliance by third parties with this License.
440
+
441
+ An "entity transaction" is a transaction transferring control of an
442
+ organization, or substantially all assets of one, or subdividing an
443
+ organization, or merging organizations. If propagation of a covered
444
+ work results from an entity transaction, each party to that
445
+ transaction who receives a copy of the work also receives whatever
446
+ licenses to the work the party's predecessor in interest had or could
447
+ give under the previous paragraph, plus a right to possession of the
448
+ Corresponding Source of the work from the predecessor in interest, if
449
+ the predecessor has it or can get it with reasonable efforts.
450
+
451
+ You may not impose any further restrictions on the exercise of the
452
+ rights granted or affirmed under this License. For example, you may
453
+ not impose a license fee, royalty, or other charge for exercise of
454
+ rights granted under this License, and you may not initiate litigation
455
+ (including a cross-claim or counterclaim in a lawsuit) alleging that
456
+ any patent claim is infringed by making, using, selling, offering for
457
+ sale, or importing the Program or any portion of it.
458
+
459
+ 11. Patents.
460
+
461
+ A "contributor" is a copyright holder who authorizes use under this
462
+ License of the Program or a work on which the Program is based. The
463
+ work thus licensed is called the contributor's "contributor version".
464
+
465
+ A contributor's "essential patent claims" are all patent claims
466
+ owned or controlled by the contributor, whether already acquired or
467
+ hereafter acquired, that would be infringed by some manner, permitted
468
+ by this License, of making, using, or selling its contributor version,
469
+ but do not include claims that would be infringed only as a
470
+ consequence of further modification of the contributor version. For
471
+ purposes of this definition, "control" includes the right to grant
472
+ patent sublicenses in a manner consistent with the requirements of
473
+ this License.
474
+
475
+ Each contributor grants you a non-exclusive, worldwide, royalty-free
476
+ patent license under the contributor's essential patent claims, to
477
+ make, use, sell, offer for sale, import and otherwise run, modify and
478
+ propagate the contents of its contributor version.
479
+
480
+ In the following three paragraphs, a "patent license" is any express
481
+ agreement or commitment, however denominated, not to enforce a patent
482
+ (such as an express permission to practice a patent or covenant not to
483
+ sue for patent infringement). To "grant" such a patent license to a
484
+ party means to make such an agreement or commitment not to enforce a
485
+ patent against the party.
486
+
487
+ If you convey a covered work, knowingly relying on a patent license,
488
+ and the Corresponding Source of the work is not available for anyone
489
+ to copy, free of charge and under the terms of this License, through a
490
+ publicly available network server or other readily accessible means,
491
+ then you must either (1) cause the Corresponding Source to be so
492
+ available, or (2) arrange to deprive yourself of the benefit of the
493
+ patent license for this particular work, or (3) arrange, in a manner
494
+ consistent with the requirements of this License, to extend the patent
495
+ license to downstream recipients. "Knowingly relying" means you have
496
+ actual knowledge that, but for the patent license, your conveying the
497
+ covered work in a country, or your recipient's use of the covered work
498
+ in a country, would infringe one or more identifiable patents in that
499
+ country that you have reason to believe are valid.
500
+
501
+ If, pursuant to or in connection with a single transaction or
502
+ arrangement, you convey, or propagate by procuring conveyance of, a
503
+ covered work, and grant a patent license to some of the parties
504
+ receiving the covered work authorizing them to use, propagate, modify
505
+ or convey a specific copy of the covered work, then the patent license
506
+ you grant is automatically extended to all recipients of the covered
507
+ work and works based on it.
508
+
509
+ A patent license is "discriminatory" if it does not include within
510
+ the scope of its coverage, prohibits the exercise of, or is
511
+ conditioned on the non-exercise of one or more of the rights that are
512
+ specifically granted under this License. You may not convey a covered
513
+ work if you are a party to an arrangement with a third party that is
514
+ in the business of distributing software, under which you make payment
515
+ to the third party based on the extent of your activity of conveying
516
+ the work, and under which the third party grants, to any of the
517
+ parties who would receive the covered work from you, a discriminatory
518
+ patent license (a) in connection with copies of the covered work
519
+ conveyed by you (or copies made from those copies), or (b) primarily
520
+ for and in connection with specific products or compilations that
521
+ contain the covered work, unless you entered into that arrangement,
522
+ or that patent license was granted, prior to 28 March 2007.
523
+
524
+ Nothing in this License shall be construed as excluding or limiting
525
+ any implied license or other defenses to infringement that may
526
+ otherwise be available to you under applicable patent law.
527
+
528
+ 12. No Surrender of Others' Freedom.
529
+
530
+ If conditions are imposed on you (whether by court order, agreement or
531
+ otherwise) that contradict the conditions of this License, they do not
532
+ excuse you from the conditions of this License. If you cannot convey a
533
+ covered work so as to satisfy simultaneously your obligations under this
534
+ License and any other pertinent obligations, then as a consequence you may
535
+ not convey it at all. For example, if you agree to terms that obligate you
536
+ to collect a royalty for further conveying from those to whom you convey
537
+ the Program, the only way you could satisfy both those terms and this
538
+ License would be to refrain entirely from conveying the Program.
539
+
540
+ 13. Remote Network Interaction; Use with the GNU General Public License.
541
+
542
+ Notwithstanding any other provision of this License, if you modify the
543
+ Program, your modified version must prominently offer all users
544
+ interacting with it remotely through a computer network (if your version
545
+ supports such interaction) an opportunity to receive the Corresponding
546
+ Source of your version by providing access to the Corresponding Source
547
+ from a network server at no charge, through some standard or customary
548
+ means of facilitating copying of software. This Corresponding Source
549
+ shall include the Corresponding Source for any work covered by version 3
550
+ of the GNU General Public License that is incorporated pursuant to the
551
+ following paragraph.
552
+
553
+ Notwithstanding any other provision of this License, you have
554
+ permission to link or combine any covered work with a work licensed
555
+ under version 3 of the GNU General Public License into a single
556
+ combined work, and to convey the resulting work. The terms of this
557
+ License will continue to apply to the part which is the covered work,
558
+ but the work with which it is combined will remain governed by version
559
+ 3 of the GNU General Public License.
560
+
561
+ 14. Revised Versions of this License.
562
+
563
+ The Free Software Foundation may publish revised and/or new versions of
564
+ the GNU Affero General Public License from time to time. Such new versions
565
+ will be similar in spirit to the present version, but may differ in detail to
566
+ address new problems or concerns.
567
+
568
+ Each version is given a distinguishing version number. If the
569
+ Program specifies that a certain numbered version of the GNU Affero General
570
+ Public License "or any later version" applies to it, you have the
571
+ option of following the terms and conditions either of that numbered
572
+ version or of any later version published by the Free Software
573
+ Foundation. If the Program does not specify a version number of the
574
+ GNU Affero General Public License, you may choose any version ever published
575
+ by the Free Software Foundation.
576
+
577
+ If the Program specifies that a proxy can decide which future
578
+ versions of the GNU Affero General Public License can be used, that proxy's
579
+ public statement of acceptance of a version permanently authorizes you
580
+ to choose that version for the Program.
581
+
582
+ Later license versions may give you additional or different
583
+ permissions. However, no additional obligations are imposed on any
584
+ author or copyright holder as a result of your choosing to follow a
585
+ later version.
586
+
587
+ 15. Disclaimer of Warranty.
588
+
589
+ THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
590
+ APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
591
+ HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
592
+ OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
593
+ THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
594
+ PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
595
+ IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
596
+ ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
597
+
598
+ 16. Limitation of Liability.
599
+
600
+ IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
601
+ WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
602
+ THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
603
+ GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
604
+ USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
605
+ DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
606
+ PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
607
+ EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
608
+ SUCH DAMAGES.
609
+
610
+ 17. Interpretation of Sections 15 and 16.
611
+
612
+ If the disclaimer of warranty and limitation of liability provided
613
+ above cannot be given local legal effect according to their terms,
614
+ reviewing courts shall apply local law that most closely approximates
615
+ an absolute waiver of all civil liability in connection with the
616
+ Program, unless a warranty or assumption of liability accompanies a
617
+ copy of the Program in return for a fee.
618
+
619
+ END OF TERMS AND CONDITIONS
620
+
621
+ How to Apply These Terms to Your New Programs
622
+
623
+ If you develop a new program, and you want it to be of the greatest
624
+ possible use to the public, the best way to achieve this is to make it
625
+ free software which everyone can redistribute and change under these terms.
626
+
627
+ To do so, attach the following notices to the program. It is safest
628
+ to attach them to the start of each source file to most effectively
629
+ state the exclusion of warranty; and each file should have at least
630
+ the "copyright" line and a pointer to where the full notice is found.
631
+
632
+ <one line to give the program's name and a brief idea of what it does.>
633
+ Copyright (C) <year> <name of author>
634
+
635
+ This program is free software: you can redistribute it and/or modify
636
+ it under the terms of the GNU Affero General Public License as published by
637
+ the Free Software Foundation, either version 3 of the License, or
638
+ (at your option) any later version.
639
+
640
+ This program is distributed in the hope that it will be useful,
641
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
642
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
643
+ GNU Affero General Public License for more details.
644
+
645
+ You should have received a copy of the GNU Affero General Public License
646
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
647
+
648
+ Also add information on how to contact you by electronic and paper mail.
649
+
650
+ If your software can interact with users remotely through a computer
651
+ network, you should also make sure that it provides a way for users to
652
+ get its source. For example, if your program is a web application, its
653
+ interface could display a "Source" link that leads users to an archive
654
+ of the code. There are many ways you could offer source, and different
655
+ solutions will be better for different programs; see section 13 for the
656
+ specific requirements.
657
+
658
+ You should also get your employer (if you work as a programmer) or school,
659
+ if any, to sign a "copyright disclaimer" for the program, if necessary.
660
+ For more information on this, and how to apply and follow the GNU AGPL, see
661
+ <http://www.gnu.org/licenses/>.
README.md ADDED
@@ -0,0 +1,362 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <div align="center">
2
+ <a href="https://readest.com?utm_source=github&utm_medium=referral&utm_campaign=readme" target="_blank">
3
+ <img src="https://github.com/readest/readest/blob/main/apps/readest-app/src-tauri/icons/icon.png?raw=true" alt="Readest Logo" width="20%" />
4
+ </a>
5
+ <h1>Readest</h1>
6
+ <br>
7
+
8
+ [Readest][link-website] is an open-source ebook reader designed for immersive and deep reading experiences. Built as a modern rewrite of [Foliate](https://github.com/johnfactotum/foliate), it leverages [Next.js 16](https://github.com/vercel/next.js) and [Tauri v2](https://github.com/tauri-apps/tauri) to deliver a smooth, cross-platform experience across macOS, Windows, Linux, Android, iOS, and the Web.
9
+
10
+ [![Website][badge-website]][link-website]
11
+ [![Web App][badge-web-app]][link-web-readest]
12
+ [![OS][badge-platforms]][link-website]
13
+ <br>
14
+ [![Discord][badge-discord]][link-discord]
15
+ [![Reddit][badge-reddit]][link-reddit]
16
+ [![AGPL Licence][badge-license]](LICENSE)
17
+ [![Language Coverage][badge-language-coverage]][link-locales]
18
+ [![Donate][badge-donate]][link-donate]
19
+ [![Latest release][badge-release]][link-gh-releases]
20
+ [![Last commit][badge-last-commit]][link-gh-commits]
21
+ [![Commits][badge-commit-activity]][link-gh-pulse]
22
+ [![][badge-hellogithub]][link-hellogithub]
23
+ [![Ask DeepWiki][badge-deepwiki]][link-deepwiki]
24
+
25
+ </div>
26
+
27
+ <p align="center">
28
+ <a href="#features">Features</a> •
29
+ <a href="#planned-features">Planned Features</a> •
30
+ <a href="#screenshots">Screenshots</a> •
31
+ <a href="#downloads">Downloads</a> •
32
+ <a href="#getting-started">Getting Started</a> •
33
+ <a href="#troubleshooting">Troubleshooting</a> •
34
+ <a href="#support">Support</a> •
35
+ <a href="#license">License</a>
36
+ </p>
37
+
38
+ <div align="center">
39
+ <a href="https://readest.com" target="_blank">
40
+ <img src="./data/screenshots/landing_all_platforms.png" alt="Readest Banner" width="100%" />
41
+ </a>
42
+ </div>
43
+
44
+ ## Features
45
+
46
+ <div align="left">✅ Implemented</div>
47
+
48
+ | **Feature** | **Description** | **Status** |
49
+ | --------------------------------------- | ---------------------------------------------------------------------------------------------------------------------- | ---------- |
50
+ | **Multi-Format Support** | Support EPUB, MOBI, KF8 (AZW3), FB2, CBZ, TXT, PDF (experimental) | ✅ |
51
+ | **Scroll/Page View Modes** | Switch between scrolling or paginated reading modes. | ✅ |
52
+ | **Full-Text Search** | Search across the entire book to find relevant sections. | ✅ |
53
+ | **Annotations and Highlighting** | Add highlights, bookmarks, and notes to enhance your reading experience and use instant mode for quicker interactions. | ✅ |
54
+ | **Dictionary/Wikipedia Lookup** | Instantly look up words and terms when reading. | ✅ |
55
+ | **[Parallel Read][link-parallel-read]** | Read two books or documents simultaneously in a split-screen view. | ✅ |
56
+ | **Customize Font and Layout** | Adjust font, layout, theme mode, and theme colors for a personalized experience. | ✅ |
57
+ | **Code Syntax Highlighting** | Read software manuals with rich coloring of code examples. | ✅ |
58
+ | **File Association and Open With** | Quickly open files in Readest in your file browser with one-click. | ✅ |
59
+ | **Library Management** | Organize, sort, and manage your entire ebook library. | ✅ |
60
+ | **OPDS/Calibre Integration** | Integrate OPDS/Calibre to access online libraries and catalogs. | ✅ |
61
+ | **Translate with DeepL and Yandex** | From a single sentence to the entire book—translate instantly. | ✅ |
62
+ | **Text-to-Speech (TTS) Support** | Enjoy smooth, multilingual narration—even within a single book. | ✅ |
63
+ | **Sync across Platforms** | Synchronize book files, reading progress, notes, and bookmarks across all supported platforms. | ✅ |
64
+ | **Accessibility** | Provides full keyboard navigation and supports for screen readers such as VoiceOver, TalkBack, NVDA, and Orca. | ✅ |
65
+ | **Visual & Focus Aids** | Reading ruler, paragraph-by-paragraph reading mode, and speed reading features. | ✅ |
66
+
67
+ ## Planned Features
68
+
69
+ <div align="left">🛠 Building</div>
70
+ <div align="left">🔄 Planned</div>
71
+
72
+ | **Feature** | **Description** | **Priority** |
73
+ | ------------------------------------------ | ------------------------------------------------------------------------------------------ | ------------ |
74
+ | [**Sync with Koreader**][link-kosync-wiki] | Synchronize reading progress, notes, and bookmarks with [Koreader][link-koreader] devices. | 🛠 |
75
+ | **AI-Powered Summarization** | Generate summaries of books or chapters using AI for quick insights. | 🛠 |
76
+ | **Advanced Reading Stats** | Track reading time, pages read, and more for detailed insights. | 🛠 |
77
+ | **Audiobook Support** | Extend functionality to play and manage audiobooks. | 🔄 |
78
+ | **Handwriting Annotations** | Add support for handwriting annotations using a pen on compatible devices. | 🔄 |
79
+ | **In-Library Full-Text Search** | Search across your entire ebook library to find topics and quotes. | 🔄 |
80
+
81
+ Stay tuned for continuous improvements and updates! Contributions and suggestions are always welcome—let's build the ultimate reading experience together. 😊
82
+
83
+ ## Screenshots
84
+
85
+ ![Annotations](./data/screenshots/annotations.png)
86
+
87
+ ![TTS](./data/screenshots/tts_speak_aloud.png)
88
+
89
+ ![DeepL](./data/screenshots/deepl.png)
90
+
91
+ ![Footnote](./data/screenshots/footnote_popover.png)
92
+
93
+ ![Wikipedia](./data/screenshots/wikipedia_vertical.png)
94
+
95
+ ![Theming Dark Mode](./data/screenshots/theming_dark_mode.png)
96
+
97
+ ---
98
+
99
+ ## Downloads
100
+
101
+ ### Mobile Apps
102
+
103
+ <div align="center">
104
+ <a href="https://apps.apple.com/app/id6738622779">
105
+ <img alt="Download on the App Store" src="https://developer.apple.com/assets/elements/badges/download-on-the-app-store.svg" style="height: 50px;" /></a>&nbsp;&nbsp;&nbsp;&nbsp;
106
+ <a href="https://play.google.com/store/apps/details?id=com.bilingify.readest">
107
+ <img alt="Get it on Google Play" src="https://upload.wikimedia.org/wikipedia/commons/7/78/Google_Play_Store_badge_EN.svg" style="height: 50px;" /></a>
108
+ </div>
109
+
110
+ ### Platform-Specific Downloads
111
+
112
+ - macOS / iOS / iPadOS : Search and install **Readest** on the [App Store][link-appstore], _also_ available on TestFlight for beta test (send your Apple ID to <readestapp@gmail.com> to request access).
113
+ - Windows / Linux / Android: Visit and download **Readest** at [https://readest.com][link-website] or the [Releases on GitHub][link-gh-releases].
114
+ - Linux users can also install [Readest on Flathub][link-flathub].
115
+ - Web: Visit and use **Readest for Web** at [https://web.readest.com][link-web-readest].
116
+
117
+ ## Requirements
118
+
119
+ - **Node.js** and **pnpm** for Next.js development
120
+ - **Rust** and **Cargo** for Tauri development
121
+
122
+ For the best experience to build Readest for yourself, use a recent version of Node.js and Rust. Refer to the [Tauri documentation](https://v2.tauri.app/start/prerequisites/) for details on setting up the development environment prerequisites on different platforms.
123
+
124
+ ```bash
125
+ nvm install v22
126
+ nvm use v22
127
+ npm install -g pnpm
128
+ rustup update
129
+ ```
130
+
131
+ ## Getting Started
132
+
133
+ To get started with Readest, follow these steps to clone and build the project.
134
+
135
+ ### 1. Clone the Repository
136
+
137
+ ```bash
138
+ git clone https://github.com/readest/readest.git
139
+ cd readest
140
+ ```
141
+
142
+ ### 2. Install Dependencies
143
+
144
+ ```bash
145
+ # might need to rerun this when code is updated
146
+ git submodule update --init --recursive
147
+ pnpm install
148
+ # copy vendors dist libs to public directory
149
+ pnpm --filter @readest/readest-app setup-vendors
150
+ ```
151
+
152
+ ### 3. Verify Dependencies Installation
153
+
154
+ To confirm that all dependencies are correctly installed, run the following command:
155
+
156
+ ```bash
157
+ pnpm tauri info
158
+ ```
159
+
160
+ This command will display information about the installed Tauri dependencies and configuration on your platform. Note that the output may vary depending on the operating system and environment setup. Please review the output specific to your platform for any potential issues.
161
+
162
+ For Windows targets, “Build Tools for Visual Studio 2022” (or a higher edition of Visual Studio) and the “Desktop development with C++” workflow must be installed. For Windows ARM64 targets, the “VS 2022 C++ ARM64 build tools” and "C++ Clang Compiler for Windows" components must be installed. And make sure `clang` can be found in the path by adding `C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\Llvm\x64\bin` for example in the environment variable `Path`.
163
+
164
+ ### 4. Build for Development
165
+
166
+ ```bash
167
+ # Start development for the Tauri app
168
+ pnpm tauri dev
169
+ # or start development for the Web app
170
+ pnpm dev-web
171
+ # preview with OpenNext build for the Web app
172
+ pnpm preview
173
+ ```
174
+
175
+ For Android:
176
+
177
+ ```bash
178
+ # Initialize the Android environment (run once)
179
+ rm apps/readest-app/src-tauri/gen/android
180
+ pnpm tauri android init
181
+ git checkout apps/readest-app/src-tauri/gen/android
182
+
183
+ pnpm tauri android dev
184
+ # or if you want to dev on a real device
185
+ pnpm tauri android dev --host
186
+ ```
187
+
188
+ For iOS:
189
+
190
+ ```bash
191
+ # Set up the iOS environment (run once)
192
+ pnpm tauri ios init
193
+
194
+ pnpm tauri ios dev
195
+ # or if you want to dev on a real device
196
+ pnpm tauri ios dev --host
197
+ ```
198
+
199
+ ### 5. Build for Production
200
+
201
+ ```bash
202
+ pnpm tauri build
203
+ pnpm tauri android build
204
+ pnpm tauri ios build
205
+ ```
206
+
207
+ Please refer to our release script if you experience any issues:
208
+ https://github.com/readest/readest/blob/main/.github/workflows/release.yml
209
+
210
+ ### 6. Setup dev environment with Nix
211
+
212
+ If you have Nix installed, you can leverage flake to enter a development shell
213
+ with all the necessary dependencies:
214
+
215
+ ```bash
216
+ nix develop ./ops # enter a dev shell for the web app
217
+ nix develop ./ops#ios # enter a dev shell for the ios app
218
+ nix develop ./ops#android # enter a dev shell for the android app
219
+ ```
220
+
221
+ ### 7. More information
222
+
223
+ Please check the [wiki][link-gh-wiki] of this project for more information on development.
224
+
225
+ ## Troubleshooting
226
+
227
+ ### 1. Readest Won’t Launch on Windows (Missing Edge WebView2 Runtime)
228
+
229
+ **Symptom**
230
+
231
+ - When you double-click readest.exe, nothing happens. No window appears, and Task Manager does not show the process.
232
+ - This can affect both the standard installer and the portable version.
233
+
234
+ **Cause**
235
+
236
+ - Microsoft Edge WebView2 Runtime is either missing, outdated, or improperly installed on your system. Readest depends on WebView2 to render the interface on Windows.
237
+
238
+ **How to Fix**
239
+
240
+ 1. Check if WebView2 is installed
241
+ - Open “Add or Remove Programs” (a.k.a. Apps & features) on Windows. Look for “Microsoft Edge WebView2 Runtime.”
242
+ 2. Install or Update WebView2
243
+ - Download the WebView2 Runtime directly from Microsoft: [link](https://developer.microsoft.com/en-us/microsoft-edge/webview2?form=MA13LH).
244
+ - If you prefer an offline installer, download the offline package and run it as an Administrator.
245
+ 3. Re-run Readest
246
+ - After installing/updating WebView2, launch readest.exe again.
247
+ - If you still encounter problems, reboot your PC and try again.
248
+
249
+ **Additional Tips**
250
+
251
+ - If reinstalling once doesn’t work, uninstall Edge WebView2 completely, then reinstall it with Administrator privileges.
252
+ - Verify your Windows installation has the latest updates from Microsoft.
253
+
254
+ **Still Stuck?**
255
+
256
+ - See Issue [readest/readest#358](https://github.com/readest/readest/issues/358) for further details, or head over to our [Discord][link-discord] server and open a support discussion with detailed logs of your environment and the steps you’ve taken.
257
+
258
+ ### 2. AppImage Launches but Only Shows a Taskbar Icon
259
+
260
+ On some Arch Linux systems—especially those using Wayland—the Readest AppImage may briefly show an icon in the taskbar and then exit without opening a window.
261
+
262
+ You might see logs such as:
263
+
264
+ ```
265
+ Could not create default EGL display: EGL_BAD_PARAMETER. Aborting...
266
+ ```
267
+
268
+ This behavior is usually caused by compatibility issues between the bundled AppImage libraries and the system’s EGL / Wayland environment.
269
+
270
+ **Workaround 1: Launch with LD_PRELOAD (recommended)**
271
+
272
+ You can preload the system Wayland client library before launching the AppImage:
273
+
274
+ ```
275
+ LD_PRELOAD=/usr/lib/libwayland-client.so /path/to/Readest.AppImage
276
+ ```
277
+
278
+ This workaround has been confirmed to resolve the issue on affected systems.
279
+
280
+ **Workaround 2: Use the Flatpak Version**
281
+
282
+ If you prefer a more reliable out-of-the-box experience on Arch Linux, consider using the [Flatpak build on Flathub][link-flathub] instead. The Flatpak runtime helps avoid system library mismatches and tends to behave more consistently across different Wayland and X11 setups.
283
+
284
+ ## Contributors
285
+
286
+ Readest is open-source, and contributions are welcome! Feel free to open issues, suggest features, or submit pull requests. Please **review our [contributing guidelines](CONTRIBUTING.md) before you start**. We also welcome you to join our [Discord][link-discord] community for either support or contributing guidance.
287
+
288
+ <a href="https://github.com/readest/readest/graphs/contributors">
289
+ <p align="left">
290
+ <img width="500" src="https://contrib.rocks/image?repo=readest/readest" alt="A table of avatars from the project's contributors" />
291
+ </p>
292
+ </a>
293
+
294
+ ## Support
295
+
296
+ If Readest has been useful to you, consider supporting its development. You can [become a sponsor on GitHub](https://github.com/sponsors/readest), [donate via Stripe](https://donate.stripe.com/4gMcN5aZdcE52kW3TFgjC01), or [donate with crypto](https://donate.readest.com). Your contribution helps us squash bugs faster, improve performance, and keep building great features.
297
+
298
+ ### Sponsors
299
+
300
+ <p align="center">
301
+ <a title="Browser testing via TestMu AI" href="https://www.testmuai.com/?utm_medium=sponsor&utm_source=readest" target="_blank">
302
+ <img src="https://raw.githubusercontent.com/readest/readest/refs/heads/main/data/sponsors/testmu-ai-logo.png" style="vertical-align: middle;" width="250" />
303
+ </a>
304
+ </p>
305
+
306
+ ## License
307
+
308
+ Readest is free software: you can redistribute it and/or modify it under the terms of the [GNU Affero General Public License](https://www.gnu.org/licenses/agpl-3.0.html) as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. See the [LICENSE](LICENSE) file for details.
309
+
310
+ The following libraries and frameworks are used in this software:
311
+
312
+ - [foliate-js](https://github.com/johnfactotum/foliate-js), which is MIT licensed.
313
+ - [zip.js](https://github.com/gildas-lormeau/zip.js), which is licensed under the BSD-3-Clause license.
314
+ - [fflate](https://github.com/101arrowz/fflate), which is MIT licensed.
315
+ - [PDF.js](https://github.com/mozilla/pdf.js), which is licensed under Apache License 2.0.
316
+ - [daisyUI](https://github.com/saadeghi/daisyui), which is MIT licensed.
317
+ - [marked](https://github.com/markedjs/marked), which is MIT licensed.
318
+ - [next.js](https://github.com/vercel/next.js), which is MIT licensed.
319
+ - [react-icons](https://github.com/react-icons/react-icons), which has various open-source licenses.
320
+ - [react](https://github.com/facebook/react), which is MIT licensed.
321
+ - [tauri](https://github.com/tauri-apps/tauri), which is MIT licensed.
322
+
323
+ The following fonts are utilized in this software, either bundled within the application or provided through web fonts:
324
+
325
+ [Bitter](https://fonts.google.com/specimen/Bitter), [Fira Code](https://fonts.google.com/specimen/Fira+Code), [Inter](https://fonts.google.com/specimen/Inter), [Literata](https://fonts.google.com/specimen/Literata), [Merriweather](https://fonts.google.com/specimen/Merriweather), [Noto Sans](https://fonts.google.com/specimen/Noto+Sans), [Roboto](https://fonts.google.com/specimen/Roboto), [LXGW WenKai](https://github.com/lxgw/LxgwWenKai), [MiSans](https://hyperos.mi.com/font/en/), [Source Han](https://github.com/adobe-fonts/source-han-sans/), [WenQuanYi Micro Hei](http://wenq.org/wqy2/)
326
+
327
+ We would also like to thank the [Web Chinese Fonts Plan](https://chinese-font.netlify.app) for offering open-source tools that enable the use of Chinese fonts on the web.
328
+
329
+ ---
330
+
331
+ <div align="center" style="color: gray;">Happy reading with Readest!</div>
332
+
333
+ [badge-website]: https://img.shields.io/badge/website-readest.com-orange
334
+ [badge-web-app]: https://img.shields.io/badge/read%20online-web.readest.com-orange
335
+ [badge-license]: https://img.shields.io/github/license/readest/readest?color=teal
336
+ [badge-release]: https://img.shields.io/github/release/readest/readest?color=green
337
+ [badge-platforms]: https://img.shields.io/badge/platforms-macOS%2C%20Windows%2C%20Linux%2C%20Android%2C%20iOS%2C%20Web%2C%20PWA-green
338
+ [badge-last-commit]: https://img.shields.io/github/last-commit/readest/readest?color=blue
339
+ [badge-commit-activity]: https://img.shields.io/github/commit-activity/m/readest/readest?color=blue
340
+ [badge-discord]: https://img.shields.io/discord/1314226120886976544?color=5865F2&label=discord&labelColor=black&logo=discord&logoColor=white&style=flat-square
341
+ [badge-hellogithub]: https://abroad.hellogithub.com/v1/widgets/recommend.svg?rid=8a5b6ade2aee461a8bd94e59200682a7&claim_uid=eRLUbPOy2qZtDgw&theme=small
342
+ [badge-donate]: https://donate.readest.com/badge.svg
343
+ [badge-deepwiki]: https://deepwiki.com/badge.svg
344
+ [badge-reddit]: https://img.shields.io/reddit/subreddit-subscribers/readest?style=flat&logo=reddit&color=F37E41
345
+ [badge-language-coverage]: https://img.shields.io/badge/coverage-53%25%20population%20🌍-green
346
+ [link-donate]: https://donate.readest.com/?tickers=btc%2Ceth%2Csol%2Cusdc
347
+ [link-appstore]: https://apps.apple.com/app/apple-store/id6738622779?pt=127463130&ct=github&mt=8
348
+ [link-website]: https://readest.com?utm_source=github&utm_medium=referral&utm_campaign=readme
349
+ [link-flathub]: https://flathub.org/en/apps/com.bilingify.readest
350
+ [link-web-readest]: https://web.readest.com
351
+ [link-gh-releases]: https://github.com/readest/readest/releases
352
+ [link-gh-commits]: https://github.com/readest/readest/commits/main
353
+ [link-gh-pulse]: https://github.com/readest/readest/pulse
354
+ [link-gh-wiki]: https://github.com/readest/readest/wiki
355
+ [link-discord]: https://discord.gg/gntyVNk3BJ
356
+ [link-parallel-read]: https://readest.com/#parallel-read
357
+ [link-koreader]: https://github.com/koreader/koreader
358
+ [link-hellogithub]: https://hellogithub.com/repository/8a5b6ade2aee461a8bd94e59200682a7
359
+ [link-deepwiki]: https://deepwiki.com/readest/readest
360
+ [link-locales]: https://github.com/readest/readest/tree/main/apps/readest-app/public/locales
361
+ [link-kosync-wiki]: https://github.com/readest/readest/wiki/Sync-with-Koreader-devices
362
+ [link-reddit]: https://reddit.com/r/readest/
apps/readest-app/.env ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ PDFJS_BUILD_PATH=../../packages/foliate-js/node_modules/pdfjs-dist/legacy/build
2
+ PDFJS_FONTS_PATH=../../packages/foliate-js/node_modules/pdfjs-dist
3
+ PDFJS_STYLE_PATH=../../packages/foliate-js/vendor/pdfjs
4
+
5
+ NEXT_PUBLIC_DEFAULT_POSTHOG_URL_BASE64="aHR0cHM6Ly91cy5pLnBvc3Rob2cuY29t"
6
+ NEXT_PUBLIC_DEFAULT_POSTHOG_KEY_BASE64="cGhjX2ViNXowbVRxWm8yZm5YYnZGNmE3bFh5TThpTmRSNTNsR1A3VFM3VGh4S08="
7
+
8
+ NEXT_PUBLIC_DEFAULT_SUPABASE_URL_BASE64="aHR0cHM6Ly9yZWFkZXN0LnN1cGFiYXNlLmNv"
9
+ NEXT_PUBLIC_DEFAULT_SUPABASE_KEY_BASE64="ZXlKaGJHY2lPaUpJVXpJMU5pSXNJblI1Y0NJNklrcFhWQ0o5LmV5SnBjM01pT2lKemRYQmhZbUZ6WlNJc0luSmxaaUk2SW5aaWMzbDRablZ6YW1weFpIaHJhbkZzZVhOaklpd2ljbTlzWlNJNkltRnViMjRpTENKcFlYUWlPakUzTXpReE1qTTJOekVzSW1WNGNDSTZNakEwT1RZNU9UWTNNWDAuM1U1VXFhb3VfMVNnclZlMWVvOXJBcGMwdUtqcWhwUWRVWGh2d1VIbVVmZw=="
10
+
11
+ NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY_DEV_BASE64="cGtfdGVzdF81MVJmQmdLRTdSWW5pTWsxc0tDV2RUd2hMZzcySzk4eDRWcjlIdDdsRFBONngzcnpZYmhydGtNQnpDdzZKbHFaRVVITVp5eVNjVXhCZXVkcGppWTk0WXNHcDAweFlRRnRRaUU="
12
+ NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY_BASE64="cGtfbGl2ZV81MVFYN3dRRU5ndjJFOUxQRHpZUlE5TlJJeTNjd09EZ1AzSkNFRHRPWlFtdFJWc3Brd053ZE1NNUpIVnVPTmJWcjZ3VGFCMUNZR1pJMmRPVWppTkY0bHJvVjAwalE4TkpkdWk="
apps/readest-app/.env.local.example ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ NEXT_PUBLIC_POSTHOG_KEY=YOUR_POSTHOG_KEY
2
+ NEXT_PUBLIC_POSTHOG_HOST=YOUR_POSTHOG_HOST
3
+
4
+ NEXT_PUBLIC_SUPABASE_URL=YOUR_SUPABASE_URL
5
+ NEXT_PUBLIC_SUPABASE_ANON_KEY=YOUR_SUPABASE_ANON_KEY
6
+
7
+ NEXT_PUBLIC_STORAGE_FIXED_QUOTA=1073741824
8
+
9
+ NEXT_PUBLIC_API_BASE_URL=https://your-api-base-url.com
10
+
11
+ SUPABASE_ADMIN_KEY=YOUR_SUPABASE_ADMIN_KEY
12
+
13
+ DEEPL_PRO_API_KEYS=YOUR_DEEPL_PRO_API_KEYS
14
+ DEEPL_FREE_API_KEYS=YOUR_DEEPL_FREE_API_KEYS
15
+
16
+ # r2, s3
17
+ NEXT_PUBLIC_OBJECT_STORAGE_TYPE=r2
18
+
19
+ R2_TOKEN_VALUE=YOUR_R2_TOKEN_VALUE
20
+ R2_ACCESS_KEY_ID=YOUR_R2_ACCESS_KEY_ID
21
+ R2_SECRET_ACCESS_KEY=YOUR_R2_SECRET_ACCESS_KEY
22
+ R2_BUCKET_NAME=YOUR_R2_BUCKET_NAME
23
+ R2_ACCOUNT_ID=YOUR_R2_ACCOUNT_ID
24
+ R2_REGION=YOUR_R2_REGION
25
+
26
+ S3_ENDPOINT=PLACE_HOLDER
27
+ S3_ACCESS_KEY_ID=PLACE_HOLDER
28
+ S3_SECRET_ACCESS_KEY=PLACE_HOLDER
29
+ S3_BUCKET_NAME=PLACE_HOLDER
30
+ S3_REGION=PLACE_HOLDER
31
+
32
+ TEMP_STORAGE_PUBLIC_BUCKET_NAME=PLACE_HOLDER
apps/readest-app/.env.tauri ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ NEXT_PUBLIC_APP_PLATFORM=tauri
2
+
3
+ DBUS_ID=com.bilingify.readest
apps/readest-app/.env.tauri.example ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ NEXT_PUBLIC_APP_PLATFORM=tauri
2
+ AI_GATEWAY_API_KEY=your_key_here
apps/readest-app/.env.web ADDED
@@ -0,0 +1 @@
 
 
1
+ NEXT_PUBLIC_APP_PLATFORM=web
apps/readest-app/.env.web.example ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ NEXT_PUBLIC_APP_PLATFORM=web
2
+ AI_GATEWAY_API_KEY=your_key_here
3
+ NEXT_PUBLIC_AI_GATEWAY_API_KEY=your_key_here
apps/readest-app/.gitignore ADDED
@@ -0,0 +1,62 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2
+
3
+ # dependencies
4
+ /node_modules
5
+ /.pnp
6
+ .pnp.js
7
+ .yarn/install-state.gz
8
+
9
+ # testing
10
+ /coverage
11
+
12
+ # next.js
13
+ /.next/
14
+ /out/
15
+
16
+ # production
17
+ /build
18
+
19
+ # misc
20
+ .DS_Store
21
+ *.pem
22
+
23
+ # debug
24
+ npm-debug.log*
25
+ yarn-debug.log*
26
+ yarn-error.log*
27
+
28
+ # local env files
29
+ .env*.local
30
+
31
+ # certs and keys
32
+ /private_keys
33
+
34
+ # plists
35
+ Entitlements*.plist
36
+
37
+ # local confs
38
+ tauri.*.conf.json
39
+
40
+ # vercel
41
+ .vercel
42
+
43
+ # open-next
44
+ .open-next
45
+ .wrangler
46
+
47
+ # typescript
48
+ *.tsbuildinfo
49
+ next-env.d.ts
50
+
51
+ #generated
52
+ src-tauri/gen
53
+
54
+ # vendor
55
+ /public/vendor
56
+
57
+ # Auto Generated PWA files
58
+ /public/sw.js
59
+ /public/workbox-*.js
60
+ /public/fallback-*.js
61
+ /public/swe-worker-*.js
62
+
apps/readest-app/components.json ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "$schema": "https://ui.shadcn.com/schema.json",
3
+ "style": "new-york",
4
+ "rsc": true,
5
+ "tsx": true,
6
+ "tailwind": {
7
+ "config": "tailwind.config.ts",
8
+ "css": "src/styles/globals.css",
9
+ "baseColor": "neutral",
10
+ "cssVariables": true,
11
+ "prefix": ""
12
+ },
13
+ "iconLibrary": "lucide",
14
+ "aliases": {
15
+ "components": "@/components",
16
+ "utils": "@/utils",
17
+ "ui": "@/components/ui",
18
+ "lib": "@/libs",
19
+ "hooks": "@/hooks"
20
+ },
21
+ "registries": {}
22
+ }
apps/readest-app/eslint.config.mjs ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import { defineConfig, globalIgnores } from 'eslint/config';
2
+ import next from 'eslint-config-next';
3
+ import nextVitals from 'eslint-config-next/core-web-vitals';
4
+ import tseslint from 'eslint-config-next/typescript';
5
+ import jsxA11y from 'eslint-plugin-jsx-a11y';
6
+
7
+ const eslintConfig = defineConfig([
8
+ ...tseslint,
9
+ ...next,
10
+ ...nextVitals,
11
+ {
12
+ rules: {
13
+ ...jsxA11y.configs.recommended.rules,
14
+ '@typescript-eslint/no-unused-vars': [
15
+ 'warn',
16
+ {
17
+ argsIgnorePattern: '^_',
18
+ varsIgnorePattern: '^_',
19
+ caughtErrorsIgnorePattern: '^_',
20
+ },
21
+ ],
22
+ },
23
+ },
24
+ globalIgnores([
25
+ 'node_modules/**',
26
+ '.next/**',
27
+ '.open-next/**',
28
+ 'out/**',
29
+ 'build/**',
30
+ 'public/**',
31
+ 'next-env.d.ts',
32
+ ]),
33
+ ]);
34
+
35
+ export default eslintConfig;
apps/readest-app/extensions/windows-thumbnail/Cargo.lock ADDED
@@ -0,0 +1,588 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # This file is automatically @generated by Cargo.
2
+ # It is not intended for manual editing.
3
+ version = 4
4
+
5
+ [[package]]
6
+ name = "adler2"
7
+ version = "2.0.1"
8
+ source = "registry+https://github.com/rust-lang/crates.io-index"
9
+ checksum = "320119579fcad9c21884f5c4861d16174d0e06250625266f50fe6898340abefa"
10
+
11
+ [[package]]
12
+ name = "anyhow"
13
+ version = "1.0.100"
14
+ source = "registry+https://github.com/rust-lang/crates.io-index"
15
+ checksum = "a23eb6b1614318a8071c9b2521f36b424b2c83db5eb3a0fead4a6c0809af6e61"
16
+
17
+ [[package]]
18
+ name = "arbitrary"
19
+ version = "1.4.2"
20
+ source = "registry+https://github.com/rust-lang/crates.io-index"
21
+ checksum = "c3d036a3c4ab069c7b410a2ce876bd74808d2d0888a82667669f8e783a898bf1"
22
+ dependencies = [
23
+ "derive_arbitrary",
24
+ ]
25
+
26
+ [[package]]
27
+ name = "autocfg"
28
+ version = "1.5.0"
29
+ source = "registry+https://github.com/rust-lang/crates.io-index"
30
+ checksum = "c08606f8c3cbf4ce6ec8e28fb0014a2c086708fe954eaa885384a6165172e7e8"
31
+
32
+ [[package]]
33
+ name = "base64"
34
+ version = "0.22.1"
35
+ source = "registry+https://github.com/rust-lang/crates.io-index"
36
+ checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6"
37
+
38
+ [[package]]
39
+ name = "bitflags"
40
+ version = "2.10.0"
41
+ source = "registry+https://github.com/rust-lang/crates.io-index"
42
+ checksum = "812e12b5285cc515a9c72a5c1d3b6d46a19dac5acfef5265968c166106e31dd3"
43
+
44
+ [[package]]
45
+ name = "bumpalo"
46
+ version = "3.19.0"
47
+ source = "registry+https://github.com/rust-lang/crates.io-index"
48
+ checksum = "46c5e41b57b8bba42a04676d81cb89e9ee8e859a1a66f80a5a72e1cb76b34d43"
49
+
50
+ [[package]]
51
+ name = "bytemuck"
52
+ version = "1.24.0"
53
+ source = "registry+https://github.com/rust-lang/crates.io-index"
54
+ checksum = "1fbdf580320f38b612e485521afda1ee26d10cc9884efaaa750d383e13e3c5f4"
55
+
56
+ [[package]]
57
+ name = "byteorder-lite"
58
+ version = "0.1.0"
59
+ source = "registry+https://github.com/rust-lang/crates.io-index"
60
+ checksum = "8f1fe948ff07f4bd06c30984e69f5b4899c516a3ef74f34df92a2df2ab535495"
61
+
62
+ [[package]]
63
+ name = "cfg-if"
64
+ version = "1.0.4"
65
+ source = "registry+https://github.com/rust-lang/crates.io-index"
66
+ checksum = "9330f8b2ff13f34540b44e946ef35111825727b38d33286ef986142615121801"
67
+
68
+ [[package]]
69
+ name = "color_quant"
70
+ version = "1.1.0"
71
+ source = "registry+https://github.com/rust-lang/crates.io-index"
72
+ checksum = "3d7b894f5411737b7867f4827955924d7c254fc9f4d91a6aad6b097804b1018b"
73
+
74
+ [[package]]
75
+ name = "crc32fast"
76
+ version = "1.5.0"
77
+ source = "registry+https://github.com/rust-lang/crates.io-index"
78
+ checksum = "9481c1c90cbf2ac953f07c8d4a58aa3945c425b7185c9154d67a65e4230da511"
79
+ dependencies = [
80
+ "cfg-if",
81
+ ]
82
+
83
+ [[package]]
84
+ name = "derive_arbitrary"
85
+ version = "1.4.2"
86
+ source = "registry+https://github.com/rust-lang/crates.io-index"
87
+ checksum = "1e567bd82dcff979e4b03460c307b3cdc9e96fde3d73bed1496d2bc75d9dd62a"
88
+ dependencies = [
89
+ "proc-macro2",
90
+ "quote",
91
+ "syn",
92
+ ]
93
+
94
+ [[package]]
95
+ name = "directories-next"
96
+ version = "2.0.0"
97
+ source = "registry+https://github.com/rust-lang/crates.io-index"
98
+ checksum = "339ee130d97a610ea5a5872d2bbb130fdf68884ff09d3028b81bec8a1ac23bbc"
99
+ dependencies = [
100
+ "cfg-if",
101
+ "dirs-sys-next",
102
+ ]
103
+
104
+ [[package]]
105
+ name = "dirs-sys-next"
106
+ version = "0.1.2"
107
+ source = "registry+https://github.com/rust-lang/crates.io-index"
108
+ checksum = "4ebda144c4fe02d1f7ea1a7d9641b6fc6b580adcfa024ae48797ecdeb6825b4d"
109
+ dependencies = [
110
+ "libc",
111
+ "redox_users",
112
+ "winapi",
113
+ ]
114
+
115
+ [[package]]
116
+ name = "equivalent"
117
+ version = "1.0.2"
118
+ source = "registry+https://github.com/rust-lang/crates.io-index"
119
+ checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f"
120
+
121
+ [[package]]
122
+ name = "fdeflate"
123
+ version = "0.3.7"
124
+ source = "registry+https://github.com/rust-lang/crates.io-index"
125
+ checksum = "1e6853b52649d4ac5c0bd02320cddc5ba956bdb407c4b75a2c6b75bf51500f8c"
126
+ dependencies = [
127
+ "simd-adler32",
128
+ ]
129
+
130
+ [[package]]
131
+ name = "flate2"
132
+ version = "1.1.5"
133
+ source = "registry+https://github.com/rust-lang/crates.io-index"
134
+ checksum = "bfe33edd8e85a12a67454e37f8c75e730830d83e313556ab9ebf9ee7fbeb3bfb"
135
+ dependencies = [
136
+ "crc32fast",
137
+ "libz-rs-sys",
138
+ "miniz_oxide",
139
+ ]
140
+
141
+ [[package]]
142
+ name = "getrandom"
143
+ version = "0.2.16"
144
+ source = "registry+https://github.com/rust-lang/crates.io-index"
145
+ checksum = "335ff9f135e4384c8150d6f27c6daed433577f86b4750418338c01a1a2528592"
146
+ dependencies = [
147
+ "cfg-if",
148
+ "libc",
149
+ "wasi",
150
+ ]
151
+
152
+ [[package]]
153
+ name = "gif"
154
+ version = "0.14.0"
155
+ source = "registry+https://github.com/rust-lang/crates.io-index"
156
+ checksum = "f954a9e9159ec994f73a30a12b96a702dde78f5547bcb561174597924f7d4162"
157
+ dependencies = [
158
+ "color_quant",
159
+ "weezl",
160
+ ]
161
+
162
+ [[package]]
163
+ name = "hashbrown"
164
+ version = "0.16.1"
165
+ source = "registry+https://github.com/rust-lang/crates.io-index"
166
+ checksum = "841d1cc9bed7f9236f321df977030373f4a4163ae1a7dbfe1a51a2c1a51d9100"
167
+
168
+ [[package]]
169
+ name = "image"
170
+ version = "0.25.9"
171
+ source = "registry+https://github.com/rust-lang/crates.io-index"
172
+ checksum = "e6506c6c10786659413faa717ceebcb8f70731c0a60cbae39795fdf114519c1a"
173
+ dependencies = [
174
+ "bytemuck",
175
+ "byteorder-lite",
176
+ "color_quant",
177
+ "gif",
178
+ "image-webp",
179
+ "moxcms",
180
+ "num-traits",
181
+ "png",
182
+ "zune-core",
183
+ "zune-jpeg",
184
+ ]
185
+
186
+ [[package]]
187
+ name = "image-webp"
188
+ version = "0.2.4"
189
+ source = "registry+https://github.com/rust-lang/crates.io-index"
190
+ checksum = "525e9ff3e1a4be2fbea1fdf0e98686a6d98b4d8f937e1bf7402245af1909e8c3"
191
+ dependencies = [
192
+ "byteorder-lite",
193
+ "quick-error",
194
+ ]
195
+
196
+ [[package]]
197
+ name = "indexmap"
198
+ version = "2.12.1"
199
+ source = "registry+https://github.com/rust-lang/crates.io-index"
200
+ checksum = "0ad4bb2b565bca0645f4d68c5c9af97fba094e9791da685bf83cb5f3ce74acf2"
201
+ dependencies = [
202
+ "equivalent",
203
+ "hashbrown",
204
+ ]
205
+
206
+ [[package]]
207
+ name = "libc"
208
+ version = "0.2.177"
209
+ source = "registry+https://github.com/rust-lang/crates.io-index"
210
+ checksum = "2874a2af47a2325c2001a6e6fad9b16a53b802102b528163885171cf92b15976"
211
+
212
+ [[package]]
213
+ name = "libredox"
214
+ version = "0.1.10"
215
+ source = "registry+https://github.com/rust-lang/crates.io-index"
216
+ checksum = "416f7e718bdb06000964960ffa43b4335ad4012ae8b99060261aa4a8088d5ccb"
217
+ dependencies = [
218
+ "bitflags",
219
+ "libc",
220
+ ]
221
+
222
+ [[package]]
223
+ name = "libz-rs-sys"
224
+ version = "0.5.2"
225
+ source = "registry+https://github.com/rust-lang/crates.io-index"
226
+ checksum = "840db8cf39d9ec4dd794376f38acc40d0fc65eec2a8f484f7fd375b84602becd"
227
+ dependencies = [
228
+ "zlib-rs",
229
+ ]
230
+
231
+ [[package]]
232
+ name = "log"
233
+ version = "0.4.28"
234
+ source = "registry+https://github.com/rust-lang/crates.io-index"
235
+ checksum = "34080505efa8e45a4b816c349525ebe327ceaa8559756f0356cba97ef3bf7432"
236
+
237
+ [[package]]
238
+ name = "md5"
239
+ version = "0.8.0"
240
+ source = "registry+https://github.com/rust-lang/crates.io-index"
241
+ checksum = "ae960838283323069879657ca3de837e9f7bbb4c7bf6ea7f1b290d5e9476d2e0"
242
+
243
+ [[package]]
244
+ name = "memchr"
245
+ version = "2.7.6"
246
+ source = "registry+https://github.com/rust-lang/crates.io-index"
247
+ checksum = "f52b00d39961fc5b2736ea853c9cc86238e165017a493d1d5c8eac6bdc4cc273"
248
+
249
+ [[package]]
250
+ name = "miniz_oxide"
251
+ version = "0.8.9"
252
+ source = "registry+https://github.com/rust-lang/crates.io-index"
253
+ checksum = "1fa76a2c86f704bdb222d66965fb3d63269ce38518b83cb0575fca855ebb6316"
254
+ dependencies = [
255
+ "adler2",
256
+ "simd-adler32",
257
+ ]
258
+
259
+ [[package]]
260
+ name = "moxcms"
261
+ version = "0.7.10"
262
+ source = "registry+https://github.com/rust-lang/crates.io-index"
263
+ checksum = "80986bbbcf925ebd3be54c26613d861255284584501595cf418320c078945608"
264
+ dependencies = [
265
+ "num-traits",
266
+ "pxfm",
267
+ ]
268
+
269
+ [[package]]
270
+ name = "num-traits"
271
+ version = "0.2.19"
272
+ source = "registry+https://github.com/rust-lang/crates.io-index"
273
+ checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841"
274
+ dependencies = [
275
+ "autocfg",
276
+ ]
277
+
278
+ [[package]]
279
+ name = "once_cell"
280
+ version = "1.21.3"
281
+ source = "registry+https://github.com/rust-lang/crates.io-index"
282
+ checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d"
283
+
284
+ [[package]]
285
+ name = "png"
286
+ version = "0.18.0"
287
+ source = "registry+https://github.com/rust-lang/crates.io-index"
288
+ checksum = "97baced388464909d42d89643fe4361939af9b7ce7a31ee32a168f832a70f2a0"
289
+ dependencies = [
290
+ "bitflags",
291
+ "crc32fast",
292
+ "fdeflate",
293
+ "flate2",
294
+ "miniz_oxide",
295
+ ]
296
+
297
+ [[package]]
298
+ name = "proc-macro2"
299
+ version = "1.0.103"
300
+ source = "registry+https://github.com/rust-lang/crates.io-index"
301
+ checksum = "5ee95bc4ef87b8d5ba32e8b7714ccc834865276eab0aed5c9958d00ec45f49e8"
302
+ dependencies = [
303
+ "unicode-ident",
304
+ ]
305
+
306
+ [[package]]
307
+ name = "pxfm"
308
+ version = "0.1.26"
309
+ source = "registry+https://github.com/rust-lang/crates.io-index"
310
+ checksum = "b3502d6155304a4173a5f2c34b52b7ed0dd085890326cb50fd625fdf39e86b3b"
311
+ dependencies = [
312
+ "num-traits",
313
+ ]
314
+
315
+ [[package]]
316
+ name = "quick-error"
317
+ version = "2.0.1"
318
+ source = "registry+https://github.com/rust-lang/crates.io-index"
319
+ checksum = "a993555f31e5a609f617c12db6250dedcac1b0a85076912c436e6fc9b2c8e6a3"
320
+
321
+ [[package]]
322
+ name = "quote"
323
+ version = "1.0.42"
324
+ source = "registry+https://github.com/rust-lang/crates.io-index"
325
+ checksum = "a338cc41d27e6cc6dce6cefc13a0729dfbb81c262b1f519331575dd80ef3067f"
326
+ dependencies = [
327
+ "proc-macro2",
328
+ ]
329
+
330
+ [[package]]
331
+ name = "redox_users"
332
+ version = "0.4.6"
333
+ source = "registry+https://github.com/rust-lang/crates.io-index"
334
+ checksum = "ba009ff324d1fc1b900bd1fdb31564febe58a8ccc8a6fdbb93b543d33b13ca43"
335
+ dependencies = [
336
+ "getrandom",
337
+ "libredox",
338
+ "thiserror",
339
+ ]
340
+
341
+ [[package]]
342
+ name = "simd-adler32"
343
+ version = "0.3.7"
344
+ source = "registry+https://github.com/rust-lang/crates.io-index"
345
+ checksum = "d66dc143e6b11c1eddc06d5c423cfc97062865baf299914ab64caa38182078fe"
346
+
347
+ [[package]]
348
+ name = "syn"
349
+ version = "2.0.111"
350
+ source = "registry+https://github.com/rust-lang/crates.io-index"
351
+ checksum = "390cc9a294ab71bdb1aa2e99d13be9c753cd2d7bd6560c77118597410c4d2e87"
352
+ dependencies = [
353
+ "proc-macro2",
354
+ "quote",
355
+ "unicode-ident",
356
+ ]
357
+
358
+ [[package]]
359
+ name = "thiserror"
360
+ version = "1.0.69"
361
+ source = "registry+https://github.com/rust-lang/crates.io-index"
362
+ checksum = "b6aaf5339b578ea85b50e080feb250a3e8ae8cfcdff9a461c9ec2904bc923f52"
363
+ dependencies = [
364
+ "thiserror-impl",
365
+ ]
366
+
367
+ [[package]]
368
+ name = "thiserror-impl"
369
+ version = "1.0.69"
370
+ source = "registry+https://github.com/rust-lang/crates.io-index"
371
+ checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1"
372
+ dependencies = [
373
+ "proc-macro2",
374
+ "quote",
375
+ "syn",
376
+ ]
377
+
378
+ [[package]]
379
+ name = "unicode-ident"
380
+ version = "1.0.22"
381
+ source = "registry+https://github.com/rust-lang/crates.io-index"
382
+ checksum = "9312f7c4f6ff9069b165498234ce8be658059c6728633667c526e27dc2cf1df5"
383
+
384
+ [[package]]
385
+ name = "wasi"
386
+ version = "0.11.1+wasi-snapshot-preview1"
387
+ source = "registry+https://github.com/rust-lang/crates.io-index"
388
+ checksum = "ccf3ec651a847eb01de73ccad15eb7d99f80485de043efb2f370cd654f4ea44b"
389
+
390
+ [[package]]
391
+ name = "weezl"
392
+ version = "0.1.12"
393
+ source = "registry+https://github.com/rust-lang/crates.io-index"
394
+ checksum = "a28ac98ddc8b9274cb41bb4d9d4d5c425b6020c50c46f25559911905610b4a88"
395
+
396
+ [[package]]
397
+ name = "winapi"
398
+ version = "0.3.9"
399
+ source = "registry+https://github.com/rust-lang/crates.io-index"
400
+ checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419"
401
+ dependencies = [
402
+ "winapi-i686-pc-windows-gnu",
403
+ "winapi-x86_64-pc-windows-gnu",
404
+ ]
405
+
406
+ [[package]]
407
+ name = "winapi-i686-pc-windows-gnu"
408
+ version = "0.4.0"
409
+ source = "registry+https://github.com/rust-lang/crates.io-index"
410
+ checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"
411
+
412
+ [[package]]
413
+ name = "winapi-x86_64-pc-windows-gnu"
414
+ version = "0.4.0"
415
+ source = "registry+https://github.com/rust-lang/crates.io-index"
416
+ checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
417
+
418
+ [[package]]
419
+ name = "windows"
420
+ version = "0.62.2"
421
+ source = "registry+https://github.com/rust-lang/crates.io-index"
422
+ checksum = "527fadee13e0c05939a6a05d5bd6eec6cd2e3dbd648b9f8e447c6518133d8580"
423
+ dependencies = [
424
+ "windows-collections",
425
+ "windows-core",
426
+ "windows-future",
427
+ "windows-numerics",
428
+ ]
429
+
430
+ [[package]]
431
+ name = "windows-collections"
432
+ version = "0.3.2"
433
+ source = "registry+https://github.com/rust-lang/crates.io-index"
434
+ checksum = "23b2d95af1a8a14a3c7367e1ed4fc9c20e0a26e79551b1454d72583c97cc6610"
435
+ dependencies = [
436
+ "windows-core",
437
+ ]
438
+
439
+ [[package]]
440
+ name = "windows-core"
441
+ version = "0.62.2"
442
+ source = "registry+https://github.com/rust-lang/crates.io-index"
443
+ checksum = "b8e83a14d34d0623b51dce9581199302a221863196a1dde71a7663a4c2be9deb"
444
+ dependencies = [
445
+ "windows-implement",
446
+ "windows-interface",
447
+ "windows-link",
448
+ "windows-result",
449
+ "windows-strings",
450
+ ]
451
+
452
+ [[package]]
453
+ name = "windows-future"
454
+ version = "0.3.2"
455
+ source = "registry+https://github.com/rust-lang/crates.io-index"
456
+ checksum = "e1d6f90251fe18a279739e78025bd6ddc52a7e22f921070ccdc67dde84c605cb"
457
+ dependencies = [
458
+ "windows-core",
459
+ "windows-link",
460
+ "windows-threading",
461
+ ]
462
+
463
+ [[package]]
464
+ name = "windows-implement"
465
+ version = "0.60.2"
466
+ source = "registry+https://github.com/rust-lang/crates.io-index"
467
+ checksum = "053e2e040ab57b9dc951b72c264860db7eb3b0200ba345b4e4c3b14f67855ddf"
468
+ dependencies = [
469
+ "proc-macro2",
470
+ "quote",
471
+ "syn",
472
+ ]
473
+
474
+ [[package]]
475
+ name = "windows-interface"
476
+ version = "0.59.3"
477
+ source = "registry+https://github.com/rust-lang/crates.io-index"
478
+ checksum = "3f316c4a2570ba26bbec722032c4099d8c8bc095efccdc15688708623367e358"
479
+ dependencies = [
480
+ "proc-macro2",
481
+ "quote",
482
+ "syn",
483
+ ]
484
+
485
+ [[package]]
486
+ name = "windows-link"
487
+ version = "0.2.1"
488
+ source = "registry+https://github.com/rust-lang/crates.io-index"
489
+ checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5"
490
+
491
+ [[package]]
492
+ name = "windows-numerics"
493
+ version = "0.3.1"
494
+ source = "registry+https://github.com/rust-lang/crates.io-index"
495
+ checksum = "6e2e40844ac143cdb44aead537bbf727de9b044e107a0f1220392177d15b0f26"
496
+ dependencies = [
497
+ "windows-core",
498
+ "windows-link",
499
+ ]
500
+
501
+ [[package]]
502
+ name = "windows-result"
503
+ version = "0.4.1"
504
+ source = "registry+https://github.com/rust-lang/crates.io-index"
505
+ checksum = "7781fa89eaf60850ac3d2da7af8e5242a5ea78d1a11c49bf2910bb5a73853eb5"
506
+ dependencies = [
507
+ "windows-link",
508
+ ]
509
+
510
+ [[package]]
511
+ name = "windows-strings"
512
+ version = "0.5.1"
513
+ source = "registry+https://github.com/rust-lang/crates.io-index"
514
+ checksum = "7837d08f69c77cf6b07689544538e017c1bfcf57e34b4c0ff58e6c2cd3b37091"
515
+ dependencies = [
516
+ "windows-link",
517
+ ]
518
+
519
+ [[package]]
520
+ name = "windows-threading"
521
+ version = "0.2.1"
522
+ source = "registry+https://github.com/rust-lang/crates.io-index"
523
+ checksum = "3949bd5b99cafdf1c7ca86b43ca564028dfe27d66958f2470940f73d86d75b37"
524
+ dependencies = [
525
+ "windows-link",
526
+ ]
527
+
528
+ [[package]]
529
+ name = "windows_thumbnail"
530
+ version = "0.1.0"
531
+ dependencies = [
532
+ "anyhow",
533
+ "base64",
534
+ "directories-next",
535
+ "image",
536
+ "md5",
537
+ "once_cell",
538
+ "windows",
539
+ "windows-core",
540
+ "zip",
541
+ ]
542
+
543
+ [[package]]
544
+ name = "zip"
545
+ version = "6.0.0"
546
+ source = "registry+https://github.com/rust-lang/crates.io-index"
547
+ checksum = "eb2a05c7c36fde6c09b08576c9f7fb4cda705990f73b58fe011abf7dfb24168b"
548
+ dependencies = [
549
+ "arbitrary",
550
+ "crc32fast",
551
+ "flate2",
552
+ "indexmap",
553
+ "memchr",
554
+ "zopfli",
555
+ ]
556
+
557
+ [[package]]
558
+ name = "zlib-rs"
559
+ version = "0.5.2"
560
+ source = "registry+https://github.com/rust-lang/crates.io-index"
561
+ checksum = "2f06ae92f42f5e5c42443fd094f245eb656abf56dd7cce9b8b263236565e00f2"
562
+
563
+ [[package]]
564
+ name = "zopfli"
565
+ version = "0.8.3"
566
+ source = "registry+https://github.com/rust-lang/crates.io-index"
567
+ checksum = "f05cd8797d63865425ff89b5c4a48804f35ba0ce8d125800027ad6017d2b5249"
568
+ dependencies = [
569
+ "bumpalo",
570
+ "crc32fast",
571
+ "log",
572
+ "simd-adler32",
573
+ ]
574
+
575
+ [[package]]
576
+ name = "zune-core"
577
+ version = "0.5.0"
578
+ source = "registry+https://github.com/rust-lang/crates.io-index"
579
+ checksum = "111f7d9820f05fd715df3144e254d6fc02ee4088b0644c0ffd0efc9e6d9d2773"
580
+
581
+ [[package]]
582
+ name = "zune-jpeg"
583
+ version = "0.5.5"
584
+ source = "registry+https://github.com/rust-lang/crates.io-index"
585
+ checksum = "dc6fb7703e32e9a07fb3f757360338b3a567a5054f21b5f52a666752e333d58e"
586
+ dependencies = [
587
+ "zune-core",
588
+ ]
apps/readest-app/extensions/windows-thumbnail/Cargo.toml ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [package]
2
+ name = "windows_thumbnail"
3
+ version = "0.1.0"
4
+ edition = "2021"
5
+ publish = false
6
+
7
+ [workspace]
8
+
9
+ [lib]
10
+ name = "windows_thumbnail"
11
+ path = "src/mod.rs"
12
+ crate-type = ["cdylib"]
13
+
14
+ [dependencies]
15
+ anyhow = "1"
16
+ base64 = "0.22"
17
+ directories-next = "2.0"
18
+ image = { version = "0.25", default-features = false, features = ["png", "jpeg", "gif", "webp"] }
19
+ md5 = "0.8"
20
+ once_cell = "1.19"
21
+ zip = { version = "6.0", default-features = false, features = ["deflate"] }
22
+ windows = { version = "0.62", features = [
23
+ "Win32_Foundation",
24
+ "Win32_Graphics_Gdi",
25
+ "Win32_Security",
26
+ "Win32_System_Com",
27
+ "Win32_System_LibraryLoader",
28
+ "Win32_System_Registry",
29
+ "Win32_UI_Shell",
30
+ ] }
31
+ windows-core = "0.62"
apps/readest-app/extensions/windows-thumbnail/README.md ADDED
@@ -0,0 +1,134 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Windows Thumbnail Provider for Readest
2
+
3
+ This crate provides Windows Explorer thumbnail support for eBook files when Readest is set as the default application.
4
+
5
+ ## Features
6
+
7
+ - **Automatic Cover Extraction**: Extracts cover images from EPUB, MOBI, AZW, AZW3, FB2, CBZ, CBR files
8
+ - **Readest Branding**: Adds a small Readest icon overlay at the bottom-right corner
9
+ - **Smart Caching**: Caches generated thumbnails for faster subsequent loads
10
+ - **File Association Aware**: Only shows thumbnails when Readest is the default app for the file type
11
+ - **COM Integration**: Full Windows Shell extension implementation via `IThumbnailProvider`
12
+
13
+ ## Supported Formats
14
+
15
+ | Format | Extension | Cover Source |
16
+ | ---------- | ----------------------- | ---------------------------- |
17
+ | EPUB | `.epub` | OPF manifest cover reference |
18
+ | MOBI/AZW | `.mobi`, `.azw`, `.prc` | EXTH cover offset |
19
+ | AZW3/KF8 | `.azw3`, `.kf8` | KF8 format cover |
20
+ | FB2 | `.fb2` | `<binary>` coverpage element |
21
+ | Comic Book | `.cbz`, `.cbr` | First image in archive |
22
+ | Plain Text | `.txt` | Generated placeholder |
23
+
24
+ ## Building
25
+
26
+ ### Library Only
27
+
28
+ ```bash
29
+ cargo build --release
30
+ ```
31
+
32
+ ### COM DLL (for Windows Explorer integration)
33
+
34
+ ```bash
35
+ cargo build --release --features com
36
+ ```
37
+
38
+ ### CLI Tool
39
+
40
+ ```bash
41
+ cargo build --release --features cli
42
+ ```
43
+
44
+ ## Installation
45
+
46
+ The thumbnail provider DLL is automatically registered when Readest is installed via the NSIS installer.
47
+
48
+ ### Manual Registration (for development)
49
+
50
+ ```powershell
51
+ # Register the DLL
52
+ regsvr32 /s target\release\windows_thumbnail.dll
53
+
54
+ # Unregister the DLL
55
+ regsvr32 /s /u target\release\windows_thumbnail.dll
56
+
57
+ # Refresh Explorer to see changes
58
+ ie4uinit.exe -show
59
+ ```
60
+
61
+ After registration, you may need to restart Windows Explorer or log out/in for changes to take effect.
62
+
63
+ ## Usage (Development / Manual testing)
64
+
65
+ For local development and testing, build the Windows DLL (or the library) from the Readest Tauri app folder and register it manually. The legacy CLI test harness used to live in the separate `packages/tauri` workspace, but the thumbnail handler implementation now lives inside Readest's Tauri app.
66
+
67
+ Build the DLL (for Windows explorer integration):
68
+
69
+ ```powershell
70
+ cd apps/readest-app/src-tauri
71
+ cargo build --release --manifest-path Cargo.toml --features com
72
+ ```
73
+
74
+ The standalone CLI test harness is no longer distributed with the app. To test the thumbnail provider locally, build and register the DLL as shown above and use a small test harness that imports `readestlib`'s thumbnail code or use Explorer after registering the handler.
75
+
76
+ Manual registration for development (register the generated DLL):
77
+
78
+ ```powershell
79
+ # Register the DLL
80
+ regsvr32 /s target\release\windows_thumbnail.dll
81
+
82
+ # Unregister the DLL
83
+ regsvr32 /s /u target\release\windows_thumbnail.dll
84
+
85
+ # Refresh Explorer to see changes
86
+ ie4uinit.exe -show
87
+ ```
88
+
89
+ This generates a thumbnail with the Readest overlay at the specified size.
90
+
91
+ ## Architecture
92
+
93
+ ```
94
+ ┌─────────────────────────────────────────────────────────────────┐
95
+ │ Windows Explorer │
96
+ ├─────────────────────────────────────────────────────────────────┤
97
+ │ │ │
98
+ │ IThumbnailProvider ───┼──► ThumbnailProvider │
99
+ │ │ │ │
100
+ │ │ ▼ │
101
+ │ │ Check File Association │
102
+ │ │ (is Readest the default?) │
103
+ │ │ │ │
104
+ │ │ ▼ (if yes) │
105
+ │ │ Extract Cover Image │
106
+ │ │ │ │
107
+ │ │ ▼ │
108
+ │ │ Add Readest Overlay │
109
+ │ │ │ │
110
+ │ │ ▼ │
111
+ │ │ Return HBITMAP │
112
+ │ │ │
113
+ └─────────────────────────────────────────────────────────────────┘
114
+ ```
115
+
116
+ ## COM Details
117
+
118
+ - **CLSID**: `{A1B2C3D4-E5F6-7890-ABCD-EF1234567890}`
119
+ - **Shell Thumbnail Handler GUID**: `{e357fccd-a995-4576-b01f-234630154e96}`
120
+ - **Threading Model**: Apartment
121
+
122
+ ## How It Works
123
+
124
+ 1. When Windows Explorer needs a thumbnail, it queries the registered shell extension
125
+ 2. The COM DLL implements `IInitializeWithItem` to receive the file path
126
+ 3. It checks if Readest.exe is the default application for that file type using `AssocQueryStringW`
127
+ 4. If Readest is the default, it extracts the cover and generates the thumbnail
128
+ 5. If Readest is NOT the default, it returns `S_FALSE` to let Windows use other handlers
129
+
130
+ This ensures thumbnails only appear for files the user has associated with Readest.
131
+
132
+ ## License
133
+
134
+ MIT License - See LICENSE file for details.
apps/readest-app/extensions/windows-thumbnail/src/com_provider.rs ADDED
@@ -0,0 +1,506 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /// Windows COM Thumbnail Provider for Readest
2
+ ///
3
+ /// Implements IThumbnailProvider and IInitializeWithItem for Windows Shell integration.
4
+ /// This allows Windows Explorer to show book covers as thumbnails for eBook files.
5
+ ///
6
+ /// **Important**: Thumbnails are only shown when Readest.exe is the default application
7
+ /// for the file type.
8
+ ///
9
+ /// ## CLSID: {A1B2C3D4-E5F6-7890-ABCD-EF1234567890}
10
+ use std::cell::UnsafeCell;
11
+ use std::ffi::c_void;
12
+ use std::path::PathBuf;
13
+ use std::sync::atomic::{AtomicIsize, AtomicU32, Ordering};
14
+
15
+ use windows::core::{IUnknown, Interface, GUID, HRESULT, PCWSTR, PWSTR};
16
+ use windows::Win32::Foundation::{
17
+ CLASS_E_NOAGGREGATION, E_FAIL, E_INVALIDARG, E_NOINTERFACE, HMODULE, S_FALSE, S_OK,
18
+ };
19
+ use windows::Win32::Graphics::Gdi::{
20
+ CreateDIBSection, BITMAPINFO, BITMAPINFOHEADER, BI_RGB, DIB_RGB_COLORS, HBITMAP,
21
+ };
22
+ use windows::Win32::System::Com::{CoTaskMemFree, IClassFactory, IClassFactory_Impl};
23
+ use windows::Win32::System::LibraryLoader::GetModuleFileNameW;
24
+ use windows::Win32::System::Registry::{
25
+ RegCloseKey, RegCreateKeyExW, RegDeleteTreeW, RegSetValueExW, HKEY, HKEY_CLASSES_ROOT,
26
+ KEY_WRITE, REG_OPTION_NON_VOLATILE, REG_SZ,
27
+ };
28
+ use windows::Win32::UI::Shell::{
29
+ AssocQueryStringW, IInitializeWithItem, IInitializeWithItem_Impl, IShellItem,
30
+ IThumbnailProvider, IThumbnailProvider_Impl, ASSOCF_NONE, ASSOCSTR_EXECUTABLE,
31
+ SIGDN_FILESYSPATH, WTSAT_ARGB, WTS_ALPHATYPE,
32
+ };
33
+ use windows_core::BOOL;
34
+ use windows_core::{implement, Ref};
35
+
36
+ use super::cached_thumbnail_for_path;
37
+
38
+ // ─────────────────────────────────────────────────────────────────────────────
39
+ // CLSID for Readest Thumbnail Provider
40
+ // ─────────────────────────────────────────────────────────────────────────────
41
+
42
+ /// CLSID: {A1B2C3D4-E5F6-7890-ABCD-EF1234567890}
43
+ pub const CLSID_READEST_THUMBNAIL: GUID = GUID::from_u128(0xA1B2C3D4_E5F6_7890_ABCD_EF1234567890);
44
+
45
+ /// Supported file extensions
46
+ pub const SUPPORTED_EXTENSIONS: &[&str] = &[
47
+ ".epub", ".mobi", ".azw", ".azw3", ".kf8", ".prc", ".fb2", ".cbz", ".cbr", ".txt",
48
+ ];
49
+
50
+ // DLL reference counting
51
+ static DLL_REF_COUNT: AtomicU32 = AtomicU32::new(0);
52
+ static DLL_MODULE_PTR: AtomicIsize = AtomicIsize::new(0);
53
+
54
+ fn dll_add_ref() {
55
+ DLL_REF_COUNT.fetch_add(1, Ordering::SeqCst);
56
+ }
57
+ fn dll_release() {
58
+ DLL_REF_COUNT.fetch_sub(1, Ordering::SeqCst);
59
+ }
60
+
61
+ fn set_dll_module(h: HMODULE) {
62
+ DLL_MODULE_PTR.store(h.0 as isize, Ordering::SeqCst);
63
+ }
64
+
65
+ fn get_dll_module() -> Option<HMODULE> {
66
+ let ptr = DLL_MODULE_PTR.load(Ordering::SeqCst);
67
+ if ptr == 0 {
68
+ None
69
+ } else {
70
+ Some(HMODULE(ptr as *mut c_void))
71
+ }
72
+ }
73
+
74
+ // ─────────────────────────────────────────────────────────────────────────────
75
+ // File Association Check
76
+ // ─────────────────────────────────────────────────────────────────────────────
77
+
78
+ /// Check if Readest.exe is the default application for a given file extension.
79
+ fn is_readest_default_for_extension(ext: &str) -> bool {
80
+ let ext_wide: Vec<u16> = ext.encode_utf16().chain(std::iter::once(0)).collect();
81
+ let mut buffer = [0u16; 260];
82
+ let mut buffer_size = buffer.len() as u32;
83
+
84
+ unsafe {
85
+ let result = AssocQueryStringW(
86
+ ASSOCF_NONE,
87
+ ASSOCSTR_EXECUTABLE,
88
+ PCWSTR(ext_wide.as_ptr()),
89
+ None,
90
+ Some(PWSTR(buffer.as_mut_ptr())),
91
+ &mut buffer_size,
92
+ );
93
+
94
+ if result.is_ok() {
95
+ let len = buffer.iter().position(|&c| c == 0).unwrap_or(buffer.len());
96
+ let path = String::from_utf16_lossy(&buffer[..len]).to_lowercase();
97
+ return path.contains("readest");
98
+ }
99
+ }
100
+
101
+ false
102
+ }
103
+
104
+ /// Check if Readest is the default app for a specific file path.
105
+ fn is_readest_default_for_file(path: &PathBuf) -> bool {
106
+ if let Some(ext) = path.extension().and_then(|e| e.to_str()) {
107
+ let ext_with_dot = format!(".{}", ext.to_lowercase());
108
+ return is_readest_default_for_extension(&ext_with_dot);
109
+ }
110
+ false
111
+ }
112
+
113
+ // ─────────────────────────────────────────────────────────────────────────────
114
+ // ThumbnailProvider
115
+ // ────────────────────────────────────────────────��────────────────────────────
116
+
117
+ /// Interior mutability wrapper for COM single-threaded apartment
118
+ struct ComCell<T>(UnsafeCell<T>);
119
+
120
+ impl<T> ComCell<T> {
121
+ fn new(value: T) -> Self {
122
+ Self(UnsafeCell::new(value))
123
+ }
124
+ fn get(&self) -> &T {
125
+ unsafe { &*self.0.get() }
126
+ }
127
+ fn set(&self, value: T) {
128
+ unsafe {
129
+ *self.0.get() = value;
130
+ }
131
+ }
132
+ }
133
+
134
+ // SAFETY: COM thumbnail providers run in single-threaded apartment (STA)
135
+ unsafe impl<T> Sync for ComCell<T> {}
136
+ unsafe impl<T> Send for ComCell<T> {}
137
+
138
+ #[implement(IThumbnailProvider, IInitializeWithItem)]
139
+ pub struct ThumbnailProvider {
140
+ file_path: ComCell<Option<PathBuf>>,
141
+ file_ext: ComCell<Option<String>>,
142
+ should_provide: ComCell<bool>,
143
+ }
144
+
145
+ impl ThumbnailProvider {
146
+ pub fn new() -> Self {
147
+ dll_add_ref();
148
+ Self {
149
+ file_path: ComCell::new(None),
150
+ file_ext: ComCell::new(None),
151
+ should_provide: ComCell::new(false),
152
+ }
153
+ }
154
+ }
155
+
156
+ impl Default for ThumbnailProvider {
157
+ fn default() -> Self {
158
+ Self::new()
159
+ }
160
+ }
161
+
162
+ impl Drop for ThumbnailProvider {
163
+ fn drop(&mut self) {
164
+ dll_release();
165
+ }
166
+ }
167
+
168
+ impl IInitializeWithItem_Impl for ThumbnailProvider_Impl {
169
+ fn Initialize(&self, psi: Ref<'_, IShellItem>, _grfmode: u32) -> windows::core::Result<()> {
170
+ let item = psi.ok()?;
171
+
172
+ unsafe {
173
+ let path_pwstr = item.GetDisplayName(SIGDN_FILESYSPATH)?;
174
+
175
+ let mut len = 0usize;
176
+ let mut ptr = path_pwstr.0;
177
+ while *ptr != 0 {
178
+ len += 1;
179
+ ptr = ptr.add(1);
180
+ }
181
+
182
+ let slice = std::slice::from_raw_parts(path_pwstr.0, len);
183
+ let path_str = String::from_utf16_lossy(slice);
184
+ let path = PathBuf::from(&path_str);
185
+
186
+ CoTaskMemFree(Some(path_pwstr.0 as *const c_void));
187
+
188
+ let is_default = is_readest_default_for_file(&path);
189
+ self.should_provide.set(is_default);
190
+
191
+ if !is_default {
192
+ return Ok(());
193
+ }
194
+
195
+ let ext = path
196
+ .extension()
197
+ .and_then(|e| e.to_str())
198
+ .map(|s| s.to_lowercase())
199
+ .unwrap_or_default();
200
+
201
+ self.file_path.set(Some(path));
202
+ self.file_ext.set(Some(ext));
203
+ }
204
+ Ok(())
205
+ }
206
+ }
207
+
208
+ impl IThumbnailProvider_Impl for ThumbnailProvider_Impl {
209
+ fn GetThumbnail(
210
+ &self,
211
+ cx: u32,
212
+ phbmp: *mut HBITMAP,
213
+ pdwalpha: *mut WTS_ALPHATYPE,
214
+ ) -> windows::core::Result<()> {
215
+ if !*self.should_provide.get() {
216
+ return Err(E_FAIL.into());
217
+ }
218
+
219
+ let path = self.file_path.get().as_ref().ok_or(E_FAIL)?;
220
+ let ext = self.file_ext.get().as_ref().ok_or(E_FAIL)?;
221
+
222
+ let png_bytes = cached_thumbnail_for_path(path, ext, cx).map_err(|_| E_FAIL)?;
223
+ let img = image::load_from_memory(&png_bytes).map_err(|_| E_FAIL)?;
224
+ let rgba = img.to_rgba8();
225
+ let (width, height) = (rgba.width(), rgba.height());
226
+
227
+ let bmi = BITMAPINFO {
228
+ bmiHeader: BITMAPINFOHEADER {
229
+ biSize: std::mem::size_of::<BITMAPINFOHEADER>() as u32,
230
+ biWidth: width as i32,
231
+ biHeight: -(height as i32),
232
+ biPlanes: 1,
233
+ biBitCount: 32,
234
+ biCompression: BI_RGB.0,
235
+ ..Default::default()
236
+ },
237
+ ..Default::default()
238
+ };
239
+
240
+ let mut bits: *mut c_void = std::ptr::null_mut();
241
+
242
+ unsafe {
243
+ let hbmp = CreateDIBSection(None, &bmi, DIB_RGB_COLORS, &mut bits, None, 0)
244
+ .map_err(|_| E_FAIL)?;
245
+ if bits.is_null() {
246
+ return Err(E_FAIL.into());
247
+ }
248
+
249
+ // RGBA -> BGRA
250
+ let dst =
251
+ std::slice::from_raw_parts_mut(bits as *mut u8, (width * height * 4) as usize);
252
+ let src = rgba.as_raw();
253
+ for i in 0..(width * height) as usize {
254
+ let si = i * 4;
255
+ dst[si] = src[si + 2]; // B
256
+ dst[si + 1] = src[si + 1]; // G
257
+ dst[si + 2] = src[si]; // R
258
+ dst[si + 3] = src[si + 3]; // A
259
+ }
260
+
261
+ *phbmp = hbmp;
262
+ *pdwalpha = WTSAT_ARGB;
263
+ }
264
+ Ok(())
265
+ }
266
+ }
267
+
268
+ // ─────────────────────────────────────────────────────────────────────────────
269
+ // ClassFactory
270
+ // ─────────────────────────────────────────────────────────────────────────────
271
+
272
+ #[implement(IClassFactory)]
273
+ pub struct ThumbnailProviderFactory;
274
+
275
+ impl ThumbnailProviderFactory {
276
+ pub fn new() -> Self {
277
+ dll_add_ref();
278
+ Self
279
+ }
280
+ }
281
+
282
+ impl Default for ThumbnailProviderFactory {
283
+ fn default() -> Self {
284
+ Self::new()
285
+ }
286
+ }
287
+
288
+ impl Drop for ThumbnailProviderFactory {
289
+ fn drop(&mut self) {
290
+ dll_release();
291
+ }
292
+ }
293
+
294
+ impl IClassFactory_Impl for ThumbnailProviderFactory_Impl {
295
+ fn CreateInstance(
296
+ &self,
297
+ punkouter: Ref<'_, IUnknown>,
298
+ riid: *const GUID,
299
+ ppvobject: *mut *mut c_void,
300
+ ) -> windows::core::Result<()> {
301
+ unsafe {
302
+ if ppvobject.is_null() {
303
+ return Err(E_INVALIDARG.into());
304
+ }
305
+ *ppvobject = std::ptr::null_mut();
306
+ if !punkouter.is_null() {
307
+ return Err(CLASS_E_NOAGGREGATION.into());
308
+ }
309
+
310
+ let provider: IThumbnailProvider = ThumbnailProvider::new().into();
311
+ provider.query(&*riid, ppvobject).ok()
312
+ }
313
+ }
314
+
315
+ fn LockServer(&self, flock: BOOL) -> windows::core::Result<()> {
316
+ if flock.as_bool() {
317
+ dll_add_ref();
318
+ } else {
319
+ dll_release();
320
+ }
321
+ Ok(())
322
+ }
323
+ }
324
+
325
+ // ─────────────────────────────────────────────────────────────────────────────
326
+ // DLL Exports
327
+ // ─────────────────────────────────────────────────────────────────────────────
328
+
329
+ #[no_mangle]
330
+ pub extern "system" fn DllMain(hinstance: HMODULE, reason: u32, _reserved: *mut c_void) -> BOOL {
331
+ const DLL_PROCESS_ATTACH: u32 = 1;
332
+ if reason == DLL_PROCESS_ATTACH {
333
+ set_dll_module(hinstance);
334
+ }
335
+ BOOL::from(true)
336
+ }
337
+
338
+ #[no_mangle]
339
+ pub extern "system" fn DllCanUnloadNow() -> HRESULT {
340
+ if DLL_REF_COUNT.load(Ordering::SeqCst) == 0 {
341
+ S_OK
342
+ } else {
343
+ S_FALSE
344
+ }
345
+ }
346
+
347
+ #[no_mangle]
348
+ pub unsafe extern "system" fn DllGetClassObject(
349
+ rclsid: *const GUID,
350
+ riid: *const GUID,
351
+ ppv: *mut *mut c_void,
352
+ ) -> HRESULT {
353
+ if ppv.is_null() || rclsid.is_null() || riid.is_null() {
354
+ return E_INVALIDARG;
355
+ }
356
+ *ppv = std::ptr::null_mut();
357
+
358
+ if *rclsid != CLSID_READEST_THUMBNAIL {
359
+ return E_NOINTERFACE;
360
+ }
361
+ if *riid != IClassFactory::IID && *riid != IUnknown::IID {
362
+ return E_NOINTERFACE;
363
+ }
364
+
365
+ let factory: IClassFactory = ThumbnailProviderFactory::new().into();
366
+ factory.query(&*riid, ppv)
367
+ }
368
+
369
+ #[no_mangle]
370
+ pub unsafe extern "system" fn DllRegisterServer() -> HRESULT {
371
+ match register_server_impl() {
372
+ Ok(()) => S_OK,
373
+ Err(e) => e,
374
+ }
375
+ }
376
+
377
+ #[no_mangle]
378
+ pub unsafe extern "system" fn DllUnregisterServer() -> HRESULT {
379
+ let _ = unregister_server_impl();
380
+ S_OK
381
+ }
382
+
383
+ // ─────────────────────────────────────────────────────────────────────────────
384
+ // Registry helpers
385
+ // ─────────────────────────────────────────────────────────────────────────────
386
+
387
+ fn get_dll_path() -> Option<String> {
388
+ let module = get_dll_module()?;
389
+ let mut buffer = [0u16; 260];
390
+ unsafe {
391
+ let len = GetModuleFileNameW(Some(module), &mut buffer);
392
+ if len == 0 {
393
+ None
394
+ } else {
395
+ Some(String::from_utf16_lossy(&buffer[..len as usize]))
396
+ }
397
+ }
398
+ }
399
+
400
+ fn clsid_string() -> String {
401
+ format!(
402
+ "{{{:08X}-{:04X}-{:04X}-{:02X}{:02X}-{:02X}{:02X}{:02X}{:02X}{:02X}{:02X}}}",
403
+ CLSID_READEST_THUMBNAIL.data1,
404
+ CLSID_READEST_THUMBNAIL.data2,
405
+ CLSID_READEST_THUMBNAIL.data3,
406
+ CLSID_READEST_THUMBNAIL.data4[0],
407
+ CLSID_READEST_THUMBNAIL.data4[1],
408
+ CLSID_READEST_THUMBNAIL.data4[2],
409
+ CLSID_READEST_THUMBNAIL.data4[3],
410
+ CLSID_READEST_THUMBNAIL.data4[4],
411
+ CLSID_READEST_THUMBNAIL.data4[5],
412
+ CLSID_READEST_THUMBNAIL.data4[6],
413
+ CLSID_READEST_THUMBNAIL.data4[7]
414
+ )
415
+ }
416
+
417
+ fn to_wide(s: &str) -> Vec<u16> {
418
+ s.encode_utf16().chain(std::iter::once(0)).collect()
419
+ }
420
+
421
+ unsafe fn set_reg_value(key: HKEY, name: &str, value: &str) -> Result<(), HRESULT> {
422
+ let name_w = to_wide(name);
423
+ let value_w = to_wide(value);
424
+ let bytes: &[u8] = std::slice::from_raw_parts(value_w.as_ptr() as *const u8, value_w.len() * 2);
425
+ if RegSetValueExW(key, PCWSTR(name_w.as_ptr()), Some(0), REG_SZ, Some(bytes)).is_err() {
426
+ Err(E_FAIL)
427
+ } else {
428
+ Ok(())
429
+ }
430
+ }
431
+
432
+ unsafe fn create_reg_key(parent: HKEY, subkey: &str) -> Result<HKEY, HRESULT> {
433
+ let subkey_w = to_wide(subkey);
434
+ let mut hkey = HKEY::default();
435
+ let result = RegCreateKeyExW(
436
+ parent,
437
+ PCWSTR(subkey_w.as_ptr()),
438
+ Some(0),
439
+ None,
440
+ REG_OPTION_NON_VOLATILE,
441
+ KEY_WRITE,
442
+ None,
443
+ &mut hkey,
444
+ None,
445
+ );
446
+ if result.is_err() {
447
+ Err(E_FAIL)
448
+ } else {
449
+ Ok(hkey)
450
+ }
451
+ }
452
+
453
+ unsafe fn register_server_impl() -> Result<(), HRESULT> {
454
+ let dll_path = get_dll_path().ok_or(E_FAIL)?;
455
+ let clsid = clsid_string();
456
+
457
+ // CLSID key
458
+ let clsid_key = create_reg_key(HKEY_CLASSES_ROOT, &format!("CLSID\\{}", clsid))?;
459
+ set_reg_value(clsid_key, "", "Readest Thumbnail Provider")?;
460
+
461
+ // CRITICAL: DisableProcessIsolation = 1
462
+ let disable_isolation_name = to_wide("DisableProcessIsolation");
463
+ let value: u32 = 1;
464
+ let _ = windows::Win32::System::Registry::RegSetValueExW(
465
+ clsid_key,
466
+ PCWSTR(disable_isolation_name.as_ptr()),
467
+ Some(0),
468
+ windows::Win32::System::Registry::REG_DWORD,
469
+ Some(std::slice::from_raw_parts(
470
+ &value as *const u32 as *const u8,
471
+ 4,
472
+ )),
473
+ );
474
+
475
+ let inproc_key = create_reg_key(clsid_key, "InprocServer32")?;
476
+ set_reg_value(inproc_key, "", &dll_path)?;
477
+ set_reg_value(inproc_key, "ThreadingModel", "Apartment")?;
478
+ let _ = RegCloseKey(inproc_key);
479
+ let _ = RegCloseKey(clsid_key);
480
+
481
+ // Register ShellEx thumbnail handler for each extension
482
+ for ext in SUPPORTED_EXTENSIONS {
483
+ let ext_shellex_path =
484
+ format!("{}\\ShellEx\\{{e357fccd-a995-4576-b01f-234630154e96}}", ext);
485
+ if let Ok(ext_shellex_key) = create_reg_key(HKEY_CLASSES_ROOT, &ext_shellex_path) {
486
+ let _ = set_reg_value(ext_shellex_key, "", &clsid);
487
+ let _ = RegCloseKey(ext_shellex_key);
488
+ }
489
+ }
490
+ Ok(())
491
+ }
492
+
493
+ unsafe fn unregister_server_impl() -> Result<(), HRESULT> {
494
+ let clsid = clsid_string();
495
+ let clsid_path = to_wide(&format!("CLSID\\{}", clsid));
496
+ let _ = RegDeleteTreeW(HKEY_CLASSES_ROOT, PCWSTR(clsid_path.as_ptr()));
497
+
498
+ for ext in SUPPORTED_EXTENSIONS {
499
+ let ext_path = to_wide(&format!(
500
+ "{}\\ShellEx\\{{e357fccd-a995-4576-b01f-234630154e96}}",
501
+ ext
502
+ ));
503
+ let _ = RegDeleteTreeW(HKEY_CLASSES_ROOT, PCWSTR(ext_path.as_ptr()));
504
+ }
505
+ Ok(())
506
+ }
apps/readest-app/extensions/windows-thumbnail/src/extraction.rs ADDED
@@ -0,0 +1,648 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /// Cover image extraction for various eBook formats
2
+ ///
3
+ /// Supports: EPUB, MOBI/AZW3/KF8, FB2, CBZ/CBR, TXT
4
+ use anyhow::{anyhow, Result};
5
+ use base64::engine::general_purpose;
6
+ use base64::Engine as _;
7
+ use directories_next::ProjectDirs;
8
+ use image::{imageops, DynamicImage, Rgba};
9
+ use md5::Context;
10
+ use once_cell::sync::Lazy;
11
+ use std::io::{Cursor, Read, Seek, SeekFrom};
12
+ use std::path::Path;
13
+ use zip::ZipArchive;
14
+
15
+ /// Thumbnail cache directory (per-user)
16
+ static CACHE_DIR: Lazy<Option<std::path::PathBuf>> = Lazy::new(|| {
17
+ ProjectDirs::from("app", "Readest", "").map(|pd| {
18
+ let dir = pd.cache_dir().join("thumbnails");
19
+ let _ = std::fs::create_dir_all(&dir);
20
+ dir
21
+ })
22
+ });
23
+
24
+ // ─────────────────────────────────────────────────────────────────────────────
25
+ // EPUB extraction
26
+ // ─────────────────────────────────────────────────────────────────────────────
27
+
28
+ /// Extract cover image bytes from an EPUB file.
29
+ pub fn extract_epub_cover_bytes<R: Read + Seek>(reader: R) -> Result<Vec<u8>> {
30
+ let mut archive = ZipArchive::new(reader)?;
31
+
32
+ // Pass 1: Look for files with "cover" in the name
33
+ let mut candidates: Vec<(usize, String, u64)> = Vec::new();
34
+ for i in 0..archive.len() {
35
+ let file = archive.by_index(i)?;
36
+ let name = file.name().to_lowercase();
37
+ let size = file.size();
38
+ drop(file);
39
+
40
+ if is_image_extension(&name) && (name.contains("cover") || name.contains("front")) {
41
+ candidates.push((i, name, size));
42
+ }
43
+ }
44
+
45
+ // Sort by priority: exact "cover" match first, then by size
46
+ if !candidates.is_empty() {
47
+ candidates.sort_by(|a, b| {
48
+ let a_exact = a.1.contains("cover.") || a.1.ends_with("cover");
49
+ let b_exact = b.1.contains("cover.") || b.1.ends_with("cover");
50
+ match (a_exact, b_exact) {
51
+ (true, false) => std::cmp::Ordering::Less,
52
+ (false, true) => std::cmp::Ordering::Greater,
53
+ _ => b.2.cmp(&a.2),
54
+ }
55
+ });
56
+
57
+ let idx = candidates[0].0;
58
+ let mut file = archive.by_index(idx)?;
59
+ let mut buf = Vec::new();
60
+ file.read_to_end(&mut buf)?;
61
+ return Ok(buf);
62
+ }
63
+
64
+ // Pass 2: Parse container.xml to find OPF, then parse OPF for cover
65
+ let container_xml = read_zip_file_to_string(&mut archive, "META-INF/container.xml");
66
+ if let Ok(xml) = container_xml {
67
+ if let Some(rootfile) = extract_attribute(&xml, "rootfile", "full-path") {
68
+ let opf_content = read_zip_file_to_string(&mut archive, &rootfile);
69
+ if let Ok(opf) = opf_content {
70
+ if let Some(cover_id) = find_cover_id_in_opf(&opf) {
71
+ if let Some(href) = find_href_by_id_in_opf(&opf, &cover_id) {
72
+ let base = Path::new(&rootfile).parent().unwrap_or(Path::new(""));
73
+ let cover_path = base.join(&href).to_string_lossy().replace('\\', "/");
74
+ if let Ok(bytes) = read_zip_file_to_bytes(&mut archive, &cover_path) {
75
+ return Ok(bytes);
76
+ }
77
+ }
78
+ }
79
+ if let Some(href) = find_first_image_in_manifest(&opf) {
80
+ let base = Path::new(&rootfile).parent().unwrap_or(Path::new(""));
81
+ let cover_path = base.join(&href).to_string_lossy().replace('\\', "/");
82
+ if let Ok(bytes) = read_zip_file_to_bytes(&mut archive, &cover_path) {
83
+ return Ok(bytes);
84
+ }
85
+ }
86
+ }
87
+ }
88
+ }
89
+
90
+ // Pass 3: Just grab the largest image file
91
+ let mut largest: Option<(usize, u64)> = None;
92
+ for i in 0..archive.len() {
93
+ let file = archive.by_index(i)?;
94
+ let name = file.name().to_lowercase();
95
+ let size = file.size();
96
+ drop(file);
97
+
98
+ if is_image_extension(&name) && (largest.is_none() || size > largest.unwrap().1) {
99
+ largest = Some((i, size));
100
+ }
101
+ }
102
+
103
+ if let Some((idx, _)) = largest {
104
+ let mut file = archive.by_index(idx)?;
105
+ let mut buf = Vec::new();
106
+ file.read_to_end(&mut buf)?;
107
+ return Ok(buf);
108
+ }
109
+
110
+ Err(anyhow!("No cover image found in EPUB"))
111
+ }
112
+
113
+ // ─────────────────────────────────────────────────────────────────────────────
114
+ // MOBI/AZW3/KF8 extraction
115
+ // ─────────────────────────────────────────────────��───────────────────────────
116
+
117
+ /// Extract cover image from MOBI/AZW3/KF8 files.
118
+ pub fn extract_mobi_cover_bytes<R: Read + Seek>(mut reader: R) -> Result<Vec<u8>> {
119
+ let mut header = [0u8; 78];
120
+ reader.read_exact(&mut header)?;
121
+
122
+ if &header[60..68] != b"BOOKMOBI" {
123
+ return Err(anyhow!("Not a valid MOBI file"));
124
+ }
125
+
126
+ let num_records = u16::from_be_bytes([header[76], header[77]]) as usize;
127
+
128
+ let mut record_offsets: Vec<u32> = Vec::with_capacity(num_records);
129
+ for _ in 0..num_records {
130
+ let mut rec = [0u8; 8];
131
+ reader.read_exact(&mut rec)?;
132
+ record_offsets.push(u32::from_be_bytes([rec[0], rec[1], rec[2], rec[3]]));
133
+ }
134
+
135
+ if record_offsets.is_empty() {
136
+ return Err(anyhow!("No records in MOBI file"));
137
+ }
138
+
139
+ reader.seek(SeekFrom::Start(record_offsets[0] as u64))?;
140
+ let mut mobi_header = [0u8; 256];
141
+ reader.read_exact(&mut mobi_header)?;
142
+
143
+ if &mobi_header[16..20] != b"MOBI" {
144
+ return Err(anyhow!("Invalid MOBI header"));
145
+ }
146
+
147
+ let header_length = u32::from_be_bytes([
148
+ mobi_header[20],
149
+ mobi_header[21],
150
+ mobi_header[22],
151
+ mobi_header[23],
152
+ ]) as usize;
153
+
154
+ let exth_flags = u32::from_be_bytes([
155
+ mobi_header[128],
156
+ mobi_header[129],
157
+ mobi_header[130],
158
+ mobi_header[131],
159
+ ]);
160
+ if exth_flags & 0x40 == 0 {
161
+ return Err(anyhow!("No EXTH header in MOBI file"));
162
+ }
163
+
164
+ let exth_offset = record_offsets[0] as u64 + 16 + header_length as u64;
165
+ reader.seek(SeekFrom::Start(exth_offset))?;
166
+
167
+ let mut exth_magic = [0u8; 4];
168
+ reader.read_exact(&mut exth_magic)?;
169
+ if &exth_magic != b"EXTH" {
170
+ return Err(anyhow!("EXTH header not found"));
171
+ }
172
+
173
+ let mut exth_len_bytes = [0u8; 4];
174
+ reader.read_exact(&mut exth_len_bytes)?;
175
+
176
+ let mut exth_count_bytes = [0u8; 4];
177
+ reader.read_exact(&mut exth_count_bytes)?;
178
+ let exth_count = u32::from_be_bytes(exth_count_bytes) as usize;
179
+
180
+ let mut cover_offset: Option<u32> = None;
181
+ let first_img_idx = u32::from_be_bytes([
182
+ mobi_header[108],
183
+ mobi_header[109],
184
+ mobi_header[110],
185
+ mobi_header[111],
186
+ ]);
187
+
188
+ for _ in 0..exth_count {
189
+ let mut rec_header = [0u8; 8];
190
+ if reader.read_exact(&mut rec_header).is_err() {
191
+ break;
192
+ }
193
+ let rec_type =
194
+ u32::from_be_bytes([rec_header[0], rec_header[1], rec_header[2], rec_header[3]]);
195
+ let rec_len =
196
+ u32::from_be_bytes([rec_header[4], rec_header[5], rec_header[6], rec_header[7]])
197
+ as usize;
198
+
199
+ let data_len = rec_len.saturating_sub(8);
200
+ let mut data = vec![0u8; data_len];
201
+ if reader.read_exact(&mut data).is_err() {
202
+ break;
203
+ }
204
+
205
+ if rec_type == 201 && data_len >= 4 {
206
+ cover_offset = Some(u32::from_be_bytes([data[0], data[1], data[2], data[3]]));
207
+ }
208
+ }
209
+
210
+ let cover_record_idx = if let Some(offset) = cover_offset {
211
+ first_img_idx + offset
212
+ } else {
213
+ first_img_idx
214
+ };
215
+
216
+ if cover_record_idx as usize >= record_offsets.len() {
217
+ return Err(anyhow!("Cover record index out of bounds"));
218
+ }
219
+
220
+ let start = record_offsets[cover_record_idx as usize] as u64;
221
+ let end = if (cover_record_idx as usize + 1) < record_offsets.len() {
222
+ record_offsets[cover_record_idx as usize + 1] as u64
223
+ } else {
224
+ reader.seek(SeekFrom::End(0))?;
225
+ reader.stream_position()?
226
+ };
227
+
228
+ let len = (end - start) as usize;
229
+ reader.seek(SeekFrom::Start(start))?;
230
+ let mut cover_data = vec![0u8; len];
231
+ reader.read_exact(&mut cover_data)?;
232
+
233
+ if cover_data.starts_with(&[0xFF, 0xD8, 0xFF])
234
+ || cover_data.starts_with(&[0x89, 0x50, 0x4E, 0x47])
235
+ || cover_data.starts_with(b"GIF")
236
+ {
237
+ return Ok(cover_data);
238
+ }
239
+
240
+ Err(anyhow!("No valid cover image found in MOBI"))
241
+ }
242
+
243
+ // ─────────────────────────────────────────────────────────────────────────────
244
+ // CBZ extraction
245
+ // ─────────────────────────────────────────────────────────────────────────────
246
+
247
+ /// Extract cover image from CBZ (comic book ZIP) file.
248
+ pub fn extract_cbz_cover_bytes<R: Read + Seek>(reader: R) -> Result<Vec<u8>> {
249
+ let mut archive = ZipArchive::new(reader)?;
250
+
251
+ let mut images: Vec<(usize, String)> = Vec::new();
252
+ for i in 0..archive.len() {
253
+ let file = archive.by_index(i)?;
254
+ let name = file.name().to_string();
255
+ drop(file);
256
+
257
+ if is_image_extension(&name.to_lowercase()) {
258
+ images.push((i, name));
259
+ }
260
+ }
261
+
262
+ images.sort_by(|a, b| a.1.cmp(&b.1));
263
+
264
+ if let Some((idx, _)) = images.first() {
265
+ let mut file = archive.by_index(*idx)?;
266
+ let mut buf = Vec::new();
267
+ file.read_to_end(&mut buf)?;
268
+ return Ok(buf);
269
+ }
270
+
271
+ Err(anyhow!("No images found in CBZ"))
272
+ }
273
+
274
+ // ─────────────────────────────────────────────────────────────────────────────
275
+ // FB2 extraction
276
+ // ─────────────────────────────────────────────────────────────────────────────
277
+
278
+ /// Extract cover image from FB2 (FictionBook) file.
279
+ pub fn extract_fb2_cover_bytes<R: Read>(mut reader: R) -> Result<Vec<u8>> {
280
+ let mut content = String::new();
281
+ reader.read_to_string(&mut content)?;
282
+
283
+ let cover_id = if let Some(start) = content.find("<coverpage>") {
284
+ let end = content[start..].find("</coverpage>").unwrap_or(500);
285
+ let coverpage = &content[start..start + end];
286
+ if let Some(href_pos) = coverpage.find("href=\"#") {
287
+ let id_start = href_pos + 7;
288
+ let id_end = coverpage[id_start..].find('"').unwrap_or(50);
289
+ Some(coverpage[id_start..id_start + id_end].to_string())
290
+ } else if let Some(href_pos) = coverpage.find("l:href=\"#") {
291
+ let id_start = href_pos + 9;
292
+ let id_end = coverpage[id_start..].find('"').unwrap_or(50);
293
+ Some(coverpage[id_start..id_start + id_end].to_string())
294
+ } else {
295
+ None
296
+ }
297
+ } else {
298
+ None
299
+ };
300
+
301
+ let search_pattern = if let Some(ref id) = cover_id {
302
+ format!("<binary id=\"{}\"", id)
303
+ } else {
304
+ "<binary".to_string()
305
+ };
306
+
307
+ if let Some(pos) = content.find(&search_pattern) {
308
+ if let Some(tag_end) = content[pos..].find('>') {
309
+ let data_start = pos + tag_end + 1;
310
+ if let Some(data_end) = content[data_start..].find("</binary>") {
311
+ let b64_data = content[data_start..data_start + data_end].trim();
312
+ let b64_clean: String = b64_data.chars().filter(|c| !c.is_whitespace()).collect();
313
+ let bytes = general_purpose::STANDARD.decode(&b64_clean)?;
314
+ return Ok(bytes);
315
+ }
316
+ }
317
+ }
318
+
319
+ if cover_id.is_some() {
320
+ if let Some(pos) = content.find("<binary") {
321
+ if let Some(tag_end) = content[pos..].find('>') {
322
+ let data_start = pos + tag_end + 1;
323
+ if let Some(data_end) = content[data_start..].find("</binary>") {
324
+ let b64_data = content[data_start..data_start + data_end].trim();
325
+ let b64_clean: String =
326
+ b64_data.chars().filter(|c| !c.is_whitespace()).collect();
327
+ let bytes = general_purpose::STANDARD.decode(&b64_clean)?;
328
+ return Ok(bytes);
329
+ }
330
+ }
331
+ }
332
+ }
333
+
334
+ Err(anyhow!("No cover image found in FB2"))
335
+ }
336
+
337
+ // ─────────────────────────────────────────────────────────────────────────────
338
+ // TXT "cover" (placeholder)
339
+ // ─────────────────────────────────────────────────────────────────────────────
340
+
341
+ /// Generate a placeholder thumbnail for TXT files.
342
+ pub fn extract_txt_cover_bytes<R: Read>(mut reader: R, size: u32) -> Result<Vec<u8>> {
343
+ let mut buf = vec![0u8; 4096];
344
+ let _n = reader.read(&mut buf)?;
345
+
346
+ let mut img = image::RgbaImage::from_pixel(size, size, Rgba([245, 245, 245, 255]));
347
+
348
+ for x in 0..size {
349
+ img.put_pixel(x, 0, Rgba([200, 200, 200, 255]));
350
+ img.put_pixel(x, size - 1, Rgba([200, 200, 200, 255]));
351
+ }
352
+ for y in 0..size {
353
+ img.put_pixel(0, y, Rgba([200, 200, 200, 255]));
354
+ img.put_pixel(size - 1, y, Rgba([200, 200, 200, 255]));
355
+ }
356
+
357
+ let mut out = Vec::new();
358
+ DynamicImage::ImageRgba8(img).write_to(&mut Cursor::new(&mut out), image::ImageFormat::Png)?;
359
+ Ok(out)
360
+ }
361
+
362
+ // ─────────────────────────────────────────────────────────────────────────────
363
+ // Unified extraction by extension
364
+ // ─────────────────────────────────────────────────────────────────────────────
365
+
366
+ /// Extract cover image bytes based on file extension.
367
+ pub fn extract_cover_bytes_by_ext(path: &Path, ext: &str) -> Result<Vec<u8>> {
368
+ let file = std::fs::File::open(path)?;
369
+ match ext.to_lowercase().as_str() {
370
+ "epub" => extract_epub_cover_bytes(file),
371
+ "mobi" | "azw" | "azw3" | "kf8" | "prc" => extract_mobi_cover_bytes(file),
372
+ "cbz" | "cbr" => extract_cbz_cover_bytes(file),
373
+ "fb2" => extract_fb2_cover_bytes(file),
374
+ "txt" => extract_txt_cover_bytes(file, 256),
375
+ _ => Err(anyhow!("Unsupported format: {}", ext)),
376
+ }
377
+ }
378
+
379
+ // ─────────────────────────────────────────────────────────────────────────────
380
+ // Thumbnail creation with overlay
381
+ // ─────────────────────────────────────────────────────────────────────────────
382
+
383
+ /// Create a thumbnail from cover image bytes with Readest icon overlay.
384
+ pub fn create_thumbnail_with_overlay(cover_bytes: &[u8], requested_size: u32) -> Result<Vec<u8>> {
385
+ let img = image::load_from_memory(cover_bytes)?;
386
+ let thumbnail = img.thumbnail(requested_size, requested_size);
387
+
388
+ let overlay_img = load_overlay_icon();
389
+
390
+ let mut base = thumbnail.to_rgba8();
391
+ let (base_w, base_h) = (base.width(), base.height());
392
+
393
+ if let Some(ov) = overlay_img {
394
+ let overlay_size = (requested_size / 5).clamp(24, 48);
395
+ let ov_resized = ov.resize(overlay_size, overlay_size, imageops::FilterType::Lanczos3);
396
+ let ovb = ov_resized.to_rgba8();
397
+ let (ov_w, ov_h) = (ovb.width(), ovb.height());
398
+
399
+ let x = base_w.saturating_sub(ov_w + 4);
400
+ let y = base_h.saturating_sub(ov_h + 4);
401
+
402
+ for oy in 0..ov_h {
403
+ for ox in 0..ov_w {
404
+ let dst_x = x + ox;
405
+ let dst_y = y + oy;
406
+
407
+ if dst_x < base_w && dst_y < base_h {
408
+ let src_pixel = ovb.get_pixel(ox, oy);
409
+ let alpha = src_pixel.0[3] as f32 / 255.0;
410
+
411
+ if alpha > 0.0 {
412
+ let dst_pixel = base.get_pixel(dst_x, dst_y);
413
+ let mut result = dst_pixel.0;
414
+
415
+ for c in 0..3 {
416
+ let fg = src_pixel.0[c] as f32;
417
+ let bg = result[c] as f32;
418
+ result[c] = (fg * alpha + bg * (1.0 - alpha)) as u8;
419
+ }
420
+ result[3] = 255;
421
+
422
+ base.put_pixel(dst_x, dst_y, Rgba(result));
423
+ }
424
+ }
425
+ }
426
+ }
427
+ }
428
+
429
+ let mut out = Vec::new();
430
+ DynamicImage::ImageRgba8(base).write_to(&mut Cursor::new(&mut out), image::ImageFormat::Png)?;
431
+ Ok(out)
432
+ }
433
+
434
+ /// Load the Readest overlay icon.
435
+ fn load_overlay_icon() -> Option<DynamicImage> {
436
+ // Try embedded icon
437
+ let icon_bytes = include_bytes!("../../../public/icon.png");
438
+ if let Ok(img) = image::load_from_memory(icon_bytes) {
439
+ return Some(img);
440
+ }
441
+
442
+ // Fallback: try loading from filesystem
443
+ if let Ok(exe) = std::env::current_exe() {
444
+ let candidates = [
445
+ exe.parent().map(|p| p.join("icon.png")),
446
+ exe.parent().map(|p| p.join("resources").join("icon.png")),
447
+ exe.parent()
448
+ .and_then(|p| p.parent())
449
+ .map(|p| p.join("resources").join("icon.png")),
450
+ ];
451
+
452
+ for candidate in candidates.into_iter().flatten() {
453
+ if candidate.exists() {
454
+ if let Ok(bytes) = std::fs::read(&candidate) {
455
+ if let Ok(img) = image::load_from_memory(&bytes) {
456
+ return Some(img);
457
+ }
458
+ }
459
+ }
460
+ }
461
+ }
462
+
463
+ None
464
+ }
465
+
466
+ // ─────────────────────────────────────────────────────────────────────────────
467
+ // Caching
468
+ // ─────────────────────────────────────────────────────────────────────────────
469
+
470
+ /// Generate a thumbnail with disk caching.
471
+ pub fn cached_thumbnail_for_path(path: &Path, ext: &str, size: u32) -> Result<Vec<u8>> {
472
+ // Compute cache key by hashing file parts for stability without loading entire file
473
+ let mut hasher = Context::new();
474
+ hasher.consume(ext.as_bytes());
475
+ hasher.consume(&size.to_le_bytes());
476
+
477
+ let file = std::fs::File::open(path)?;
478
+ let metadata = file.metadata()?;
479
+ let file_len = metadata.len();
480
+
481
+ // Read partial chunks like the TypeScript partialMD5 implementation
482
+ const STEP: u64 = 1024;
483
+ const SIZE: u64 = 1024;
484
+ let mut file = file;
485
+
486
+ for i in -1i32..=10 {
487
+ let pos = if i == -1 {
488
+ 256u64
489
+ } else {
490
+ STEP << (2 * i as u32)
491
+ };
492
+ let start = pos.min(file_len);
493
+ let end = (start + SIZE).min(file_len);
494
+
495
+ if start >= file_len {
496
+ break;
497
+ }
498
+
499
+ file.seek(SeekFrom::Start(start))?;
500
+ let mut buf = vec![0u8; (end - start) as usize];
501
+ file.read_exact(&mut buf)?;
502
+ hasher.consume(&buf);
503
+ }
504
+
505
+ let digest = hasher.finalize();
506
+ let key = format!("{:x}.png", digest);
507
+
508
+ if let Some(ref dir) = *CACHE_DIR {
509
+ let cache_path = dir.join(&key);
510
+ if cache_path.exists() {
511
+ if let Ok(cached) = std::fs::read(&cache_path) {
512
+ return Ok(cached);
513
+ }
514
+ }
515
+ }
516
+
517
+ let cover = extract_cover_bytes_by_ext(path, ext)?;
518
+ let thumbnail = create_thumbnail_with_overlay(&cover, size)?;
519
+
520
+ if let Some(ref dir) = *CACHE_DIR {
521
+ let cache_path = dir.join(&key);
522
+ let _ = std::fs::write(&cache_path, &thumbnail);
523
+ }
524
+
525
+ Ok(thumbnail)
526
+ }
527
+
528
+ // ─────────────────────────────────────────────────────────────────────────────
529
+ // Helper functions
530
+ // ─────────────────────────────────────────────────────────────────────────────
531
+
532
+ fn is_image_extension(name: &str) -> bool {
533
+ name.ends_with(".jpg")
534
+ || name.ends_with(".jpeg")
535
+ || name.ends_with(".png")
536
+ || name.ends_with(".gif")
537
+ || name.ends_with(".webp")
538
+ || name.ends_with(".bmp")
539
+ }
540
+
541
+ fn read_zip_file_to_string<R: Read + Seek>(
542
+ archive: &mut ZipArchive<R>,
543
+ name: &str,
544
+ ) -> Result<String> {
545
+ let mut file = archive.by_name(name)?;
546
+ let mut content = String::new();
547
+ file.read_to_string(&mut content)?;
548
+ Ok(content)
549
+ }
550
+
551
+ fn read_zip_file_to_bytes<R: Read + Seek>(
552
+ archive: &mut ZipArchive<R>,
553
+ name: &str,
554
+ ) -> Result<Vec<u8>> {
555
+ let mut file = archive.by_name(name)?;
556
+ let mut buf = Vec::new();
557
+ file.read_to_end(&mut buf)?;
558
+ Ok(buf)
559
+ }
560
+
561
+ fn extract_attribute(xml: &str, tag: &str, attr: &str) -> Option<String> {
562
+ let pattern = format!("<{}", tag);
563
+ if let Some(tag_pos) = xml.find(&pattern) {
564
+ let tag_end = xml[tag_pos..].find('>').unwrap_or(500) + tag_pos;
565
+ let tag_content = &xml[tag_pos..tag_end];
566
+
567
+ let attr_pattern = format!("{}=\"", attr);
568
+ if let Some(attr_pos) = tag_content.find(&attr_pattern) {
569
+ let value_start = attr_pos + attr_pattern.len();
570
+ if let Some(value_end) = tag_content[value_start..].find('"') {
571
+ return Some(tag_content[value_start..value_start + value_end].to_string());
572
+ }
573
+ }
574
+ }
575
+ None
576
+ }
577
+
578
+ fn find_cover_id_in_opf(opf: &str) -> Option<String> {
579
+ if let Some(pos) = opf.find("name=\"cover\"") {
580
+ let window_start = pos.saturating_sub(50);
581
+ let window_end = (pos + 100).min(opf.len());
582
+ let window = &opf[window_start..window_end];
583
+
584
+ if let Some(content_pos) = window.find("content=\"") {
585
+ let start = content_pos + 9;
586
+ if let Some(end) = window[start..].find('"') {
587
+ return Some(window[start..start + end].to_string());
588
+ }
589
+ }
590
+ }
591
+
592
+ if let Some(pos) = opf.find("properties=\"cover-image\"") {
593
+ let window_start = pos.saturating_sub(200);
594
+ let window_end = pos;
595
+ let window = &opf[window_start..window_end];
596
+
597
+ if let Some(id_pos) = window.rfind("id=\"") {
598
+ let start = id_pos + 4;
599
+ if let Some(end) = window[start..].find('"') {
600
+ return Some(window[start..start + end].to_string());
601
+ }
602
+ }
603
+ }
604
+
605
+ None
606
+ }
607
+
608
+ fn find_href_by_id_in_opf(opf: &str, id: &str) -> Option<String> {
609
+ let pattern = format!("id=\"{}\"", id);
610
+ if let Some(pos) = opf.find(&pattern) {
611
+ let window_start = pos.saturating_sub(10);
612
+ let window_end = (pos + 200).min(opf.len());
613
+ let window = &opf[window_start..window_end];
614
+
615
+ if let Some(href_pos) = window.find("href=\"") {
616
+ let start = href_pos + 6;
617
+ if let Some(end) = window[start..].find('"') {
618
+ return Some(window[start..start + end].to_string());
619
+ }
620
+ }
621
+ }
622
+ None
623
+ }
624
+
625
+ fn find_first_image_in_manifest(opf: &str) -> Option<String> {
626
+ let manifest_start = opf.find("<manifest")?;
627
+ let manifest_end = opf[manifest_start..]
628
+ .find("</manifest>")
629
+ .map(|e| manifest_start + e)?;
630
+ let manifest = &opf[manifest_start..manifest_end];
631
+
632
+ for media_type in ["image/jpeg", "image/png", "image/gif", "image/webp"] {
633
+ let pattern = format!("media-type=\"{}\"", media_type);
634
+ if let Some(pos) = manifest.find(&pattern) {
635
+ let window_start = pos.saturating_sub(200);
636
+ let window = &manifest[window_start..pos];
637
+
638
+ if let Some(href_pos) = window.rfind("href=\"") {
639
+ let start = href_pos + 6;
640
+ if let Some(end) = window[start..].find('"') {
641
+ return Some(window[start..start + end].to_string());
642
+ }
643
+ }
644
+ }
645
+ }
646
+
647
+ None
648
+ }
apps/readest-app/extensions/windows-thumbnail/src/mod.rs ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ //! Windows Thumbnail Provider for Readest
2
+ //!
3
+ //! This module provides Windows Explorer thumbnail support for eBook files.
4
+ //! Thumbnails are only shown when Readest is set as the default application.
5
+ //!
6
+ //! Supported formats: EPUB, MOBI, AZW, AZW3, KF8, FB2, CBZ, CBR
7
+
8
+ #![allow(non_snake_case)]
9
+
10
+ mod com_provider;
11
+ mod extraction;
12
+
13
+ pub use extraction::*;
apps/readest-app/i18next-scanner.config.js ADDED
@@ -0,0 +1,60 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ module.exports = {
2
+ input: ['src/**/*.{js,jsx,ts,tsx}', '!src/**/*.test.{js,jsx,ts,tsx}'],
3
+ output: '.',
4
+ options: {
5
+ debug: false,
6
+ sort: false,
7
+ func: {
8
+ list: ['_'],
9
+ extensions: ['.js', '.jsx', '.ts', '.tsx'],
10
+ },
11
+ lngs: [
12
+ 'de',
13
+ 'ja',
14
+ 'es',
15
+ 'fa',
16
+ 'fr',
17
+ 'it',
18
+ 'el',
19
+ 'ko',
20
+ 'uk',
21
+ 'nl',
22
+ 'sv',
23
+ 'pl',
24
+ 'pt',
25
+ 'ru',
26
+ 'tr',
27
+ 'hi',
28
+ 'id',
29
+ 'vi',
30
+ 'ms',
31
+ 'he',
32
+ 'ar',
33
+ 'th',
34
+ 'bo',
35
+ 'bn',
36
+ 'ta',
37
+ 'si',
38
+ 'zh-CN',
39
+ 'zh-TW',
40
+ ],
41
+ ns: ['translation'],
42
+ defaultNs: 'translation',
43
+ defaultValue: '__STRING_NOT_TRANSLATED__',
44
+ resource: {
45
+ loadPath: './public/locales/{{lng}}/{{ns}}.json',
46
+ savePath: './public/locales/{{lng}}/{{ns}}.json',
47
+ jsonIndent: 2,
48
+ lineEnding: '\n',
49
+ },
50
+ keySeparator: false,
51
+ nsSeparator: false,
52
+ interpolation: {
53
+ prefix: '{{',
54
+ suffix: '}}',
55
+ },
56
+ metadata: {},
57
+ allowDynamicKeys: true,
58
+ removeUnusedKeys: true,
59
+ },
60
+ };
apps/readest-app/next.config.mjs ADDED
@@ -0,0 +1,106 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import withSerwistInit from '@serwist/next';
2
+ import withBundleAnalyzer from '@next/bundle-analyzer';
3
+
4
+ const isDev = process.env['NODE_ENV'] === 'development';
5
+ const appPlatform = process.env['NEXT_PUBLIC_APP_PLATFORM'];
6
+
7
+ if (isDev) {
8
+ const { initOpenNextCloudflareForDev } = await import('@opennextjs/cloudflare');
9
+ initOpenNextCloudflareForDev();
10
+ }
11
+
12
+ const exportOutput = appPlatform !== 'web' && !isDev;
13
+
14
+ /** @type {import('next').NextConfig} */
15
+ const nextConfig = {
16
+ // Ensure Next.js uses SSG instead of SSR
17
+ // https://nextjs.org/docs/pages/building-your-application/deploying/static-exports
18
+ output: exportOutput ? 'export' : undefined,
19
+ pageExtensions: exportOutput ? ['jsx', 'tsx'] : ['js', 'jsx', 'ts', 'tsx'],
20
+ // Note: This feature is required to use the Next.js Image component in SSG mode.
21
+ // See https://nextjs.org/docs/messages/export-image-api for different workarounds.
22
+ images: {
23
+ unoptimized: true,
24
+ },
25
+ devIndicators: false,
26
+ // Configure assetPrefix or else the server won't properly resolve your assets.
27
+ assetPrefix: '',
28
+ reactStrictMode: true,
29
+ serverExternalPackages: ['isows'],
30
+ webpack: (config) => {
31
+ config.resolve.alias = {
32
+ ...config.resolve.alias,
33
+ nunjucks: 'nunjucks/browser/nunjucks.js',
34
+ };
35
+ return config;
36
+ },
37
+ turbopack: {
38
+ resolveAlias: {
39
+ nunjucks: 'nunjucks/browser/nunjucks.js',
40
+ },
41
+ },
42
+ transpilePackages: [
43
+ 'ai',
44
+ 'ai-sdk-ollama',
45
+ '@ai-sdk/react',
46
+ '@assistant-ui/react',
47
+ '@assistant-ui/react-ai-sdk',
48
+ '@assistant-ui/react-markdown',
49
+ 'streamdown',
50
+ ...(isDev
51
+ ? []
52
+ : [
53
+ 'i18next-browser-languagedetector',
54
+ 'react-i18next',
55
+ 'i18next',
56
+ '@tauri-apps',
57
+ 'highlight.js',
58
+ 'foliate-js',
59
+ 'marked',
60
+ ]),
61
+ ],
62
+ async headers() {
63
+ return [
64
+ {
65
+ source: '/.well-known/apple-app-site-association',
66
+ headers: [
67
+ {
68
+ key: 'Content-Type',
69
+ value: 'application/json',
70
+ },
71
+ ],
72
+ },
73
+ {
74
+ source: '/_next/static/:path*',
75
+ headers: [
76
+ {
77
+ key: 'Cache-Control',
78
+ value: isDev
79
+ ? 'public, max-age=0, must-revalidate'
80
+ : 'public, max-age=31536000, immutable',
81
+ },
82
+ ],
83
+ },
84
+ ];
85
+ },
86
+ };
87
+
88
+ const pwaDisabled = isDev || appPlatform !== 'web';
89
+
90
+ const withPWA = pwaDisabled
91
+ ? (config) => config
92
+ : withSerwistInit({
93
+ swSrc: 'src/sw.ts',
94
+ swDest: 'public/sw.js',
95
+ cacheOnNavigation: true,
96
+ reloadOnOnline: true,
97
+ disable: false,
98
+ register: true,
99
+ scope: '/',
100
+ });
101
+
102
+ const withAnalyzer = withBundleAnalyzer({
103
+ enabled: process.env.ANALYZE === 'true',
104
+ });
105
+
106
+ export default withPWA(withAnalyzer(nextConfig));
apps/readest-app/open-next.config.ts ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ import { defineCloudflareConfig } from '@opennextjs/cloudflare';
2
+ import r2IncrementalCache from '@opennextjs/cloudflare/overrides/incremental-cache/r2-incremental-cache';
3
+
4
+ export default defineCloudflareConfig({
5
+ incrementalCache: r2IncrementalCache,
6
+ });
apps/readest-app/package.json ADDED
@@ -0,0 +1,198 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "name": "@readest/readest-app",
3
+ "version": "0.9.100",
4
+ "private": true,
5
+ "scripts": {
6
+ "dev": "dotenv -e .env.tauri -- next dev",
7
+ "build": "dotenv -e .env.tauri -- next build",
8
+ "start": "dotenv -e .env.tauri -- next start",
9
+ "dev-web": "dotenv -e .env.web -- next dev",
10
+ "build-web": "dotenv -e .env.web -- next build",
11
+ "start-web": "dotenv -e .env.web -- next start",
12
+ "build-tauri": "dotenv -e .env.tauri -- next build",
13
+ "i18n:extract": "i18next-scanner",
14
+ "lint": "eslint .",
15
+ "test": "dotenv -e .env -e .env.test.local vitest",
16
+ "tauri": "tauri",
17
+ "clippy": "cargo clippy -p Readest --no-deps -- -D warnings",
18
+ "format": "pnpm -w format",
19
+ "format:check": "pnpm -w format:check",
20
+ "prepare-public-vendor": "mkdirp ./public/vendor/pdfjs ./public/vendor/simplecc",
21
+ "copy-pdfjs-js": "cpx \"../../packages/foliate-js/node_modules/pdfjs-dist/legacy/build/{pdf.worker.min.mjs,pdf.min.mjs,pdf.d.mts}\" ./public/vendor/pdfjs",
22
+ "copy-pdfjs-wasm": "cpx \"../../packages/foliate-js/node_modules/pdfjs-dist/wasm/{openjpeg.wasm,qcms_bg.wasm}\" ./public/vendor/pdfjs",
23
+ "copy-pdfjs-fonts": "cpx \"../../packages/foliate-js/node_modules/pdfjs-dist/{cmaps,standard_fonts}/*\" ./public/vendor/pdfjs",
24
+ "copy-flatten-pdfjs-annotation-layer-css": "npx postcss \"../../packages/foliate-js/vendor/pdfjs/annotation_layer_builder.css\" --no-map -u postcss-nested > ./public/vendor/pdfjs/annotation_layer_builder.css",
25
+ "copy-flatten-pdfjs-text-layer-css": "npx postcss \"../../packages/foliate-js/vendor/pdfjs/text_layer_builder.css\" --no-map -u postcss-nested > ./public/vendor/pdfjs/text_layer_builder.css",
26
+ "copy-flatten-pdfjs-css": "pnpm copy-flatten-pdfjs-annotation-layer-css && pnpm copy-flatten-pdfjs-text-layer-css",
27
+ "copy-pdfjs": "pnpm copy-pdfjs-js && pnpm copy-pdfjs-wasm && pnpm copy-pdfjs-fonts && pnpm copy-flatten-pdfjs-css",
28
+ "copy-simplecc": "cpx \"../../packages/simplecc-wasm/dist/web/*\" ./public/vendor/simplecc",
29
+ "setup-pdfjs": "pnpm prepare-public-vendor && pnpm copy-pdfjs",
30
+ "setup-simplecc": "pnpm prepare-public-vendor && pnpm copy-simplecc",
31
+ "setup-vendors": "pnpm setup-pdfjs && pnpm setup-simplecc",
32
+ "build-win-x64": "dotenv -e .env.tauri.local -- tauri build --target i686-pc-windows-msvc --bundles nsis",
33
+ "build-win-arm64": "dotenv -e .env.tauri.local -- tauri build --target aarch64-pc-windows-msvc --bundles nsis",
34
+ "build-linux-x64": "dotenv -e .env.tauri.local -- tauri build --target x86_64-unknown-linux-gnu --bundles appimage",
35
+ "build-macos-universial": "dotenv -e .env.tauri.local -e .env.apple-nonstore.local -- tauri build -t universal-apple-darwin --bundles dmg",
36
+ "build-macos-universial-appstore": "dotenv -e .env.tauri.local -e .env.apple-appstore.local -- tauri build -t universal-apple-darwin --bundles app --config src-tauri/tauri.appstore.conf.json",
37
+ "build-macos-universial-appstore-dev": "dotenv -e .env.tauri.local -e .env.apple-appstore-dev.local -- tauri build -t universal-apple-darwin --bundles app --config src-tauri/tauri.appstore-dev.conf.json",
38
+ "build-ios": "dotenv -e .env.ios-appstore-dev.local -- tauri ios build",
39
+ "build-ios-appstore": "dotenv -e .env.ios-appstore.local -- tauri ios build --export-method app-store-connect",
40
+ "release-macos-universial-appstore": "dotenv -e .env.tauri.local -e .env.apple-appstore.local -- bash scripts/release-mac-appstore.sh",
41
+ "release-ios-appstore": "dotenv -e .env.ios-appstore.local -- bash scripts/release-ios-appstore.sh",
42
+ "release-google-play": "dotenv -e .env.google-play.local -- bash scripts/release-google-play.sh",
43
+ "config-wrangler": "sed -i \"s/\\${TRANSLATIONS_KV_ID}/$TRANSLATIONS_KV_ID/g\" wrangler.toml",
44
+ "preview": "pnpm patch-build-webpack && NEXT_PUBLIC_APP_PLATFORM=web opennextjs-cloudflare build && pnpm restore-build-original && opennextjs-cloudflare preview --ip 0.0.0.0 --port 3001",
45
+ "deploy": "pnpm patch-build-webpack && NEXT_PUBLIC_APP_PLATFORM=web opennextjs-cloudflare build && pnpm restore-build-original && opennextjs-cloudflare deploy",
46
+ "upload": "pnpm patch-build-webpack && NEXT_PUBLIC_APP_PLATFORM=web opennextjs-cloudflare build && pnpm restore-build-original && opennextjs-cloudflare upload",
47
+ "cf-typegen": "wrangler types --env-interface CloudflareEnv cloudflare-env.d.ts",
48
+ "patch-build-webpack": "if [ \"$(uname)\" = \"Darwin\" ]; then sed -i '' 's/next build\"/next build --webpack\"/' package.json; else sed -i 's/next build\"/next build --webpack\"/' package.json; fi",
49
+ "restore-build-original": "if [ \"$(uname)\" = \"Darwin\" ]; then sed -i '' 's/next build --webpack\"/next build\"/' package.json; else sed -i 's/next build --webpack\"/next build\"/' package.json; fi",
50
+ "update-metadata": "bash ./scripts/sync-release-notes.sh release-notes.json ../../data/metainfo/appdata.xml",
51
+ "check:optional-chaining": "count=$(grep -rno '\\?\\.[a-zA-Z_$]' .next/static/chunks/* out/_next/static/chunks/* | wc -l); if [ \"$count\" -gt 0 ]; then echo '❌ Optional chaining found in output!'; exit 1; else echo '✅ No optional chaining found.'; fi",
52
+ "check:translations": "count=$(grep -rno '__STRING_NOT_TRANSLATED__' public/locales/* | wc -l); if [ \"$count\" -gt 0 ]; then echo '❌ Untranslated strings found!'; exit 1; else echo '✅ All strings translated.'; fi",
53
+ "check:lookbehind-regex": "count=$(grep -rnoE '\\(\\?<[!=]' .next/static/chunks/* out/_next/static/chunks/* | wc -l); if [ \"$count\" -gt 0 ]; then echo '❌ Lookbehind regex found in output!'; exit 1; else echo '✅ No lookbehind regex found.'; fi",
54
+ "check:all": "pnpm check:translations && pnpm check:lookbehind-regex",
55
+ "build-check": "pnpm build && pnpm build-web && pnpm check:all"
56
+ },
57
+ "dependencies": {
58
+ "@ai-sdk/react": "^3.0.49",
59
+ "@assistant-ui/react": "0.11.56",
60
+ "@assistant-ui/react-ai-sdk": "1.1.21",
61
+ "@assistant-ui/react-markdown": "0.11.9",
62
+ "@aws-sdk/client-s3": "^3.735.0",
63
+ "@aws-sdk/s3-request-presigner": "^3.735.0",
64
+ "@choochmeque/tauri-plugin-sharekit-api": "^0.3.0",
65
+ "@fabianlars/tauri-plugin-oauth": "2",
66
+ "@opennextjs/cloudflare": "^1.15.1",
67
+ "@radix-ui/react-collapsible": "^1.1.12",
68
+ "@radix-ui/react-dialog": "^1.1.15",
69
+ "@radix-ui/react-dropdown-menu": "^2.1.16",
70
+ "@radix-ui/react-hover-card": "^1.1.15",
71
+ "@radix-ui/react-scroll-area": "^1.2.10",
72
+ "@radix-ui/react-select": "^2.2.6",
73
+ "@radix-ui/react-separator": "^1.1.8",
74
+ "@radix-ui/react-slot": "^1.2.4",
75
+ "@radix-ui/react-tabs": "^1.1.13",
76
+ "@radix-ui/react-tooltip": "^1.2.8",
77
+ "@serwist/next": "^9.4.2",
78
+ "@stripe/react-stripe-js": "^3.7.0",
79
+ "@stripe/stripe-js": "^7.4.0",
80
+ "@supabase/auth-ui-react": "^0.4.7",
81
+ "@supabase/auth-ui-shared": "^0.1.8",
82
+ "@supabase/supabase-js": "^2.76.1",
83
+ "@tauri-apps/api": "2.9.1",
84
+ "@tauri-apps/plugin-cli": "^2.4.1",
85
+ "@tauri-apps/plugin-deep-link": "^2.4.6",
86
+ "@tauri-apps/plugin-dialog": "^2.6.0",
87
+ "@tauri-apps/plugin-fs": "^2.4.5",
88
+ "@tauri-apps/plugin-haptics": "^2.3.2",
89
+ "@tauri-apps/plugin-http": "^2.5.6",
90
+ "@tauri-apps/plugin-log": "^2.8.0",
91
+ "@tauri-apps/plugin-opener": "^2.5.3",
92
+ "@tauri-apps/plugin-os": "^2.3.2",
93
+ "@tauri-apps/plugin-process": "^2.3.1",
94
+ "@tauri-apps/plugin-shell": "~2.3.4",
95
+ "@tauri-apps/plugin-updater": "^2.9.0",
96
+ "@tauri-apps/plugin-websocket": "~2.4.2",
97
+ "@zip.js/zip.js": "^2.8.16",
98
+ "abortcontroller-polyfill": "^1.7.8",
99
+ "ai": "^6.0.47",
100
+ "ai-sdk-ollama": "^3.2.0",
101
+ "app-store-server-api": "^0.17.1",
102
+ "aws4fetch": "^1.0.20",
103
+ "buffer": "^6.0.3",
104
+ "class-variance-authority": "^0.7.1",
105
+ "clsx": "^2.1.1",
106
+ "cmdk": "^1.1.1",
107
+ "cors": "^2.8.5",
108
+ "dayjs": "^1.11.13",
109
+ "dompurify": "^3.3.0",
110
+ "foliate-js": "workspace:*",
111
+ "franc-min": "^6.2.0",
112
+ "fzf": "^0.5.2",
113
+ "google-auth-library": "^10.5.0",
114
+ "googleapis": "^164.1.0",
115
+ "highlight.js": "^11.11.1",
116
+ "i18next": "^24.2.0",
117
+ "i18next-browser-languagedetector": "^8.0.2",
118
+ "i18next-http-backend": "^3.0.1",
119
+ "iso-639-2": "^3.0.2",
120
+ "iso-639-3": "^3.0.1",
121
+ "isomorphic-ws": "^5.0.0",
122
+ "js-md5": "^0.8.3",
123
+ "jwt-decode": "^4.0.0",
124
+ "lucide-react": "^0.562.0",
125
+ "lunr": "^2.3.9",
126
+ "marked": "^15.0.12",
127
+ "nanoid": "^5.1.6",
128
+ "next": "16.1.6",
129
+ "nunjucks": "^3.2.4",
130
+ "overlayscrollbars": "^2.11.4",
131
+ "overlayscrollbars-react": "^0.5.6",
132
+ "posthog-js": "^1.246.0",
133
+ "react": "19.2.0",
134
+ "react-color": "^2.19.3",
135
+ "react-dom": "19.2.0",
136
+ "react-i18next": "^15.2.0",
137
+ "react-icons": "^5.4.0",
138
+ "react-responsive": "^10.0.0",
139
+ "react-virtuoso": "^4.17.0",
140
+ "react-window": "^1.8.11",
141
+ "remark-gfm": "^4.0.1",
142
+ "semver": "^7.7.1",
143
+ "streamdown": "^1.6.10",
144
+ "stripe": "^18.2.1",
145
+ "styled-jsx": "^5.1.7",
146
+ "tailwind-merge": "^3.4.0",
147
+ "tinycolor2": "^1.6.0",
148
+ "uuid": "^11.1.0",
149
+ "ws": "^8.18.3",
150
+ "zod": "^4.0.8",
151
+ "zustand": "5.0.10"
152
+ },
153
+ "devDependencies": {
154
+ "@next/bundle-analyzer": "^15.4.2",
155
+ "@tailwindcss/typography": "^0.5.16",
156
+ "@tauri-apps/cli": "2.9.6",
157
+ "@testing-library/dom": "^10.4.0",
158
+ "@testing-library/react": "^16.3.0",
159
+ "@types/cors": "^2.8.17",
160
+ "@types/cssbeautify": "^0.3.5",
161
+ "@types/lunr": "^2.3.7",
162
+ "@types/node": "^22.15.31",
163
+ "@types/nunjucks": "^3.2.6",
164
+ "@types/react": "^19.0.0",
165
+ "@types/react-color": "^3.0.13",
166
+ "@types/react-dom": "^19.0.0",
167
+ "@types/react-window": "^1.8.8",
168
+ "@types/semver": "^7.7.0",
169
+ "@types/tinycolor2": "^1.4.6",
170
+ "@types/uuid": "^10.0.0",
171
+ "@types/ws": "^8.18.1",
172
+ "@typescript-eslint/eslint-plugin": "^8.48.0",
173
+ "@typescript-eslint/parser": "^8.48.0",
174
+ "@vitejs/plugin-react": "^5.1.1",
175
+ "autoprefixer": "^10.4.20",
176
+ "caniuse-lite": "^1.0.30001746",
177
+ "cpx2": "^8.0.0",
178
+ "daisyui": "^4.12.24",
179
+ "dotenv-cli": "^7.4.4",
180
+ "eslint": "^9.16.0",
181
+ "eslint-config-next": "16.0.0",
182
+ "eslint-plugin-jsx-a11y": "^6.10.2",
183
+ "i18next-scanner": "^4.6.0",
184
+ "jsdom": "^26.1.0",
185
+ "mkdirp": "^3.0.1",
186
+ "node-env-run": "^4.0.2",
187
+ "postcss": "^8.4.49",
188
+ "postcss-cli": "^11.0.0",
189
+ "postcss-nested": "^7.0.2",
190
+ "raw-loader": "^4.0.2",
191
+ "serwist": "^9.3.0",
192
+ "tailwindcss": "^3.4.18",
193
+ "typescript": "^5.7.2",
194
+ "vite-tsconfig-paths": "^5.1.4",
195
+ "vitest": "^4.0.15",
196
+ "wrangler": "^4.60.0"
197
+ }
198
+ }
apps/readest-app/postcss.config.mjs ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
 
1
+ /** @type {import('postcss-load-config').Config} */
2
+ const config = {
3
+ plugins: {
4
+ tailwindcss: {},
5
+ autoprefixer: {},
6
+ },
7
+ };
8
+
9
+ export default config;
apps/readest-app/public/.well-known/apple-app-site-association ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "applinks": {
3
+ "details": [
4
+ {
5
+ "appIDs": [
6
+ "J5W48D69VR.com.bilingify.readest"
7
+ ],
8
+ "components": [
9
+ {
10
+ "/": "/auth/*",
11
+ "comment": "Matches any URL whose path starts with /auth/"
12
+ }
13
+ ]
14
+ }
15
+ ]
16
+ }
17
+ }
apps/readest-app/public/.well-known/assetlinks.json ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [
2
+ {
3
+ "relation": [
4
+ "delegate_permission/common.handle_all_urls",
5
+ "delegate_permission/common.get_login_creds"
6
+ ],
7
+ "target": {
8
+ "namespace": "android_app",
9
+ "package_name": "com.bilingify.readest",
10
+ "sha256_cert_fingerprints": [
11
+ "65:2D:11:67:76:12:29:14:18:42:CB:3D:18:50:B6:E4:7E:46:E1:2F:4B:E4:7F:5A:6C:14:B6:D7:12:74:1E:82",
12
+ "E0:E7:60:55:80:8D:3A:DE:A0:D1:CF:7C:20:85:40:A3:DD:4B:E6:4D:17:5C:0F:DE:26:57:7D:9C:5B:29:5F:51"
13
+ ]
14
+ }
15
+ }
16
+ ]
apps/readest-app/public/.well-known/org.flathub.VerifiedApps.txt ADDED
@@ -0,0 +1 @@
 
 
1
+ ed533042-5626-4704-b5f2-fa3bbd1136ed
apps/readest-app/public/apple-touch-icon.png ADDED

Git LFS Details

  • SHA256: bf7c5003595f80353d7223b2383473ef0c21522cb30385cd327bcc9242b45f6d
  • Pointer size: 130 Bytes
  • Size of remote file: 70.5 kB
apps/readest-app/public/favicon.ico ADDED
apps/readest-app/public/fonts/InterVariable-Italic.woff2 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e564f652916db6c139570fefb9524a77c4d48f30c92928de9db19b6b5c7a262a
3
+ size 387976