mirror of
https://github.com/Ylianst/MeshCentral.git
synced 2025-03-09 15:40:18 +00:00
Added messenger web application.
This commit is contained in:
parent
79dd5ec5d2
commit
e0e32a5c5b
5 changed files with 130 additions and 9 deletions
|
@ -52,13 +52,18 @@ module.exports.CreateRedirServer = function (parent, db, args, func) {
|
|||
|
||||
// Renter the terms of service.
|
||||
obj.app.get("/MeshServerRootCert.cer", function (req, res) {
|
||||
res.set({ "Cache-Control": "no-cache, no-store, must-revalidate", "Pragma": "no-cache", "Expires": "0", "Content-Type": "application/octet-stream", "Content-Disposition": "attachment; filename=" + obj.certificates.RootName + ".cer" });
|
||||
var rootcert = obj.certificates.root.cert;
|
||||
var i = rootcert.indexOf("-----BEGIN CERTIFICATE-----\r\n");
|
||||
if (i >= 0) { rootcert = rootcert.substring(i + 29); }
|
||||
i = rootcert.indexOf("-----END CERTIFICATE-----");
|
||||
if (i >= 0) { rootcert = rootcert.substring(i, 0); }
|
||||
res.send(new Buffer(rootcert, "base64"));
|
||||
// The redirection server starts before certificates are loaded, make sure to handle the case where no certificate is loaded now.
|
||||
if (obj.certificates != null) {
|
||||
res.set({ "Cache-Control": "no-cache, no-store, must-revalidate", "Pragma": "no-cache", "Expires": "0", "Content-Type": "application/octet-stream", "Content-Disposition": "attachment; filename=" + obj.certificates.RootName + ".cer" });
|
||||
var rootcert = obj.certificates.root.cert;
|
||||
var i = rootcert.indexOf("-----BEGIN CERTIFICATE-----\r\n");
|
||||
if (i >= 0) { rootcert = rootcert.substring(i + 29); }
|
||||
i = rootcert.indexOf("-----END CERTIFICATE-----");
|
||||
if (i >= 0) { rootcert = rootcert.substring(i, 0); }
|
||||
res.send(new Buffer(rootcert, "base64"));
|
||||
} else {
|
||||
res.sendStatus(404);
|
||||
}
|
||||
});
|
||||
|
||||
// Add HTTP security headers to all responses
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue