@missing-elements/h5p-embed 0.8.0 → 1.0.0
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.
- package/README.md +1 -1
- package/lib/build.mjs +5 -5
- package/package.json +4 -4
- package/site/embed.js +2 -4
- package/site/index.html +1 -1
package/README.md
CHANGED
|
@@ -74,7 +74,7 @@ To update, run the command again with `--force` and redeploy.
|
|
|
74
74
|
| Parameter | Effect |
|
|
75
75
|
|---|---|
|
|
76
76
|
| `src=<url>` | The package, required. Encode `&`, `#`, `+`, `%` and spaces |
|
|
77
|
-
| `libraries=pack`, `<url>` or `none` | Where libraries come from; several are tried in order. `pack` is this domain's copy, or jsDelivr's without one: a package gets the libraries it lacks from it, and those it carries at the pack's newer versions. `
|
|
77
|
+
| `libraries=pack`, `<url>` or `none` | Where libraries come from; several are tried in order. `pack` is this domain's copy, or jsDelivr's without one: a package gets the libraries it lacks from it, and those it carries at the pack's newer versions. `none` turns off `--default-libraries` |
|
|
78
78
|
| `refresh-libraries=off` | Play the libraries a package carries as exported; `pack` then only fills gaps |
|
|
79
79
|
| `frame`, `copyright`, `export`, `icon`, `reporting` | H5P's action bar and its buttons |
|
|
80
80
|
| `fullscreen=off` | No fullscreen button |
|
package/lib/build.mjs
CHANGED
|
@@ -57,7 +57,7 @@ const PACK_CDN_ORIGIN = 'https://cdn.jsdelivr.net'
|
|
|
57
57
|
|
|
58
58
|
/**
|
|
59
59
|
* A `libraries` value for addresses that name none, checked against the site it goes into: the
|
|
60
|
-
* tokens the page understands (`pack`, `
|
|
60
|
+
* tokens the page understands (`pack`, `none`, https URLs), and with a host list, nothing
|
|
61
61
|
* the page would then refuse on every load. Returns the value normalised to single spaces.
|
|
62
62
|
*
|
|
63
63
|
* @param {string | null | undefined} value
|
|
@@ -74,19 +74,19 @@ export function parseDefaultLibraries(value, { packages = null, libraries = true
|
|
|
74
74
|
return null
|
|
75
75
|
}
|
|
76
76
|
// An exact match on a parsed origin, not a substring of a URL. Without its own copy, `pack` is
|
|
77
|
-
// the copy on jsDelivr that the element names
|
|
77
|
+
// the copy on jsDelivr that the element names.
|
|
78
78
|
const cdnAllowed = !packages || packages.some((origin) => origin === PACK_CDN_ORIGIN)
|
|
79
79
|
for (const token of tokens) {
|
|
80
|
-
if (token === 'pack'
|
|
80
|
+
if (token === 'pack') {
|
|
81
81
|
if (!libraries && !cdnAllowed) {
|
|
82
|
-
throw new EmbedError(`--default-libraries names
|
|
82
|
+
throw new EmbedError(`--default-libraries names pack, but the site has no pack (--no-libraries) and --packages does not list ${PACK_CDN_ORIGIN}.`)
|
|
83
83
|
}
|
|
84
84
|
} else {
|
|
85
85
|
let url
|
|
86
86
|
try {
|
|
87
87
|
url = new URL(token)
|
|
88
88
|
} catch {
|
|
89
|
-
throw new EmbedError(`--default-libraries: not pack,
|
|
89
|
+
throw new EmbedError(`--default-libraries: not pack, none or a URL: ${token}`)
|
|
90
90
|
}
|
|
91
91
|
if (url.protocol !== 'https:' && !['localhost', '127.0.0.1', '[::1]'].includes(url.hostname)) {
|
|
92
92
|
throw new EmbedError(`--default-libraries: not an https URL: ${token}`)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@missing-elements/h5p-embed",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "1.0.0",
|
|
4
4
|
"description": "Self-hosted H5P embeds: writes the H5P embed page as a static site for a player domain of your own, then any site frames it with an iframe and one script line. No H5P server, no third-party service; optional allowlists for package hosts and embedding sites.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -43,9 +43,9 @@
|
|
|
43
43
|
"cli"
|
|
44
44
|
],
|
|
45
45
|
"dependencies": {
|
|
46
|
-
"@missing-elements/h5p-
|
|
47
|
-
"@missing-elements/h5p-runtime": "^0.
|
|
48
|
-
"@missing-elements/h5p-
|
|
46
|
+
"@missing-elements/h5p-offline-player": "^1.0.0",
|
|
47
|
+
"@missing-elements/h5p-runtime": "^1.0.0",
|
|
48
|
+
"@missing-elements/h5p-libraries": "^1.0.0"
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
51
51
|
"@types/node": "^26.6.5",
|
package/site/embed.js
CHANGED
|
@@ -244,12 +244,10 @@ export function startEmbed({ packBase = null, pack = null, librariesPack = null,
|
|
|
244
244
|
const sources = []
|
|
245
245
|
if (value === 'none') return { value: '' }
|
|
246
246
|
for (const token of value.split(/\s+/).filter(Boolean)) {
|
|
247
|
-
if (token === 'pack'
|
|
247
|
+
if (token === 'pack') {
|
|
248
248
|
// This site's copy of the pack, which the element was pointed at above; without one, the
|
|
249
249
|
// element's own `pack`, the copy on jsDelivr, where that may be reached, so a snippet
|
|
250
|
-
// written for `pack` keeps playing after a rebuild with --no-libraries.
|
|
251
|
-
// `pack` since player 0.6: the one H5P hub host that answers a browser serves a
|
|
252
|
-
// catalogue older than current exports need.
|
|
250
|
+
// written for `pack` keeps playing after a rebuild with --no-libraries.
|
|
253
251
|
if (ownPack || (!librariesPack && permitted(PACK_CDN_ORIGIN))) sources.push('pack')
|
|
254
252
|
else if (librariesPack) sources.push(librariesPack)
|
|
255
253
|
else return { error: 'This player was set up without the library pack, so libraries=pack is not available here.' }
|
package/site/index.html
CHANGED