diff --git a/mmm-dropbox.js b/mmm-dropbox.js index cf12d7d..9862c38 100644 --- a/mmm-dropbox.js +++ b/mmm-dropbox.js @@ -22,7 +22,7 @@ Module.register('mmm-dropbox', { updateInterval: 5 * 60 * 1000, // every 5 minutes animationSpeed: 2 * 1000, initialLoadDelay: 0, - version: '1.0.1' + version: '2.0.0' }, getStyles: function() { @@ -76,9 +76,9 @@ Module.register('mmm-dropbox', { this.sendSocketNotification('MMM_DROPBOX_GET'); }, - notificationReceived(notification, payload, sender) { + notificationReceived: function(notification, payload, sender) { - if (notification === 'DOM_OBJECTS_CREATED') { + if (notification === 'MODULE_DOM_CREATED') { if (this.config.token === '') { this.errMsg = 'Please add your Dropbox token to the MagicMirror config.js file.'; this.updateDom(this.config.animationSpeed); diff --git a/node_helper.js b/node_helper.js index 9d4722b..78dca31 100644 --- a/node_helper.js +++ b/node_helper.js @@ -23,7 +23,7 @@ module.exports = NodeHelper.create({ this.config = config; this.extensions = ['.jpg', '.jpeg', '.png', '.gif']; - this.dbx = new Dropbox({ fetch, accessToken: this.config.token }); + this.dbx = new Dropbox({ accessToken: this.config.token }); this.initialLoadDone = false; // triggered after the initial load of data this.filesToSave = 25; @@ -74,7 +74,7 @@ module.exports = NodeHelper.create({ mode: 'filename' }).then((result) => { - const matches = result.matches; + const matches = result.result.matches; if ((matches) && (matches.length > 0)) { for (const j in matches) { @@ -107,9 +107,9 @@ module.exports = NodeHelper.create({ include_media_info: true }).then((fileMetaData) => { - if ((fileMetaData.media_info) && (fileMetaData.media_info.metadata)) { + if ((fileMetaData.result.media_info) && (fileMetaData.result.media_info.metadata)) { - const fileMetaDataData = fileMetaData.media_info.metadata; + const fileMetaDataData = fileMetaData.result.media_info.metadata; if (fileMetaDataData.dimensions) { fileObj.width = fileMetaDataData.dimensions.width; @@ -230,11 +230,11 @@ module.exports = NodeHelper.create({ entries: filesToDownload }).then((data) => { - if (data.entries.length > 0) { + if (data.result.entries.length > 0) { - for (const j in data.entries) { + for (const j in data.result.entries) { - const image = data.entries[j]; + const image = data.result.entries[j]; const success = (image['.tag'] === 'success'); let imageId = 0; @@ -365,4 +365,4 @@ module.exports = NodeHelper.create({ } -}); \ No newline at end of file +}); diff --git a/package.json b/package.json index d13722d..e8a49ab 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "mmm-dropbox", - "version": "1.0.1", + "version": "2.0.0", "description": "Dropbox module for MagicMirror", "main": "mmm-dropbox.js", "repository": { @@ -8,7 +8,7 @@ "url": "git+https://github.com/michael5r/mmm-dropbox.git" }, "engines": { - "node": ">=8.9.0" + "node": ">=14" }, "author": "Michael Schmidt", "license": "MIT", @@ -17,7 +17,7 @@ }, "homepage": "https://github.com/michael5r/mmm-dropbox#readme", "dependencies": { - "dropbox": "^4.0.30", - "isomorphic-fetch": "^2.2.1" + "dropbox": "^10.24.0", + "isomorphic-fetch": "^3.0.0" } }