mirror of
https://github.com/Ylianst/MeshCentral.git
synced 2024-09-11 08:55:32 +03:00
Improved HTTP sharing domains.
This commit is contained in:
parent
5a679d583a
commit
aba5de4e0d
@ -296,7 +296,8 @@
|
||||
"NIET ACTIEF"
|
||||
],
|
||||
"statusDescription": "Huidige agent status",
|
||||
"description": "Klik op de onderstaande knoppen om de mesh-agent te installeren of te verwijderen. Na installatie wordt deze software op de achtergrond uitgevoerd, zodat deze computer kan worden beheerd en bestuurd door een externe beheerder."
|
||||
"description": "Klik op de onderstaande knoppen om de mesh-agent te installeren of te verwijderen. Na installatie wordt deze software op de achtergrond uitgevoerd, zodat deze computer kan worden beheerd en bestuurd door een externe beheerder.",
|
||||
"graphicalerror": "De grafische versie van dit installatieprogramma kan niet op dit systeem worden uitgevoerd"
|
||||
},
|
||||
"pt": {
|
||||
"agent": "Agente",
|
||||
|
27
webserver.js
27
webserver.js
@ -5003,26 +5003,8 @@ module.exports.CreateWebServer = function (parent, db, args, certificates) {
|
||||
// Extend the session time by forcing a change to the session every minute.
|
||||
if (req.session.userid != null) { req.session.nowInMinutes = Math.floor(Date.now() / 60e3); } else { delete req.session.nowInMinutes; }
|
||||
|
||||
// Detect if this is a file sharing domain, if so, just share files.
|
||||
if ((domain != null) && (domain.share != null)) {
|
||||
var rpath;
|
||||
if (domain.dns == null) { rpath = req.url.split('/'); rpath.splice(1, 1); rpath = rpath.join('/'); } else { rpath = req.url; }
|
||||
if ((req.headers != null) && (req.headers.upgrade)) {
|
||||
// If this is a websocket, stop here.
|
||||
res.sendStatus(404);
|
||||
} else {
|
||||
// Check if the file exists, if so, serve it.
|
||||
var fpath = obj.path.join(domain.share, rpath);
|
||||
if (rpath == '') {
|
||||
res.redirect(req.url + '/' + getQueryPortion(req));
|
||||
} else {
|
||||
obj.fs.exists(fpath, function (exists) { if (exists == true) { res.sendFile(rpath, { root: domain.share }); } else { next(); } });
|
||||
}
|
||||
}
|
||||
} else {
|
||||
//if (parent.config.settings.accesscontrolalloworigin != null) { headers['Access-Control-Allow-Origin'] = parent.config.settings.accesscontrolalloworigin; }
|
||||
// Continue processing the request
|
||||
return next();
|
||||
}
|
||||
});
|
||||
|
||||
if (obj.agentapp) {
|
||||
@ -5058,10 +5040,15 @@ module.exports.CreateWebServer = function (parent, db, args, certificates) {
|
||||
});
|
||||
}
|
||||
|
||||
// Setup all sharing domains
|
||||
for (var i in parent.config.domains) {
|
||||
if ((parent.config.domains[i].dns == null) && (parent.config.domains[i].share != null)) { obj.app.use(parent.config.domains[i].url, obj.express.static(parent.config.domains[i].share)); }
|
||||
}
|
||||
|
||||
// Setup all HTTP handlers
|
||||
if (parent.multiServer != null) { obj.app.ws('/meshserver.ashx', function (ws, req) { parent.multiServer.CreatePeerInServer(parent.multiServer, ws, req, obj.args.tlsoffload == null); }); }
|
||||
for (var i in parent.config.domains) {
|
||||
if (parent.config.domains[i].dns != null) { continue; } // This is a subdomain with a DNS name, no added HTTP bindings needed.
|
||||
if ((parent.config.domains[i].dns != null) || (parent.config.domains[i].share != null)) { continue; } // This is a subdomain with a DNS name, no added HTTP bindings needed.
|
||||
var domain = parent.config.domains[i];
|
||||
var url = domain.url;
|
||||
if (domain.rootredirect == null) {
|
||||
|
Loading…
Reference in New Issue
Block a user