Skip to content

Commit

Permalink
Updates to the dropbox API (#5)
Browse files Browse the repository at this point in the history
  • Loading branch information
michael5r authored Mar 15, 2022
1 parent 1867676 commit c5e99b0
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 15 deletions.
6 changes: 3 additions & 3 deletions mmm-dropbox.js
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down Expand Up @@ -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);
Expand Down
16 changes: 8 additions & 8 deletions node_helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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) {

Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;

Expand Down Expand Up @@ -365,4 +365,4 @@ module.exports = NodeHelper.create({

}

});
});
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
{
"name": "mmm-dropbox",
"version": "1.0.1",
"version": "2.0.0",
"description": "Dropbox module for MagicMirror",
"main": "mmm-dropbox.js",
"repository": {
"type": "git",
"url": "git+https://github.com/michael5r/mmm-dropbox.git"
},
"engines": {
"node": ">=8.9.0"
"node": ">=14"
},
"author": "Michael Schmidt",
"license": "MIT",
Expand All @@ -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"
}
}

0 comments on commit c5e99b0

Please sign in to comment.