1
0
Fork 0
mirror of https://github.com/overleaf/overleaf.git synced 2025-04-22 22:17:41 +00:00

[misc] optionally expose the hostname in the 'debug.getHostname' rpc

This commit is contained in:
Jakob Ackermann 2020-07-06 14:27:46 +01:00
parent aa9d6c8dc9
commit 9fff03bca5
2 changed files with 18 additions and 0 deletions
services/real-time

View file

@ -21,6 +21,8 @@ const httpAuth = basicAuth(function (user, pass) {
return isValid
})
const HOSTNAME = require('os').hostname()
let Router
module.exports = Router = {
_handleError(callback, error, client, method, attrs) {
@ -157,6 +159,19 @@ module.exports = Router = {
user = { _id: 'anonymous-user' }
}
if (settings.exposeHostname) {
client.on('debug.getHostname', function (callback) {
if (typeof callback !== 'function') {
return Router._handleInvalidArguments(
client,
'debug.getHostname',
arguments
)
}
callback(HOSTNAME)
})
}
client.on('joinProject', function (data, callback) {
data = data || {}
if (typeof callback !== 'function') {

View file

@ -109,6 +109,9 @@ const settings = {
cookieName: process.env.COOKIE_NAME || 'sharelatex.sid',
// Expose the hostname in the `debug.getHostname` rpc
exposeHostname: process.env.EXPOSE_HOSTNAME === 'true',
max_doc_length: 2 * 1024 * 1024, // 2mb
// combine