total5 0.0.10-1 → 0.0.10-2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/changelog.txt +1 -0
- package/flow-flowstream.js +14 -3
- package/package.json +1 -1
package/changelog.txt
CHANGED
package/flow-flowstream.js
CHANGED
|
@@ -1753,7 +1753,7 @@ exports.io = function(flowstreamid, id, callback) {
|
|
|
1753
1753
|
});
|
|
1754
1754
|
};
|
|
1755
1755
|
|
|
1756
|
-
exports.socket = function(flow, socket, check) {
|
|
1756
|
+
exports.socket = function(flow, socket, verify, check) {
|
|
1757
1757
|
|
|
1758
1758
|
if (typeof(flow) === 'string')
|
|
1759
1759
|
flow = FLOWS[flow];
|
|
@@ -1779,8 +1779,8 @@ exports.socket = function(flow, socket, check) {
|
|
|
1779
1779
|
};
|
|
1780
1780
|
|
|
1781
1781
|
socket.on('open', function(client) {
|
|
1782
|
-
if (
|
|
1783
|
-
|
|
1782
|
+
if (verify)
|
|
1783
|
+
verify(client, () => newclient(client));
|
|
1784
1784
|
else
|
|
1785
1785
|
newclient(client);
|
|
1786
1786
|
});
|
|
@@ -1807,6 +1807,17 @@ exports.socket = function(flow, socket, check) {
|
|
|
1807
1807
|
|
|
1808
1808
|
socket.on('message', function(client, msg) {
|
|
1809
1809
|
if (client.isflowstreamready) {
|
|
1810
|
+
|
|
1811
|
+
// It can check permissions
|
|
1812
|
+
if (check) {
|
|
1813
|
+
let err = check(client, msg);
|
|
1814
|
+
if (err !== true) {
|
|
1815
|
+
if (msg.callbackid)
|
|
1816
|
+
client.send({ callbackid: msg.callbackid, error: typeof(err) === 'string' ? err : '401' });
|
|
1817
|
+
return;
|
|
1818
|
+
}
|
|
1819
|
+
}
|
|
1820
|
+
|
|
1810
1821
|
if (flow.isworkerthread)
|
|
1811
1822
|
flow.postMessage2({ TYPE: 'ui/message', clientid: client.id, data: msg });
|
|
1812
1823
|
else
|