More robust loading
This commit is contained in:
@@ -1,6 +1,9 @@
|
||||
{
|
||||
"developer_tools": false,
|
||||
"native_app_js_css_option": "default",
|
||||
"native_app_which_html": "default",
|
||||
"native_app_index_path": "[home]/OSIT/native_app/app/index.html",
|
||||
"native_app_index_url": "https://app.oneskyit.com/native/index.html",
|
||||
|
||||
"native_app_js_css_base_url": "https://demo.oneskyit.com",
|
||||
"native_app_js_css_base_url_bak": "https://bak-demo.oneskyit.com",
|
||||
|
||||
@@ -33,36 +36,11 @@
|
||||
"access_control_allow_origin": "*",
|
||||
|
||||
"idb_name": "osit",
|
||||
"idb_event_check_period": 240000,
|
||||
"idb_event_location_check_period": 120000,
|
||||
"idb_event_session_check_period": 120000,
|
||||
"idb_event_presentation_check_period": 120000,
|
||||
"idb_event_presenter_check_period": 90000,
|
||||
"idb_event_file_check_period": 60000,
|
||||
|
||||
"local_file_cache_path": "[home]/OSIT/file_cache",
|
||||
"host_file_cache_check_period": 30000,
|
||||
"host_file_temp_path": "[home]/OSIT/temp",
|
||||
|
||||
"main_loop_interval": 2000,
|
||||
"api_token_loop_interval": 1000,
|
||||
"api_update_period": 90000,
|
||||
"api_auth_loop_interval": 100,
|
||||
"api_token_update_loop_interval": 120000,
|
||||
|
||||
"open_tables_loop_interval": 10,
|
||||
"update_idb_loop_interval": 10,
|
||||
"idb_to_launcher_loop_interval": 250,
|
||||
"update_render_loop_interval": 1000,
|
||||
"check_file_cache_loop_interval": 250,
|
||||
|
||||
"display_menu_session_times": true,
|
||||
"display_session_codes": true,
|
||||
"display_session_badges": true,
|
||||
"display_presentation_codes": true,
|
||||
"display_presentation_badges": true,
|
||||
"display_presenter_codes": true,
|
||||
"display_presenter_badges": true,
|
||||
|
||||
"display_arrangement": "mirror_and_extend",
|
||||
"display_builtin_resolution": "",
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
<!-- Cascading Style Sheets (CSS) end -->
|
||||
|
||||
<!-- JavaScript (JS) start -->
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/axios/1.1.2/axios.min.js" integrity="sha512-bHeT+z+n8rh9CKrSrbyfbINxu7gsBmSHlDCb3gUF1BjmjDzKhoKspyB71k0CIRBSjE5IVQiMMVBgCWjF60qsvA==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/axios/1.1.3/axios.min.js" integrity="sha512-0qU9M9jfqPw6FKkPafM3gy2CBAvUWnYVOfNPDYKVuRTel1PrciTj+a9P3loJB+j0QmN2Y0JYQmkBBS8W+mbezg==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
|
||||
<script src="https://webrtc.github.io/adapter/adapter-latest.js"></script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/socket.io/4.2.0/socket.io.js" integrity="sha512-WL6WGKMPBiM9PnHRYIn5YEtq0Z8XP4fkVb4qy7PP4vhmYQErJ/dySyXuFIMDf1eEYCXCrQrMJfkNwKc9gsjTjA==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
|
||||
<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>
|
||||
@@ -25,8 +25,11 @@
|
||||
|
||||
<script>
|
||||
const native_app = require('./js/aether_app_native_v4');
|
||||
let native_app_config = native_app.load_config();
|
||||
console.log('Native App Config:', native_app_config);
|
||||
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);
|
||||
|
||||
let native_app_js_css_base_url = native_app_config.native_app_js_css_base_url;
|
||||
|
||||
@@ -67,7 +70,8 @@
|
||||
// END: Environment constants set by server when rendering HTML
|
||||
|
||||
// BEGIN: Content constants set by server when rendering HTML
|
||||
const page_for = {"event": native_app_config.event_id, "event_device": native_app_config.event_device_id, "event_location": native_app_config.event_location_id, "event_session": native_app_config.event_session_id}; // Simple key value like object
|
||||
// const page_for_id = {"event": native_app_config.event_id, "event_device": native_app_config.event_device_id, "event_location": native_app_config.event_location_id, "event_session": native_app_config.event_session_id}; // Simple key value like object
|
||||
const page_for = {'event_id': native_app_config.event_id, 'event_device_id': native_app_config.event_device_id, 'event_location_id': native_app_config.event_location_id, 'event_session_id': native_app_config.event_session_id}; // Simple key value like object
|
||||
console.log('Page For:', page_for);
|
||||
// END: Content constants set by server when rendering HTML
|
||||
|
||||
@@ -96,7 +100,8 @@
|
||||
|
||||
let page = {}
|
||||
page['mode'] = null;
|
||||
page['page_for'] = { 'event': native_app_config.event_id, 'event_device': native_app_config.event_device_id, 'event_location': native_app_config.event_location_id, "event_session": native_app_config.event_session_id }; // Simple key value like object;
|
||||
// page['page_for_id'] = { 'event': native_app_config.event_id, 'event_device': native_app_config.event_device_id, 'event_location': native_app_config.event_location_id, 'event_session': native_app_config.event_session_id }; // Simple key value like object;
|
||||
page['page_for'] = { 'event_id': native_app_config.event_id, 'event_device_id': native_app_config.event_device_id, 'event_location_id': native_app_config.event_location_id, 'event_session_id': native_app_config.event_session_id }; // Simple key value like object;
|
||||
|
||||
page['current_url_root'] = null;
|
||||
page['current_url_full_path'] = null;
|
||||
|
||||
@@ -35,8 +35,8 @@ console.log('Temporary: '+tmp_directory);
|
||||
|
||||
let config = null;
|
||||
|
||||
exports.load_config = function () {
|
||||
console.log('*** Aether App Native export: load_config() ***');
|
||||
exports.load_init_config = function () {
|
||||
console.log('*** Aether App Native export: load_init_config() ***');
|
||||
|
||||
let cwd = process.cwd();
|
||||
console.log(`CWD: ${cwd}`);
|
||||
@@ -59,8 +59,8 @@ exports.load_config = function () {
|
||||
|
||||
// let config = null;
|
||||
let config_directory = null;
|
||||
// let default_config_path = path.join(process.cwd(),'aether_native_app_config.current.json');
|
||||
let default_config_path = 'aether_native_app_config.current.json';
|
||||
// let default_config_path = path.join(process.cwd(),'ae_native_app_config.current.json');
|
||||
let default_config_path = 'ae_native_app_config.current.json';
|
||||
console.log(`Default Config File (path): ${default_config_path}`);
|
||||
let config_path = null;
|
||||
|
||||
@@ -80,38 +80,38 @@ exports.load_config = function () {
|
||||
fs.mkdirSync(config_directory);
|
||||
console.log('Config directory created: '+config_directory);
|
||||
|
||||
//default_config_path = path.join(process.cwd(),'aether_native_app_config.current.json');
|
||||
// config_path = path.join(config_directory, 'aether_native_app_config.json');
|
||||
//default_config_path = path.join(process.cwd(),'ae_native_app_config.current.json');
|
||||
// config_path = path.join(config_directory, 'ae_native_app_config.json');
|
||||
// fs.copyFileSync(default_config_path, config_path);
|
||||
// console.log('Default config file copied: '+config_directory);
|
||||
}
|
||||
|
||||
config_path = path.join(config_directory, 'aether_native_app_config.json');
|
||||
config_path = path.join(config_directory, 'ae_native_app_config.json');
|
||||
|
||||
// Attempt to open the config file. The preferred location is based on the OS's config directory.
|
||||
if (fs.existsSync(config_path)) {
|
||||
console.log(`Config file (aether_native_app_config.json) found under ${config_directory}`);
|
||||
console.log(`Config file (ae_native_app_config.json) found under ${config_directory}`);
|
||||
} else if (!fs.existsSync(config_path) && fs.existsSync(default_config_path)) {
|
||||
fs.copyFileSync(default_config_path, config_path);
|
||||
console.log('Default config file copied: '+config_directory);
|
||||
|
||||
// config = JSON.parse(fs.readFileSync(config_path));
|
||||
// console.log('Config file read.');
|
||||
} else if (fs.existsSync(path.join(cwd, 'aether_native_app_config.json'))) {
|
||||
} else if (fs.existsSync(path.join(cwd, 'ae_native_app_config.json'))) {
|
||||
//fs.copyFileSync(default_config_path, config_path);
|
||||
//console.log('Default config file copied: '+config_directory);
|
||||
|
||||
console.log(`Config file (config.json) not found under ${config_directory}. Using config in CWD. ${cwd}`);
|
||||
config_path = path.join(cwd, 'aether_native_app_config.json');
|
||||
config_path = path.join(cwd, 'ae_native_app_config.json');
|
||||
|
||||
console.log(`Config file (config.json) not found under ${config_directory}. Using config in CWD. ${cwd}`);
|
||||
let found_config_path = path.join(cwd, 'aether_native_app_config.json');
|
||||
let found_config_path = path.join(cwd, 'ae_native_app_config.json');
|
||||
|
||||
fs.copyFileSync(found_config_path, config_path);
|
||||
console.log(`Found config file copied: ${config_directory}`);
|
||||
} else if (fs.existsSync(path.join(cwd, 'aether_native_app_config.current.json'))) {
|
||||
} else if (fs.existsSync(path.join(cwd, 'ae_native_app_config.current.json'))) {
|
||||
console.log(`Config file (config.json) not found under ${config_directory} or CWD. Using default config in CWD. ${cwd}`);
|
||||
default_config_path = path.join(cwd, 'aether_native_app_config.current.json');
|
||||
default_config_path = path.join(cwd, 'ae_native_app_config.current.json');
|
||||
|
||||
fs.copyFileSync(default_config_path, config_path);
|
||||
console.log(`Default config file copied: ${config_directory}`);
|
||||
@@ -121,8 +121,11 @@ exports.load_config = function () {
|
||||
return false;
|
||||
}
|
||||
|
||||
config = JSON.parse(fs.readFileSync(config_path));
|
||||
console.log('Config file read.', config);
|
||||
let local_config = JSON.parse(fs.readFileSync(config_path));
|
||||
console.log('Config file read.', local_config);
|
||||
config = local_config;
|
||||
|
||||
// Do some quick clean up.
|
||||
|
||||
config.home_directory = home_directory; // From the OS platform
|
||||
config.tmp_directory = tmp_directory; // From the OS platform
|
||||
@@ -149,6 +152,10 @@ exports.load_config = function () {
|
||||
console.log(`Host file temp directory created: ${config.host_file_temp_path}`);
|
||||
}
|
||||
|
||||
if (!config.account_id) {
|
||||
config.account_id = '_XY7DXtc9MY'; // Not ideal...?
|
||||
}
|
||||
|
||||
let import_config_to_ipc_result = ipcRenderer.invoke('import_config', config).then((result) => {
|
||||
console.log('IPC import config finished');
|
||||
// console.log(result);
|
||||
@@ -160,6 +167,146 @@ exports.load_config = function () {
|
||||
}
|
||||
|
||||
|
||||
exports.load_full_config = function (init_config) {
|
||||
console.log('*** Aether App Native export: load_config() ***');
|
||||
|
||||
console.log('Init config.', init_config);
|
||||
// config = init_config;
|
||||
|
||||
config = get_url_cfg(init_config).then((cfg) => {
|
||||
console.log('URL config file downloaded.', cfg);
|
||||
|
||||
let new_config = init_config;
|
||||
|
||||
// Update with remote device config settings from API.
|
||||
new_config.account_id = cfg.account_id_random;
|
||||
new_config.event_id = cfg.event_id_random;
|
||||
new_config.event_device_id = cfg.event_device_id;
|
||||
new_config.event_location_id = cfg.event_location_id;
|
||||
new_config.event_session_id = cfg.event_session_id;
|
||||
|
||||
new_config.check_event_device_loop_period = cfg.check_event_device_loop_period;
|
||||
new_config.check_event_location_loop_period = cfg.check_event_location_loop_period;
|
||||
new_config.check_event_loop_period = cfg.check_event_loop_period;
|
||||
new_config.check_event_session_loop_period = cfg.check_event_session_loop_period;
|
||||
|
||||
new_config.record_audio = cfg.record_audio;
|
||||
new_config.record_video = cfg.record_video;
|
||||
new_config.recording_path = cfg.recording_path;
|
||||
new_config.recording_path = new_config.recording_path.replace('[home]', home_directory);
|
||||
new_config.recording_path = new_config.recording_path.replace('[tmp]', home_directory);
|
||||
|
||||
new_config.home_directory = home_directory; // From the OS platform
|
||||
new_config.tmp_directory = tmp_directory; // From the OS platform
|
||||
|
||||
new_config.app_root_path = new_config.app_root_path.replace('[home]', home_directory);
|
||||
new_config.app_root_path = new_config.app_root_path.replace('[tmp]', tmp_directory);
|
||||
console.log(`App Root Path: ${new_config.app_root_path}`);
|
||||
|
||||
new_config.local_file_cache_path = new_config.local_file_cache_path.replace('[home]', home_directory);
|
||||
new_config.local_file_cache_path = new_config.local_file_cache_path.replace('[tmp]', tmp_directory);
|
||||
console.log(`Local File Cache Path: ${new_config.local_file_cache_path}`);
|
||||
if (fs.existsSync(new_config.local_file_cache_path)) {
|
||||
} else {
|
||||
fs.mkdirSync(new_config.local_file_cache_path);
|
||||
console.log(`Host file cache directory created: ${new_config.local_file_cache_path}`);
|
||||
}
|
||||
|
||||
new_config.host_file_temp_path = new_config.host_file_temp_path.replace('[home]', home_directory);
|
||||
new_config.host_file_temp_path = new_config.host_file_temp_path.replace('[tmp]', tmp_directory);
|
||||
console.log(`Host file temp path: ${new_config.host_file_temp_path}`);
|
||||
if (fs.existsSync(new_config.host_file_temp_path)) {
|
||||
} else {
|
||||
fs.mkdirSync(new_config.host_file_temp_path);
|
||||
console.log(`Host file temp directory created: ${new_config.host_file_temp_path}`);
|
||||
}
|
||||
|
||||
let import_config_to_ipc_result = ipcRenderer.invoke('import_config', new_config).then((result) => {
|
||||
console.log('IPC import config finished');
|
||||
// console.log(result);
|
||||
return result; // Result should be "true"
|
||||
})
|
||||
|
||||
return new_config
|
||||
})
|
||||
|
||||
//console.log(config);
|
||||
return config;
|
||||
}
|
||||
|
||||
|
||||
async function get_url_cfg(cfg) {
|
||||
let base_url = `${cfg.api_protocol}://${cfg.api_server}:${cfg.api_port}/${cfg.api_path}`;
|
||||
|
||||
let axios_api = axios.create({
|
||||
baseURL: base_url,
|
||||
timeout: 60000, // in milliseconds; 60000 = 60 seconds
|
||||
/* other custom settings */
|
||||
});
|
||||
// axios_api.defaults.headers = cfg['headers'];
|
||||
|
||||
// axios.defaults.baseURL = `${cfg.api_protocol}://${cfg.api_server}:${cfg.api_port}/${cfg.api_path}`;
|
||||
axios_api.defaults.headers.common['Access-Control-Allow-Origin'] = cfg.access_control_allow_origin; // '*'; // app_cfg.access_control_allow_origin;
|
||||
axios_api.defaults.headers.common['content-type'] = 'application/json';
|
||||
axios_api.defaults.headers.common['x-aether-api-key'] = cfg.api_secret_key;
|
||||
// axios_api.defaults.headers.common['x-account-id'] = cfg.account_id;
|
||||
|
||||
let event_device_id = 'dbgMWS3KEHE';
|
||||
let endpoint = `/event/device/${event_device_id}`;
|
||||
|
||||
let params = {'event_device_code': 'asdf'};
|
||||
|
||||
let response_data_promise = await axios_api.get(
|
||||
endpoint,
|
||||
{
|
||||
params: params,
|
||||
onDownloadProgress: (progressEvent) => {
|
||||
let percent_completed = Math.round(
|
||||
(progressEvent.loaded * 100) / progressEvent.total
|
||||
);
|
||||
console.log('GET Data Timestamp:', progressEvent.timeStamp, 'Total:', progressEvent.total, 'Loaded:', progressEvent.loaded, 'Percent Completed', percent_completed);
|
||||
|
||||
// temp_get_object_percent_completed = percent_completed;
|
||||
}
|
||||
}
|
||||
)
|
||||
.then(function (response) {
|
||||
console.log(`Response: ${response}`);
|
||||
|
||||
let return_data = response.data['data'];
|
||||
if (Array.isArray(return_data)) {
|
||||
console.log(`Data result is an array/list. Array length: ${return_data.length}`);
|
||||
} else {
|
||||
console.log(`Data result is a dictionary/object, not an array/list.`);
|
||||
}
|
||||
return return_data;
|
||||
})
|
||||
.catch(function (error) {
|
||||
console.log(`Base URL: ${base_url} | Endpoint: ${endpoint}`);
|
||||
|
||||
console.log('Error Message:', error.message); // Is this needed here or below in the in the else portion???
|
||||
if (error.response) {
|
||||
console.log(`Response Status: ${error.response.status}; Status Text: ${error.response.statusText}`);
|
||||
} else {
|
||||
console.log('Error:', error);
|
||||
}
|
||||
|
||||
if (error.response && error.response.status === 404) {
|
||||
return null; // Returning null since there were no results
|
||||
}
|
||||
return false; // Returning false since something may have gone wrong. Also more in line with what the API returns.
|
||||
});
|
||||
|
||||
return response_data_promise;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// Check for local file
|
||||
// Updated 2022-05-06
|
||||
exports.check_local_file = async function ({local_file_path, filename}) {
|
||||
|
||||
114
index.js
114
index.js
@@ -30,7 +30,7 @@ if (os.platform == 'darwin') {
|
||||
}
|
||||
|
||||
// let config_path = path.join(config_directory, 'config.json');
|
||||
let config_path = path.join(config_directory, 'aether_native_app_config.json');
|
||||
let config_path = path.join(config_directory, 'ae_native_app_config.json');
|
||||
|
||||
let config = JSON.parse(fs.readFileSync(config_path));
|
||||
console.log('Config file read.', config);
|
||||
@@ -41,6 +41,75 @@ let host_file_temp_path = null;
|
||||
console.log(os.type());
|
||||
console.log(process.getSystemVersion());
|
||||
|
||||
async function get_url_cfg() {
|
||||
let base_url = `${config.api_protocol}://${config.api_server}:${config.api_port}/${config.api_path}`;
|
||||
|
||||
let axios_api = axios.create({
|
||||
baseURL: base_url,
|
||||
timeout: 60000, // in milliseconds; 60000 = 60 seconds
|
||||
/* other custom settings */
|
||||
});
|
||||
// axios_api.defaults.headers = config['headers'];
|
||||
|
||||
// axios.defaults.baseURL = `${config.api_protocol}://${config.api_server}:${config.api_port}/${config.api_path}`;
|
||||
axios_api.defaults.headers.common['Access-Control-Allow-Origin'] = config.access_control_allow_origin; // '*'; // app_config.access_control_allow_origin;
|
||||
axios_api.defaults.headers.common['content-type'] = 'application/json';
|
||||
axios_api.defaults.headers.common['x-aether-api-key'] = config.api_secret_key;
|
||||
axios_api.defaults.headers.common['x-account-id'] = config.account_id;
|
||||
|
||||
let event_device_id = 'dbgMWS3KEHE';
|
||||
let endpoint = `/event/device/${event_device_id}`;
|
||||
|
||||
let params = {'event_device_code': 'asdf'};
|
||||
|
||||
let response_data_promise = await axios_api.get(
|
||||
endpoint,
|
||||
{
|
||||
params: params,
|
||||
onDownloadProgress: (progressEvent) => {
|
||||
let percent_completed = Math.round(
|
||||
(progressEvent.loaded * 100) / progressEvent.total
|
||||
);
|
||||
console.log('GET Data Timestamp:', progressEvent.timeStamp, 'Total:', progressEvent.total, 'Loaded:', progressEvent.loaded, 'Percent Completed', percent_completed);
|
||||
|
||||
// temp_get_object_percent_completed = percent_completed;
|
||||
}
|
||||
}
|
||||
)
|
||||
.then(function (response) {
|
||||
console.log(`Response: ${response}`);
|
||||
|
||||
let return_data = response.data['data'];
|
||||
if (Array.isArray(return_data)) {
|
||||
console.log(`Data result is an array/list. Array length: ${return_data.length}`);
|
||||
} else {
|
||||
console.log(`Data result is a dictionary/object, not an array/list.`);
|
||||
}
|
||||
return return_data;
|
||||
})
|
||||
.catch(function (error) {
|
||||
console.log(`Base URL: ${base_url} | Endpoint: ${endpoint}`);
|
||||
|
||||
console.log('Error Message:', error.message); // Is this needed here or below in the in the else portion???
|
||||
if (error.response) {
|
||||
console.log(`Response Status: ${error.response.status}; Status Text: ${error.response.statusText}`);
|
||||
} else {
|
||||
console.log('Error:', error);
|
||||
}
|
||||
|
||||
if (error.response && error.response.status === 404) {
|
||||
return null; // Returning null since there were no results
|
||||
}
|
||||
return false; // Returning false since something may have gone wrong. Also more in line with what the API returns.
|
||||
});
|
||||
|
||||
return response_data_promise;
|
||||
}
|
||||
|
||||
let new_config = get_url_cfg();
|
||||
console.log(new_config);
|
||||
|
||||
|
||||
let endpoints_in_progress = [];
|
||||
|
||||
|
||||
@@ -88,19 +157,32 @@ function createWindow () {
|
||||
|
||||
// win.webContents.session.clearStorageData(['filesystem']); // Does this do anything???
|
||||
|
||||
// and load the index.html of the app.
|
||||
if (config.native_app_js_css_option == '' || config.native_app_js_css_option == 'default') {
|
||||
// native_app_which_html = 'default', 'path', 'url'
|
||||
// 'default' (internal) is within the bundled native app
|
||||
// 'path' (external to app) is a file path on the host, probably under the home directory
|
||||
// 'url' is over HTTPS, maybe onsite or offsite
|
||||
|
||||
// Load the index.html of the app
|
||||
if (config.native_app_which_html == '' || config.native_app_which_html == 'default') {
|
||||
win.loadFile('app/index.html');
|
||||
} else if (config.native_app_js_css_option == 'primary') {
|
||||
win.loadFile('app/index_primary.html');
|
||||
} else if (config.native_app_js_css_option == 'development_internal') {
|
||||
win.loadFile('app/index_development_internal.html');
|
||||
} else if (config.native_app_js_css_option == 'development_localhost') {
|
||||
win.loadFile('app/index_development_localhost.html');
|
||||
} else if (config.native_app_js_css_option == 'onsite') {
|
||||
win.loadFile('app/index_onsite.html');
|
||||
} else if (config.native_app_js_css_option == 'onsite_5000') {
|
||||
win.loadFile('app/index_onsite_5000.html');
|
||||
} else if (config.native_app_which_html == 'path') {
|
||||
let index_path = 'index.html';
|
||||
|
||||
if (config.native_app_index_path) {
|
||||
index_path = config.native_app_index_path.replace('[home]', home_directory);
|
||||
} else {
|
||||
index_path = path.join(home_directory, 'OSIT/native_app/app/index.html');
|
||||
}
|
||||
win.loadFile(index_path);
|
||||
} else if (config.native_app_which_html == 'url') {
|
||||
let index_url = 'http://localhost/index.html';
|
||||
|
||||
if (config.native_app_index_url) {
|
||||
index_url = native_app_index_url;
|
||||
} else {
|
||||
index_url = 'https://app.oneskyit.com/native/index.html';
|
||||
}
|
||||
win.loadURL(index_url);
|
||||
} else {
|
||||
win.loadFile('app/index.html');
|
||||
}
|
||||
@@ -182,7 +264,7 @@ 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-10-12
|
||||
// Updated 2023-05-14
|
||||
ipcMain.handle('download_file', async (event, api_base_url, api_endpoint, full_save_path, hash=null, verify_hash=false, overwrite_existing=false) => {
|
||||
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);
|
||||
@@ -196,8 +278,8 @@ ipcMain.handle('download_file', async (event, api_base_url, api_endpoint, full_s
|
||||
axios.defaults.baseURL = api_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;
|
||||
axios.defaults.headers.common['x-account-id'] = config.account_id; // '_XY7DXtc9MY'; // account_id;
|
||||
axios.defaults.headers.common['x-aether-api-key'] = config.api_secret_key;
|
||||
axios.defaults.headers.common['x-account-id'] = config.account_id;
|
||||
|
||||
const url = api_endpoint;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user