Skip to content

Commit

Permalink
Merge pull request #38 from VeliovGroup/dev_1
Browse files Browse the repository at this point in the history
Tune-up for streaming from meteor.com
  • Loading branch information
dr-dimitru committed Oct 20, 2015
2 parents 7f602c6 + f23ef99 commit 9b692a8
Show file tree
Hide file tree
Showing 9 changed files with 163 additions and 149 deletions.
4 changes: 2 additions & 2 deletions .versions
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ [email protected]
[email protected]_1
[email protected]
[email protected]
ostrio:[email protected].0
ostrio:[email protected].9
ostrio:[email protected].1
ostrio:[email protected].10
[email protected]
[email protected]
[email protected]
Expand Down
19 changes: 10 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,17 +84,9 @@ API
* Default value: `/assets/app/uploads`
- `collectionName` {*String*} - Collection name
* Default value: `MeteorUploadFiles`
- `cacheControl` {*String*} - Default `Cache-Control` header, by default: `public, max-age=31536000, s-maxage=31536000`
- `downloadRoute` {*String*} - Server Route used to retrieve files
* Default value: `/cdn/storage`
- `downloadCallback` {*Function*} - Called right before initiate file download, with next context and only one argument `fileObj`:
* `fileObj` - see __Current schema__ section below
* __context__:
- `@request`
- `@response`
- `@user()`
- `@userId`
* __Notes__:
* Function should return {*Boolean*} value, to abort download - return `false`, to allow download - return `true`
- `schema` {*Object*} - Collection Schema (*Not editable for current release*)
- `chunkSize` {*Number*} - Upload chunk size
* Default value: `272144`
Expand All @@ -106,6 +98,15 @@ API
* Default value: `true`
- `strict` {*Boolean*} - Strict mode for partial content, if is `true` server will return `416` response code, when `range` is not specified
* Default value: `false`
- `downloadCallback` {*Function*} - Called right before initiate file download, with next context and only one argument `fileObj`:
* `fileObj` - see __Current schema__ section below
* __context__:
- `@request`
- `@response`
- `@user()`
- `@userId`
* __Notes__:
* Function should return {*Boolean*} value, to abort download - return `false`, to allow download - return `true`
- `protected` {*Boolean*|*Function*} - If `true` - files will be served only to authorized users, if `function()` - you're able to check visitor's permissions in your own way
* Default value: `false`
* If function - `function` __context__ has:
Expand Down
16 changes: 8 additions & 8 deletions demo/client/file.jade
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,16 @@ template(name="file")
img(src="{{fileURL .}}" alt="{{name}}" style="max-width: 100%")

else if isAudio
audio.center-block(controls style="max-width: 100%")
audio.center-block(controls style="max-width: 100%" autoplay preload="auto" loop)
source(src="{{fileURL .}}?play=true" type="{{type}}")

else if isVideo
video.center-block(controls style="max-width: 100%")
video.center-block(controls style="max-width: 100%" autoplay preload="auto" loop)
source(src="{{fileURL .}}?play=true" type="{{type}}")
else
.alert.alert-info Preview is not avalible, please download file.

table.table.table-bordered.table-condenced(style="table-layout:fixed")
table.table.table-bordered.table-condensed(style="table-layout:fixed")
thead
tr
th Name
Expand All @@ -28,10 +28,10 @@ template(name="file")
th Downloads
tbody
tr
td.text-center.ellipsis: span.label.label-default #{name}
td.text-center: span.label.label-default #{type}
td.text-center: span.label.label-default {{filesize size}}
td.text-center: span.label.label-default .#{extension}
td.text-center: a.label.label-default(title="Download \"{{name}}\"" href="{{fileURL .}}?download=true" target="_parent" download)
td.text-center: span.ellipsis.label.label-default #{name}
td.text-center: span.ellipsis.label.label-default #{type}
td.text-center: span.ellipsis.label.label-default {{filesize size}}
td.text-center: span.ellipsis.label.label-default .#{extension}
td.text-center: a.ellipsis.label.label-default(title="Download \"{{name}}\"" href="{{fileURL .}}?download=true" target="_parent" download)
i.fa.fa-download
| #{meta.downloads}
24 changes: 13 additions & 11 deletions demo/client/index.jade
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,17 @@ template(name="index")
tbody
each latest
tr
td.ellipsis: a(href="{{pathFor 'file' _id=_id}}") #{name}
td: a.ellipsis(href="{{pathFor 'file' _id=_id}}") #{name}
td.text-right
span.label.label-default(title="Will be removed {{removedIn}}")
i.fa.fa-fw.fa-history
| {{removedIn}}
|
span.label.label-default(title="Downloads")
i.fa.fa-download
| #{meta.downloads}
if compare filesLength '>' latest.count
tr: td(colspan="100%")
button.btn.btn-default.btn-block#loadMore(type="button" title="Show older files") Load More
span.ellipsis(color="#fafafa")
span.label.label-default(title="Will be removed {{removedIn}}")
i.fa.fa-fw.fa-history
| {{removedIn}}
|
span.label.label-default(title="Downloads")
i.fa.fa-download
| #{meta.downloads}

if compare filesLength '>' latest.count
.panel-footer
button.btn.btn-default.btn-block#loadMore(type="button" title="Show older files") Load More
3 changes: 3 additions & 0 deletions demo/client/misc/_layout.jade
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
head
meta(name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no")

template(name="_layout")
a(href='https://github.com/VeliovGroup/Meteor-Files')
img.gh-ribbon(src='https://camo.githubusercontent.com/365986a132ccd6a44c23a9169022c0b5c890c387/68747470733a2f2f73332e616d617a6f6e6177732e636f6d2f6769746875622f726962626f6e732f666f726b6d655f72696768745f7265645f6161303030302e706e67' alt='Fork me on GitHub' data-canonical-src='https://s3.amazonaws.com/github/ribbons/forkme_right_red_aa0000.png')
Expand Down
11 changes: 11 additions & 0 deletions demo/client/styles.sass
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
*
animation: newElement 350ms ease-in-out 1

@keyframes newElement
from
opacity: 0
to
opacity: 1

.container
padding-top: 15px
max-width: 640px
Expand All @@ -8,6 +17,7 @@
max-width: 100%
text-overflow: ellipsis
-o-text-overflow: ellipsis
display: block

button, input, select, textarea, .label
user-select: none !important
Expand All @@ -20,6 +30,7 @@ button, select, input, button, form, textarea, a, pre, i
th
text-align: center
vertical-align: middle
word-break: break-word

.control-btns > *
width: 50% !important
Expand Down
1 change: 1 addition & 0 deletions demo/lib/files.collection.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ Collections.files = new Meteor.Files
debug: false
storagePath: 'assets/app/uploads/uploadedFiles'
collectionName: 'uploadedFiles'
chunkSize: 256*256*8
onBeforeUpload: -> if @size <= 100000 * 10 * 128 then true else "Max. file size is 128MB you've tried to upload #{filesize(@size)}"
allowClientCode: false
downloadCallback: (fileObj) ->
Expand Down
Loading

0 comments on commit 9b692a8

Please sign in to comment.