mirror of
https://github.com/abraunegg/onedrive
synced 2024-06-17 05:06:17 +02:00
Extend GitHub version check (#1863)
* Extend GitHub version check to be done once per day when running in --monitor * Change notification to also notify GUI if notifications are being utilized
This commit is contained in:
parent
bb889f130e
commit
ff78e84efd
|
@ -36,7 +36,7 @@ void init(string logDir)
|
||||||
// we got an error ..
|
// we got an error ..
|
||||||
writeln("\nUnable to access ", logFilePath);
|
writeln("\nUnable to access ", logFilePath);
|
||||||
writeln("Please manually create '",logFilePath, "' and set appropriate permissions to allow write access");
|
writeln("Please manually create '",logFilePath, "' and set appropriate permissions to allow write access");
|
||||||
writeln("The requested client activity log will instead be located in your users home directory\n");
|
writeln("The requested client activity log will instead be located in your users home directory");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
15
src/main.d
15
src/main.d
|
@ -689,8 +689,10 @@ int main(string[] args)
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
|
|
||||||
// Check application version and Initialize OneDrive API, check for authorization
|
// Check application version and Initialize OneDrive API, check for authorization
|
||||||
|
if (online) {
|
||||||
// Check Application Version
|
// Check Application Version
|
||||||
log.vlog("Checking Application Version ...");
|
log.vlog("Checking Application Version ...");
|
||||||
checkApplicationVersion();
|
checkApplicationVersion();
|
||||||
|
@ -1142,9 +1144,12 @@ int main(string[] args)
|
||||||
bool performMonitor = true;
|
bool performMonitor = true;
|
||||||
ulong monitorLoopFullCount = 0;
|
ulong monitorLoopFullCount = 0;
|
||||||
immutable auto checkInterval = dur!"seconds"(cfg.getValueLong("monitor_interval"));
|
immutable auto checkInterval = dur!"seconds"(cfg.getValueLong("monitor_interval"));
|
||||||
|
immutable auto githubCheckInterval = dur!"seconds"(86400);
|
||||||
immutable long logInterval = cfg.getValueLong("monitor_log_frequency");
|
immutable long logInterval = cfg.getValueLong("monitor_log_frequency");
|
||||||
immutable long fullScanFrequency = cfg.getValueLong("monitor_fullscan_frequency");
|
immutable long fullScanFrequency = cfg.getValueLong("monitor_fullscan_frequency");
|
||||||
MonoTime lastCheckTime = MonoTime.currTime();
|
MonoTime lastCheckTime = MonoTime.currTime();
|
||||||
|
MonoTime lastGitHubCheckTime = MonoTime.currTime();
|
||||||
|
|
||||||
long logMonitorCounter = 0;
|
long logMonitorCounter = 0;
|
||||||
long fullScanCounter = 0;
|
long fullScanCounter = 0;
|
||||||
// set fullScanRequired to true so that at application startup we perform a full walk
|
// set fullScanRequired to true so that at application startup we perform a full walk
|
||||||
|
@ -1205,6 +1210,14 @@ int main(string[] args)
|
||||||
// Skipping uploading this new file as parent path is not in the database: target/2eVPInOMTFNXzRXeNMEoJch5OR9XpGby
|
// Skipping uploading this new file as parent path is not in the database: target/2eVPInOMTFNXzRXeNMEoJch5OR9XpGby
|
||||||
// 'target' should be in the DB, it should also exist online, but because of --resync, it does not exist in the database thus parent check fails
|
// 'target' should be in the DB, it should also exist online, but because of --resync, it does not exist in the database thus parent check fails
|
||||||
if (notificationReceived || (currTime - lastCheckTime > checkInterval) || (monitorLoopFullCount == 0)) {
|
if (notificationReceived || (currTime - lastCheckTime > checkInterval) || (monitorLoopFullCount == 0)) {
|
||||||
|
// Check Application Version against GitHub once per day
|
||||||
|
if (currTime - lastGitHubCheckTime > githubCheckInterval) {
|
||||||
|
// --monitor GitHub Application Version Check time expired
|
||||||
|
checkApplicationVersion();
|
||||||
|
// update when we have performed this check
|
||||||
|
lastGitHubCheckTime = MonoTime.currTime();
|
||||||
|
}
|
||||||
|
|
||||||
// monitor sync loop
|
// monitor sync loop
|
||||||
logOutputMessage = "################################################## NEW LOOP ##################################################";
|
logOutputMessage = "################################################## NEW LOOP ##################################################";
|
||||||
if (displaySyncOptions) {
|
if (displaySyncOptions) {
|
||||||
|
|
|
@ -388,7 +388,11 @@ void checkApplicationVersion() {
|
||||||
// application version is older than available on GitHub
|
// application version is older than available on GitHub
|
||||||
if (applicationVersion < latestVersion) {
|
if (applicationVersion < latestVersion) {
|
||||||
// application version is obsolete and unsupported
|
// application version is obsolete and unsupported
|
||||||
log.log("\nWARNING: Your onedrive client is obsolete and unsupported. Please upgrade your client version.\n");
|
writeln();
|
||||||
|
log.logAndNotify("WARNING: Your onedrive client version is obsolete and unsupported. Please upgrade your client version.");
|
||||||
|
log.vlog("Application version: ", applicationVersion);
|
||||||
|
log.vlog("Version available: ", latestVersion);
|
||||||
|
writeln();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue