diff options
-rw-r--r-- | client/components/cards/attachments.js | 4 | ||||
-rw-r--r-- | client/components/cards/minicard.js | 2 | ||||
-rwxr-xr-x | client/components/main/editor.js | 47 | ||||
-rw-r--r-- | models/attachments.js | 2 | ||||
-rw-r--r-- | sandstorm-pkgdef.capnp | 3 |
5 files changed, 31 insertions, 27 deletions
diff --git a/client/components/cards/attachments.js b/client/components/cards/attachments.js index 9e32825e..82ecabcf 100644 --- a/client/components/cards/attachments.js +++ b/client/components/cards/attachments.js @@ -47,7 +47,7 @@ Template.attachmentsGalery.events({ Template.attachmentsGalery.helpers({ url() { - return Attachments.link(this); + return Attachments.link(this, 'original', '/'); }, isUploaded() { return !!this.meta.uploaded; @@ -62,7 +62,7 @@ Template.previewAttachedImagePopup.events({ Template.previewAttachedImagePopup.helpers({ url() { - return Attachments.link(this); + return Attachments.link(this, 'original', '/'); } }); diff --git a/client/components/cards/minicard.js b/client/components/cards/minicard.js index 3ddb7e97..430042f4 100644 --- a/client/components/cards/minicard.js +++ b/client/components/cards/minicard.js @@ -33,6 +33,6 @@ Template.minicard.helpers({ return Meteor.user().hasHiddenMinicardLabelText(); }, coverUrl() { - return Attachments.findOne(this.coverId).link(); + return Attachments.findOne(this.coverId).link('original', '/'); }, }); diff --git a/client/components/main/editor.js b/client/components/main/editor.js index 64f24f98..bc2e0bad 100755 --- a/client/components/main/editor.js +++ b/client/components/main/editor.js @@ -225,32 +225,33 @@ Template.editor.onRendered(() => { $summernote.summernote('insertNode', img); }; const processData = function(fileObj) { - // FIXME: Change to new API Utils.processUploadedAttachment( currentCard, - fileObj, - attachment => { - if (attachment && attachment._id && attachment.isImage) { - attachment.one('uploaded', function() { - const maxTry = 3; - const checkItvl = 500; - let retry = 0; - const checkUrl = function() { - // even though uploaded event fired, attachment.url() is still null somehow //TODO - const url = attachment.link(); - if (url) { - insertImage( - `${location.protocol}//${location.host}${url}`, - ); - } else { - retry++; - if (retry < maxTry) { - setTimeout(checkUrl, checkItvl); + fileObj, + { onUploaded: + attachment => { + if (attachment && attachment._id && attachment.isImage) { + attachment.one('uploaded', function() { + const maxTry = 3; + const checkItvl = 500; + let retry = 0; + const checkUrl = function() { + // even though uploaded event fired, attachment.url() is still null somehow //TODO + const url = Attachments.link(attachment, 'original', '/'); + if (url) { + insertImage( + `${location.protocol}//${location.host}${url}`, + ); + } else { + retry++; + if (retry < maxTry) { + setTimeout(checkUrl, checkItvl); + } } - } - }; - checkUrl(); - }); + }; + checkUrl(); + }); + } } }, ); diff --git a/models/attachments.js b/models/attachments.js index 5dcc75e6..25e4b4bb 100644 --- a/models/attachments.js +++ b/models/attachments.js @@ -291,6 +291,8 @@ if (Meteor.isServer) { } function storagePath(defaultPath) { + // FIXME + return '/var/attachments'; const storePath = process.env.ATTACHMENTS_STORE_PATH; return storePath ? storePath : defaultPath; } diff --git a/sandstorm-pkgdef.capnp b/sandstorm-pkgdef.capnp index dbdb7640..fc805f6b 100644 --- a/sandstorm-pkgdef.capnp +++ b/sandstorm-pkgdef.capnp @@ -257,6 +257,7 @@ const myCommand :Spk.Manifest.Command = ( (key = "OAUTH2_TOKEN_ENDPOINT", value=""), (key = "LDAP_ENABLE", value="false"), (key = "SANDSTORM", value="1"), - (key = "METEOR_SETTINGS", value = "{\"public\": {\"sandstorm\": true}}") + (key = "METEOR_SETTINGS", value = "{\"public\": {\"sandstorm\": true}}"), + (key = "ATTACHMENTS_STORE_PATH", value = "/var/attachments/") ] ); |