Repository navigation
feat(vscode): H5P Preview by Missing Elements, a VS Code extension that plays .h5p files - #84
Merged
Merged
Conversation
…eview loads no Playwright lib/verify.mjs imports Playwright at its top, and lib/preview.mjs took its server from there, so starting a preview loaded the check's browser driver it never uses. The package file, the library sources, the player's dist and the static server now live in lib/serve.mjs; verify.mjs and preview.mjs both import them, and verify.mjs re-exports VerifyError, the one of them that is public. For the VS Code extension (#83), which bundles the preview server: previewPackage takes `roots`, the player's and the runtime's files where a host ships them itself, and sendArchive is exported, both @internal. Nothing changes for the command. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…at plays .h5p files A .h5p opens in a read-only custom editor that plays it in the real player. The editor is a webview framing a page from a server on 127.0.0.1, one per window on port 4646 when free: a webview's own origin cannot register a Service Worker, and a page it frames from a local server can. The server is the verifier's, bundled; the extension carries the player, the runtime and the library pack's parts, so content-only exports play offline and nothing leaves the machine. - Restricted Mode plays every package untrusted; a trusted workspace plays by the settings, with an Untrusted and a Newest libraries switch in each editor. - Reload and Open in Browser in the title bar; a file written again plays again. - A file from a remote or virtual workspace is copied to this computer first. Tests: the server and the HTML in Node, and a suite that runs in a real VS Code, also in CI under xvfb-run, which uploads the .vsix. Not on npm: the owner publishes the .vsix. Closes #83. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
CodeQL (js/bad-tag-filter): the test's pattern for the webview's script and style tags matched lower case only, so an upper-case `<SCRIPT>` without the nonce would have passed it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ck in various environments
…es and improve file read error management
- Updated the project's logo in `demo/favicon.svg` to a new design. - Modified `AGENTS.md` to reflect changes in logo and icon dimensions. - Enhanced icon generation scripts in `build-app-icons.mjs` and `build-og-image.mjs` to use the new logo. - Added a new script `icon.mjs` for generating the extension's icon from the logo. - Updated `package.json` to include the new icon generation script and added `playwright-core` as a dependency. - Updated binary assets for various icons and screenshots to reflect the new logo design.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #83.
VS Code showed a
.h5pas a binary file it could not open. Now it opens in a read-only editor that plays it in the real player: H5P Preview by Missing Elements (missing-elements.h5p-preview), a new workspace part atpackages/vscode.How it plays
A webview's own origin,
vscode-webview://, cannot register a Service Worker, so the player cannot run in the webview's document. The editor's webview frames a page from a server on 127.0.0.1 instead, one per window, on port 4646 when it is free. Measured before building, in VS Code 1.143.1 (Electron 43) on macOS: the frame's worker controls it, the demo quiz isreadyin 0.5 s, and the Interactive Video's H.264 clip decodes.The server is the verifier's, bundled from this checkout. The extension carries the player, the runtime and the library pack's parts, so content-only exports play offline and nothing leaves the machine.
Changes
packages/verify: a refactor in its own commit, nothing changes for the command.lib/verify.mjstolib/serve.mjs.verify.mjsimports Playwright at its top, and the preview took its server from there, so starting a preview loaded a browser driver it never used.previewPackagetakesroots, andsendArchiveis exported, both@internal.VerifyErroris still exported from the package's entry, and the generated declarations show only it.packages/vscode:src/holds the editor provider, the window's server, the page the webview frames, and the webview: a bar with the package's title, content type and licence, an Untrusted switch and a Newest libraries switch.scripts/build.mjswritesdist/extension.cjs(33 KB, Playwright refused by an esbuild plugin),assets/andNOTICE.txt.scripts/package.mjswrites the.vsix: 13.8 MB in 141 files, nonode_modules.vscodejob. It runs the suite in a downloaded VS Code underxvfb-run, caches the editor by week, and uploads the.vsixas an artifact.pnpm-workspace.yaml:@vscode/vsce-signmay run its install script. It copies the platform's signing binary out of its optional dependency, andvsce publishsigns with it.Testing
Unit: 11 of 11 in Node. The server runs against the built player, runtime and pack:
The webview's policy and nonces, and the page's messaging, have tests of their own.
In a real VS Code (1.143.1,
test-electron): 7 of 7.formulas.h5p(a content-only export, played from the pack).Against the packed
.vsix: the same 7 of 7, with the unpacked.vsixas the extension, so the shipped files alone suffice.The verifier: 24 of 24 in Chrome, and the skills' preview playback test 2 of 2.
pnpm typecheckpasses for every package.The bar, by eye: rendered in Chromium with VS Code's theme variables, in dark, in light, and in a 420 px Restricted Mode pane, where the switches wrap together.
Not verified: Windows, Restricted Mode and Open in Browser in VS Code, remote and virtual workspaces, and the bar inside VS Code's own window (I could not capture it).
Release
Not on npm. To publish 0.1.0:
missing-elementson the Marketplace and the namespace on Open VSX, if they don't exist..vsixfrom CI's artifact or frompnpm build && pnpm --filter h5p-preview package.npx @vscode/vsce publish --packagePath h5p-preview-0.1.0.vsixnpx ovsx publish h5p-preview-0.1.0.vsix -p <token>Before publishing:
The verifier needs no release: its refactor changes nothing for the command, and its next release carries it. The root README and the skills can mention the extension once it is listed.
🤖 Generated with Claude Code