-
-
Notifications
You must be signed in to change notification settings - Fork 81
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(contentUserData): add feature to save and retrieve contentUserdata (closes #1014) #1886
Conversation
Documentation and comments will follow tomorrow. Right now the contentUserData can be integrated directly into the Integration generated by the |
I've added a few first remarks. |
): Promise<void> { | ||
const file = this.getUserDataFilePath(contentId); | ||
try { | ||
await fs.unlink(file); |
Check failure
Code scanning / CodeQL
Uncontrolled data used in path expression
const file = this.getUserDataFilePath(contentId); | ||
let dataList: IContentUserData[]; | ||
try { | ||
dataList = await fs.readJSON(file); |
Check failure
Code scanning / CodeQL
Uncontrolled data used in path expression
): Promise<void> { | ||
const file = this.getFinishedFilePath(contentId); | ||
try { | ||
await fs.unlink(file); |
Check failure
Code scanning / CodeQL
Uncontrolled data used in path expression
* test(jest): run jest tests in watch mode via test:watch * chore(scripts): add start:rest script * feat(contentUserData): add parameters to contentUserDataUrl config * feat(contentUserData): read saveFreq from config * feat(contentUserData): add the contentUserData into the H5PIntegration * test(contentUserDataGET): add example for GET issue Lumieducation/H5P-Nodejs-library#1014 (comment) * test(contentUserData): revert example * chore(scripts): add h5p-server build script * test(launch): add DEBUG to vscode launch * refactor(script): rename start:rest to start:rest:server Lumieducation/H5P-Nodejs-library#1886 (comment) * refactor(saveFreq): rename saveFreq to contentUserStateSaveInterval Lumieducation/H5P-Nodejs-library#1886 (comment) * feat(contentUserData): delete contentUserData when content is deleted * test(contentUserData): use mock for H5PPlayer.render test * refactor(h5p-examples): add mock implementation to pass build * feat(contentUserData): build contentUserDataIntegration in Manager * feat(contentUserData): update interfaces * test(contentUserDataManager): add tests * refactor(h5p-examples): remove test/example conentUserDataStorage * refactor(saveContentUserData): add invalidate and preload parameters * feat(h5p-express): add ContentUserDataController * fix(contentManager): delete contentUserDataStorage after content Lumieducation/H5P-Nodejs-library#1886 (comment) * refactor(ContentUserDataManager): remove unnecessary code * refactor(ContentUserDataManager): use boolean instead of number Lumieducation/H5P-Nodejs-library#1886 (comment) * refactor(ContentManager): remove unnecessary code * refactor(ContentUserDataManager): use boolean instead of number Lumieducation/H5P-Nodejs-library#1886 (comment) * fix(ContentUserDataManager): sanitize userState before saving * feat(h5pexpress): add ContentUserDataRouter * refactor(h5p-server): add deleteAllContentUserDataforContentId method * refactor(h5p-examples): add reference implementation to h5p-example * docs(ContentUserDataStorage): add contentUserDataStorage docs * feat(contentUserData): add setFinished * fix(ContentUserDataManager): throw H5pError instead of regular error * fix(contentUserStateSaveInterval): change from seconds to milliseconds Lumieducation/H5P-Nodejs-library#1886 (comment) * refactor(code): remove redundant return statements * refactor(code): reorder import statements * refactor(log): change to debug from info * refactor(code): remove typos, reorder imports, remove redundant code * refactor(h5p-examples): don't use singleton * fix(H5PPlayer): use contentUserStateSaveInterval in milliseconds * refactor(code): fix typos * fix(contentUserDataManager): saveContentUserData: check arguments * fix(h5p-examples): correct json number declaration (#1991) * feat(listContentUserDataByUserId): add listContentUserDataByUserId * style(jsdocs): add divergence * refactor: formatting and minor issues * refactor: fixed imports * test: corrected test * refactor: decreased content user state save interval * test: fix test * fix(contentUserDataManager): remove userData when invalidate is true Lumieducation/H5P-Nodejs-library#1886 (comment) * fix(contentUserData): generate integration only when preload is true Lumieducation/H5P-Nodejs-library#1886 (comment) * feat(FileContentUserDataStorage): add FileContentUserDataStorage * feat(contentUserData): include contentUserData in rest-example * feat(contentUserData): include in rest example * test(contentUserDataRouter): fix test * chore(contentUserDataStorage): add json to gitignore * build(h5p-shared-state-server): build h5p-shared-state-server on install * fix(contentUserData): delete invalid contentUserData if content changes Lumieducation/H5P-Nodejs-library#1886 (comment) * refactor(contentUserData): rename saveContentUserData saveContentUserData-method is renamed to createOrUpdateContentUserData * feat(mongos3): add MongoContentUserDataStorage * refactor: made namings more consistent * refactor: minor cleanup * fix: examples work * test: use snapshot instead of inline HTML * feat: corrected and extended MongoContentUserDataStorage * fix: corrected FileContentUserDataStorage signature * test: added more tests * test: more tests * feat: delete finished data when content is deleted * feat: reimplemented FileContentUserDataStorage to work with directories * test: added tests for FileContentUserDataStorage * test: renamed generalized test file * fix: missing user data doesn't return 404 * fix: corrected CSFR token generation + own route for setFinished * fix: protected FileContentUserDataStorage against attacks * test: corrected tests * fix: corrected config to load falsy settings * fix: improved filename validation * feat: routes are closed when feature disabled in config * feat: added CSRF tokens to rest example & fixed bugs * fix: fileContentUserDataStorage saves more than one entry * test: corrected test * feat: improved CSRF * refactor: correct shared state example * refactor: cleanup * docs: added docs Co-authored-by: Oliver Tacke <o.tacke@posteo.de> Co-authored-by: Sebastian Rettig <serettig@posteo.de>
This PR will introduce the feature of saving and retreiving contentUserData.