Compare commits

...

3 Commits

Author SHA1 Message Date
Kevin Jahns
013fee2421 v13.0.0-7 -- distribution files 2017-07-22 01:17:21 +02:00
Kevin Jahns
bb45abbb70 13.0.0-7 2017-07-22 01:16:50 +02:00
Kevin Jahns
67b47fd868 bugfix - sync step 2 also authenticates) 2017-07-22 01:15:13 +02:00
9 changed files with 21874 additions and 7 deletions

2
package-lock.json generated
View File

@@ -1,6 +1,6 @@
{
"name": "yjs",
"version": "13.0.0-6",
"version": "13.0.0-7",
"lockfileVersion": 1,
"dependencies": {
"acorn": {

View File

@@ -1,6 +1,6 @@
{
"name": "yjs",
"version": "13.0.0-6",
"version": "13.0.0-7",
"description": "A framework for real-time p2p shared editing on any data",
"main": "./y.node.js",
"browser": "./y.js",

View File

@@ -269,17 +269,20 @@ export default function extendConnector (Y/* :any */) {
})
return Promise.reject(new Error('Incompatible protocol version'))
}
if (message.type === 'sync step 1' && this.connections[sender] != null && this.connections[sender].auth == null) {
if ((message.type === 'sync step 1' || message.type === 'sync step 2') && this.connections[sender] != null && this.connections[sender].auth == null) {
// authenticate using auth in message
var auth = this.checkAuth(message.auth, this.y)
this.connections[sender].auth = auth
auth.then(auth => {
// in case operations were received before sender was received
// we apply the messages after authentication
this.connections[sender].waitingMessages.forEach(msg => {
this.receiveMessage(sender, msg)
this.connections[sender].syncStep2.promise.then(() => {
// we do it after sync step 1
this.connections[sender].waitingMessages.forEach(msg => {
this.receiveMessage(sender, msg)
})
this.connections[sender].waitingMessages = null
})
this.connections[sender].waitingMessages = null
for (var f of this.userEventListeners) {
f({
action: 'userAuthenticated',
@@ -389,7 +392,7 @@ export default function extendConnector (Y/* :any */) {
})
} else if (this.connections[sender] != null) {
// wait for authentication
let senderConn = this.connection[sender]
let senderConn = this.connections[sender]
senderConn.waitingMessages = senderConn.waitingMessages || []
senderConn.waitingMessages.push(message)
} else {

9
y.js Normal file

File diff suppressed because one or more lines are too long

1
y.js.map Normal file

File diff suppressed because one or more lines are too long

4255
y.node.js Normal file

File diff suppressed because it is too large Load Diff

1
y.node.js.map Normal file

File diff suppressed because one or more lines are too long

17597
y.test.js Normal file

File diff suppressed because one or more lines are too long

1
y.test.js.map Normal file

File diff suppressed because one or more lines are too long