Making things easier.
This commit is contained in:
@@ -514,9 +514,9 @@ exports.download_hash_file_to_cache = async function ({api_base_url, local_file_
|
||||
// Download hash file to cache
|
||||
// Used by Svelte Event Launcher
|
||||
// Updated 2022-10-12
|
||||
exports.download_hash_file_to_cache_v2 = async function ({api_base_url, local_file_cache_path, event_file_id=null, hash=null, verify_hash=true, overwrite_existing=false}) {
|
||||
exports.download_hash_file_to_cache_v2 = async function ({api_base_url, api_base_url_backup, local_file_cache_path, event_file_id=null, hash=null, verify_hash=true, overwrite_existing=false}) {
|
||||
console.log('*** Aether App Native export: download_hash_file_to_cache_v2() ***');
|
||||
console.log(`Base URL: ${api_base_url}; Host File Cache Path: ${local_file_cache_path}; Event File ID: ${event_file_id}; Hash: ${hash}`);
|
||||
console.log(`Base URL: ${api_base_url}; Base URL Backup: ${api_base_url_backup}; Host File Cache Path: ${local_file_cache_path}; Event File ID: ${event_file_id}; Hash: ${hash}`);
|
||||
|
||||
if (fs.existsSync(local_file_cache_path)) {
|
||||
} else {
|
||||
@@ -568,7 +568,7 @@ exports.download_hash_file_to_cache_v2 = async function ({api_base_url, local_fi
|
||||
}
|
||||
}
|
||||
|
||||
let download_file_result = await ipcRenderer.invoke('download_file', api_base_url, endpoint, full_cached_hash_path, hash, verify_hash, overwrite_existing).then((result) => {
|
||||
let download_file_result = await ipcRenderer.invoke('download_file', api_base_url, endpoint, full_cached_hash_path, hash, verify_hash, overwrite_existing).then(async (result) => {
|
||||
if (result) {
|
||||
console.log('IPC download file process finished successfully');
|
||||
return true;
|
||||
@@ -578,9 +578,70 @@ exports.download_hash_file_to_cache_v2 = async function ({api_base_url, local_fi
|
||||
} else {
|
||||
console.log('IPC Download Result (file being downloaded or something went wrong):', result);
|
||||
return false;
|
||||
|
||||
// if (api_base_url_backup) {
|
||||
// console.log(`Download FAILED! Trying again with backup API server. API Backup: ${api_base_url_backup}`);
|
||||
// let download_backup_file_result = await ipcRenderer.invoke('download_file', api_base_url_backup, endpoint, full_cached_hash_path, hash, verify_hash, overwrite_existing).then((result_backup) => {
|
||||
// if (result_backup) {
|
||||
// console.log('IPC download file (from backup) process finished successfully');
|
||||
// return true;
|
||||
// } else if (result_backup == null) {
|
||||
// console.log('IPC Download Result (from backup) (file not found?):', result_backup);
|
||||
// return null;
|
||||
// } else {
|
||||
// console.log('IPC Download Result (from backup) (file being downloaded or something went wrong):', result_backup);
|
||||
// return false;
|
||||
// }
|
||||
// });
|
||||
// } else {
|
||||
// return false;
|
||||
// }
|
||||
}
|
||||
return true;
|
||||
// });
|
||||
}).then(async (result) => {
|
||||
if (result === false) {
|
||||
if (api_base_url_backup) {
|
||||
console.log(`IPC Download FAILED! Trying again with backup API server. API Backup: ${api_base_url_backup}`);
|
||||
let download_backup_file_result = await ipcRenderer.invoke('download_file', api_base_url_backup, endpoint, full_cached_hash_path, hash, verify_hash, overwrite_existing).then((result_backup) => {
|
||||
if (result_backup) {
|
||||
console.log('IPC download file (from backup) process finished successfully');
|
||||
return true;
|
||||
} else if (result_backup == null) {
|
||||
console.log('IPC Download Result (from backup) (file not found?):', result_backup);
|
||||
return null;
|
||||
} else {
|
||||
console.log('IPC Download Result (from backup) (file being downloaded or something went wrong):', result_backup);
|
||||
return false;
|
||||
}
|
||||
});
|
||||
return download_backup_file_result;
|
||||
} else {
|
||||
console.log(`IPC Download FAILED! No backup API server passed. Returning false.`);
|
||||
return false;
|
||||
}
|
||||
|
||||
} else {
|
||||
return result;
|
||||
}
|
||||
});
|
||||
|
||||
// if (download_file_result === false) {
|
||||
// console.log(`Download FAILED! Trying again with backup API server. API Backup: ${api_base_url_backup}`)
|
||||
// download_file_result = await ipcRenderer.invoke('download_file', api_base_url_backup, endpoint, full_cached_hash_path, hash, verify_hash, overwrite_existing).then((result) => {
|
||||
// if (result) {
|
||||
// console.log('IPC download file (from backup) process finished successfully');
|
||||
// return true;
|
||||
// } else if (result == null) {
|
||||
// console.log('IPC Download Result (from backup) (file not found?):', result);
|
||||
// return null;
|
||||
// } else {
|
||||
// console.log('IPC Download Result (from backup) (file being downloaded or something went wrong):', result);
|
||||
// return false;
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
|
||||
return download_file_result;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user