-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathglobal.js
More file actions
37 lines (33 loc) · 1002 Bytes
/
global.js
File metadata and controls
37 lines (33 loc) · 1002 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
// All messages -- data model
// Loaded on both the client and the server
///////////////////////////////////////////////////////////////////////////////
// Messages
/*
Each message is represented by a row in the Messages collection:
name: Name of poster, not verified in any way
hash: A hash of the cifer used to encrypt the message, using sha256
time: ISO format timestamp of when the message was sent.
message: AES encrypted string that contains the message.
*/
Messages = new Meteor.Collection("messages");
Messages.allow({
insert: function () {
return false; // Everything through methods now.
},
update: function () {
return false;
},
remove: function () {
return false;
}
});
Meteor.methods({
postMessage: function (messageHashTable){
Messages.insert({
name: messageHashTable['name'],
message: messageHashTable['message'],
hash: messageHashTable['hash'],
time: ((new Date()).toISOString())
});
}
});