mirror of
https://github.com/ONLYOFFICE/server.git
synced 2026-04-07 14:04:35 +08:00
[feature] Add "internal/connections/edit" handler for container management
This commit is contained in:
@ -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());
|
||||
}
|
||||
};
|
||||
|
||||
@ -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...
|
||||
|
||||
Reference in New Issue
Block a user