few fixes and doc updates

Signed-off-by: si458 <simonsmith5521@gmail.com>

si458 committed Sep 5, 2024 at 19:19 UTC d367b2ed87a35a5ac7278b822abc8685ec6c7a06
6 files changed +51 -12
agents/meshcore.js
-1
@@ -2763,7 +2763,6 @@ function onTunnelData(data)
2763 // Handle tunnel data
2764 if (this.httprequest.protocol == 0) { // 1 = Terminal (admin), 2 = Desktop, 5 = Files, 6 = PowerShell (admin), 7 = Plugin Data Exchange, 8 = Terminal (user), 9 = PowerShell (user), 10 = FileTransfer
2765 // Take a look at the protocol
2766 - if (data[0] == 123) { data = data.toString(); } // convert to string to fix binary data coming from peer servers
2766 if ((data.length > 3) && (data[0] == '{')) { onTunnelControlData(data, this); return; }
2767 this.httprequest.protocol = parseInt(data);
2768 if (typeof this.httprequest.protocol != 'number') { this.httprequest.protocol = 0; }
agents/modules_meshcore/sysinfo.js
+7 -3
@@ -209,9 +209,13 @@ function macos_memUtilization()
209 {
210 var usage = lines[0].split(':')[1];
211 var bdown = usage.split(',');
212 -
213 - mem.MemTotal = parseInt(bdown[0].trim().split(' ')[0]);
214 - mem.MemFree = parseInt(bdown[1].trim().split(' ')[0]);
212 + if (bdown.length > 2){ // new style - PhysMem: 5750M used (1130M wired, 634M compressor), 1918M unused.
213 + mem.MemFree = parseInt(bdown[2].trim().split(' ')[0]);
214 + } else { // old style - PhysMem: 6683M used (1606M wired), 9699M unused.
215 + mem.MemFree = parseInt(bdown[1].trim().split(' ')[0]);
216 + }
217 + mem.MemUsed = parseInt(bdown[0].trim().split(' ')[0]);
218 + mem.MemTotal = (mem.MemFree + mem.MemUsed);
219 mem.percentFree = ((mem.MemFree / mem.MemTotal) * 100);//.toFixed(2);
220 mem.percentConsumed = (((mem.MemTotal - mem.MemFree) / mem.MemTotal) * 100);//.toFixed(2);
221 return (mem);
docs/docs/install/install2.md
+28
@@ -15,6 +15,34 @@ docker pull ghcr.io/ylianst/meshcentral:master
15 !!!warning
16 Do not use the built in mesh update function. Update docker the docker way.
17
18 +### Docker Compose
19 +
20 +```
21 +version: '3'
22 +services:
23 + meshcentral:
24 + restart: unless-stopped # always restart the container unless you stop it
25 + image: ghcr.io/ylianst/meshcentral:1.1.27 # 1.1.27 is a version number OR use master for the master branch of bug fixes
26 + ports:
27 + - 80:80 # HTTP
28 + - 443:443 # HTTPS
29 + - 4433:4433 # AMT (Optional)
30 + volumes:
31 + - data:/opt/meshcentral/meshcentral-data # config.json and other important files live here
32 + - user_files:/opt/meshcentral/meshcentral-files # where file uploads for users live
33 + - backup:/opt/meshcentral/meshcentral-backups # location for the meshcentral backups - this should be mounted to an external storage
34 + - web:/opt/meshcentral/meshcentral-web # location for site customization files
35 +volumes:
36 + data:
37 + driver: local
38 + user_files:
39 + driver: local
40 + backup:
41 + driver: local
42 + web:
43 + driver: local
44 +```
45 +
46 ## Quick Start
47
48 For some who want to skip this document entirely, there are quick install scripts that will get a MeshCentral2 instance up and running on Linux in a few minutes. These scripts will pretty much do what this document explains very rapidly. Right now, there are two such scripts available:
docs/docs/meshcentral/openidConnectStrategy.md
+3 -3
@@ -104,7 +104,7 @@ There are plenty of options at your disposal if you need them. In fact, you can
104 "issuer": "https://sso.your.domain",
105 "authorization_endpoint": "https://auth.your.domain/auth-endpoint",
106 "token_endpoint": "https://tokens.sso.your.domain/token-endpoint",
107 - "endsession_endpoint": "https://sso.your.domain/logout",
107 + "end_session_endpoint": "https://sso.your.domain/logout",
108 "jwks_uri": "https://sso.your.domain/jwks-uri"
109 },
110 "client": {
@@ -161,14 +161,14 @@ In the advanced example config above, did you notice that the issuer property ha
161 "issuer": "https://sso.your.domain",
162 "authorization_endpoint": "https://auth.your.domain/auth-endpoint",
163 "token_endpoint": "https://tokens.sso.your.domain/token-endpoint",
164 - "endsession_endpoint": "https://sso.your.domain/logout",
164 + "end_session_endpoint": "https://sso.your.domain/logout",
165 "jwks_uri": "https://sso.your.domain/jwks-uri"
166 },
167 ```
168
169 #### *Required and Commonly Used Configs*
170
171 -The `issuer` property in the `issuer` object is the only one required, and its only required if you aren't using a preset. Besides the issuer, these are mostly options related to the endpoints and their configuration. The schema below looks intimidating but it comes down to being able to support any IdP. Setting the issuer, and endsession_endpoint are the two main ones you want to setup.
171 +The `issuer` property in the `issuer` object is the only one required, and its only required if you aren't using a preset. Besides the issuer, these are mostly options related to the endpoints and their configuration. The schema below looks intimidating but it comes down to being able to support any IdP. Setting the issuer, and end_session_endpoint are the two main ones you want to setup.
172
173 #### *Schema*
174
meshcentral.js
+12 -4
@@ -3926,10 +3926,18 @@ function InstallModules(modules, args, func) {
3926 for (var i in modules) {
3927 // Modules may contain a version tag (foobar@1.0.0), remove it so the module can be found using require
3928 const moduleNameAndVersion = modules[i];
3929 - const moduleInfo = moduleNameAndVersion.split('@', 2);
3930 - var moduleName = moduleInfo[0];
3931 - var moduleVersion = moduleInfo[1];
3932 - if (moduleName == '') { moduleName = moduleNameAndVersion; moduleVersion = null; } // If the module name starts with @, don't use @ as a version seperator.
3929 + const moduleInfo = moduleNameAndVersion.split('@', 3);
3930 + var moduleName = null;
3931 + var moduleVersion = null;
3932 + if(moduleInfo.length == 1){ // normal package without version
3933 + moduleName = moduleInfo[0];
3934 + } else if (moduleInfo.length == 2) { // normal package with a version OR custom repo package with no version
3935 + moduleName = moduleInfo[0] === '' ? moduleNameAndVersion : moduleInfo[0];
3936 + moduleVersion = moduleInfo[0] === '' ? null : moduleInfo[1];
3937 + } else if (moduleInfo.length == 3) { // custom repo package and package with a version
3938 + moduleName = "@" + moduleInfo[1];
3939 + moduleVersion = moduleInfo[2];
3940 + }
3941 try {
3942 // Does the module need a specific version?
3943 if (moduleVersion) {
views/default.handlebars
+1 -1
@@ -11762,7 +11762,7 @@
11762 if (start >= data.byteLength) {
11763 files.sendText(JSON.stringify({ action: 'uploaddone', reqid: uploadFile.xfilePtr }));
11764 } else {
11765 - var end = uploadFile.xptr + (attemptWebRTC ? 16384 : 65536);
11765 + var end = uploadFile.xptr + (attemptWebRTC ? 16384 : 65536);
11766 if (end > data.byteLength) { if (dataPriming == true) { return; } end = data.byteLength; }
11767 var dataslice = new Uint8Array(data.slice(start, end))
11768 if ((dataslice[0] == 123) || (dataslice[0] == 0)) {