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

@@ -22,26 +22,26 @@
<script src="https://cdnjs.cloudflare.com/ajax/libs/dayjs/1.10.7/dayjs.min.js" integrity="sha512-bwD3VD/j6ypSSnyjuaURidZksoVx3L1RPvTkleC48SbHCZsemT3VKMD39KknPnH728LLXVMTisESIBOAb5/W0Q==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/localforage/1.10.0/localforage.min.js" integrity="sha512-+BMamP0e7wn39JGL8nKAZ3yAQT2dL5oaXWr4ZYlTGkKOaoXM/Yj7c4oy50Ngz5yoUutAG17flueD4F6QpTlPng==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
<!-- JavaScript (JS) end -->
<script type="module">
import {check_for_native_app_update, check_and_copy_app_files, check_and_get_updated_native_app_config} from 'https://dev-cmsc.oneskyit.com/srv/assets/js/init_bootstrap_app.js';
check_for_native_app_update({overwrite: false});
check_and_copy_app_files({overwrite: true});
check_and_get_updated_native_app_config({overwrite: false})
// let native_app_config = load_init_config();
// console.log('Native App Initial Config:', native_app_config);
// const native_app = require('./script');
// let native_app_config = native_app.load_init_config();
// console.log('Native App Initial Config:', native_app_config);
//
//
// let native_app_js_css_base_url = native_app_config.native_app_js_css_base_url;
//
//
// document.aether = {
// name: 'Aether Native App (Electron and Svelte)'
// };
@@ -53,7 +53,7 @@
const native_app = require('./script');
let native_app_config = native_app.load_init_config();
console.log('Native App Initial Config:', native_app_config);
// native_app_config = native_app.load_full_config(native_app_config);
// console.log('Native App Full Config:', native_app_config);
@@ -121,7 +121,7 @@
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 = {}
@@ -137,8 +137,8 @@
page['params'] = null; // For future use or in other contexts
document.aether.page = page;
let aether = JSON.stringify(document.aether);
let aether_cfg = JSON.stringify(document.aether.cfg);
let aether_client = JSON.stringify(document.aether.client);
@@ -148,7 +148,7 @@
sessionStorage.setItem('ae', aether);
sessionStorage.setItem('ae_client', aether_client);
sessionStorage.setItem('ae_page', aether_page);
/* ***** **** *** ** * ### * ** *** **** ***** */
let app_online = false;
@@ -291,6 +291,7 @@
<section id="Main-Nav-Menu"></section>
<main id="Main-Content"></main>
</section>
<section id="Site-Set-Access-Type" class="svelte_target set_access_type"></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
// 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;
}