kopia lustrzana https://github.com/FacilMap/facilmap
Only allow using history in writable mode
Otherwise stuff can be reverted, and the write ID can be taken from padData change events.pull/54/merge
rodzic
88483d142e
commit
be37c6b6e1
|
@ -429,8 +429,8 @@ utils.extend(SocketConnection.prototype, {
|
|||
|
||||
listenToHistory: function() {
|
||||
return Promise.resolve().then(() => {
|
||||
if(this.padId == null)
|
||||
throw "No pad ID set.";
|
||||
if(!this.writable)
|
||||
throw "In read-only mode.";
|
||||
|
||||
if(this.historyListener)
|
||||
throw "Already listening to history.";
|
||||
|
@ -450,6 +450,9 @@ utils.extend(SocketConnection.prototype, {
|
|||
if(!this.historyListener)
|
||||
throw "Not listening to history.";
|
||||
|
||||
if(!this.writable)
|
||||
throw "In read-only mode.";
|
||||
|
||||
this.historyListener(); // Unregister db listener
|
||||
this.historyListener = null;
|
||||
},
|
||||
|
@ -461,6 +464,9 @@ utils.extend(SocketConnection.prototype, {
|
|||
if(!utils.stripObject(data, { id: "number" }))
|
||||
throw "Invalid parameters.";
|
||||
|
||||
if(!this.writable)
|
||||
throw "In read-only mode.";
|
||||
|
||||
if(listening)
|
||||
this.socketHandlers.stopListeningToHistory.call(this);
|
||||
|
||||
|
|
Ładowanie…
Reference in New Issue