1
0
mirror of https://github.com/Ylianst/MeshCentralRouter synced 2025-12-06 00:13:33 +00:00

Added -noupdate switch.

This commit is contained in:
Ylian Saint-Hilaire
2022-05-24 15:50:24 -07:00
parent c0d7435b81
commit 3a1e8671be
3 changed files with 1485 additions and 937 deletions

View File

@@ -49,6 +49,7 @@ namespace MeshCentralRouter
public bool forceExit = false;
public bool sendEmailToken = false;
public bool sendSMSToken = false;
public bool allowUpdates = true;
public Uri authLoginUrl = null;
public Process installProcess = null;
public string acceptableCertHash = null;
@@ -229,6 +230,7 @@ namespace MeshCentralRouter
if (arg.ToLower() == "-oldstyle") { deviceListViewMode = false; }
if (arg.ToLower() == "-install") { hookRouter(); forceExit = true; return; }
if (arg.ToLower() == "-uninstall") { unHookRouter(); forceExit = true; return; }
if (arg.ToLower() == "-noupdate") { allowUpdates = false; return; }
if (arg.ToLower() == "-debug") { debug = true; }
if (arg.ToLower() == "-tlsdump") { tlsdump = true; }
if (arg.ToLower() == "-ignorecert") { ignoreCert = true; }
@@ -554,7 +556,7 @@ namespace MeshCentralRouter
meshcentral.onLoginTokenChanged += Meshcentral_onLoginTokenChanged;
meshcentral.onClipboardData += Meshcentral_onClipboardData;
meshcentral.onTwoFactorCookie += Meshcentral_onTwoFactorCookie;
//meshcentral.onToolUpdate += Meshcentral_onToolUpdate;
if (allowUpdates) { meshcentral.onToolUpdate += Meshcentral_onToolUpdate; }
if (lastBadConnectCert != null)
{
meshcentral.okCertHash = lastBadConnectCert.GetCertHashString();
@@ -632,7 +634,7 @@ namespace MeshCentralRouter
meshcentral.onLoginTokenChanged += Meshcentral_onLoginTokenChanged;
meshcentral.onClipboardData += Meshcentral_onClipboardData;
meshcentral.onTwoFactorCookie += Meshcentral_onTwoFactorCookie;
meshcentral.onToolUpdate += Meshcentral_onToolUpdate;
if (allowUpdates) { meshcentral.onToolUpdate += Meshcentral_onToolUpdate; }
meshcentral.okCertHash = lastBadConnectCert.GetCertHashString();
Uri serverurl = null;
@@ -1405,7 +1407,7 @@ namespace MeshCentralRouter
meshcentral.onLoginTokenChanged += Meshcentral_onLoginTokenChanged;
meshcentral.onClipboardData += Meshcentral_onClipboardData;
meshcentral.onTwoFactorCookie += Meshcentral_onTwoFactorCookie;
meshcentral.onToolUpdate += Meshcentral_onToolUpdate;
if (allowUpdates) { meshcentral.onToolUpdate += Meshcentral_onToolUpdate; }
if (sendEmailToken == true)
{
sendEmailToken = false;

File diff suppressed because it is too large Load Diff

View File

@@ -262,7 +262,7 @@ namespace MeshCentralRouter
wc.SendString("{\"action\":\"nodes\"}");
wc.SendString("{\"action\":\"authcookie\"}");
wc.SendString("{\"action\":\"logincookie\"}");
wc.SendString("{\"action\":\"meshToolInfo\",\"name\":\"MeshCentralRouter\"}");
if (onToolUpdate != null) { wc.SendString("{\"action\":\"meshToolInfo\",\"name\":\"MeshCentralRouter\"}"); }
break;
}
case "authcookie":
@@ -708,7 +708,10 @@ namespace MeshCentralRouter
if (jsonAction.ContainsKey("serverhash")) { serverhash = jsonAction["serverhash"].ToString(); }
// If the hashes don't match, event the tool update with URL
if (selfExecutableHashHex != hash) { onToolUpdate((string)url, (string)jsonAction["hash"], (int)jsonAction["size"], serverhash); }
if (selfExecutableHashHex != hash) {
if (debug) { try { File.AppendAllText("debug.log", "Self-executable hash mismatch, update available.\r\n"); } catch (Exception) { } }
onToolUpdate((string)url, (string)jsonAction["hash"], (int)jsonAction["size"], serverhash);
}
}
break;
}