Fixed base URL variable names
This commit is contained in:
@@ -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) => {
|
||||
|
||||
14
index.js
14
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;
|
||||
|
||||
Reference in New Issue
Block a user