5 Commits

Author SHA1 Message Date
ly-wang19
ab74d6a3b2
fix(export): guard toPoints() against arc-first SVG paths (#638)
An SVG path whose first command is an arc (A) — or one whose leading
commands push no anchor point — reaches the arc branch with an empty
`points` array, so `points[points.length - 1].type` threw a TypeError
and aborted the entire PPTX export. toPoints() documents that a malformed
path should return [] (mirroring getSvgPathRange) so a single bad or
LLM-hallucinated shape does not take down the export; this restores that
contract with a `!lastPoint` guard. Adds a regression test for the
arc-first case.

Co-authored-by: ly-wang19 <ly-wang19@users.noreply.github.com>
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-authored-by: wyuc <wang-yc24@mails.tsinghua.edu.cn>
2026-06-06 10:46:48 -04:00
wyuc
86c8e0c543
feat: inline external assets at export for offline classrooms (#596) (#613)
* feat(export): add external-asset reference scanner for HTML inlining

* feat(export): add cached asset fetcher and data-uri encoder

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* feat(export): recursively inline url() refs inside stylesheets

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* feat(export): orchestrate inlining of links, scripts, images, and inline css

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* refactor(export): drop dead escapeAttr, harden importmap skip in scanner

* feat(export): inline importmap modules incl three/addons graph closure

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* refactor(export): extract shared module to break inline-assets import cycle

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* feat(export): inline interactive-scene assets into .maic.zip at export

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* feat(export): inline interactive assets in Resource Pack export too

* docs: document offline export asset inlining

* style: prettier formatting

* fix(test): resolve tsc type errors in export-classroom-inline test

* fix(export): keep importmap prefix fallback on partial failure, chunk base64, preserve media attr, log pptx inline failures

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* perf(export): parallelize asset fetching, share fetcher across scenes, promise-cache

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* fix(export): retry transient asset fetches, bound concurrency, warn user on partial inline

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* perf(export): inline only woff2 fonts, drop woff/ttf siblings to halve size

Within @font-face blocks that have a woff2 url(), rewrite sibling woff/ttf/otf/eot
refs to url(about:invalid) instead of inlining them. Falls back to full inline for
ttf-only blocks. Drops katex output from ~1.79MB to ~0.71MB (~3x fewer font fetches).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* i18n(export): translate partial-inline warning and surface failed asset hosts

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* feat(proxy-media): follow redirects with per-hop SSRF revalidation (#398)

Replace blanket redirect rejection with a bounded 5-hop follow loop that
re-validates every Location target through validateUrlForSSRF before
fetching, preventing redirect-to-internal SSRF while allowing CDN
redirects (e.g. cdn.tailwindcss.com 302→/3.4.17).

* feat(export): route asset inlining through proxy-media to bypass CORS

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* fix(export): keep importmap prefix fallback, forward proxy 4xx, cap proxy size, re-export FetchAsset

* style: prettier formatting for proxy-media + proxied-fetch

* fix(export): report CSS-nested asset failures in inline report

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-authored-by: 杨慎 <117187635+cosarah@users.noreply.github.com>
2026-05-31 18:36:39 +08:00
杨慎
757ac07955
fix: preserve discussion triggers in imported classroom zips (#557)
* fix: remap discussion agents in classroom zip imports

* fix: preserve preset discussion initiators in zip export

---------
2026-05-12 19:54:29 +08:00
wyuc
7cf3928abc
fix(export): skip shapes with malformed SVG paths instead of aborting PPTX export (#505)
A single unparseable shape path (e.g. an upstream LLM hallucination that
turns an `A` arc command into the literal token `alert`) used to throw
out of `toPoints` and crash the entire `buildPptxBlob` run, surfacing a
generic "导出失败 / Export failed" toast and producing no file.

Make `toPoints` mirror the existing tolerant behaviour of
`getSvgPathRange`: warn and return `[]` on parse failure. The shape
branch in `buildPptxBlob` then skips the offending element and keeps
exporting the rest of the deck.

Closes #504

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-28 12:01:33 +08:00
wyuc
db7f187106
feat: classroom export and import (ZIP) (#408) (#418)
* feat(export): add classroom ZIP manifest type definitions

* feat(i18n): add classroom export/import translation keys for all locales

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* feat(export): add classroom ZIP utilities and unit tests

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* feat(export): add useExportClassroom hook for ZIP export

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* feat(import): add useImportClassroom hook for ZIP import

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* feat(ui): add Export Classroom ZIP option to header dropdown

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* feat(ui): add Import Classroom button to home page

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* test(export): add integration tests and fix lint issues

* fix(ui): improve import button placement and read appVersion from package.json

* chore: fix prettier formatting

* fix: address PR review feedback

- Read appVersion from process.env.npm_package_version instead of hardcoding
- Remove unused buildIdMap export and its tests
- Add forward-compat comment on ManifestAgent.voiceConfig
- Add file size warning for large ZIP imports
- Distinguish storage quota errors from parse errors in import
- Move poster check before first DB put to avoid redundant write
- Use CLASSROOM_ZIP_EXTENSION constant in export hook
- Add storageFull i18n key for all 4 locales

* fix: adapt to language→languageDirective rename from #412

* fix(ui): widen import button hover expand to prevent text truncation

* fix(ui): use grid 0fr→1fr for import button expand instead of fixed max-w

---------

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-13 22:17:18 +08:00