diff --git a/.npm/package/npm-shrinkwrap.json b/.npm/package/npm-shrinkwrap.json index 35bb9a8e..91e5e87a 100644 --- a/.npm/package/npm-shrinkwrap.json +++ b/.npm/package/npm-shrinkwrap.json @@ -12,9 +12,9 @@ "integrity": "sha512-Q1y515GcOdTHgagaVFhHnIFQ38ygs/kmxdNpvpou+raI9UO3YZcHDngBSYKQklcKlvA7iuQlmIKbzvmxcOE9CQ==" }, "ajv": { - "version": "6.12.0", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.0.tgz", - "integrity": "sha512-D6gFiFA0RRLyUbvijN74DWAjXSFxWKaWP7mldxkVhyhAV3+SWA9HEJPHQ2c9soIeTFJqcSdFDGFgdqs1iUU2Hw==" + "version": "6.12.2", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.2.tgz", + "integrity": "sha512-k+V+hzjm5q/Mr8ef/1Y9goCmlsK4I6Sm74teeyGvFk1XrOsbsKLjEdrvny42CZ+a8sXbk8KWpY/bDwS+FLL2UQ==" }, "asn1": { "version": "0.2.4", @@ -107,9 +107,9 @@ "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==" }, "file-type": { - "version": "14.1.3", - "resolved": "https://registry.npmjs.org/file-type/-/file-type-14.1.3.tgz", - "integrity": "sha512-fTTNfpY1QxlpKCrA5bRxZL/6f7+6jUCJkOCCzFkAI+tmLu5lfX+4Zo22GG1orRhVH7Dx0fHtMFXq0++NDjKn/w==" + "version": "14.2.0", + "resolved": "https://registry.npmjs.org/file-type/-/file-type-14.2.0.tgz", + "integrity": "sha512-CAkX5G5jq8LIgFu++dpM3giMZadYdU+QVQoPLajjNboo8IzaR4cKpBCVEuz+suhd/vHqoAJeSWhEubKjRPQHJg==" }, "forever-agent": { "version": "0.6.1", @@ -227,9 +227,9 @@ "integrity": "sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns=" }, "psl": { - "version": "1.7.0", - "resolved": "https://registry.npmjs.org/psl/-/psl-1.7.0.tgz", - "integrity": "sha512-5NsSEDv8zY70ScRnOTn7bK7eanl2MvFrOrS/R6x+dBt5g1ghnj9Zv90kO8GwT8gxcu2ANyFprnFYB85IogIJOQ==" + "version": "1.8.0", + "resolved": "https://registry.npmjs.org/psl/-/psl-1.8.0.tgz", + "integrity": "sha512-RIdOzyoavK+hA18OGGWDqUTsCLhtA7IcZ/6NCs4fFJaHBDab+pDDmDIByWFRQJq2Cd7r1OoQxBGKOaztq+hjIQ==" }, "punycode": { "version": "2.1.1", diff --git a/.versions b/.versions index 90a9b843..0b70bdc4 100644 --- a/.versions +++ b/.versions @@ -1,18 +1,18 @@ allow-deny@1.1.0 -babel-compiler@7.5.2 +babel-compiler@7.5.3 babel-runtime@1.5.0 base64@1.0.12 binary-heap@1.0.11 -boilerplate-generator@1.6.0 +boilerplate-generator@1.7.0 callback-hook@1.3.0 check@1.3.1 ddp@1.4.0 ddp-client@2.3.3 ddp-common@1.4.0 -ddp-server@2.3.0 +ddp-server@2.3.1 diff-sequence@1.1.1 -dynamic-import@0.5.1 -ecmascript@0.14.2 +dynamic-import@0.5.2 +ecmascript@0.14.3 ecmascript-runtime@0.7.0 ecmascript-runtime-client@0.10.0 ecmascript-runtime-server@0.9.0 @@ -21,32 +21,32 @@ fetch@0.1.1 geojson-utils@1.0.10 http@1.4.2 id-map@1.1.0 -inter-process-messaging@0.1.0 -local-test:ostrio:files@1.14.0 +inter-process-messaging@0.1.1 +local-test:ostrio:files@1.14.1 logging@1.1.20 meteor@1.9.3 -minimongo@1.4.5 -modern-browsers@0.1.4 +minimongo@1.6.0 +modern-browsers@0.1.5 modules@0.15.0 modules-runtime@0.12.0 -mongo@1.8.0 +mongo@1.10.0 mongo-decimal@0.1.1 mongo-dev-server@1.1.0 mongo-id@1.0.7 -npm-mongo@3.3.0 +npm-mongo@3.7.0 ordered-dict@1.1.0 ostrio:cookies@2.6.0 -ostrio:files@1.14.0 +ostrio:files@1.14.1 promise@0.11.2 -random@1.1.0 +random@1.2.0 reactive-var@1.0.11 reload@1.3.0 retry@1.1.0 routepolicy@1.1.0 -socket-stream-client@0.2.2 +socket-stream-client@0.3.0 tinytest@1.1.0 tracker@1.2.0 underscore@1.0.10 -url@1.2.0 -webapp@1.8.0 +url@1.3.0 +webapp@1.9.1 webapp-hashing@1.0.9 diff --git a/client.js b/client.js index 960a5fe0..23672bf8 100644 --- a/client.js +++ b/client.js @@ -8,7 +8,7 @@ import FilesCollectionCore from './core.js'; import { formatFleURL, helpers } from './lib.js'; const NOOP = () => { }; -const allowedParams = ['debug', 'ddp', 'schema', 'public', 'chunkSize', 'downloadRoute', 'collection', 'collectionName', 'namingFunction', 'onBeforeUpload', 'allowClientCode', 'onbeforeunloadMessage', 'disableUpload']; +const allowedParams = ['debug', 'ddp', 'schema', 'public', 'chunkSize', 'downloadRoute', 'collection', 'collectionName', 'namingFunction', 'onBeforeUpload', 'allowClientCode', 'onbeforeunloadMessage', 'disableUpload', 'allowQueryStringCookies']; /* * @locus Anywhere @@ -110,6 +110,9 @@ export class FilesCollection extends FilesCollectionCore { const setTokenCookie = () => { if (Meteor.connection._lastSessionId) { cookie.set('x_mtok', Meteor.connection._lastSessionId, { path: '/' }); + if (Meteor.isCordova && this.allowQueryStringCookies) { + cookie.send(); + } } }; diff --git a/docs/gridfs-migration.md b/docs/gridfs-migration.md index ef9a851f..c52900c0 100644 --- a/docs/gridfs-migration.md +++ b/docs/gridfs-migration.md @@ -1,30 +1,30 @@ -### Migrating files from GridFS between applications +# Migrating files from GridFS between applications You can share/migrate files between Meteor applications via DDP on a server/database level **without the need for complex setups**. This is due to the circumstance, that GridFS makes use of a normal Mongo.Collection to store metadata and chunks. This topic can be of relevance for Services or Microservices, that don't share a database but have to share their data. -##### Use Case +## Use Case Consider two Meteor applications **C (Consumer)** and **P (Provider)** where C wants to synchronize all files from P. The sync will happen without clients (browsers/devices) being involved and the files and documents won't be mutated. - -##### Step 1 Provide access to the files +### Step 1 Provide access to the files First create three Methods in P that each share one of the three crucial Parts of a `FilesCollection`: -* Sharing the `FilesCollection`'s documents -* Sharing the `fs.files`* metadata for the files' respective subversions -* Sharing the `fs.chunks`* (the actual data) of all stored files and their subversions +- Sharing the `FilesCollection`'s documents +- Sharing the `fs.files`* metadata for the files' respective subversions +- Sharing the `fs.chunks`* (the actual data) of all stored files and their subversions -*This assumes the [default configuration of your GridFS](https://github.com/VeliovGroup/Meteor-Files/wiki/GridFS-Integration) whichs by default using the `db.fs.files` and `db.fs.chunks` collections. -For custom configuration you may consult the JS Mongo Driver documentation on [GridFSBucket](http://mongodb.github.io/node-mongodb-native/3.2/api/GridFSBucket.html). +*This assumes the [default configuration of your GridFS](https://github.com/VeliovGroup/Meteor-Files/wiki/GridFS-Integration) which is by default using the `db.fs.files` and `db.fs.chunks` collections.* -*P/server/sync.js* +*For custom configuration you may consult the JS Mongo Native Driver documentation on [GridFSBucket](http://mongodb.github.io/node-mongodb-native/3.2/api/GridFSBucket.html).* -```javascript +#### P/server/sync.js + +```js import { Meteor } from 'meteor/meteor' import { Mongo } from 'meteor/mongo' import { FilesCollection } from 'meteor/ostrio:files' @@ -49,11 +49,11 @@ function getFilesChunks () { Meteor.methods({getFilesDocuments, getFilesMetadata, getFilesChunks}) ``` -##### Step 2 Create collections and sync method in C +### Step 2 Create collections and sync method in C -*C/server/sync.js* +#### C/server/sync.js -```javascript +```js import { Meteor } from 'meteor/meteor' import { Mongo } from 'meteor/mongo' import { DDP } from 'meteor/ddp-client' @@ -109,19 +109,17 @@ function synchronize (trackerComputation) { // ... code continues in the next step ``` - -##### Step 3 Create a remote DDP connection and run the sync +### Step 3 Create a remote DDP connection and run the sync In your Consumer application C you can now connect to the remote app on the server-side. - -*C/server/sync.js (continued)* +#### C/server/sync.js (continued) ```javascript Meteor.startup(() => { const url = 'p.domain.tld' // get url of P, for example via process.env or Meteor.settings remoteConnection = DDP.connect(url) - + // use Tracker to run the sync when the remoteConnection is "connected" const synchronizeTracker = Meteor.bindEnvironment(synchronize) Tracker.autorun(synchronizeTracker) @@ -129,10 +127,9 @@ Meteor.startup(() => { ``` - -##### Further considerations +### Further considerations You may require authentication for the remote connection, which can be added using [`ongoworks:ddp-login`](https://github.com/reactioncommerce/meteor-ddp-login). A good pattern is to create a user that is only permitted to run the sync methods in P and login with that user from C. The credentials for login can be passed using `process.env` or `Meteor.settings`. -From this point you can configure your methods to sync only a subset of documents or manipulate them before/after sync or remove them after sync. \ No newline at end of file +From this point you can configure your methods to sync only a subset of documents or manipulate them before/after sync or remove them after sync. diff --git a/package.js b/package.js index 2a4232f1..056d5760 100755 --- a/package.js +++ b/package.js @@ -1,6 +1,6 @@ Package.describe({ name: 'ostrio:files', - version: '1.14.0', + version: '1.14.1', summary: 'Upload files to Meteor application, with 3rd party storage support: AWS:S3, GridFS and other', git: 'https://github.com/VeliovGroup/Meteor-Files', documentation: 'README.md' @@ -9,7 +9,7 @@ Package.describe({ Npm.depends({ 'fs-extra': '8.1.0', request: '2.88.2', - 'file-type': '14.1.3', + 'file-type': '14.2.0', eventemitter3: '4.0.0' });