Making things easier.

This commit is contained in:
Scott Idem
2023-05-26 15:20:32 -04:00
parent 29111e8dce
commit bc4bf6d294
2 changed files with 79 additions and 17 deletions

View File

@@ -121,7 +121,7 @@
document.aether.cfg.idb = { "name": native_app_config.idb_name }; document.aether.cfg.idb = { "name": native_app_config.idb_name };
document.aether.client = { "account_id": native_app_config.account_id, "site_id": native_app_config.site_id, "site_domain_id": native_app_config.site_domain_id, "person_id": null, "user_id": null, "order_cart_id_random": null, "super_check": false, "manager_check": false, "administrator_check": false, "support_check": false, "assistant_check": false, "trusted_check": false, "verified_check": false, "provisional_check": false, "public_check": false, "user_check": false, "logged_in_check": false, "person_check": false, "authenticated_check": false, "anonymous_check": true, "person_group": null, "user_group": null, "orders_closed_count": 0, "order_count": 0, "app_mode": "native" }; document.aether.client = { "account_id": native_app_config.account_id, "site_id": native_app_config.site_id, "site_domain_id": native_app_config.site_domain_id, "person_id": null, "user_id": null, "order_cart_id_random": null, "super_check": false, "manager_check": false, "administrator_check": false, "support_check": false, "assistant_check": false, "trusted_check": false, "verified_check": false, "provisional_check": false, "public_check": false, "user_check": false, "logged_in_check": false, "person_check": false, "authenticated_check": false, "anonymous_check": true, "person_group": null, "user_group": null, "orders_closed_count": 0, "order_count": 0, "app_mode": "native", "administrator_passcode": "11500", "trusted_passcode": "19111", "authenticated_passcode": "20902" };
let page = {} let page = {}
@@ -291,6 +291,7 @@
<section id="Main-Nav-Menu"></section> <section id="Main-Nav-Menu"></section>
<main id="Main-Content"></main> <main id="Main-Content"></main>
</section> </section>
<section id="Site-Set-Access-Type" class="svelte_target set_access_type"></section>
<section id="Site-Footer">Site-Footer</section> <section id="Site-Footer">Site-Footer</section>

View File

@@ -514,9 +514,9 @@ exports.download_hash_file_to_cache = async function ({api_base_url, local_file_
// Download hash file to cache // Download hash file to cache
// Used by Svelte Event Launcher // Used by Svelte Event Launcher
// Updated 2022-10-12 // 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('*** 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)) { if (fs.existsSync(local_file_cache_path)) {
} else { } 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) { if (result) {
console.log('IPC download file process finished successfully'); console.log('IPC download file process finished successfully');
return true; return true;
@@ -578,9 +578,70 @@ exports.download_hash_file_to_cache_v2 = async function ({api_base_url, local_fi
} else { } else {
console.log('IPC Download Result (file being downloaded or something went wrong):', result); console.log('IPC Download Result (file being downloaded or something went wrong):', result);
return false; 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; return download_file_result;
} }