Skip to content

Commit a83bcdb

Browse files
committed
v0.3.0
- PDF support, we now bundle pdf.js - You can now turn highlights into annotations - Improvements and bug fixes
1 parent 34b18c5 commit a83bcdb

340 files changed

Lines changed: 66803 additions & 1094 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/update-pdfjs.yml

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
name: Update PDF.js
2+
3+
on:
4+
schedule:
5+
- cron: '0 9 * * 1'
6+
workflow_dispatch:
7+
8+
jobs:
9+
update:
10+
runs-on: ubuntu-latest
11+
permissions:
12+
contents: write
13+
pull-requests: write
14+
15+
steps:
16+
- name: Checkout code
17+
uses: actions/checkout@v4
18+
19+
- name: Check for PDF.js update
20+
id: check
21+
run: |
22+
LATEST=$(curl -sL "https://api.github.com/repos/mozilla/pdf.js/releases/latest" \
23+
| grep '"tag_name"' | head -1 | sed -E 's/.*"v([^"]+)".*/\1/')
24+
echo "latest=$LATEST" >> "$GITHUB_OUTPUT"
25+
26+
if [ -f extension/public/pdfjs/build/pdf.mjs ]; then
27+
CURRENT=$(grep -oP "pdfjsVersion = '[^']+'" extension/public/pdfjs/build/pdf.mjs | head -1 | sed "s/pdfjsVersion = '//;s/'//")
28+
fi
29+
CURRENT="${CURRENT:-unknown}"
30+
echo "current=$CURRENT" >> "$GITHUB_OUTPUT"
31+
32+
if [ "$LATEST" = "$CURRENT" ]; then
33+
echo "up_to_date=true" >> "$GITHUB_OUTPUT"
34+
echo "PDF.js is already at v${CURRENT}"
35+
else
36+
echo "up_to_date=false" >> "$GITHUB_OUTPUT"
37+
echo "Update available: v${CURRENT} → v${LATEST}"
38+
fi
39+
40+
- name: Run update script
41+
if: steps.check.outputs.up_to_date == 'false'
42+
run: |
43+
cd extension
44+
chmod +x tools/update-pdfjs.sh
45+
./tools/update-pdfjs.sh "${{ steps.check.outputs.latest }}"
46+
47+
- name: Create Pull Request
48+
if: steps.check.outputs.up_to_date == 'false'
49+
uses: peter-evans/create-pull-request@v6
50+
with:
51+
commit-message: "chore(extension): update PDF.js to v${{ steps.check.outputs.latest }}"
52+
title: "Update PDF.js to v${{ steps.check.outputs.latest }}"
53+
body: |
54+
Automated update of the bundled PDF.js viewer.
55+
56+
- **Previous version:** v${{ steps.check.outputs.current }}
57+
- **New version:** v${{ steps.check.outputs.latest }}
58+
- [Release notes](https://github.com/mozilla/pdf.js/releases/tag/v${{ steps.check.outputs.latest }})
59+
60+
Patches applied automatically by `extension/tools/update-pdfjs.sh`:
61+
- Origin check bypass in `viewer.mjs`
62+
- Init script injection in `viewer.html`
63+
branch: chore/update-pdfjs-${{ steps.check.outputs.latest }}
64+
labels: dependencies

backend/cmd/server/main.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ func serveStatic(r chi.Router, staticDir string) {
183183
r.Get("/*", func(w http.ResponseWriter, req *http.Request) {
184184
path := req.URL.Path
185185

186-
if strings.HasPrefix(path, "/api/") || strings.HasPrefix(path, "/auth/") || strings.HasPrefix(path, "/.well-known/") {
186+
if strings.HasPrefix(path, "/api/") || strings.HasPrefix(path, "/auth/") {
187187
http.NotFound(w, req)
188188
return
189189
}
@@ -194,6 +194,11 @@ func serveStatic(r chi.Router, staticDir string) {
194194
return
195195
}
196196

197+
if strings.HasPrefix(path, "/.well-known/") {
198+
http.NotFound(w, req)
199+
return
200+
}
201+
197202
lastSlash := strings.LastIndex(path, "/")
198203
lastSegment := path
199204
if lastSlash >= 0 {

extension/bun.lock

Lines changed: 29 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)