-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
56 changed files
with
2,154 additions
and
221 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,7 +18,14 @@ [email protected] # Enable ECMAScript2015+ syntax in app code | |
[email protected] # Server-side component of the `meteor shell` command | ||
|
||
planettraining:material-design-icons-font | ||
react-meteor-data | ||
nimble:restivus | ||
accounts-password | ||
alanning:roles | ||
mdg:validated-method | ||
ddp-rate-limiter | ||
universe:i18n | ||
react-meteor-data | ||
aldeed:collection2-core | ||
aldeed:schema-deny | ||
session | ||
less |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,5 +3,5 @@ | |
</head> | ||
|
||
<body> | ||
<div id="render-target"></div> | ||
<div id="app"></div> | ||
</body> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,7 @@ | ||
import React from 'react'; | ||
import { Meteor } from 'meteor/meteor'; | ||
import { render } from 'react-dom'; | ||
|
||
import App from '../imports/ui/App.js'; | ||
import { renderRoutes } from '../imports/startup/client/routes.js'; | ||
|
||
Meteor.startup(() => { | ||
render(<App />, document.getElementById('render-target')); | ||
render(renderRoutes(), document.getElementById('app')); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
@import "{}/imports/ui/stylesheets/reset.less"; | ||
|
||
// Global namespace | ||
@import "{}/imports/ui/stylesheets/base.less"; | ||
@import '{}/imports/ui/stylesheets/button.less'; | ||
@import '{}/imports/ui/stylesheets/form.less'; | ||
@import '{}/imports/ui/stylesheets/link.less'; | ||
@import '{}/imports/ui/stylesheets/nav.less'; | ||
@import '{}/imports/ui/stylesheets/fade-transition.less'; | ||
|
||
// App layout | ||
@import "{}/imports/ui/layouts/App.less"; | ||
|
||
// Pages | ||
@import "{}/imports/ui/pages/NotFoundPage.less"; | ||
|
||
// Components | ||
@import "{}/imports/ui/components/ConnectionNotification.less"; | ||
@import "{}/imports/ui/components/Loading.less"; | ||
@import "{}/imports/ui/components/Message.less"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
{ | ||
"components": { | ||
"connectionNotification": { | ||
"tryingToConnect": "Trying to connect", | ||
"connectionIssue": "There seems to be a connection issue" | ||
} | ||
}, | ||
"pages": { | ||
"notFoundPage": { | ||
"pageNotFound": "Page not found" | ||
} | ||
}, | ||
"api": { | ||
"recipients": { | ||
"insert": { | ||
"accessDenied": "Cannot add recipients without permissions" | ||
} | ||
} | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
import { Meteor } from 'meteor/meteor'; | ||
import { _ } from 'meteor/underscore'; | ||
import { ValidatedMethod } from 'meteor/mdg:validated-method'; | ||
import SimpleSchema from 'simpl-schema'; | ||
import { DDPRateLimiter } from 'meteor/ddp-rate-limiter'; | ||
import { Roles } from 'meteor/alanning:roles'; | ||
|
||
import { Recipients } from './recipients.js'; | ||
|
||
export const insert = new ValidatedMethod({ | ||
name: 'recipients.insert', | ||
validate: Recipients.simpleSchema().pick(['email', 'customerId']).validator({ clean: true, filter: false }), | ||
run({ email, customerId }) { | ||
if(!this.userId || !Roles.userIsInRole(this.userId, ['admin'])) { | ||
throw new Meteor.Error('recipients.insert.accessDenied', | ||
'Cannot add recipients without permissions'); | ||
} | ||
// TODO: Private+PublicKey | ||
const recipient = { | ||
email, | ||
customerId, | ||
createdAt: new Date(), | ||
}; | ||
|
||
Recipients.insert(todo); | ||
}, | ||
}); | ||
|
||
// Get list of all method names on Recipients | ||
const RECIPIENTS_METHODS = _.pluck([ | ||
insert | ||
], 'name'); | ||
|
||
if (Meteor.isServer) { | ||
// Only allow 5 recipient operations per connection per second | ||
DDPRateLimiter.addRule({ | ||
name(name) { | ||
return _.contains(RECIPIENTS_METHODS, name); | ||
}, | ||
|
||
// Rate limit per connection ID | ||
connectionId() { return true; }, | ||
}, 5, 1000); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
import { Mongo } from 'meteor/mongo'; | ||
import SimpleSchema from 'simpl-schema'; | ||
|
||
class RecipientsCollection extends Mongo.Collection { | ||
insert(recipient, callback) { | ||
const ourRecipient = recipient; | ||
ourRecipient.createdAt = ourRecipient.createdAt || new Date(); | ||
const result = super.insert(ourRecipient, callback); | ||
return result; | ||
} | ||
update(selector, modifier) { | ||
const result = super.update(selector, modifier); | ||
return result; | ||
} | ||
remove(selector) { | ||
const result = super.remove(selector); | ||
return result; | ||
} | ||
} | ||
|
||
export const Recipients = new RecipientsCollection('recipients'); | ||
|
||
// Deny all client-side updates since we will be using methods to manage this collection | ||
Recipients.deny({ | ||
insert() { return true; }, | ||
update() { return true; }, | ||
remove() { return true; }, | ||
}); | ||
|
||
Recipients.schema = new SimpleSchema({ | ||
_id: { | ||
type: String, | ||
regEx: SimpleSchema.RegEx.Id, | ||
}, | ||
email: { | ||
type: String, | ||
denyUpdate: true, | ||
}, | ||
customerId: { | ||
type: String, | ||
denyUpdate: false, | ||
}, | ||
privateKey: { | ||
type: String, | ||
max: 100, | ||
denyUpdate: true, | ||
}, | ||
publicKey: { | ||
type: String, | ||
max: 100, | ||
denyUpdate: true, | ||
}, | ||
createdAt: { | ||
type: Date, | ||
denyUpdate: true, | ||
} | ||
}); | ||
|
||
Recipients.attachSchema(Recipients.schema); | ||
|
||
// This represents the keys from Recipient objects that should be published | ||
// to the client. If we add secret properties to Recipient objects, don't list | ||
// them here to keep them private to the server. | ||
Recipients.publicFields = { | ||
customerId: 1, | ||
publicKey: 1, | ||
createdAt: 1 | ||
}; |
Oops, something went wrong.