-
Notifications
You must be signed in to change notification settings - Fork 633
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Render H5P files entirely on the clientside.
- Loading branch information
Showing
14 changed files
with
572 additions
and
171 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,3 @@ | ||
This code is currently pulled verbatim from https://github.com/tunapanda/h5p-standalone/tree/master/dist | ||
|
||
To update, copy in the files (with `frame.bundle.js` copied into the JS folder). You can delete any pre-existing files. | ||
|
||
To make `frame.bundle.js` compatible with running it inside a sandboxed iframe replace every instance of `window.parent.H5PIntegration` with `window.H5PIntegration`. |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
const fs = require('fs'); | ||
const path = require('path'); | ||
const mimeDB = require('mime-db'); | ||
|
||
// Allowed file extensions for H5P from: https://h5p.org/allowed-file-extensions | ||
const allowedFileExtensions = new Set([ | ||
'bmp', | ||
'css', | ||
'csv', | ||
'diff', | ||
'doc', | ||
'docx', | ||
'eof', | ||
'gif', | ||
'jpeg', | ||
'jpg', | ||
'js', | ||
'json', | ||
'mp3', | ||
'mp4', | ||
'm4a', | ||
'odp', | ||
'ods', | ||
'odt', | ||
'ogg', | ||
'otf', | ||
'patch', | ||
'pdf', | ||
'png', | ||
'ppt', | ||
'pptx', | ||
'rtf', | ||
'svg', | ||
'swf', | ||
'tif', | ||
'tiff', | ||
'ttf', | ||
'txt', | ||
'wav', | ||
'webm', | ||
'woff', | ||
'xls', | ||
'xlsx', | ||
'xml', | ||
'md', | ||
'textile', | ||
'vtt', | ||
]); | ||
|
||
const output = {}; | ||
|
||
for (let key in mimeDB) { | ||
if (mimeDB[key].extensions) { | ||
for (let ext of mimeDB[key].extensions) { | ||
if (allowedFileExtensions.has(ext)) { | ||
output[ext] = key; | ||
} | ||
} | ||
} | ||
} | ||
|
||
fs.writeFileSync(path.join(__dirname, 'src', 'mimetypes.json'), JSON.stringify(output)); |
Oops, something went wrong.