From f6fab17e0007cafec63d5c5dada91938c62f24c9 Mon Sep 17 00:00:00 2001 From: Scott Idem Date: Fri, 6 May 2022 15:09:12 -0400 Subject: [PATCH] Fixed base URL variable names --- app/js/aether_native_app_v3.js | 6 +++--- index.js | 14 +++++++------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/app/js/aether_native_app_v3.js b/app/js/aether_native_app_v3.js index 619bfa3..0b2aef6 100644 --- a/app/js/aether_native_app_v3.js +++ b/app/js/aether_native_app_v3.js @@ -184,7 +184,7 @@ exports.download_hash_file_to_cache = async function ({host_file_cache_path, eve let hash_file_cache_path = path.join(subdirectory_path, hash_filename); // console.log(hash_file_cache_path); - let download_file_result = await ipcRenderer.invoke('download_file', api_base_url, endpoint, hash_file_cache_path).then((result) => { + let download_file_result = await ipcRenderer.invoke('download_file', api_server_base_url, endpoint, hash_file_cache_path).then((result) => { console.log('IPC download file process finished'); console.log(result); return true; @@ -295,7 +295,7 @@ exports.check_file_cache = async function ({host_file_cache_path, event_file_id, } else { console.log('Hashed file not found in local cache. Downloading file: '+save_path); let endpoint = `/event/file/${event_file_id}/download`; - let result = await ipcRenderer.send('download_file', api_base_url, endpoint, save_path); // Must download file using main node.js thread. + let result = await ipcRenderer.send('download_file', api_server_base_url, endpoint, save_path); // Must download file using main node.js thread. console.log(result); return new Promise((resolve, reject) => { @@ -351,7 +351,7 @@ async function check_file_cache({host_file_cache_path, event_file_id, hash}) { } else { console.log('Hashed file not found in local cache. Downloading file: '+save_path); let endpoint = `/event/file/${event_file_id}/download`; - let result = await ipcRenderer.send('download_file', api_base_url, endpoint, save_path); // Must download file using main node.js thread. + let result = await ipcRenderer.send('download_file', api_server_base_url, endpoint, save_path); // Must download file using main node.js thread. console.log(result); return new Promise((resolve, reject) => { diff --git a/index.js b/index.js index 4475a3b..4da949d 100644 --- a/index.js +++ b/index.js @@ -111,7 +111,7 @@ app.on('activate', () => { // Updated 2022-04-16 ipcMain.handle('import_config', async (event, config_data) => { console.log('*** Electron IPC Main: import_config() ***'); - // console.log('ipcMain on download_file: api_base_url='+api_base_url+' | api_temporary_token='+api_temporary_token); + // console.log('ipcMain on download_file: api_server_base_url='+api_server_base_url+' | api_temporary_token='+api_temporary_token); console.log('ipcMain on import_config:'); console.log(config_data); @@ -141,13 +141,13 @@ ipcMain.handle('import_config', async (event, config_data) => { // Download file to path // full_save_path should be the full path that includes the filename // Updated 2022-03-09 -ipcMain.handle('download_file', async (event, api_base_url, api_endpoint, full_save_path) => { +ipcMain.handle('download_file', async (event, api_server_base_url, api_endpoint, full_save_path) => { console.log('*** Electron IPC Main: download_file() ***'); - // console.log('ipcMain on download_file: api_base_url='+api_base_url+' | api_temporary_token='+api_temporary_token); - console.log('ipcMain on download_file: api_base_url='+api_base_url); + // console.log('ipcMain on download_file: api_server_base_url='+api_server_base_url+' | api_temporary_token='+api_temporary_token); + console.log('ipcMain on download_file: api_server_base_url='+api_server_base_url); console.log('ipcMain download and save file: HTTP '+api_endpoint+' -> FILE '+full_save_path); - let result = await download_file(api_base_url, api_endpoint, full_save_path); + let result = await download_file(api_server_base_url, api_endpoint, full_save_path); console.log(result); console.log('End: Electron IPC Main: download_file()'); @@ -159,10 +159,10 @@ ipcMain.handle('download_file', async (event, api_base_url, api_endpoint, full_s // Download file to path // full_save_path should be the full path that includes the filename // Updated 2022-03-09 -async function download_file(api_base_url, api_endpoint, full_save_path) { +async function download_file(api_server_base_url, api_endpoint, full_save_path) { console.log('*** node.js: download_file() ***'); - axios.defaults.baseURL = api_base_url; + axios.defaults.baseURL = api_server_base_url; axios.defaults.headers.common['Access-Control-Allow-Origin'] = config.access_control_allow_origin; // '*'; // app_config.access_control_allow_origin; axios.defaults.headers.common['content-type'] = 'application/json'; axios.defaults.headers.common['x-aether-api-key'] = config.api_secret_key; // 'dFP6J9DVj9hUgIMn-fNIqg'; // api_secret_key;