Skip to content

Commit

Permalink
Merge pull request #633 from VeliovGroup/dev
Browse files Browse the repository at this point in the history
v1.10.0
  • Loading branch information
dr-dimitru authored Jul 23, 2018
2 parents c970725 + 7f8701c commit 5d8bc02
Show file tree
Hide file tree
Showing 30 changed files with 1,313 additions and 694 deletions.
124 changes: 46 additions & 78 deletions .npm/package/npm-shrinkwrap.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

59 changes: 31 additions & 28 deletions .versions
Original file line number Diff line number Diff line change
@@ -1,46 +1,49 @@
[email protected]
babel-compiler@7.0.6
[email protected].0
[email protected].10
babel-compiler@7.1.1
[email protected].2
[email protected].11
[email protected]
boilerplate-generator@1.4.0
boilerplate-generator@1.5.0
[email protected]
[email protected].0
[email protected].1
[email protected]
[email protected].1
[email protected].2
[email protected]
ddp-server@2.1.2
ddp-server@2.2.0
[email protected]
dynamic-import@0.3.0
ecmascript@0.10.6
ecmascript-runtime@0.5.0
ecmascript-runtime-client@0.6.0
ecmascript-runtime-server@0.5.0
dynamic-import@0.4.0
ecmascript@0.11.1
ecmascript-runtime@0.7.0
ecmascript-runtime-client@0.7.1
ecmascript-runtime-server@0.7.0
[email protected]
[email protected]
[email protected].0
[email protected].1
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
local-test:ostrio:[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected].6
npm-mongo@2.2.33
[email protected].7
npm-mongo@3.0.7
[email protected]
ostrio:[email protected].4
ostrio:files@1.9.11
promise@0.10.1
ostrio:[email protected].7
ostrio:files@1.10.0
promise@0.11.1
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
webapp@1.5.0
webapp@1.6.0
[email protected]
35 changes: 18 additions & 17 deletions client.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
import { _ } from 'meteor/underscore';
import { Mongo } from 'meteor/mongo';
import { Meteor } from 'meteor/meteor';
import { Cookies } from 'meteor/ostrio:cookies';
import { formatFleURL } from './lib.js';
import { check, Match } from 'meteor/check';
import { UploadInstance } from './upload.js';
import FilesCollectionCore from './core.js';
import { formatFleURL, helpers } from './lib.js';

const NOOP = () => { };

Expand Down Expand Up @@ -53,11 +52,11 @@ export class FilesCollection extends FilesCollectionCore {

const self = this;
const cookie = new Cookies();
if (!_.isBoolean(this.debug)) {
if (!helpers.isBoolean(this.debug)) {
this.debug = false;
}

if (!_.isBoolean(this.public)) {
if (!helpers.isBoolean(this.public)) {
this.public = false;
}

Expand All @@ -66,7 +65,7 @@ export class FilesCollection extends FilesCollectionCore {
}
this.chunkSize = Math.floor(this.chunkSize / 8) * 8;

if (!_.isString(this.collectionName) && !this.collection) {
if (!helpers.isString(this.collectionName) && !this.collection) {
this.collectionName = 'MeteorUploadFiles';
}

Expand All @@ -83,25 +82,25 @@ export class FilesCollection extends FilesCollectionCore {
throw new Meteor.Error(500, `[FilesCollection.${this.collectionName}]: "downloadRoute" must be precisely provided on "public" collections! Note: "downloadRoute" must be equal or be inside of your web/proxy-server (relative) root.`);
}

if (!_.isBoolean(this.disableUpload)) {
if (!helpers.isBoolean(this.disableUpload)) {
this.disableUpload = false;
}

if (!_.isString(this.downloadRoute)) {
if (!helpers.isString(this.downloadRoute)) {
this.downloadRoute = '/cdn/storage';
}

this.downloadRoute = this.downloadRoute.replace(/\/$/, '');

if (!_.isFunction(this.namingFunction)) {
if (!helpers.isFunction(this.namingFunction)) {
this.namingFunction = false;
}

if (!_.isFunction(this.onBeforeUpload)) {
if (!helpers.isFunction(this.onBeforeUpload)) {
this.onBeforeUpload = false;
}

if (!_.isBoolean(this.allowClientCode)) {
if (!helpers.isBoolean(this.allowClientCode)) {
this.allowClientCode = true;
}

Expand Down Expand Up @@ -191,11 +190,11 @@ export class FilesCollection extends FilesCollectionCore {
_getMimeType(fileData) {
let mime;
check(fileData, Object);
if (_.isObject(fileData)) {
if (helpers.isObject(fileData)) {
mime = fileData.type;
}

if (!mime || !_.isString(mime)) {
if (!mime || !helpers.isString(mime)) {
mime = 'application/octet-stream';
}
return mime;
Expand All @@ -216,7 +215,7 @@ export class FilesCollection extends FilesCollectionCore {
userId: null
};

if (_.isFunction(Meteor.userId)) {
if (helpers.isFunction(Meteor.userId)) {
result.user = () => Meteor.user();
result.userId = Meteor.userId();
}
Expand Down Expand Up @@ -296,19 +295,21 @@ export class FilesCollection extends FilesCollectionCore {
* @name fileURL
* @param {Object} fileRef - File reference object
* @param {String} version - [Optional] Version of file you would like to request
* @param {String} URIBase - [Optional] URI base, see - https://github.com/VeliovGroup/Meteor-Files/issues/626
* @summary Get download URL for file by fileRef, even without subscription
* @example {{fileURL fileRef}}
* @returns {String}
*/
Meteor.startup(() => {
if (typeof Template !== 'undefined' && Template !== null) {
Template.registerHelper('fileURL', (fileRef, version = 'original') => {
if (!_.isObject(fileRef)) {
Template.registerHelper('fileURL', (fileRef, _version = 'original', _URIBase) => {
if (!helpers.isObject(fileRef)) {
return '';
}

version = (!_.isString(version)) ? 'original' : version;
return formatFleURL(fileRef, version);
const version = (!helpers.isString(_version)) ? 'original' : _version;
const URIBase = (!helpers.isString(_URIBase)) ? void 0 : _URIBase;
return formatFleURL(fileRef, version, URIBase);
});
}
});
Loading

0 comments on commit 5d8bc02

Please sign in to comment.