Leon4gr45 commited on
Commit
eda8dc6
·
verified ·
1 Parent(s): 52ef37f

Upload folder using huggingface_hub

Browse files
.dockerignore ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ node_modules
2
+ npm-debug.log
3
+ dist
4
+ coverage
5
+ .git
6
+ .gitignore
7
+ .env
8
+ *.md
9
+ .vscode
10
+ .idea
.env.example ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # BentoPDF Environment Variables
2
+ # Copy this file to .env.production and configure as needed.
3
+
4
+ # CORS Proxy for digital signature certificate chain fetching
5
+ VITE_CORS_PROXY_URL=
6
+ VITE_CORS_PROXY_SECRET=
7
+
8
+ # WASM Module URLs
9
+ # Pre-configured defaults enable advanced PDF features out of the box.
10
+ # For air-gapped / offline deployments, point these to your internal server (e.g., /wasm/pymupdf/).
11
+ VITE_WASM_PYMUPDF_URL=https://cdn.jsdelivr.net/npm/@bentopdf/pymupdf-wasm@0.11.14/
12
+ VITE_WASM_GS_URL=https://cdn.jsdelivr.net/npm/@bentopdf/gs-wasm/assets/
13
+ VITE_WASM_CPDF_URL=https://cdn.jsdelivr.net/npm/coherentpdf/dist/
14
+
15
+ # Default UI language (build-time)
16
+ # Supported: en, ar, be, fr, de, es, zh, zh-TW, vi, tr, id, it, pt, nl, da
17
+ VITE_DEFAULT_LANGUAGE=
18
+
19
+ # Custom branding (build-time)
20
+ # Replace the default BentoPDF branding with your own.
21
+ # Place your logo file in the public/ folder and set the path relative to it.
22
+ VITE_BRAND_NAME=
23
+ VITE_BRAND_LOGO=
24
+ VITE_FOOTER_TEXT=
.github/FUNDING.yml ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ github: alam00000
2
+ ko_fi: alio01
.github/ISSUE_TEMPLATE/bug_report.yml ADDED
@@ -0,0 +1,122 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ name: 🐛 Bug Report
2
+ description: Report a bug in BentoPDF
3
+ title: "(Bug) "
4
+ labels: ["bug", "needs triage"]
5
+ body:
6
+ - type: markdown
7
+ attributes:
8
+ value: |
9
+ ## ⚠️ Important Notice
10
+ **Bug reports without logs or a sample file demonstrating the issue will not be investigated.**
11
+ Please help us help you by providing the information needed to reproduce and fix the problem.
12
+
13
+ - type: textarea
14
+ id: description
15
+ attributes:
16
+ label: Description
17
+ description: Provide a clear and concise description of the bug.
18
+ placeholder: What happened? What did you expect to happen?
19
+ validations:
20
+ required: true
21
+
22
+ - type: textarea
23
+ id: steps
24
+ attributes:
25
+ label: Steps to Reproduce
26
+ description: How can we reproduce this issue?
27
+ placeholder: |
28
+ 1. Go to '...'
29
+ 2. Click on '...'
30
+ 3. Upload file '...'
31
+ 4. See error
32
+ validations:
33
+ required: true
34
+
35
+ - type: textarea
36
+ id: console-logs
37
+ attributes:
38
+ label: Console Logs
39
+ description: Open browser DevTools (F12 → Console tab) and paste any errors here.
40
+ placeholder: Paste console logs here...
41
+ render: shell
42
+ validations:
43
+ required: true
44
+
45
+ - type: textarea
46
+ id: sample-file
47
+ attributes:
48
+ label: Sample PDF or File
49
+ description: |
50
+ Attach a sample PDF that reproduces the issue, or describe how to create one.
51
+ If you cannot share the original, create a minimal example that shows the problem.
52
+ placeholder: Drag and drop your file here, or describe how to reproduce with any PDF...
53
+ validations:
54
+ required: true
55
+
56
+ - type: dropdown
57
+ id: browser
58
+ attributes:
59
+ label: Browser
60
+ description: Which browser are you using?
61
+ options:
62
+ - Chrome
63
+ - Firefox
64
+ - Safari
65
+ - Edge
66
+ - Brave
67
+ - Other
68
+ validations:
69
+ required: true
70
+
71
+ - type: input
72
+ id: browser-version
73
+ attributes:
74
+ label: Browser Version
75
+ description: e.g., Chrome 120, Firefox 121
76
+ placeholder: "120"
77
+ validations:
78
+ required: true
79
+
80
+ - type: dropdown
81
+ id: os
82
+ attributes:
83
+ label: Operating System
84
+ options:
85
+ - macOS
86
+ - Windows
87
+ - Linux
88
+ - iOS
89
+ - Android
90
+ - Other
91
+ validations:
92
+ required: true
93
+
94
+ - type: input
95
+ id: bentopdf-version
96
+ attributes:
97
+ label: BentoPDF Version
98
+ description: Check the footer or package.json
99
+ placeholder: "1.15.4"
100
+ validations:
101
+ required: false
102
+
103
+ - type: textarea
104
+ id: additional
105
+ attributes:
106
+ label: Additional Context
107
+ description: Any other information that might help us debug this issue.
108
+ placeholder: Screenshots, network errors, stack traces, etc.
109
+ validations:
110
+ required: false
111
+
112
+ - type: checkboxes
113
+ id: checklist
114
+ attributes:
115
+ label: Pre-submission Checklist
116
+ options:
117
+ - label: I have included console logs from the browser DevTools
118
+ required: true
119
+ - label: I have attached a sample file or described how to reproduce the issue
120
+ required: true
121
+ - label: I have searched existing issues to ensure this is not a duplicate
122
+ required: true
.github/ISSUE_TEMPLATE/config.yml ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ blank_issues_enabled: false
2
+ contact_links:
3
+ - name: 💬 Discord Community
4
+ url: https://discord.gg/Bgq3Ay3f2w
5
+ about: Join our Discord for quick questions and community support
6
+ - name: 📖 Documentation
7
+ url: https://github.com/nicholaschen09/BentoPDF#readme
8
+ about: Check the README for setup and usage instructions
.github/ISSUE_TEMPLATE/feature_request.yml ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ name: 💡 Feature Request
2
+ description: Suggest a new feature for BentoPDF
3
+ title: "(Feature) "
4
+ labels: ["enhancement", "needs triage"]
5
+ body:
6
+ - type: textarea
7
+ id: description
8
+ attributes:
9
+ label: Feature Description
10
+ description: What functionality are you requesting?
11
+ placeholder: Describe the feature you'd like to see...
12
+ validations:
13
+ required: true
14
+
15
+ - type: textarea
16
+ id: use-case
17
+ attributes:
18
+ label: Use Case
19
+ description: Why is this feature useful? What problem does it solve?
20
+ placeholder: Explain why you need this feature...
21
+ validations:
22
+ required: true
23
+
24
+ - type: textarea
25
+ id: examples
26
+ attributes:
27
+ label: Examples
28
+ description: Any examples, mockups, or references to illustrate the feature?
29
+ placeholder: Links to similar features, screenshots, etc.
30
+ validations:
31
+ required: false
32
+
33
+ - type: textarea
34
+ id: additional
35
+ attributes:
36
+ label: Additional Context
37
+ description: Any other information about the feature request.
38
+ validations:
39
+ required: false
.github/ISSUE_TEMPLATE/question.yml ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ name: ❓ Question
2
+ description: Ask a question about BentoPDF
3
+ title: "(Question) "
4
+ labels: ["question"]
5
+ body:
6
+ - type: textarea
7
+ id: question
8
+ attributes:
9
+ label: Question
10
+ description: What would you like to know?
11
+ placeholder: Your question here...
12
+ validations:
13
+ required: true
14
+
15
+ - type: textarea
16
+ id: tried
17
+ attributes:
18
+ label: What have you tried?
19
+ description: What solutions have you already attempted?
20
+ placeholder: Describe what you've tried so far...
21
+ validations:
22
+ required: false
23
+
24
+ - type: textarea
25
+ id: context
26
+ attributes:
27
+ label: Additional Context
28
+ description: Any relevant code snippets, screenshots, or scenarios.
29
+ validations:
30
+ required: false
.github/cla.json ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "name": "BentoPDF CLA",
3
+ "text": [
4
+ "Thank you for your contribution to BentoPDF!",
5
+ "",
6
+ "By signing this CLA, you agree to the terms of our Contributor License Agreement.",
7
+ "",
8
+ "**Individual Contributors**: Please review and sign our [Individual CLA (ICLA)](ICLA.md)",
9
+ "",
10
+ "**Corporate Contributors**: If you are contributing on behalf of your employer, please have your organization sign our [Corporate CLA (CCLA)](CCLA.md) by contacting contact@bentopdf.com"
11
+ ],
12
+ "notes": {
13
+ "purpose": "This CLA enables BentoPDF's dual licensing model (AGPL-3.0 + commercial license)",
14
+ "icla_url": "https://github.com/alam00000/bentopdf/blob/main/ICLA.md",
15
+ "ccla_url": "https://github.com/alam00000/bentopdf/blob/main/CCLA.md",
16
+ "contact": "contact@bentopdf.com"
17
+ }
18
+ }
.github/dependabot.yml ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ version: 2
2
+ updates:
3
+ - package-ecosystem: 'npm'
4
+ directory: '/'
5
+ schedule:
6
+ interval: 'daily'
7
+ groups:
8
+ npm-dependencies:
9
+ patterns:
10
+ - '*'
11
+
12
+ - package-ecosystem: 'github-actions'
13
+ directory: '/'
14
+ schedule:
15
+ interval: 'daily'
.github/pull_request_template.md ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ### Description
2
+
3
+ Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. List any dependencies that are required for this change.
4
+
5
+ Fixes # (issue)
6
+
7
+ ### Type of change
8
+
9
+ Please delete options that are not relevant.
10
+
11
+ - [ ] Bug fix (non-breaking change which fixes an issue)
12
+ - [ ] New feature (non-breaking change which adds functionality)
13
+ - [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
14
+ - [ ] This change requires a documentation update
15
+
16
+ ### 🧪 How Has This Been Tested?
17
+
18
+ Please describe **how you tested your changes** so that maintainers can verify them. Include enough detail for someone else to reproduce your tests.
19
+
20
+ **Checklist:**
21
+
22
+ - [ ] Verified output manually
23
+ - [ ] Tested with relevant sample documents or data
24
+ - [ ] Wrote Vite Test Case (if applicable)
25
+
26
+ **Expected Results:**
27
+
28
+ - What the tests should produce (e.g., correct PDF rendering, no errors).
29
+
30
+ **Actual Results:**
31
+
32
+ - What you observed when running the tests.
33
+
34
+ ### Checklist:
35
+
36
+ - [ ] I have signed the [Contributor License Agreement (CLA)](ICLA.md) or my organization has signed the [Corporate CLA](CCLA.md)
37
+ - [ ] My code follows the style guidelines of this project
38
+ - [ ] I have performed a self-review of my own code
39
+ - [ ] I have commented my code, particularly in hard-to-understand areas
40
+ - [ ] I have made corresponding changes to the documentation
41
+ - [ ] My changes generate no new warnings
42
+ - [ ] I have added tests that prove my fix is effective or that my feature works
43
+ - [ ] New and existing unit tests pass locally with my changes
44
+ - [ ] Any dependent changes have been merged and published in downstream modules
.github/workflows/build-and-publish.yml ADDED
@@ -0,0 +1,324 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ name: Build and Push Docker Images (Default + Simple Mode)
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - "main"
7
+ tags:
8
+ - "v*"
9
+ workflow_dispatch:
10
+
11
+ jobs:
12
+ # New job to build dist and create release
13
+ build-and-release:
14
+ runs-on: ubuntu-latest
15
+ if: github.repository == 'alam00000/bentopdf' && startsWith(github.ref, 'refs/tags/')
16
+ permissions:
17
+ contents: write
18
+ env:
19
+ HUSKY: 0
20
+ steps:
21
+ - name: Checkout code
22
+ uses: actions/checkout@v4
23
+
24
+ - name: Setup Node.js
25
+ uses: actions/setup-node@v4
26
+ with:
27
+ node-version: "20"
28
+
29
+ - name: Install dependencies
30
+ run: npm ci
31
+
32
+ - name: Build distribution
33
+ run: npm run build
34
+
35
+ - name: Extract version
36
+ id: version
37
+ run: |
38
+ VERSION=${GITHUB_REF#refs/tags/v}
39
+ echo "version=${VERSION}" >> $GITHUB_OUTPUT
40
+
41
+ - name: Package distribution
42
+ run: npm run package
43
+
44
+ - name: Create GitHub Release
45
+ uses: softprops/action-gh-release@v2
46
+ with:
47
+ files: dist-${{ steps.version.outputs.version }}.zip
48
+ generate_release_notes: true
49
+ draft: false
50
+ prerelease: false
51
+ env:
52
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
53
+
54
+ # Build each platform natively in parallel, then merge manifests
55
+ build-amd64:
56
+ runs-on: ubuntu-latest
57
+ if: github.repository == 'alam00000/bentopdf'
58
+ permissions:
59
+ contents: read
60
+ packages: write
61
+ strategy:
62
+ matrix:
63
+ mode:
64
+ - name: default
65
+ simple_mode: false
66
+ suffix: ""
67
+ - name: simple
68
+ simple_mode: true
69
+ suffix: "-simple"
70
+ steps:
71
+ - name: Checkout code
72
+ uses: actions/checkout@v4
73
+
74
+ - name: Set up Docker Buildx
75
+ uses: docker/setup-buildx-action@v3
76
+
77
+ - name: Login to GitHub Container Registry
78
+ uses: docker/login-action@v3
79
+ with:
80
+ registry: ghcr.io
81
+ username: ${{ github.repository_owner }}
82
+ password: ${{ secrets.GITHUB_TOKEN }}
83
+
84
+ - name: Extract version
85
+ id: version
86
+ run: |
87
+ if [[ $GITHUB_REF == refs/tags/v* ]]; then
88
+ VERSION=${GITHUB_REF#refs/tags/}
89
+ echo "version=${VERSION}" >> $GITHUB_OUTPUT
90
+ echo "version_without_v=${VERSION#v}" >> $GITHUB_OUTPUT
91
+ echo "is_release=true" >> $GITHUB_OUTPUT
92
+ else
93
+ SHORT_SHA=${GITHUB_SHA::7}
94
+ echo "version=edge" >> $GITHUB_OUTPUT
95
+ echo "short_sha=${SHORT_SHA}" >> $GITHUB_OUTPUT
96
+ echo "is_release=false" >> $GITHUB_OUTPUT
97
+ fi
98
+
99
+ - name: Build and push amd64 ${{ matrix.mode.name }} (release)
100
+ if: steps.version.outputs.is_release == 'true'
101
+ uses: docker/build-push-action@v6
102
+ with:
103
+ push: true
104
+ build-args: |
105
+ SIMPLE_MODE=${{ matrix.mode.simple_mode }}
106
+ tags: |
107
+ ghcr.io/${{ github.repository_owner }}/bentopdf${{ matrix.mode.suffix }}:${{ steps.version.outputs.version }}-amd64
108
+ platforms: linux/amd64
109
+ cache-from: type=gha,scope=amd64-${{ matrix.mode.name }}
110
+ cache-to: type=gha,mode=max,scope=amd64-${{ matrix.mode.name }}
111
+
112
+ - name: Build and push amd64 ${{ matrix.mode.name }} (edge)
113
+ if: steps.version.outputs.is_release == 'false'
114
+ uses: docker/build-push-action@v6
115
+ with:
116
+ push: true
117
+ build-args: |
118
+ SIMPLE_MODE=${{ matrix.mode.simple_mode }}
119
+ tags: |
120
+ ghcr.io/${{ github.repository_owner }}/bentopdf${{ matrix.mode.suffix }}:edge-amd64
121
+ platforms: linux/amd64
122
+ cache-from: type=gha,scope=amd64-${{ matrix.mode.name }}
123
+ cache-to: type=gha,mode=max,scope=amd64-${{ matrix.mode.name }}
124
+
125
+ build-arm64:
126
+ runs-on: ubuntu-24.04-arm # Native ARM64 runner
127
+ permissions:
128
+ contents: read
129
+ packages: write
130
+ strategy:
131
+ matrix:
132
+ mode:
133
+ - name: default
134
+ simple_mode: false
135
+ suffix: ""
136
+ - name: simple
137
+ simple_mode: true
138
+ suffix: "-simple"
139
+ steps:
140
+ - name: Checkout code
141
+ uses: actions/checkout@v4
142
+
143
+ - name: Set up Docker Buildx
144
+ uses: docker/setup-buildx-action@v3
145
+
146
+ - name: Login to GitHub Container Registry
147
+ uses: docker/login-action@v3
148
+ with:
149
+ registry: ghcr.io
150
+ username: ${{ github.repository_owner }}
151
+ password: ${{ secrets.GITHUB_TOKEN }}
152
+
153
+ - name: Extract version
154
+ id: version
155
+ run: |
156
+ if [[ $GITHUB_REF == refs/tags/v* ]]; then
157
+ VERSION=${GITHUB_REF#refs/tags/}
158
+ echo "version=${VERSION}" >> $GITHUB_OUTPUT
159
+ echo "version_without_v=${VERSION#v}" >> $GITHUB_OUTPUT
160
+ echo "is_release=true" >> $GITHUB_OUTPUT
161
+ else
162
+ SHORT_SHA=${GITHUB_SHA::7}
163
+ echo "version=edge" >> $GITHUB_OUTPUT
164
+ echo "short_sha=${SHORT_SHA}" >> $GITHUB_OUTPUT
165
+ echo "is_release=false" >> $GITHUB_OUTPUT
166
+ fi
167
+
168
+ - name: Build and push arm64 ${{ matrix.mode.name }} (release)
169
+ if: steps.version.outputs.is_release == 'true'
170
+ uses: docker/build-push-action@v6
171
+ with:
172
+ push: true
173
+ build-args: |
174
+ SIMPLE_MODE=${{ matrix.mode.simple_mode }}
175
+ tags: |
176
+ ghcr.io/${{ github.repository_owner }}/bentopdf${{ matrix.mode.suffix }}:${{ steps.version.outputs.version }}-arm64
177
+ platforms: linux/arm64
178
+ cache-from: type=gha,scope=arm64-${{ matrix.mode.name }}
179
+ cache-to: type=gha,mode=max,scope=arm64-${{ matrix.mode.name }}
180
+
181
+ - name: Build and push arm64 ${{ matrix.mode.name }} (edge)
182
+ if: steps.version.outputs.is_release == 'false'
183
+ uses: docker/build-push-action@v6
184
+ with:
185
+ push: true
186
+ build-args: |
187
+ SIMPLE_MODE=${{ matrix.mode.simple_mode }}
188
+ tags: |
189
+ ghcr.io/${{ github.repository_owner }}/bentopdf${{ matrix.mode.suffix }}:edge-arm64
190
+ platforms: linux/arm64
191
+ cache-from: type=gha,scope=arm64-${{ matrix.mode.name }}
192
+ cache-to: type=gha,mode=max,scope=arm64-${{ matrix.mode.name }}
193
+
194
+ # Merge GHCR manifests after both platforms are built
195
+ merge-manifests-ghcr:
196
+ runs-on: ubuntu-latest
197
+ needs: [build-amd64, build-arm64]
198
+ permissions:
199
+ packages: write
200
+ strategy:
201
+ matrix:
202
+ mode:
203
+ - name: default
204
+ suffix: ""
205
+ - name: simple
206
+ suffix: "-simple"
207
+ steps:
208
+ - name: Login to GitHub Container Registry
209
+ uses: docker/login-action@v3
210
+ with:
211
+ registry: ghcr.io
212
+ username: ${{ github.repository_owner }}
213
+ password: ${{ secrets.GITHUB_TOKEN }}
214
+
215
+ - name: Extract version
216
+ id: version
217
+ run: |
218
+ if [[ $GITHUB_REF == refs/tags/v* ]]; then
219
+ VERSION=${GITHUB_REF#refs/tags/}
220
+ echo "version=${VERSION}" >> $GITHUB_OUTPUT
221
+ echo "version_without_v=${VERSION#v}" >> $GITHUB_OUTPUT
222
+ echo "is_release=true" >> $GITHUB_OUTPUT
223
+ else
224
+ SHORT_SHA=${GITHUB_SHA::7}
225
+ echo "version=edge" >> $GITHUB_OUTPUT
226
+ echo "short_sha=${SHORT_SHA}" >> $GITHUB_OUTPUT
227
+ echo "is_release=false" >> $GITHUB_OUTPUT
228
+ fi
229
+
230
+ - name: Create and push GHCR manifest (release)
231
+ if: steps.version.outputs.is_release == 'true'
232
+ run: |
233
+ docker buildx imagetools create -t ghcr.io/${{ github.repository_owner }}/bentopdf${{ matrix.mode.suffix }}:latest \
234
+ ghcr.io/${{ github.repository_owner }}/bentopdf${{ matrix.mode.suffix }}:${{ steps.version.outputs.version }}-amd64 \
235
+ ghcr.io/${{ github.repository_owner }}/bentopdf${{ matrix.mode.suffix }}:${{ steps.version.outputs.version }}-arm64
236
+
237
+ docker buildx imagetools create -t ghcr.io/${{ github.repository_owner }}/bentopdf${{ matrix.mode.suffix }}:${{ steps.version.outputs.version }} \
238
+ ghcr.io/${{ github.repository_owner }}/bentopdf${{ matrix.mode.suffix }}:${{ steps.version.outputs.version }}-amd64 \
239
+ ghcr.io/${{ github.repository_owner }}/bentopdf${{ matrix.mode.suffix }}:${{ steps.version.outputs.version }}-arm64
240
+
241
+ docker buildx imagetools create -t ghcr.io/${{ github.repository_owner }}/bentopdf${{ matrix.mode.suffix }}:${{ steps.version.outputs.version_without_v }} \
242
+ ghcr.io/${{ github.repository_owner }}/bentopdf${{ matrix.mode.suffix }}:${{ steps.version.outputs.version }}-amd64 \
243
+ ghcr.io/${{ github.repository_owner }}/bentopdf${{ matrix.mode.suffix }}:${{ steps.version.outputs.version }}-arm64
244
+
245
+ - name: Create and push GHCR manifest (edge)
246
+ if: steps.version.outputs.is_release == 'false'
247
+ run: |
248
+ docker buildx imagetools create -t ghcr.io/${{ github.repository_owner }}/bentopdf${{ matrix.mode.suffix }}:edge \
249
+ ghcr.io/${{ github.repository_owner }}/bentopdf${{ matrix.mode.suffix }}:edge-amd64 \
250
+ ghcr.io/${{ github.repository_owner }}/bentopdf${{ matrix.mode.suffix }}:edge-arm64
251
+
252
+ docker buildx imagetools create -t ghcr.io/${{ github.repository_owner }}/bentopdf${{ matrix.mode.suffix }}:sha-${{ steps.version.outputs.short_sha }} \
253
+ ghcr.io/${{ github.repository_owner }}/bentopdf${{ matrix.mode.suffix }}:edge-amd64 \
254
+ ghcr.io/${{ github.repository_owner }}/bentopdf${{ matrix.mode.suffix }}:edge-arm64
255
+
256
+ # Copy images from GHCR to DockerHub
257
+ push-to-dockerhub:
258
+ runs-on: ubuntu-latest
259
+ needs: [merge-manifests-ghcr]
260
+ continue-on-error: true
261
+ permissions:
262
+ contents: read
263
+ packages: read
264
+ strategy:
265
+ matrix:
266
+ mode:
267
+ - name: default
268
+ suffix: ""
269
+ - name: simple
270
+ suffix: "-simple"
271
+ steps:
272
+ - name: Login to GitHub Container Registry
273
+ uses: docker/login-action@v3
274
+ with:
275
+ registry: ghcr.io
276
+ username: ${{ github.repository_owner }}
277
+ password: ${{ secrets.GITHUB_TOKEN }}
278
+
279
+ - name: Login to DockerHub
280
+ uses: docker/login-action@v3
281
+ with:
282
+ username: ${{ secrets.DOCKER_USERNAME }}
283
+ password: ${{ secrets.DOCKER_TOKEN }}
284
+
285
+ - name: Extract version
286
+ id: version
287
+ run: |
288
+ if [[ $GITHUB_REF == refs/tags/v* ]]; then
289
+ VERSION=${GITHUB_REF#refs/tags/}
290
+ echo "version=${VERSION}" >> $GITHUB_OUTPUT
291
+ echo "version_without_v=${VERSION#v}" >> $GITHUB_OUTPUT
292
+ echo "is_release=true" >> $GITHUB_OUTPUT
293
+ else
294
+ SHORT_SHA=${GITHUB_SHA::7}
295
+ echo "version=edge" >> $GITHUB_OUTPUT
296
+ echo "short_sha=${SHORT_SHA}" >> $GITHUB_OUTPUT
297
+ echo "is_release=false" >> $GITHUB_OUTPUT
298
+ fi
299
+
300
+ - name: Copy images to DockerHub (release)
301
+ if: steps.version.outputs.is_release == 'true'
302
+ run: |
303
+ docker buildx imagetools create -t bentopdfteam/bentopdf${{ matrix.mode.suffix }}:latest \
304
+ ghcr.io/${{ github.repository_owner }}/bentopdf${{ matrix.mode.suffix }}:${{ steps.version.outputs.version }}-amd64 \
305
+ ghcr.io/${{ github.repository_owner }}/bentopdf${{ matrix.mode.suffix }}:${{ steps.version.outputs.version }}-arm64
306
+
307
+ docker buildx imagetools create -t bentopdfteam/bentopdf${{ matrix.mode.suffix }}:${{ steps.version.outputs.version }} \
308
+ ghcr.io/${{ github.repository_owner }}/bentopdf${{ matrix.mode.suffix }}:${{ steps.version.outputs.version }}-amd64 \
309
+ ghcr.io/${{ github.repository_owner }}/bentopdf${{ matrix.mode.suffix }}:${{ steps.version.outputs.version }}-arm64
310
+
311
+ docker buildx imagetools create -t bentopdfteam/bentopdf${{ matrix.mode.suffix }}:${{ steps.version.outputs.version_without_v }} \
312
+ ghcr.io/${{ github.repository_owner }}/bentopdf${{ matrix.mode.suffix }}:${{ steps.version.outputs.version }}-amd64 \
313
+ ghcr.io/${{ github.repository_owner }}/bentopdf${{ matrix.mode.suffix }}:${{ steps.version.outputs.version }}-arm64
314
+
315
+ - name: Copy images to DockerHub (edge)
316
+ if: steps.version.outputs.is_release == 'false'
317
+ run: |
318
+ docker buildx imagetools create -t bentopdfteam/bentopdf${{ matrix.mode.suffix }}:edge \
319
+ ghcr.io/${{ github.repository_owner }}/bentopdf${{ matrix.mode.suffix }}:edge-amd64 \
320
+ ghcr.io/${{ github.repository_owner }}/bentopdf${{ matrix.mode.suffix }}:edge-arm64
321
+
322
+ docker buildx imagetools create -t bentopdfteam/bentopdf${{ matrix.mode.suffix }}:sha-${{ steps.version.outputs.short_sha }} \
323
+ ghcr.io/${{ github.repository_owner }}/bentopdf${{ matrix.mode.suffix }}:edge-amd64 \
324
+ ghcr.io/${{ github.repository_owner }}/bentopdf${{ matrix.mode.suffix }}:edge-arm64
.github/workflows/cla.yml ADDED
@@ -0,0 +1,78 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ name: "CLA Assistant"
2
+
3
+ on:
4
+ issue_comment:
5
+ types: [created]
6
+ pull_request_target:
7
+ types: [opened, closed, synchronize]
8
+
9
+ # Permissions needed for the workflow
10
+ permissions:
11
+ actions: write
12
+ contents: write
13
+ pull-requests: write
14
+ statuses: write
15
+
16
+ jobs:
17
+ cla-check:
18
+ runs-on: ubuntu-latest
19
+ if: >
20
+ github.event_name == 'pull_request_target' ||
21
+ (
22
+ github.event_name == 'issue_comment' &&
23
+ github.event.issue.pull_request &&
24
+ (
25
+ github.event.comment.body == 'recheck' ||
26
+ github.event.comment.body == 'I have read the CLA Document and I hereby sign the CLA'
27
+ )
28
+ )
29
+ steps:
30
+ - name: "CLA Assistant"
31
+ uses: cla-assistant/github-action@v2.5.0
32
+ env:
33
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
34
+ PERSONAL_ACCESS_TOKEN: ${{ secrets.CLA_ASSISTANT_TOKEN }}
35
+ with:
36
+ path-to-signatures: 'signatures/cla.json'
37
+ path-to-document: 'https://github.com/${{ github.repository }}/blob/main/ICLA.md'
38
+
39
+ # Branch to store signatures
40
+ branch: 'main'
41
+
42
+ # Allowlist for bot accounts (won't need to sign CLA)
43
+ allowlist: 'bot*,*[bot],dependabot*,renovate*,github-actions*'
44
+
45
+ # Custom messages
46
+ custom-notsigned-prcomment: |
47
+ ## CLA Signature Required
48
+
49
+ Thank you for your contribution! Before we can accept your pull request, you need to sign our [Contributor License Agreement (CLA)](https://github.com/${{ github.repository }}/blob/main/ICLA.md).
50
+
51
+ ### Why do we need a CLA?
52
+
53
+ BentoPDF uses a dual licensing model (AGPL-3.0 for open source + commercial license). The CLA allows us to:
54
+ - Include your contributions in both open source and commercial versions
55
+ - Protect you and us legally
56
+ - Keep the project sustainable
57
+
58
+ ### How to sign
59
+
60
+ To sign the CLA, please comment on this PR with:
61
+
62
+ ```
63
+ I have read the CLA Document and I hereby sign the CLA
64
+ ```
65
+
66
+ **For corporate contributions**, please have your organization sign our [Corporate CLA (CCLA)](https://github.com/${{ github.repository }}/blob/main/CCLA.md) by contacting us at contact@bentopdf.com.
67
+
68
+ ---
69
+
70
+ ⚠️ **Note**: You only need to sign the CLA once. Future contributions to this repository will not require re-signing.
71
+
72
+ custom-pr-sign-comment: 'I have read the CLA Document and I hereby sign the CLA'
73
+
74
+ # Lock PR while waiting for CLA signature
75
+ lock-pullrequest-aftermerge: false
76
+
77
+ # Use issues to store signatures (alternative to branch storage)
78
+ use-dco-flag: false
.github/workflows/sponsors.yml ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ name: Update Sponsors
2
+ on:
3
+ workflow_dispatch:
4
+ jobs:
5
+ update:
6
+ runs-on: ubuntu-latest
7
+ steps:
8
+ - uses: actions/checkout@v4
9
+ - uses: JamesIves/github-sponsors-readme-action@v1
10
+ with:
11
+ token: ${{ secrets.SPONSORS_TOKEN }}
12
+ file: 'README.md'
.github/workflows/static.yml ADDED
@@ -0,0 +1,67 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Simple workflow for deploying static content to GitHub Pages
2
+ name: Deploy static content to Pages
3
+
4
+ on:
5
+ # Runs on pushes targeting the default branch
6
+ push:
7
+ branches: ["main"]
8
+
9
+ # Allows you to run this workflow manually from the Actions tab
10
+ workflow_dispatch:
11
+
12
+ # Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
13
+ permissions:
14
+ contents: read
15
+ pages: write
16
+ id-token: write
17
+
18
+ # Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
19
+ # However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
20
+ concurrency:
21
+ group: "pages"
22
+ cancel-in-progress: false
23
+
24
+
25
+ # Configure these variables under your repo settings.
26
+ # You will likely need to set BASE_URL to be the name of your repo eg 'bentopdf'
27
+ env:
28
+ SIMPLE_MODE: ${{ vars.SIMPLE_MODE }}
29
+ BASE_URL: ${{ vars.BASE_URL }}/
30
+ HUSKY: 0
31
+
32
+ jobs:
33
+ # Single deploy job since we're just deploying
34
+ deploy:
35
+ if: github.repository == 'alam00000/bentopdf'
36
+ environment:
37
+ name: github-pages
38
+ url: ${{ steps.deployment.outputs.page_url }}
39
+ runs-on: ubuntu-latest
40
+ steps:
41
+ - name: Checkout
42
+ uses: actions/checkout@v4
43
+ - name: Setup Node.js
44
+ uses: actions/setup-node@v4
45
+ with:
46
+ node-version: "20"
47
+ - name: Install dependencies
48
+ run: npm ci
49
+ - name: Build distribution
50
+ run: |
51
+ # export SIMPLE_MODE=${{ vars.SIMPLE_MODE }}
52
+ # export BASE_URL=${{ vars.BASE_URL }}/
53
+ npm run build
54
+
55
+ - name: Setup Pages
56
+ uses: actions/configure-pages@v5
57
+ - name: Upload artifact
58
+ uses: actions/upload-pages-artifact@v3
59
+ with:
60
+ # Upload entire repository
61
+ path: dist
62
+ name: github-pages-deployment
63
+ - name: Deploy to GitHub Pages
64
+ id: deployment
65
+ uses: actions/deploy-pages@v4
66
+ with:
67
+ artifact_name: github-pages-deployment
.github/workflows/update-embedpdf-snippet.yml ADDED
@@ -0,0 +1,139 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ name: Update EmbedPDF Snippet
2
+
3
+ on:
4
+ workflow_dispatch:
5
+ schedule:
6
+ - cron: '0 3 * * 1' # Weekly; adjust as needed
7
+
8
+ jobs:
9
+ update-snippet:
10
+ runs-on: ubuntu-latest
11
+ steps:
12
+ - name: Checkout repo
13
+ uses: actions/checkout@v4
14
+
15
+ - name: Read current upstream version marker
16
+ id: current-version
17
+ run: |
18
+ if [ -f vendor/embedpdf/.upstream-version ]; then
19
+ CUR=$(cat vendor/embedpdf/.upstream-version)
20
+ else
21
+ CUR=""
22
+ fi
23
+ echo "version=$CUR" >> "$GITHUB_OUTPUT"
24
+
25
+ - name: Read latest upstream version (@embedpdf/core)
26
+ id: upstream-version
27
+ run: |
28
+ LATEST=$(npm view @embedpdf/core version)
29
+ echo "version=$LATEST" >> "$GITHUB_OUTPUT"
30
+
31
+ - name: Should update?
32
+ id: gate
33
+ run: |
34
+ if [ "${{ steps.upstream-version.outputs.version }}" = "${{ steps.current-version.outputs.version }}" ]; then
35
+ echo "run=false" >> "$GITHUB_OUTPUT"
36
+ echo "No upstream version change detected."
37
+ else
38
+ echo "run=true" >> "$GITHUB_OUTPUT"
39
+ echo "Updating from '${{ steps.current-version.outputs.version }}' to '${{ steps.upstream-version.outputs.version }}'"
40
+ fi
41
+
42
+ - name: Enable corepack (pnpm)
43
+ if: steps.gate.outputs.run == 'true'
44
+ run: corepack enable
45
+
46
+ - name: Prepare workspace
47
+ if: steps.gate.outputs.run == 'true'
48
+ run: |
49
+ mkdir -p vendor/embedpdf
50
+ npm config set cache ./\.npm-cache
51
+
52
+ - name: Clone upstream embed-pdf-viewer
53
+ if: steps.gate.outputs.run == 'true'
54
+ run: git clone --depth 1 --branch main https://github.com/embedpdf/embed-pdf-viewer ./_upstream/embed-pdf-viewer
55
+
56
+ - name: Setup Node
57
+ if: steps.gate.outputs.run == 'true'
58
+ uses: actions/setup-node@v4
59
+ with:
60
+ node-version: 20
61
+ cache: npm
62
+
63
+ - name: Install upstream deps
64
+ if: steps.gate.outputs.run == 'true'
65
+ working-directory: ./_upstream/embed-pdf-viewer
66
+ run: pnpm install --no-frozen-lockfile
67
+
68
+ - name: Build snippet
69
+ if: steps.gate.outputs.run == 'true'
70
+ working-directory: ./_upstream/embed-pdf-viewer
71
+ run: pnpm run build:snippet
72
+
73
+ - name: Pack snippet tarball
74
+ if: steps.gate.outputs.run == 'true'
75
+ working-directory: ./_upstream/embed-pdf-viewer
76
+ run: |
77
+ npm pack ./viewers/snippet --pack-destination ../../vendor/embedpdf
78
+ ls -l ../../vendor/embedpdf
79
+
80
+ - name: Sanitize tarball (rename pkg and pin deps)
81
+ if: steps.gate.outputs.run == 'true'
82
+ env:
83
+ UPSTREAM_VERSION: ${{ steps.upstream-version.outputs.version }}
84
+ run: |
85
+ TARBALL=$(ls vendor/embedpdf/*.tgz | sort | tail -n1)
86
+ TMP=$(mktemp -d)
87
+ tar -xzf "$TARBALL" -C "$TMP"
88
+ PKG="$TMP/package/package.json"
89
+ PKG="$PKG" node - <<'NODE'
90
+ const fs = require("fs");
91
+ const path = process.env.PKG;
92
+ const ver = process.env.UPSTREAM_VERSION || "1.4.1";
93
+ const pkg = JSON.parse(fs.readFileSync(path, "utf8"));
94
+ pkg.name = "embedpdf-snippet";
95
+ pkg.dependencies = pkg.dependencies || {};
96
+ for (const k of Object.keys(pkg.dependencies)) {
97
+ if (k.startsWith("@embedpdf/")) pkg.dependencies[k] = `^${ver}`;
98
+ if (k === "preact") pkg.dependencies[k] = "^10.17.0";
99
+ }
100
+ fs.writeFileSync(path, JSON.stringify(pkg, null, 2) + "\n");
101
+ NODE
102
+ NEW=vendor/embedpdf/embedpdf-snippet-${UPSTREAM_VERSION}.tgz
103
+ tar -czf "$NEW" -C "$TMP" package
104
+ # Remove any older snippet tarballs, keep only the new one
105
+ find vendor/embedpdf -maxdepth 1 -name 'embedpdf-snippet-*.tgz' ! -name "$(basename "$NEW")" -delete
106
+ rm -rf "$TMP"
107
+ ls -l vendor/embedpdf
108
+
109
+ - name: Update package.json dependency path
110
+ if: steps.gate.outputs.run == 'true'
111
+ run: |
112
+ TARBALL=$(ls vendor/embedpdf/embedpdf-snippet-*.tgz | sort | tail -n1)
113
+ node -e "const fs=require('fs');const pkg=require('./package.json');const tar=process.argv[1];pkg.dependencies['embedpdf-snippet']='file:'+tar;fs.writeFileSync('package.json',JSON.stringify(pkg,null,2)+'\n');" "$TARBALL"
114
+
115
+ - name: Refresh lockfile
116
+ if: steps.gate.outputs.run == 'true'
117
+ run: npm install --package-lock-only --ignore-scripts
118
+
119
+ - name: Write upstream version marker
120
+ if: steps.gate.outputs.run == 'true'
121
+ run: |
122
+ echo "${{ steps.upstream-version.outputs.version }}" > vendor/embedpdf/.upstream-version
123
+
124
+ - name: Cleanup upstream clone
125
+ if: steps.gate.outputs.run == 'true'
126
+ run: rm -rf ./_upstream
127
+
128
+ - name: Create Pull Request
129
+ if: steps.gate.outputs.run == 'true'
130
+ uses: peter-evans/create-pull-request@v6
131
+ with:
132
+ commit-message: "build(deps): bump embedpdf-snippet from ${{ steps.current-version.outputs.version }} to ${{ steps.upstream-version.outputs.version }}"
133
+ title: "build(deps): bump embedpdf-snippet from ${{ steps.current-version.outputs.version }} to ${{ steps.upstream-version.outputs.version }}"
134
+ body: |
135
+ - Build snippet from upstream embed-pdf-viewer via `npm run build:snippet`
136
+ - Pack tarball into `vendor/embedpdf/` and point dependency to it
137
+ - Refresh package-lock.json
138
+ branch: chore/update-embedpdf-snippet
139
+ delete-branch: true
.gitignore ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Logs
2
+ logs
3
+ *.log
4
+ npm-debug.log*
5
+ yarn-debug.log*
6
+ yarn-error.log*
7
+ pnpm-debug.log*
8
+ lerna-debug.log*
9
+
10
+ node_modules
11
+ dist
12
+ dist-ssr
13
+ *.local
14
+ .npm-cache
15
+ .env
16
+ .env.production
17
+ .env.local
18
+
19
+ # Editor directories and files
20
+ .vscode/*
21
+ !.vscode/extensions.json
22
+ .idea
23
+ .DS_Store
24
+ *.suo
25
+ *.ntvs*
26
+ *.njsproj
27
+ *.sln
28
+ *.sw?
29
+ # Coverage reports
30
+ coverage/
31
+ *.lcov
32
+
33
+ # Generated sitemap
34
+ public/sitemap.xml
35
+
36
+ #backup
37
+ .seo-backup
38
+ libreoffice-wasm-package
39
+
40
+ # helm chart
41
+ bentopdf-*.tgz
42
+
43
+ # test
44
+ dist-test
.htaccess ADDED
@@ -0,0 +1,139 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ RewriteEngine On
2
+ RewriteBase /
3
+
4
+ # ============================================
5
+ # 1. SECURITY HEADERS (UPDATED FOR CDN COMPATIBILITY)
6
+ # ============================================
7
+ <IfModule mod_headers.c>
8
+ Header always set X-Frame-Options "SAMEORIGIN"
9
+ Header always set X-Content-Type-Options "nosniff"
10
+ Header always set X-XSS-Protection "1; mode=block"
11
+ Header always set Referrer-Policy "strict-origin-when-cross-origin"
12
+ Header always set Permissions-Policy "geolocation=(), microphone=(), camera=()"
13
+ Header always set Cross-Origin-Opener-Policy "same-origin"
14
+ Header always set Cross-Origin-Embedder-Policy "require-corp"
15
+ </IfModule>
16
+
17
+ # ============================================
18
+ # 2. BROWSER CACHING
19
+ # ============================================
20
+ <IfModule mod_expires.c>
21
+ ExpiresActive On
22
+ ExpiresByType image/jpeg "access plus 1 year"
23
+ ExpiresByType image/png "access plus 1 year"
24
+ ExpiresByType image/gif "access plus 1 year"
25
+ ExpiresByType image/webp "access plus 1 year"
26
+ ExpiresByType image/svg+xml "access plus 1 year"
27
+ ExpiresByType image/x-icon "access plus 1 year"
28
+ ExpiresByType font/woff2 "access plus 1 year"
29
+ ExpiresByType font/woff "access plus 1 year"
30
+ ExpiresByType font/ttf "access plus 1 year"
31
+ ExpiresByType text/css "access plus 1 month"
32
+ ExpiresByType application/javascript "access plus 1 month"
33
+ ExpiresByType application/wasm "access plus 1 year"
34
+ ExpiresByType application/gzip "access plus 1 year"
35
+ ExpiresByType text/html "access plus 0 seconds"
36
+ </IfModule>
37
+
38
+ # ============================================
39
+ # 3. COMPRESSION (STANDARD)
40
+ # ============================================
41
+ SetEnvIfNoCase Request_URI "\.gz$" no-gzip
42
+ SetEnvIfNoCase Request_URI "\.br$" no-gzip
43
+ SetEnvIfNoCase Request_URI "\.wasm$" no-gzip
44
+
45
+ <IfModule mod_deflate.c>
46
+ AddOutputFilterByType DEFLATE text/plain
47
+ AddOutputFilterByType DEFLATE text/html
48
+ AddOutputFilterByType DEFLATE text/xml
49
+ AddOutputFilterByType DEFLATE text/css
50
+ AddOutputFilterByType DEFLATE application/xml
51
+ AddOutputFilterByType DEFLATE application/xhtml+xml
52
+ AddOutputFilterByType DEFLATE application/rss+xml
53
+ AddOutputFilterByType DEFLATE application/javascript
54
+ AddOutputFilterByType DEFLATE application/x-javascript
55
+ AddOutputFilterByType DEFLATE application/json
56
+ AddOutputFilterByType DEFLATE image/svg+xml
57
+ AddOutputFilterByType DEFLATE font/woff
58
+ AddOutputFilterByType DEFLATE font/ttf
59
+ </IfModule>
60
+
61
+ # ============================================
62
+ # 4. MIME TYPES & SPECIAL FILE HANDLING
63
+ # ============================================
64
+ AddType application/javascript .js .mjs
65
+ AddType application/wasm .wasm
66
+ AddType font/woff2 .woff2
67
+ AddType font/woff .woff
68
+ AddType image/webp .webp
69
+
70
+ <FilesMatch "soffice\.wasm\.gz$">
71
+ ForceType application/wasm
72
+ Header set Content-Encoding "gzip"
73
+ Header set Cross-Origin-Resource-Policy "cross-origin"
74
+ Header append Vary Accept-Encoding
75
+ </FilesMatch>
76
+
77
+ <FilesMatch "soffice\.data\.gz$">
78
+ ForceType application/octet-stream
79
+ Header set Content-Encoding "gzip"
80
+ Header append Vary Accept-Encoding
81
+ </FilesMatch>
82
+
83
+ # ============================================
84
+ # 5. REDIRECTS & ROUTING
85
+ # ============================================
86
+ # Canonical WWW
87
+ RewriteCond %{HTTP_HOST} ^bentopdf\.com [NC]
88
+ RewriteRule ^(.*)$ https://www.bentopdf.com/$1 [L,R=301]
89
+
90
+ # Force HTTPS
91
+ RewriteCond %{HTTPS} off
92
+ RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
93
+
94
+ # Remove trailing slash (except for language root directories)
95
+ RewriteCond %{REQUEST_FILENAME} !-d
96
+ RewriteCond %{REQUEST_URI} !^/(de|es|zh|zh-TW|vi|it|id|tr|fr|pt)/$
97
+ RewriteCond %{REQUEST_URI} (.+)/$
98
+ RewriteRule ^ %1 [R=301,L]
99
+
100
+ # Existing files/dirs - serve directly
101
+ RewriteCond %{REQUEST_FILENAME} -f [OR]
102
+ RewriteCond %{REQUEST_FILENAME} -d
103
+ RewriteRule ^ - [L]
104
+
105
+ # ============================================
106
+ # 5.1. LANGUAGE ROUTES (MUST BE BEFORE .html extension rule)
107
+ # ============================================
108
+ # English prefix redirects to root
109
+ RewriteRule ^en/?$ / [R=301,L]
110
+ RewriteRule ^en/(.+)$ /$1 [R=301,L]
111
+
112
+ # Language prefix root (e.g., /de/ -> /de/index.html)
113
+ RewriteCond %{DOCUMENT_ROOT}/$1/index.html -f
114
+ RewriteRule ^(de|es|zh|zh-TW|vi|it|id|tr|fr|pt)/?$ /$1/index.html [L]
115
+
116
+ # Language prefix with path (e.g., /de/merge-pdf -> /de/merge-pdf.html)
117
+ RewriteCond %{DOCUMENT_ROOT}/$1/$2.html -f
118
+ RewriteRule ^(de|es|zh|zh-TW|vi|it|id|tr|fr|pt)/([^/]+)/?$ /$1/$2.html [L]
119
+
120
+ # ============================================
121
+ # 5.5. DOCS ROUTING (VitePress)
122
+ # ============================================
123
+ RewriteCond %{REQUEST_URI} ^/docs
124
+ RewriteCond %{REQUEST_FILENAME} !-f
125
+ RewriteCond %{REQUEST_FILENAME}\.html -f
126
+ RewriteRule ^(.*)$ $1.html [L]
127
+
128
+ # ============================================
129
+ # 6. ADD .HTML EXTENSION IF FILE EXISTS (ROOT LEVEL ONLY)
130
+ # ============================================
131
+ RewriteCond %{REQUEST_FILENAME} !-f
132
+ RewriteCond %{REQUEST_FILENAME} !-d
133
+ RewriteCond %{REQUEST_FILENAME}.html -f
134
+ RewriteRule ^([^/]+)$ $1.html [L]
135
+
136
+ # ============================================
137
+ # 7. ERROR PAGES
138
+ # ============================================
139
+ ErrorDocument 404 /404.html
.husky/pre-commit ADDED
@@ -0,0 +1 @@
 
 
1
+ npx lint-staged
.prettierignore ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ # Handlebars partials with template syntax inside HTML attributes
2
+ src/partials/footer.html
.prettierrc ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "semi": true,
3
+ "trailingComma": "es5",
4
+ "singleQuote": true,
5
+ "printWidth": 80,
6
+ "tabWidth": 2,
7
+ "useTabs": false
8
+ }