Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 12 additions & 8 deletions cloudinary.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ if (Meteor.isClient) {

Cloudinary.upload(files, {
folder: Meteor.settings.public.cloudinary.folder,
fields: {}
}, function (error, result) {
if (error) {
failure(new Meteor.Error('rwatts:orionjs-cloudinary', i18n('filesystem.messages.errorUploading')));
Expand All @@ -13,17 +14,17 @@ if (Meteor.isClient) {
}
Cloudinary.collection.remove({});
});

Tracker.autorun(function () {
var file = Cloudinary.collection.findOne();
if (file) {
progress(file.percent_uploaded);
progress(file.percent_uploaded || 0);
}
});
};

orion.filesystem.providerRemove = function (file, success, failure) {
Cloudinary.delete(file.meta.publicId, function (error, result) {
Cloudinary.delete(file.meta.public_id, function (error, result) {
if (error) {
failure(new Meteor.Error('rwatts:orionjs-cloudinary', i18n('filesystem.messages.errorRemoving')));
} else {
Expand All @@ -34,12 +35,15 @@ if (Meteor.isClient) {
}

if (Meteor.isServer) {
Cloudinary.config({
cloud_name: Meteor.settings.private.cloudinary.cloud_name,
api_key: Meteor.settings.private.cloudinary.api_key,
api_secret: Meteor.settings.private.cloudinary.api_secret
Meteor.startup(function() {
if (Meteor.settings.private && Meteor.settings.private.cloudinary) {
Cloudinary.config({
cloud_name: Meteor.settings.private.cloudinary.cloud_name,
api_key: Meteor.settings.private.cloudinary.api_key,
api_secret: Meteor.settings.private.cloudinary.api_secret
});
}
});

}
if (Meteor.isClient) {
let cloud_name = Meteor.settings.public.cloudinary.cloud_name;
Expand Down
6 changes: 3 additions & 3 deletions package.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@ Package.onUse(function(api) {
'orionjs:core@1.6.0',
'orionjs:filesystem@1.6.0',
'orionjs:config@1.6.0',
'lepozepo:cloudinary@4.1.3',
'lepozepo:cloudinary@4.2.2',
'ecmascript'
]);

api.addFiles([
'cloudinary.js'
]);

api.mainModule("cloudinary.js", "client");
api.export(['orion', 'Cloudinary']);
});