diff --git a/DocService/sources/DocsCoServer.js b/DocService/sources/DocsCoServer.js index 4e003277..f2b9c24d 100644 --- a/DocService/sources/DocsCoServer.js +++ b/DocService/sources/DocsCoServer.js @@ -4415,3 +4415,22 @@ exports.shutdown = function(req, res) { } }); }; +exports.getEditorConnectionsCount = function (req, res) { + let ctx = new operationContext.Context(); + let count = 0; + try { + ctx.initFromRequest(req); + for (let i = 0; i < connections.length; ++i) { + let conn = connections[i]; + if (!(conn.isCloseCoAuthoring || (conn.user && conn.user.view))) { + count++; + } + } + ctx.logger.info('getConnectionsCount count=%d', count); + } catch (err) { + ctx.logger.error('getConnectionsCount error %s', err.stack); + } finally { + res.setHeader('Content-Type', 'text/plain'); + res.send(count.toString()); + } +}; diff --git a/DocService/sources/server.js b/DocService/sources/server.js index a89fb6c2..222b11c7 100644 --- a/DocService/sources/server.js +++ b/DocService/sources/server.js @@ -239,6 +239,7 @@ docsCoServer.install(server, () => { app.get('/info/info.json', utils.checkClientIp, docsCoServer.licenseInfo); app.put('/internal/cluster/inactive', utils.checkClientIp, docsCoServer.shutdown); app.delete('/internal/cluster/inactive', utils.checkClientIp, docsCoServer.shutdown); + app.get('/internal/connections/edit', docsCoServer.getEditorConnectionsCount); function checkWopiEnable(req, res, next) { //todo may be move code into wopiClient or wopiClient.discovery...