mirror of
https://github.com/abraunegg/onedrive
synced 2024-06-08 17:02:25 +02:00
Update PR
* Update PR
This commit is contained in:
parent
f28bf7ae75
commit
3f5a4fa29c
|
@ -532,12 +532,13 @@ int main(string[] cliArgs) {
|
||||||
|
|
||||||
// Do we perform a sync with OneDrive?
|
// Do we perform a sync with OneDrive?
|
||||||
if (notificationReceived || (currentTime - lastCheckTime > checkOnlineInterval) || (monitorLoopFullCount == 0)) {
|
if (notificationReceived || (currentTime - lastCheckTime > checkOnlineInterval) || (monitorLoopFullCount == 0)) {
|
||||||
|
// Increment monitorLoopFullCount
|
||||||
|
monitorLoopFullCount++;
|
||||||
log.vdebug(loopStartOutputMessage);
|
log.vdebug(loopStartOutputMessage);
|
||||||
|
log.vdebug("Loop Number: ", monitorLoopFullCount);
|
||||||
log.log("Starting a sync with Microsoft OneDrive");
|
log.log("Starting a sync with Microsoft OneDrive");
|
||||||
SysTime startFunctionProcessingTime = Clock.currTime();
|
SysTime startFunctionProcessingTime = Clock.currTime();
|
||||||
log.vdebug("Start Monitor Loop Time: ", startFunctionProcessingTime);
|
log.vdebug("Start Monitor Loop Time: ", startFunctionProcessingTime);
|
||||||
// Increment monitorLoopFullCount
|
|
||||||
monitorLoopFullCount++;
|
|
||||||
|
|
||||||
// Did the user specify --upload-only?
|
// Did the user specify --upload-only?
|
||||||
if (appConfig.getValueBool("upload_only")) {
|
if (appConfig.getValueBool("upload_only")) {
|
||||||
|
|
|
@ -284,13 +284,13 @@ class OneDriveApi {
|
||||||
} else {
|
} else {
|
||||||
// Try and read the value from the appConfig if it is set, rather than trying to read the value from disk
|
// Try and read the value from the appConfig if it is set, rather than trying to read the value from disk
|
||||||
if (!appConfig.refreshToken.empty) {
|
if (!appConfig.refreshToken.empty) {
|
||||||
|
log.vdebug("read token from appConfig");
|
||||||
refreshToken = appConfig.refreshToken;
|
refreshToken = appConfig.refreshToken;
|
||||||
authorised = true;
|
authorised = true;
|
||||||
} else {
|
} else {
|
||||||
// Try and read the file from disk
|
// Try and read the file from disk
|
||||||
try {
|
try {
|
||||||
refreshToken = readText(appConfig.refreshTokenFilePath);
|
refreshToken = readText(appConfig.refreshTokenFilePath);
|
||||||
|
|
||||||
// is the refresh_token empty?
|
// is the refresh_token empty?
|
||||||
if (refreshToken.empty) {
|
if (refreshToken.empty) {
|
||||||
log.error("refreshToken exists but is empty: ", appConfig.refreshTokenFilePath);
|
log.error("refreshToken exists but is empty: ", appConfig.refreshTokenFilePath);
|
||||||
|
@ -298,6 +298,8 @@ class OneDriveApi {
|
||||||
} else {
|
} else {
|
||||||
// existing token not empty
|
// existing token not empty
|
||||||
authorised = true;
|
authorised = true;
|
||||||
|
// update appConfig.refreshToken
|
||||||
|
appConfig.refreshToken = refreshToken;
|
||||||
}
|
}
|
||||||
} catch (FileException e) {
|
} catch (FileException e) {
|
||||||
authorised = authorise();
|
authorised = authorise();
|
||||||
|
@ -308,6 +310,11 @@ class OneDriveApi {
|
||||||
authorised = false;
|
authorised = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (refreshToken.empty) {
|
||||||
|
// PROBLEM
|
||||||
|
writeln("refreshToken is empty !!!!!!!!!! will cause 4xx errors");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// Return if we are authorised
|
// Return if we are authorised
|
||||||
log.vdebug("Authorised State: ", authorised);
|
log.vdebug("Authorised State: ", authorised);
|
||||||
|
|
10
src/sync.d
10
src/sync.d
|
@ -1773,12 +1773,16 @@ class SyncEngine {
|
||||||
// Function variables
|
// Function variables
|
||||||
JSONValue deltaChangesBundle;
|
JSONValue deltaChangesBundle;
|
||||||
// Get the /delta data for this account | driveId | deltaLink combination
|
// Get the /delta data for this account | driveId | deltaLink combination
|
||||||
|
// Create a new API Instance for this thread and initialise it
|
||||||
|
OneDriveApi getDeltaQueryOneDriveApiInstance;
|
||||||
|
getDeltaQueryOneDriveApiInstance = new OneDriveApi(appConfig);
|
||||||
|
getDeltaQueryOneDriveApiInstance.initialise();
|
||||||
try {
|
try {
|
||||||
deltaChangesBundle = oneDriveApiInstance.viewChangesByItemId(selectedDriveId, selectedItemId, providedDeltaLink);
|
deltaChangesBundle = getDeltaQueryOneDriveApiInstance.viewChangesByItemId(selectedDriveId, selectedItemId, providedDeltaLink);
|
||||||
} catch (OneDriveException exception) {
|
} catch (OneDriveException exception) {
|
||||||
log.vdebug("deltaChangesBundle = oneDriveApiInstance.viewChangesByItemId() generated a OneDriveException");
|
log.vdebug("deltaChangesBundle = oneDriveApiInstance.viewChangesByItemId() generated a OneDriveException");
|
||||||
// display error and exit
|
// display error message
|
||||||
defaultUnhandledHTTPErrorCode(exception);
|
displayOneDriveErrorMessage(exception.msg, getFunctionName!({}));
|
||||||
}
|
}
|
||||||
|
|
||||||
// If the JSON response is a correct JSON object, and has an 'id' we can set these details
|
// If the JSON response is a correct JSON object, and has an 'id' we can set these details
|
||||||
|
|
Loading…
Reference in a new issue