Applying newly-added file upload settings.

pull/1152/head
George Secrieru 10 years ago
parent 51ffb4f5da
commit 208ae725ab
  1. 3
      client/views/app/room.coffee
  2. 4
      client/views/app/room.html
  3. 32
      lib/fileUpload.coffee

@ -221,6 +221,9 @@ Template.room.helpers
compactView: ->
return 'compact' if Meteor.user()?.settings?.preferences?.compactView
fileUploadAllowedMediaTypes: ->
return RocketChat.settings.get('FileUpload_MediaTypeWhiteList')
Template.room.events
"touchstart .message": (e, t) ->
message = this._arguments[1]

@ -81,7 +81,7 @@
<div style="display: flex">
<div class="file">
<i class="octicon octicon-cloud-upload file"></i>
<input type="file" accept="image/*">
<input type="file" accept="{{fileUploadAllowedMediaTypes}}">
</div>
<div class="input-message-container">
{{> messagePopupConfig getPupupConfig}}
@ -152,4 +152,4 @@
{{> Template.dynamic template=flexTemplate data=flexData}}
</section>
</div>
</template>
</template>

@ -1,6 +1,5 @@
if UploadFS?
@fileCollection = new Mongo.Collection 'rocketchat_uploads'
fileCollection.allow
insert: (userId, doc) ->
return userId
@ -11,14 +10,23 @@ if UploadFS?
remove: (userId, doc) ->
return userId is doc.userId
Meteor.fileStore = new UploadFS.store.GridFS
collection: fileCollection
name: 'rocketchat_uploads'
collectionName: 'rocketchat_uploads'
filter: new UploadFS.Filter
maxSize: 2097152
contentTypes: ['image/*', 'audio/*']
onFinishUpload: ->
console.log arguments
onRead: (fileId, file, req, res) ->
res.setHeader 'content-disposition', 'download'
initFileStore = ->
Meteor.fileStore = new UploadFS.store.GridFS
collection: fileCollection
name: 'rocketchat_uploads'
collectionName: 'rocketchat_uploads'
filter: new UploadFS.Filter
maxSize: RocketChat.settings.get('FileUpload_MaxFileSize')
contentTypes: _.map(RocketChat.settings.get('FileUpload_MediaTypeWhiteList').split(','), (item) -> return item.trim() )
onFinishUpload: ->
console.log arguments
onRead: (fileId, file, req, res) ->
res.setHeader 'content-disposition', 'download'
if Meteor.isServer
initFileStore()
else
Tracker.autorun (c) ->
if RocketChat.settings.subscription.ready()
initFileStore()
c.stop()

Loading…
Cancel
Save