[feature] Add "internal/connections/edit" handler for container management

This commit is contained in:
Sergey Konovalov
2024-08-27 00:25:27 +03:00
parent 4a1909b03c
commit b355f08148
2 changed files with 20 additions and 0 deletions

View File

@ -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());
}
};

View File

@ -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...