glideshow 0.2.2__tar.gz → 0.3.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {glideshow-0.2.2 → glideshow-0.3.0}/.gitignore +2 -0
- {glideshow-0.2.2 → glideshow-0.3.0}/PKG-INFO +1 -1
- {glideshow-0.2.2 → glideshow-0.3.0}/cloud/auth.js +26 -9
- {glideshow-0.2.2 → glideshow-0.3.0}/cloud/share.js +45 -21
- {glideshow-0.2.2 → glideshow-0.3.0}/cloud/worker.js +244 -19
- {glideshow-0.2.2 → glideshow-0.3.0}/cloud/wrangler.toml +20 -2
- {glideshow-0.2.2 → glideshow-0.3.0}/docs/agents.md +44 -9
- {glideshow-0.2.2 → glideshow-0.3.0}/docs/deck-format.md +29 -1
- {glideshow-0.2.2 → glideshow-0.3.0}/docs/self-hosting.md +28 -3
- {glideshow-0.2.2 → glideshow-0.3.0}/editor/deck/base.css +3 -0
- {glideshow-0.2.2 → glideshow-0.3.0}/editor/deck/present.js +65 -2
- {glideshow-0.2.2 → glideshow-0.3.0}/editor/deck/shapes.js +6 -2
- {glideshow-0.2.2 → glideshow-0.3.0}/editor/editor.css +53 -11
- {glideshow-0.2.2 → glideshow-0.3.0}/editor/globals.d.ts +1 -0
- {glideshow-0.2.2 → glideshow-0.3.0}/editor/home.html +32 -8
- {glideshow-0.2.2 → glideshow-0.3.0}/editor/index.html +13 -10
- {glideshow-0.2.2 → glideshow-0.3.0}/editor/js/arrange.js +61 -19
- glideshow-0.3.0/editor/js/boot.js +106 -0
- {glideshow-0.2.2 → glideshow-0.3.0}/editor/js/dialogs.js +11 -9
- {glideshow-0.2.2 → glideshow-0.3.0}/editor/js/file.js +53 -7
- {glideshow-0.2.2 → glideshow-0.3.0}/editor/js/keyboard.js +1 -1
- {glideshow-0.2.2 → glideshow-0.3.0}/editor/js/live.js +1 -1
- {glideshow-0.2.2 → glideshow-0.3.0}/editor/js/menubar.js +1 -0
- {glideshow-0.2.2 → glideshow-0.3.0}/editor/js/menus.js +4 -3
- {glideshow-0.2.2 → glideshow-0.3.0}/editor/js/objects.js +23 -0
- glideshow-0.3.0/editor/js/offline.js +65 -0
- {glideshow-0.2.2 → glideshow-0.3.0}/editor/js/render.js +28 -7
- {glideshow-0.2.2 → glideshow-0.3.0}/editor/js/shortcuts.js +1 -1
- {glideshow-0.2.2 → glideshow-0.3.0}/editor/js/slides.js +1 -1
- {glideshow-0.2.2 → glideshow-0.3.0}/editor/js/state.js +24 -0
- {glideshow-0.2.2 → glideshow-0.3.0}/editor/js/storage.js +99 -18
- {glideshow-0.2.2 → glideshow-0.3.0}/editor/js/text.js +5 -4
- {glideshow-0.2.2 → glideshow-0.3.0}/editor/js/theme.js +1 -1
- {glideshow-0.2.2 → glideshow-0.3.0}/editor/js/toolbar.js +26 -3
- {glideshow-0.2.2 → glideshow-0.3.0}/editor/lib/library.js +61 -5
- {glideshow-0.2.2 → glideshow-0.3.0}/editor/lib/onefile.js +12 -3
- glideshow-0.3.0/editor/lib/pending.js +55 -0
- glideshow-0.3.0/editor/local/offline.js +474 -0
- {glideshow-0.2.2 → glideshow-0.3.0}/editor/local/sw.js +30 -11
- {glideshow-0.2.2 → glideshow-0.3.0}/editor/looks/thermal.css +7 -1
- {glideshow-0.2.2 → glideshow-0.3.0}/editor/phone.css +9 -0
- {glideshow-0.2.2 → glideshow-0.3.0}/editor/share/share.css +4 -1
- {glideshow-0.2.2 → glideshow-0.3.0}/editor/share/share.js +32 -9
- glideshow-0.3.0/editor/share/still.js +80 -0
- {glideshow-0.2.2 → glideshow-0.3.0}/editor/tsconfig.json +2 -1
- glideshow-0.3.0/editor/vendor/README.md +14 -0
- glideshow-0.3.0/editor/vendor/fonts/HankenGrotesk-00.woff2 +0 -0
- glideshow-0.3.0/editor/vendor/fonts/HankenGrotesk-01.woff2 +0 -0
- glideshow-0.3.0/editor/vendor/fonts/HankenGrotesk-02.woff2 +0 -0
- glideshow-0.3.0/editor/vendor/fonts/HankenGrotesk-03.woff2 +0 -0
- glideshow-0.3.0/editor/vendor/fonts/HankenGrotesk-OFL.txt +94 -0
- glideshow-0.3.0/editor/vendor/fonts/IBMPlexMono-00.woff2 +0 -0
- glideshow-0.3.0/editor/vendor/fonts/IBMPlexMono-01.woff2 +0 -0
- glideshow-0.3.0/editor/vendor/fonts/IBMPlexMono-02.woff2 +0 -0
- glideshow-0.3.0/editor/vendor/fonts/IBMPlexMono-03.woff2 +0 -0
- glideshow-0.3.0/editor/vendor/fonts/IBMPlexMono-04.woff2 +0 -0
- glideshow-0.3.0/editor/vendor/fonts/IBMPlexMono-05.woff2 +0 -0
- glideshow-0.3.0/editor/vendor/fonts/IBMPlexMono-06.woff2 +0 -0
- glideshow-0.3.0/editor/vendor/fonts/IBMPlexMono-07.woff2 +0 -0
- glideshow-0.3.0/editor/vendor/fonts/IBMPlexMono-08.woff2 +0 -0
- glideshow-0.3.0/editor/vendor/fonts/IBMPlexMono-09.woff2 +0 -0
- glideshow-0.3.0/editor/vendor/fonts/IBMPlexMono-OFL.txt +93 -0
- glideshow-0.3.0/editor/vendor/fonts/MaterialSymbolsOutlined-00.woff2 +0 -0
- glideshow-0.3.0/editor/vendor/fonts/MaterialSymbolsOutlined-LICENSE.txt +202 -0
- glideshow-0.3.0/editor/vendor/fonts/Roboto-00.woff2 +0 -0
- glideshow-0.3.0/editor/vendor/fonts/Roboto-01.woff2 +0 -0
- glideshow-0.3.0/editor/vendor/fonts/Roboto-02.woff2 +0 -0
- glideshow-0.3.0/editor/vendor/fonts/Roboto-03.woff2 +0 -0
- glideshow-0.3.0/editor/vendor/fonts/Roboto-04.woff2 +0 -0
- glideshow-0.3.0/editor/vendor/fonts/Roboto-05.woff2 +0 -0
- glideshow-0.3.0/editor/vendor/fonts/Roboto-06.woff2 +0 -0
- glideshow-0.3.0/editor/vendor/fonts/Roboto-07.woff2 +0 -0
- glideshow-0.3.0/editor/vendor/fonts/Roboto-08.woff2 +0 -0
- glideshow-0.3.0/editor/vendor/fonts/Roboto-OFL.txt +93 -0
- glideshow-0.3.0/editor/vendor/fonts/fonts.css +532 -0
- glideshow-0.3.0/editor/vendor/katex-0.16.11/LICENSE +21 -0
- glideshow-0.3.0/editor/vendor/katex-0.16.11/dist/contrib/auto-render.min.js +1 -0
- glideshow-0.3.0/editor/vendor/katex-0.16.11/dist/fonts/KaTeX_AMS-Regular.woff2 +0 -0
- glideshow-0.3.0/editor/vendor/katex-0.16.11/dist/fonts/KaTeX_Caligraphic-Bold.woff2 +0 -0
- glideshow-0.3.0/editor/vendor/katex-0.16.11/dist/fonts/KaTeX_Caligraphic-Regular.woff2 +0 -0
- glideshow-0.3.0/editor/vendor/katex-0.16.11/dist/fonts/KaTeX_Fraktur-Bold.woff2 +0 -0
- glideshow-0.3.0/editor/vendor/katex-0.16.11/dist/fonts/KaTeX_Fraktur-Regular.woff2 +0 -0
- glideshow-0.3.0/editor/vendor/katex-0.16.11/dist/fonts/KaTeX_Main-Bold.woff2 +0 -0
- glideshow-0.3.0/editor/vendor/katex-0.16.11/dist/fonts/KaTeX_Main-BoldItalic.woff2 +0 -0
- glideshow-0.3.0/editor/vendor/katex-0.16.11/dist/fonts/KaTeX_Main-Italic.woff2 +0 -0
- glideshow-0.3.0/editor/vendor/katex-0.16.11/dist/fonts/KaTeX_Main-Regular.woff2 +0 -0
- glideshow-0.3.0/editor/vendor/katex-0.16.11/dist/fonts/KaTeX_Math-BoldItalic.woff2 +0 -0
- glideshow-0.3.0/editor/vendor/katex-0.16.11/dist/fonts/KaTeX_Math-Italic.woff2 +0 -0
- glideshow-0.3.0/editor/vendor/katex-0.16.11/dist/fonts/KaTeX_SansSerif-Bold.woff2 +0 -0
- glideshow-0.3.0/editor/vendor/katex-0.16.11/dist/fonts/KaTeX_SansSerif-Italic.woff2 +0 -0
- glideshow-0.3.0/editor/vendor/katex-0.16.11/dist/fonts/KaTeX_SansSerif-Regular.woff2 +0 -0
- glideshow-0.3.0/editor/vendor/katex-0.16.11/dist/fonts/KaTeX_Script-Regular.woff2 +0 -0
- glideshow-0.3.0/editor/vendor/katex-0.16.11/dist/fonts/KaTeX_Size1-Regular.woff2 +0 -0
- glideshow-0.3.0/editor/vendor/katex-0.16.11/dist/fonts/KaTeX_Size2-Regular.woff2 +0 -0
- glideshow-0.3.0/editor/vendor/katex-0.16.11/dist/fonts/KaTeX_Size3-Regular.woff2 +0 -0
- glideshow-0.3.0/editor/vendor/katex-0.16.11/dist/fonts/KaTeX_Size4-Regular.woff2 +0 -0
- glideshow-0.3.0/editor/vendor/katex-0.16.11/dist/fonts/KaTeX_Typewriter-Regular.woff2 +0 -0
- glideshow-0.3.0/editor/vendor/katex-0.16.11/dist/katex.min.css +1 -0
- glideshow-0.3.0/editor/vendor/katex-0.16.11/dist/katex.min.js +1 -0
- glideshow-0.3.0/editor/vendor/reveal.js-5.1.0/LICENSE +19 -0
- glideshow-0.3.0/editor/vendor/reveal.js-5.1.0/dist/reveal.css +8 -0
- glideshow-0.3.0/editor/vendor/reveal.js-5.1.0/dist/reveal.js +9 -0
- glideshow-0.3.0/editor/vendor/reveal.js-5.1.0/plugin/highlight/highlight.js +5 -0
- glideshow-0.3.0/editor/vendor/reveal.js-5.1.0/plugin/notes/notes.js +1 -0
- {glideshow-0.2.2 → glideshow-0.3.0}/glideshow/__init__.py +1 -1
- glideshow-0.3.0/glideshow/build.py +84 -0
- {glideshow-0.2.2 → glideshow-0.3.0}/glideshow/gslides.py +1 -1
- {glideshow-0.2.2 → glideshow-0.3.0}/glideshow/movie.py +2 -2
- {glideshow-0.2.2 → glideshow-0.3.0}/glideshow/pptx_export.py +22 -1
- {glideshow-0.2.2 → glideshow-0.3.0}/glideshow/render.py +62 -8
- {glideshow-0.2.2 → glideshow-0.3.0}/glideshow/server.py +12 -3
- {glideshow-0.2.2 → glideshow-0.3.0}/pyproject.toml +1 -1
- {glideshow-0.2.2 → glideshow-0.3.0}/skills/glideshow/SKILL.md +6 -2
- {glideshow-0.2.2 → glideshow-0.3.0}/test/agent.py +43 -2
- glideshow-0.3.0/test/caching.py +99 -0
- {glideshow-0.2.2 → glideshow-0.3.0}/test/cloud.py +95 -46
- {glideshow-0.2.2 → glideshow-0.3.0}/test/coedit.py +3 -3
- {glideshow-0.2.2 → glideshow-0.3.0}/test/keys.py +2 -2
- {glideshow-0.2.2 → glideshow-0.3.0}/test/media.py +1 -1
- glideshow-0.3.0/test/offline.py +214 -0
- glideshow-0.3.0/test/offline_save.py +219 -0
- glideshow-0.3.0/test/offline_sw.py +275 -0
- glideshow-0.3.0/test/perf.py +225 -0
- {glideshow-0.2.2 → glideshow-0.3.0}/test/share.py +24 -5
- {glideshow-0.2.2 → glideshow-0.3.0}/test/smoke.py +136 -7
- {glideshow-0.2.2 → glideshow-0.3.0}/tools/gslides2deck.py +3 -8
- glideshow-0.3.0/tools/vendor.py +57 -0
- {glideshow-0.2.2 → glideshow-0.3.0}/uv.lock +332 -332
- glideshow-0.2.2/editor/js/boot.js +0 -66
- glideshow-0.2.2/glideshow/build.py +0 -54
- {glideshow-0.2.2 → glideshow-0.3.0}/.github/workflows/checks.yml +0 -0
- {glideshow-0.2.2 → glideshow-0.3.0}/.github/workflows/release.yml +0 -0
- {glideshow-0.2.2 → glideshow-0.3.0}/.github/workflows/staging.yml +0 -0
- {glideshow-0.2.2 → glideshow-0.3.0}/.github/workflows/tests.yml +0 -0
- {glideshow-0.2.2 → glideshow-0.3.0}/LICENSE +0 -0
- {glideshow-0.2.2 → glideshow-0.3.0}/README.md +0 -0
- {glideshow-0.2.2 → glideshow-0.3.0}/bin/glideshow +0 -0
- {glideshow-0.2.2 → glideshow-0.3.0}/cloud/clean.js +0 -0
- {glideshow-0.2.2 → glideshow-0.3.0}/cloud/env.d.ts +0 -0
- {glideshow-0.2.2 → glideshow-0.3.0}/cloud/github-app.py +0 -0
- {glideshow-0.2.2 → glideshow-0.3.0}/cloud/library.js +0 -0
- {glideshow-0.2.2 → glideshow-0.3.0}/cloud/pages.js +0 -0
- {glideshow-0.2.2 → glideshow-0.3.0}/cloud/setup.sh +0 -0
- {glideshow-0.2.2 → glideshow-0.3.0}/cloud/store-drive.js +0 -0
- {glideshow-0.2.2 → glideshow-0.3.0}/cloud/store-github.js +0 -0
- {glideshow-0.2.2 → glideshow-0.3.0}/cloud/tsconfig.json +0 -0
- {glideshow-0.2.2 → glideshow-0.3.0}/docs/shortcuts.md +0 -0
- {glideshow-0.2.2 → glideshow-0.3.0}/editor/.assetsignore +0 -0
- {glideshow-0.2.2 → glideshow-0.3.0}/editor/apple-touch-icon.png +0 -0
- {glideshow-0.2.2 → glideshow-0.3.0}/editor/data/font-metrics.json +0 -0
- {glideshow-0.2.2 → glideshow-0.3.0}/editor/data/fonts.json +0 -0
- {glideshow-0.2.2 → glideshow-0.3.0}/editor/data/icons.json +0 -0
- {glideshow-0.2.2 → glideshow-0.3.0}/editor/data/symbols.js +0 -0
- {glideshow-0.2.2 → glideshow-0.3.0}/editor/data/themes.js +0 -0
- {glideshow-0.2.2 → glideshow-0.3.0}/editor/deck/template.html +0 -0
- {glideshow-0.2.2 → glideshow-0.3.0}/editor/glideshow-1024.png +0 -0
- {glideshow-0.2.2 → glideshow-0.3.0}/editor/glideshow.svg +0 -0
- {glideshow-0.2.2 → glideshow-0.3.0}/editor/js/boxes.js +0 -0
- {glideshow-0.2.2 → glideshow-0.3.0}/editor/js/charts.js +0 -0
- {glideshow-0.2.2 → glideshow-0.3.0}/editor/js/comments.js +0 -0
- {glideshow-0.2.2 → glideshow-0.3.0}/editor/js/context-menus.js +0 -0
- {glideshow-0.2.2 → glideshow-0.3.0}/editor/js/dock.js +0 -0
- {glideshow-0.2.2 → glideshow-0.3.0}/editor/js/draw.js +0 -0
- {glideshow-0.2.2 → glideshow-0.3.0}/editor/js/find.js +0 -0
- {glideshow-0.2.2 → glideshow-0.3.0}/editor/js/format-panel.js +0 -0
- {glideshow-0.2.2 → glideshow-0.3.0}/editor/js/geometry.js +0 -0
- {glideshow-0.2.2 → glideshow-0.3.0}/editor/js/guides.js +0 -0
- {glideshow-0.2.2 → glideshow-0.3.0}/editor/js/insert.js +0 -0
- {glideshow-0.2.2 → glideshow-0.3.0}/editor/js/motion.js +0 -0
- {glideshow-0.2.2 → glideshow-0.3.0}/editor/js/notes.js +0 -0
- {glideshow-0.2.2 → glideshow-0.3.0}/editor/js/people.js +0 -0
- {glideshow-0.2.2 → glideshow-0.3.0}/editor/js/phone-comments.js +0 -0
- {glideshow-0.2.2 → glideshow-0.3.0}/editor/js/phone-edit.js +0 -0
- {glideshow-0.2.2 → glideshow-0.3.0}/editor/js/phone-home.js +0 -0
- {glideshow-0.2.2 → glideshow-0.3.0}/editor/js/phone-mode.js +0 -0
- {glideshow-0.2.2 → glideshow-0.3.0}/editor/js/phone-sheets.js +0 -0
- {glideshow-0.2.2 → glideshow-0.3.0}/editor/js/phone-touch.js +0 -0
- {glideshow-0.2.2 → glideshow-0.3.0}/editor/js/phone-view.js +0 -0
- {glideshow-0.2.2 → glideshow-0.3.0}/editor/js/pointer.js +0 -0
- {glideshow-0.2.2 → glideshow-0.3.0}/editor/js/spacing.js +0 -0
- {glideshow-0.2.2 → glideshow-0.3.0}/editor/js/theme-toggle.js +0 -0
- {glideshow-0.2.2 → glideshow-0.3.0}/editor/js/toolbar-groups.js +0 -0
- {glideshow-0.2.2 → glideshow-0.3.0}/editor/lib/browser-db.js +0 -0
- {glideshow-0.2.2 → glideshow-0.3.0}/editor/lib/merge.js +0 -0
- {glideshow-0.2.2 → glideshow-0.3.0}/editor/lib/move-local.js +0 -0
- {glideshow-0.2.2 → glideshow-0.3.0}/editor/lib/polygon-clipping.min.js +0 -0
- {glideshow-0.2.2 → glideshow-0.3.0}/editor/lib/store-browser.js +0 -0
- {glideshow-0.2.2 → glideshow-0.3.0}/editor/lib/store-folder.js +0 -0
- {glideshow-0.2.2 → glideshow-0.3.0}/editor/local/tsconfig.json +0 -0
- {glideshow-0.2.2 → glideshow-0.3.0}/editor/looks/glider.svg +0 -0
- {glideshow-0.2.2 → glideshow-0.3.0}/editor/looks/thermal-phone.css +0 -0
- {glideshow-0.2.2 → glideshow-0.3.0}/editor/manifest.json +0 -0
- {glideshow-0.2.2 → glideshow-0.3.0}/editor/share/speaker.html +0 -0
- {glideshow-0.2.2 → glideshow-0.3.0}/glideshow/__main__.py +0 -0
- {glideshow-0.2.2 → glideshow-0.3.0}/glideshow/agent.py +0 -0
- {glideshow-0.2.2 → glideshow-0.3.0}/glideshow/cli.py +0 -0
- {glideshow-0.2.2 → glideshow-0.3.0}/glideshow/comments.py +0 -0
- {glideshow-0.2.2 → glideshow-0.3.0}/glideshow/decks.py +0 -0
- {glideshow-0.2.2 → glideshow-0.3.0}/glideshow/figure.py +0 -0
- {glideshow-0.2.2 → glideshow-0.3.0}/glideshow/fonts.py +0 -0
- {glideshow-0.2.2 → glideshow-0.3.0}/glideshow/history.py +0 -0
- {glideshow-0.2.2 → glideshow-0.3.0}/glideshow/merge.py +0 -0
- {glideshow-0.2.2 → glideshow-0.3.0}/glideshow/osutil.py +0 -0
- {glideshow-0.2.2 → glideshow-0.3.0}/glideshow/pptx_import.py +0 -0
- {glideshow-0.2.2 → glideshow-0.3.0}/glideshow/publish.py +0 -0
- {glideshow-0.2.2 → glideshow-0.3.0}/glideshow/service.py +0 -0
- {glideshow-0.2.2 → glideshow-0.3.0}/test/fake_drive.py +0 -0
- {glideshow-0.2.2 → glideshow-0.3.0}/test/fixtures/agent-deck.html +0 -0
- {glideshow-0.2.2 → glideshow-0.3.0}/test/fixtures/gslides-api.json +0 -0
- {glideshow-0.2.2 → glideshow-0.3.0}/test/fixtures/stack-deck.html +0 -0
- {glideshow-0.2.2 → glideshow-0.3.0}/test/snap.py +0 -0
- {glideshow-0.2.2 → glideshow-0.3.0}/tools/check.sh +0 -0
- {glideshow-0.2.2 → glideshow-0.3.0}/tools/font_metrics.py +0 -0
- {glideshow-0.2.2 → glideshow-0.3.0}/tools/make-app.sh +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: glideshow
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.3.0
|
|
4
4
|
Summary: Slides you own: a Google Slides-style editor whose decks are plain HTML folders that AI agents can edit
|
|
5
5
|
Project-URL: Homepage, https://glideshow.org
|
|
6
6
|
License-Expression: AGPL-3.0-or-later
|
|
@@ -12,7 +12,14 @@ export const SESSION_DAYS = 90;
|
|
|
12
12
|
const enc = s => new TextEncoder().encode(s);
|
|
13
13
|
|
|
14
14
|
export const cookie = (name, value, maxAge) => `${name}=${value}; Path=/; Max-Age=${maxAge}; HttpOnly; Secure; SameSite=Lax`;
|
|
15
|
+
/* The session's and sign-in's cookies carry the __Host- prefix: the browser takes such a cookie only host-only (no Domain),
|
|
16
|
+
Secure and on Path=/, so a page on a subdomain (a shared deck's own host, worker.js deckHost: its scripts are the deck
|
|
17
|
+
owner's) can't set one that glideshow.org would read: "cookie tossing", which would sign the viewer in as someone else
|
|
18
|
+
or spoil a sign-in. Before 2026-11 they were plain `session` and `oauth`: see legacySession. */
|
|
19
|
+
export const SESSION = '__Host-session', OAUTH = '__Host-oauth';
|
|
15
20
|
export const getCookie = (req, name) => (req.headers.get('cookie') || '').split(/;\s*/).find(c => c.startsWith(name + '='))?.slice(name.length + 1) || '';
|
|
21
|
+
/* If-None-Match names this version: compared weakly, as Cloudflare may weaken an ETag on the way (W/"x" is "x") */
|
|
22
|
+
export const sameTag = (req, etag) => (req.headers.get('if-none-match') || '').split(/\s*,\s*/).some(t => t.replace(/^W\//, '') === etag.replace(/^W\//, ''));
|
|
16
23
|
export const json = (obj, status = 200, headers = {}) => new Response(JSON.stringify(obj), { status, headers: { 'content-type': 'application/json', ...headers } });
|
|
17
24
|
export const redirect = (location, headers = {}) => new Response(null, { status: 303, headers: { location, ...headers } });
|
|
18
25
|
export const safeNext = asked => /^\/(?![\/\\])/.test(asked || '') ? asked : '/'; // only a path on this site
|
|
@@ -51,7 +58,17 @@ export async function unlock(env, value) {
|
|
|
51
58
|
}
|
|
52
59
|
|
|
53
60
|
/* The person signed in, or null: {p: 'github'|'google', u: id, l: login, n: name, e: [emails], x: expiry}. */
|
|
54
|
-
export async function session(req, env) { return unseal(env, getCookie(req,
|
|
61
|
+
export async function session(req, env) { return await unseal(env, getCookie(req, SESSION)) || unseal(env, await legacySession(req, env)); }
|
|
62
|
+
/* A session still under its old name (`session`), as signed in before the rename: taken (and reissued under the new name:
|
|
63
|
+
worker.js) only when there is no new one, and only if it was issued before OLD_SESSIONS_BEFORE (wrangler.toml, the day
|
|
64
|
+
the rename was deployed). A subdomain can toss a `session` cookie for Domain=glideshow.org, and its value would be a
|
|
65
|
+
real sealed session (anyone's own, copied from their browser): issued after the rename, it is never read under the old
|
|
66
|
+
name, so tossing one does nothing. The sealed value is the same under either name. */
|
|
67
|
+
export async function legacySession(req, env) {
|
|
68
|
+
if (getCookie(req, SESSION) || !env.OLD_SESSIONS_BEFORE) return '';
|
|
69
|
+
const v = getCookie(req, 'session'), o = v ? await unseal(env, v) : null;
|
|
70
|
+
return o && (o.x - SESSION_DAYS * 86400) * 1000 < Date.parse(env.OLD_SESSIONS_BEFORE) ? v : '';
|
|
71
|
+
}
|
|
55
72
|
const listed = (list, x) => (list || '').split(',').map(a => a.trim().toLowerCase()).some(a => a === '*' || a === x.toLowerCase());
|
|
56
73
|
/* Who may take shared decks down and suspend accounts (/admin): GitHub logins on ADMINS. */
|
|
57
74
|
export const isAdmin = (s, env) => s?.p === 'github' && !!env.ADMINS && listed(env.ADMINS.replace(/\*/g, ''), s.l);
|
|
@@ -60,7 +77,7 @@ export const isOwner = (s, env) => s?.p === 'github' ? listed(env.ALLOWED_USERS,
|
|
|
60
77
|
export const libraryFor = (env, who) => env.LIB.get(env.LIB.idFromName(who.p === 'google' ? 'user:g:' + who.u : 'user:' + who.u));
|
|
61
78
|
async function signIn(env, who, next) {
|
|
62
79
|
const x = Math.floor(Date.now() / 1000) + SESSION_DAYS * 86400;
|
|
63
|
-
return redirect(next, { 'set-cookie': cookie(
|
|
80
|
+
return redirect(next, { 'set-cookie': cookie(SESSION, await seal(env, { ...who, x }), SESSION_DAYS * 86400) });
|
|
64
81
|
}
|
|
65
82
|
|
|
66
83
|
/* ---------- GitHub: sign in through the Glideshow app ---------- */
|
|
@@ -69,12 +86,12 @@ export async function githubStart(env, url) {
|
|
|
69
86
|
const state = await seal(env, { next: safeNext(url.searchParams.get('next')), x: Math.floor(Date.now() / 1000) + 600, n: crypto.randomUUID() });
|
|
70
87
|
const to = new URL('https://github.com/login/oauth/authorize');
|
|
71
88
|
to.searchParams.set('client_id', env.GITHUB_CLIENT_ID); to.searchParams.set('redirect_uri', url.origin + '/auth/github/callback'); to.searchParams.set('state', state);
|
|
72
|
-
return redirect(to.href, { 'set-cookie': cookie(
|
|
89
|
+
return redirect(to.href, { 'set-cookie': cookie(OAUTH, state, 600) });
|
|
73
90
|
}
|
|
74
91
|
|
|
75
92
|
export async function githubCallback(req, env, url) {
|
|
76
93
|
const state = url.searchParams.get('state') || '', st = await unseal(env, state);
|
|
77
|
-
if (!st || state !== getCookie(req,
|
|
94
|
+
if (!st || state !== getCookie(req, OAUTH)) return page('Sign-in expired', '<p>That sign-in took too long or came from elsewhere. <a href="/login">Try again</a>.</p>', 400);
|
|
78
95
|
const r = await fetch('https://github.com/login/oauth/access_token', { method: 'POST', headers: { accept: 'application/json', 'content-type': 'application/json' },
|
|
79
96
|
body: JSON.stringify({ client_id: env.GITHUB_CLIENT_ID, client_secret: env.GITHUB_CLIENT_SECRET, code: url.searchParams.get('code'), redirect_uri: url.origin + '/auth/github/callback' }) });
|
|
80
97
|
const tok = (await r.json().catch(() => ({}))).access_token;
|
|
@@ -84,7 +101,7 @@ export async function githubCallback(req, env, url) {
|
|
|
84
101
|
if (!user) return page('Sign-in failed', '<p>GitHub didn\'t say who you are. <a href="/login">Try again</a>.</p>', 400);
|
|
85
102
|
const who = { p: 'github', u: String(user.id), l: user.login, n: user.name || user.login, e: user.email ? [user.email.toLowerCase()] : [] };
|
|
86
103
|
const res = await signIn(env, who, st.next);
|
|
87
|
-
res.headers.append('set-cookie', cookie(
|
|
104
|
+
res.headers.append('set-cookie', cookie(OAUTH, '', 0));
|
|
88
105
|
if (isOwner(who, env)) await libraryFor(env, who).signedIn(who, tok); // the token lists the repos it may use, for setup
|
|
89
106
|
return res;
|
|
90
107
|
}
|
|
@@ -102,12 +119,12 @@ export async function googleStart(env, url) {
|
|
|
102
119
|
...(drive ? { scope: 'openid email profile https://www.googleapis.com/auth/drive.file', access_type: 'offline', prompt: url.searchParams.get('hint') ? 'consent' : 'select_account consent', include_granted_scopes: 'true', login_hint: url.searchParams.get('hint') || '' }
|
|
103
120
|
: { scope: 'openid email profile', prompt: 'select_account' }) };
|
|
104
121
|
for (const [k, v] of Object.entries(params)) if (v) to.searchParams.set(k, v);
|
|
105
|
-
return redirect(to.href, { 'set-cookie': cookie(
|
|
122
|
+
return redirect(to.href, { 'set-cookie': cookie(OAUTH, state, 600) });
|
|
106
123
|
}
|
|
107
124
|
|
|
108
125
|
export async function googleCallback(req, env, url) {
|
|
109
126
|
const state = url.searchParams.get('state') || '', st = await unseal(env, state);
|
|
110
|
-
if (!st || state !== getCookie(req,
|
|
127
|
+
if (!st || state !== getCookie(req, OAUTH)) return page('Sign-in expired', '<p>That sign-in took too long or came from elsewhere. <a href="/login">Try again</a>.</p>', 400);
|
|
111
128
|
const r = await fetch('https://oauth2.googleapis.com/token', { method: 'POST', headers: { 'content-type': 'application/x-www-form-urlencoded' },
|
|
112
129
|
body: new URLSearchParams({ code: url.searchParams.get('code') || '', client_id: env.GOOGLE_CLIENT_ID, client_secret: env.GOOGLE_CLIENT_SECRET, redirect_uri: url.origin + '/auth/google/callback', grant_type: 'authorization_code' }) });
|
|
113
130
|
const tokens = await r.json().catch(() => ({})), idToken = tokens.id_token;
|
|
@@ -124,7 +141,7 @@ export async function googleCallback(req, env, url) {
|
|
|
124
141
|
else if (next === '/' && !(await lib.info()).ready) next = `/setup`; // only someone who came to make decks, not a viewer of a link
|
|
125
142
|
}
|
|
126
143
|
const res = await signIn(env, who, next);
|
|
127
|
-
res.headers.append('set-cookie', cookie(
|
|
144
|
+
res.headers.append('set-cookie', cookie(OAUTH, '', 0));
|
|
128
145
|
return res;
|
|
129
146
|
}
|
|
130
147
|
|
|
@@ -207,7 +224,7 @@ export function page(title, body, status = 200, opts = {}) {
|
|
|
207
224
|
return new Response(`<!doctype html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1">
|
|
208
225
|
${meta(opts.full || (title === 'Glideshow' ? title : title + ' · Glideshow'), opts)}<link rel="icon" href="/favicon.svg" type="image/svg+xml"><link rel="apple-touch-icon" href="/apple-touch-icon.png"><title>${esc(opts.full || (title === 'Glideshow' ? title : title + ' · Glideshow'))}</title>
|
|
209
226
|
<script>try { const v = localStorage.getItem('slides-dark'); if (v) document.documentElement.dataset.theme = v === '1' ? 'dark' : 'light'; } catch {}</script>
|
|
210
|
-
<link rel="stylesheet" href="
|
|
227
|
+
<link rel="stylesheet" href="/editor/vendor/fonts/fonts.css"><style>
|
|
211
228
|
.stage { display: inline-block; margin-left: .5em; padding: .15em .55em; border-radius: 999px; background: var(--accent); color: var(--on-accent); font-size: .32em; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; vertical-align: .55em; } /* alpha (the front page) */
|
|
212
229
|
:root { --card: #fff; --ink: #14204a; --muted: #5c6b87; --line: #dbe2ea; --accent: #2f6bff; --on-accent: #fff; --err: #b3261e; --hover: #f1f4f9;
|
|
213
230
|
--sky: radial-gradient(120% 140% at 88% 130%, #ffe1a8 0%, rgba(255, 225, 168, 0) 58%), linear-gradient(180deg, #a9c8ff 0%, #d4e3ff 48%, #f3f6fb 100%); --grain-blend: multiply; --grain: .14; }
|
|
@@ -13,13 +13,14 @@
|
|
|
13
13
|
"replies": [{"id", "text", "by", "at"}]}]}
|
|
14
14
|
Anyone who can open a shared deck can read and add comments once signed in; the owner sees them in the editor.
|
|
15
15
|
|
|
16
|
-
A shared deck is HTML its owner wrote, scripts and all, so
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
…/~<pass>/) and in a header for comments. A pass is
|
|
16
|
+
A shared deck is HTML its owner wrote, scripts and all, so its scripts must never act as the viewer on glideshow.org.
|
|
17
|
+
With DECK_HOST set (worker.js deckHost) it runs on a host of its own, framed by the link's page on glideshow.org, which
|
|
18
|
+
hands it the viewer's pass once (?pass=, kept there in a cookie). Without, it is served sandboxed with an opaque origin
|
|
19
|
+
and the pass rides in the path of the deck's files (its <base> is …/~<pass>/) and in a header for comments. A pass is
|
|
20
|
+
encrypted, so the page can carry it but not read it, and is good for one deck, for 12 hours. */
|
|
20
21
|
|
|
21
|
-
import { json, page, esc, lock, unlock } from './auth.js';
|
|
22
|
-
import { baseOf, enc, dec, typeOf, clean, titleOf } from './library.js';
|
|
22
|
+
import { json, page, esc, lock, unlock, sameTag } from './auth.js';
|
|
23
|
+
import { baseOf, enc, dec, typeOf, clean, titleOf, vendored } from './library.js';
|
|
23
24
|
import { composeDeck, deckForCollaborator } from './clean.js';
|
|
24
25
|
|
|
25
26
|
const rand = n => Array.from(crypto.getRandomValues(new Uint8Array(n)), b => 'abcdefghijkmnpqrstuvwxyz23456789'[b % 32]).join('');
|
|
@@ -123,7 +124,7 @@ async function changeComments(lib, deck, r, by, isOwner) {
|
|
|
123
124
|
/* ---------- a viewer's side: /p/<owner>/<slug>/… (the Worker passes the viewer's session in x-viewer) ---------- */
|
|
124
125
|
|
|
125
126
|
export async function shareRoutes(lib, req, url) {
|
|
126
|
-
const [, , slug = '', ...restParts] = url.pathname.split('/'), base = url.searchParams.get('base') || '/';
|
|
127
|
+
const [, , slug = '', ...restParts] = url.pathname.split('/'), base = url.searchParams.get('base') || '/', site = url.searchParams.get('site') || '';
|
|
127
128
|
let viewer = JSON.parse(req.headers.get('x-viewer') || 'null');
|
|
128
129
|
const pass = (restParts[0]?.startsWith('~') ? restParts.shift()?.slice(1) : '') || req.headers.get('x-glideshow-view') || '';
|
|
129
130
|
if (pass) { const p = await unlock(lib.env, pass); if (p?.k === 'view' && p.s === slug) viewer = p.v; } // the sandboxed deck's own requests
|
|
@@ -135,6 +136,8 @@ export async function shareRoutes(lib, req, url) {
|
|
|
135
136
|
if (!viewer) return new Response(null, { status: 303, headers: { location: `/login?why=shared&next=${encodeURIComponent(base)}` } });
|
|
136
137
|
return page('No access', `<p>You're signed in as <b>${esc(viewer.l)}</b>, which this deck isn't shared with.</p><p>Ask ${esc(lib.cfg.user?.n || 'its owner')} to add you, or use another account.</p><a class="btn" href="/logout?next=${encodeURIComponent(base)}">Use another account</a>`, 403);
|
|
137
138
|
}
|
|
139
|
+
const passFor = async () => viewer ? await lock(lib.env, { k: 'view', s: slug, v: viewer, x: Math.floor(Date.now() / 1000) + PASS_HOURS * 3600 }) : '';
|
|
140
|
+
if (rest === '__shell') return json({ pass: await passFor(), title: entry.title || '', edit: canEdit(entry, viewer, lib.cfg.user || {}, lib.cfg.kind) }); // the link's page on the site (worker.js shell): it may open, as whom
|
|
138
141
|
if (rest === '__comments') { // reading and adding comments needs a name to put on them
|
|
139
142
|
if (!viewer) return json({ error: 'Sign in to see and add comments.', signin: true }, 401);
|
|
140
143
|
const isOwner = viewer.u === lib.cfg.user?.u && viewer.p === (lib.cfg.kind === 'drive' ? 'google' : 'github');
|
|
@@ -146,9 +149,12 @@ export async function shareRoutes(lib, req, url) {
|
|
|
146
149
|
const file = clean(rest || 'deck.html');
|
|
147
150
|
let f = lib.base.tree[deck + '/' + file]; // the deck's latest saved files (the library checks for newer ones every few seconds)
|
|
148
151
|
if (!f || f.folder) return new Response('not found', { status: 404 });
|
|
149
|
-
const etag = `"${f.v}"`; // a file's version: one changed under the same name (a plot made again) comes new, one that didn't costs a 304
|
|
150
|
-
|
|
151
|
-
|
|
152
|
+
const etag = `W/"${f.v}"`; // (weak: Cloudflare keeps those on what it compresses) a file's version: one changed under the same name (a plot made again) comes new, one that didn't costs a 304
|
|
153
|
+
// asked for by its version (?gsv=, as deck.html names its files: deckRefs) a file is kept for good; else 5 minutes (a
|
|
154
|
+
// looping video was asked again every loop). On its own host the deck keeps them across visits; sandboxed with an opaque
|
|
155
|
+
// origin (no DECK_HOST), Chrome gives it a fresh cache each visit.
|
|
156
|
+
const keep = file === 'deck.html' ? 'private, no-cache' : url.searchParams.get('gsv') === f.v ? 'private, max-age=31536000, immutable' : 'private, max-age=300';
|
|
157
|
+
if (file !== 'deck.html' && sameTag(req, etag)) return new Response(null, { status: 304, headers: { etag, 'cache-control': keep } });
|
|
152
158
|
let body;
|
|
153
159
|
try { body = await lib.store.read({ ref: f.ref, bv: f.v }); }
|
|
154
160
|
catch { // read just as the file was replaced (Drive changes a file in place): once more, from the library as it is now
|
|
@@ -158,11 +164,11 @@ export async function shareRoutes(lib, req, url) {
|
|
|
158
164
|
}
|
|
159
165
|
const headers = { 'content-type': typeOf(file), 'cache-control': keep, etag };
|
|
160
166
|
if (file === 'deck.html') { // the deck, with the comments panel on top
|
|
161
|
-
const
|
|
162
|
-
const boot = { comments: base + '__comments', pass, me: viewer ? { n: viewer.n } : null, report: '/report?link=' + encodeURIComponent(base),
|
|
163
|
-
signin:
|
|
164
|
-
edit: canEdit(entry, viewer, lib.cfg.user || {}, lib.cfg.kind) ? base.replace(/^\/p\//, '/e/') : '' }; // an Edit button for whoever may edit
|
|
165
|
-
const inject = `<link rel="icon" href="/favicon.svg" type="image/svg+xml"><link rel="stylesheet" href="/share/share.css"><script>window.GLIDESHOW = ${JSON.stringify(boot).replace(/</g, '\\u003c')}</script><script src="/share/share.js" defer></script>\n`;
|
|
167
|
+
const p = site ? '' : await passFor(); // (on its own host the viewer's pass is a cookie there: worker.js deckHost)
|
|
168
|
+
const boot = { comments: base + '__comments', pass: p, me: viewer ? { n: viewer.n } : null, report: site + '/report?link=' + encodeURIComponent(base),
|
|
169
|
+
signin: `${site}/login?why=comment&next=${encodeURIComponent(base)}`, owner: lib.cfg.user?.n || '', title: entry.title || '',
|
|
170
|
+
edit: canEdit(entry, viewer, lib.cfg.user || {}, lib.cfg.kind) ? site + base.replace(/^\/p\//, '/e/') : '', site }; // an Edit button for whoever may edit
|
|
171
|
+
const inject = `<link rel="icon" href="/favicon.svg" type="image/svg+xml"><link rel="stylesheet" href="/share/share.css"><script>window.GLIDESHOW = ${JSON.stringify(boot).replace(/</g, '\\u003c')}</script><script src="/share/still.js" defer></script><script src="/share/share.js" defer></script>\n`;
|
|
166
172
|
// first in <head>, so before any key handler of the deck's own (older decks' present.js takes Enter, N, P… at window
|
|
167
173
|
// capture): keys typed into the comments panel's fields go to the field alone, and Esc closes the panel (gsEscape)
|
|
168
174
|
// rather than leaving the slideshow. A signed-in viewer's pass rides in
|
|
@@ -172,14 +178,29 @@ export async function shareRoutes(lib, req, url) {
|
|
|
172
178
|
// memory, for this visit, before any of the deck's scripts run.
|
|
173
179
|
const storage = `<script>for (const k of ['localStorage', 'sessionStorage']) { try { window[k].length } catch { const m = new Map(); Object.defineProperty(window, k, { configurable: true, value: { get length() { return m.size }, key: i => [...m.keys()][i] ?? null, getItem: x => m.has(String(x)) ? m.get(String(x)) : null, setItem: (x, v) => { m.set(String(x), String(v)) }, removeItem: x => { m.delete(String(x)) }, clear: () => m.clear() } }) } }</script>`;
|
|
174
180
|
const keys = storage + `<script>addEventListener('keydown', e => { const t = e.target; if (t.gsKey && t.closest('.gs-panel')) { e.stopImmediatePropagation(); t.gsKey(e); } else if (e.key === 'Escape' && window.gsEscape?.()) { e.preventDefault(); e.stopImmediatePropagation(); } }, true)</script>`
|
|
175
|
-
+ (
|
|
176
|
-
let html = dec(body); const at = html.lastIndexOf('</body>');
|
|
181
|
+
+ (p ? `<base href="${esc(base)}~${p}/">` : '');
|
|
182
|
+
let html = deckRefs(vendored(dec(body)), deck, lib.base.tree); const at = html.lastIndexOf('</body>'); // reveal.js and KaTeX from /editor/vendor/ (library.js vendored)
|
|
177
183
|
html = at < 0 ? html + inject : html.slice(0, at) + inject + html.slice(at);
|
|
178
184
|
body = enc(html.replace(/<head[^>]*>/, m => m + keys));
|
|
179
185
|
headers['cache-control'] = 'no-store';
|
|
180
186
|
}
|
|
181
187
|
return file === 'deck.html' ? new Response(body, { headers }) : ranged(req, body, headers);
|
|
182
188
|
}
|
|
189
|
+
/* The deck's own files as deck.html names them, each with its version (?gsv=<v>), so the browser keeps each until it
|
|
190
|
+
changes and a second visit asks for none of them. Only relative addresses of files the deck has: src, href, poster,
|
|
191
|
+
reveal's data-src / data-background-*, and CSS url(). */
|
|
192
|
+
function deckRefs(html, deck, tree) {
|
|
193
|
+
const tag = (ref, m) => {
|
|
194
|
+
if (!ref || /^(?:[a-z][\w+.-]*:|\/|#|\.\.)/i.test(ref) || /[?#]/.test(ref)) return m;
|
|
195
|
+
let path; try { path = decodeURIComponent(ref.replace(/^\.\//, '').replace(/&/g, '&')); } catch { return m; }
|
|
196
|
+
const f = tree[deck + '/' + path];
|
|
197
|
+
return f && !f.folder && f.v ? m.replace(ref, `${ref}?gsv=${encodeURIComponent(f.v)}`) : m;
|
|
198
|
+
};
|
|
199
|
+
return html.replace(/\b(?:src|href|poster|data-src|data-background-image|data-background-video|data-background-iframe)="([^"]*)"/gi, (m, ref) => tag(ref, m))
|
|
200
|
+
.replace(/url\((['"]?)([^'")]*)\1\)/gi, (m, q, ref) => tag(ref, m))
|
|
201
|
+
.replace(/url\("([^&]*)"\)/gi, (m, ref) => tag(ref, m));
|
|
202
|
+
}
|
|
203
|
+
|
|
183
204
|
/* A deck's file in parts when asked (Range), as the owner's editor sends them (lib/library.js file): a video loops by
|
|
184
205
|
seeking back to its start, which Chrome does only on a server that answers ranges. A shared link sent the whole file
|
|
185
206
|
every time, and its videos stopped at their end once Chrome no longer held their start (2026-10-21, presenting). */
|
|
@@ -214,7 +235,10 @@ export async function collabRoutes(lib, req, url) {
|
|
|
214
235
|
const body = req.method === 'POST' ? await req.arrayBuffer() : null, j = () => { try { return JSON.parse(dec(new Uint8Array(body))); } catch { return {}; } };
|
|
215
236
|
if (path === '__can') return json({ ok: true, title: entry.title || '', view: url.searchParams.get('base')?.replace(/^\/e\//, '/p/') || '' });
|
|
216
237
|
if (req.method === 'GET') {
|
|
217
|
-
if (path === 'api/deck')
|
|
238
|
+
if (path === 'api/deck') { // with its files' versions, as the owner's (lib/library.js): pictures asked for by version
|
|
239
|
+
const files = {}; for (const [p, e] of Object.entries(v)) if (p.startsWith(deck + '/') && p !== deckFile && !e.folder) files[p.slice(deck.length + 1)] = e.v;
|
|
240
|
+
return json({ html: await deckForCollaborator(await lib.text(deckFile) || ''), mtime: version, draft: false, files });
|
|
241
|
+
}
|
|
218
242
|
if (path === 'api/events') return new Response(`retry: 8000\ndata: ${version}\n\n`, { headers: { 'content-type': 'text/event-stream', 'cache-control': 'no-store' } });
|
|
219
243
|
if (path === 'api/ping') return json({ app: 'glideshow', cloud: true, collab: true, deck });
|
|
220
244
|
if (path === 'api/recent' || path === 'api/history') return json([]);
|
|
@@ -223,11 +247,11 @@ export async function collabRoutes(lib, req, url) {
|
|
|
223
247
|
const file = clean(path.slice(5) || 'deck.html');
|
|
224
248
|
let f = v[deck + '/' + file];
|
|
225
249
|
if (!f || f.folder) return new Response('not found', { status: 404 });
|
|
226
|
-
const etag = `"${f.v}"`, keep = file === 'deck.html' ? { 'cache-control': 'no-store' } : { 'cache-control': 'private, max-age=300', etag }; // (as the owner's editor: library.js file)
|
|
227
|
-
if (file !== 'deck.html' && req
|
|
250
|
+
const etag = `W/"${f.v}"`, keep = file === 'deck.html' ? { 'cache-control': 'no-store' } : { 'cache-control': url.searchParams.get('gsv') === f.v ? 'private, max-age=31536000, immutable' : 'private, max-age=300', etag }; // (as the owner's editor: library.js file)
|
|
251
|
+
if (file !== 'deck.html' && sameTag(req, etag)) return new Response(null, { status: 304, headers: keep });
|
|
228
252
|
let b; try { b = await lib.read(f); } catch { await lib.refresh(true); f = lib.view()[deck + '/' + file]; if (!f || f.folder) return new Response('not found', { status: 404 }); b = await lib.read(f); } // (as above)
|
|
229
253
|
const sandbox = file === 'deck.html' ? 'sandbox allow-scripts allow-popups allow-modals' : /^assets\/.*\.html?$/i.test(file) ? 'sandbox allow-scripts allow-pointer-lock' : 'sandbox';
|
|
230
|
-
if (file === 'deck.html') b = enc(dec(b).replace(/<head[^>]*>/, m => m + `<script>for (const k of ['localStorage', 'sessionStorage']) { try { window[k].length } catch { const m = new Map(); Object.defineProperty(window, k, { configurable: true, value: { get length() { return m.size }, key: i => [...m.keys()][i] ?? null, getItem: x => m.has(String(x)) ? m.get(String(x)) : null, setItem: (x, v) => { m.set(String(x), String(v)) }, removeItem: x => { m.delete(String(x)) }, clear: () => m.clear() } }) } }</script>`));
|
|
254
|
+
if (file === 'deck.html') b = enc(vendored(dec(b)).replace(/<head[^>]*>/, m => m + `<script>for (const k of ['localStorage', 'sessionStorage']) { try { window[k].length } catch { const m = new Map(); Object.defineProperty(window, k, { configurable: true, value: { get length() { return m.size }, key: i => [...m.keys()][i] ?? null, getItem: x => m.has(String(x)) ? m.get(String(x)) : null, setItem: (x, v) => { m.set(String(x), String(v)) }, removeItem: x => { m.delete(String(x)) }, clear: () => m.clear() } }) } }</script>`));
|
|
231
255
|
const fh = { 'content-type': typeOf(file), ...keep, 'x-content-type-options': 'nosniff', 'content-security-policy': sandbox };
|
|
232
256
|
return file === 'deck.html' ? new Response(b, { headers: fh }) : ranged(req, b, fh);
|
|
233
257
|
}
|