diff --git a/app/css/event_launcher.css b/app/css/event_launcher.css index 7f88596..76cfd41 100644 --- a/app/css/event_launcher.css +++ b/app/css/event_launcher.css @@ -60,7 +60,7 @@ background-color: hsla(0,0%,100%,.98); font-size: 1.1em; - + padding-right: .1em; border-right: solid medium hsla(0,0%,90%,1); @@ -125,7 +125,7 @@ .event_launcher_main_nav_menu .btn { min-width: 100%; max-width: 100%; - + border-radius: .25em; margin: .1em 0em; } @@ -145,7 +145,7 @@ text-align: center; font-size: .7em; min-width: 5em; - + margin: .1em .2em; } @@ -173,6 +173,39 @@ z-index: 500; } +.event_launcher_status { + outline: dashed thin red; + margin: .1em .4em; + padding: .0em; + + position: fixed; + bottom: 0; + right: 0; + /* width: 12em; */ + + z-index: 500; + + display: flex; + flex-direction: row; + /* flex-wrap: nowrap; */ + justify-content: center; + align-items: center; + align-content: center; + + font-size: .7em; +} +.event_launcher_status:hover { + font-size: 1.1em; + font-weight: bold; +} + +.event_launcher_status > .network_status { + margin: .2em .2em; +} + +.event_launcher_status > .current_datetime { + margin: .2em .2em; +} .event_launcher_main_content header.event_session_about { @@ -243,17 +276,17 @@ ul.event_presentation_list .btn_list>li { .event_launcher_main_content .event_presentation_datetime_name .event_presentation_datetime { /*align-self: flex-start;*/ /*border-right: dashed thin green;*/ - + text-align: center; font-size: .7em; min-width: 5em; - + margin: .1em .2em; } .event_launcher_main_content .event_presentation_datetime_name .event_presentation_name { border-left: solid thin gray; - + margin: .1em .2em; padding-left: .2em; } diff --git a/app/js/app_v3.js b/app/js/app_v3.js index 82b32e8..c2f2f5e 100644 --- a/app/js/app_v3.js +++ b/app/js/app_v3.js @@ -71,6 +71,25 @@ exports.load_config = function () { } +// Check for local file +// Updated 2022-03-10 +exports.check_local_file = async function ({local_file_path, filename}) { + console.log('*** Electron framework export: check_local_file() ***'); + console.log('Check for local file'); + console.log(`Local File Path: ${local_file_path}; Filename: ${filename}`); + + let full_local_file_path = path.join(local_file_path, filename); + console.log(full_local_file_path); + + if (fs.existsSync(full_local_file_path)) { + console.log(`Local file exists: ${full_local_file_path}`); + return true; + } else { + return false; + } +} + + // Check local hash file cache // Updated 2022-03-09 exports.check_hash_file_cache = async function ({host_file_cache_path, hash}) { @@ -84,13 +103,15 @@ exports.check_hash_file_cache = async function ({host_file_cache_path, hash}) { // console.log(hash_file_cache_path); if (fs.existsSync(hash_file_cache_path)) { - console.log(`Hashed file cache already exists: ${hash_file_cache_path}`); + console.log(`Hashed file exists in cache: ${hash_file_cache_path}`); return true; } else { + console.log(`Hashed file not found in cache: ${hash_file_cache_path}`); return false; } } + // Download hash file to cache // Updated 2022-03-09 exports.download_hash_file_to_cache = async function ({host_file_cache_path, event_file_id=null, hash=null}) { @@ -121,8 +142,9 @@ exports.download_hash_file_to_cache = async function ({host_file_cache_path, eve } } + // Open cached hash file after copying to temp directory -// Updated 2022-03-07 +// Updated 2022-03-09 exports.open_hash_file_to_temp = async function ({host_file_cache_path, hash, host_file_temp_path, filename}) { console.log('*** Electron framework export: open_hash_file_to_temp() ***'); console.log('Open cached hash file after copying to temp directory'); @@ -149,6 +171,40 @@ exports.open_hash_file_to_temp = async function ({host_file_cache_path, hash, ho } +// Open local file +// Updated 2022-03-10 +exports.open_local_file = async function ({local_file_path, filename}) { + console.log('*** Electron framework export: open_local_file() ***'); + console.log('Open local file'); + console.log(`Local File Path: ${local_file_path}; Filename: ${filename}`); + + // let full_local_file_path = path.join(local_file_path, filename); + // console.log(full_local_file_path); + + // if (fs.existsSync(full_local_file_path)) { + // console.log(`Local file exists: ${full_local_file_path}`); + // // return true; + // } else { + // return false; + // } + + let open_local_file_result = await ipcRenderer.invoke('open_local_file', local_file_path, filename).then((result) => { + console.log('IPC open local file finished'); + console.log(result); + return true; + }) + + console.log(open_local_file_result); + console.log('End: open_local_file()'); + if (open_local_file_result) { + console.log('File opened successfully'); + return true; + } else { + console.log('File was not opened successfully'); + return false; + } +} + diff --git a/app/static/launcher.reset b/app/static/launcher.reset new file mode 100644 index 0000000..3a0225e --- /dev/null +++ b/app/static/launcher.reset @@ -0,0 +1 @@ +launcher reset diff --git a/app/static/test.txt b/app/static/test.txt new file mode 100644 index 0000000..5eb252b --- /dev/null +++ b/app/static/test.txt @@ -0,0 +1 @@ +test txt diff --git a/index.js b/index.js index 010d475..091bbeb 100644 --- a/index.js +++ b/index.js @@ -203,8 +203,8 @@ ipcMain.handle('open_hash_file_to_temp', async (event, host_file_cache_path, has } if (fs.existsSync(full_cache_file_path)) { - console.log('Hashed file cache exists: '+full_cache_file_path); - console.log('Copying file to temp: '+open_temp_file_path); + console.log(`Hashed file exists in cache: ${full_cache_file_path}`); + console.log(`Copying file to temp: ${open_temp_file_path}`); try { await fs.copyFileSync(full_cache_file_path, open_temp_file_path); } catch (error) { @@ -215,6 +215,7 @@ ipcMain.handle('open_hash_file_to_temp', async (event, host_file_cache_path, has // console.log('Creating file link: '+open_temp_file_path); // fs.linkSync(full_cache_file_path, open_temp_file_path); } else { + console.log(`Hashed file not found in cache: ${full_cache_file_path}`); return false; } @@ -230,3 +231,37 @@ ipcMain.handle('open_hash_file_to_temp', async (event, host_file_cache_path, has // return 'Return from Electron IPC Main open_hash_file_to_temp()'; return true; }); + + +ipcMain.handle('open_local_file', async (event, local_file_path, filename, use_cwd=true) => { + console.log('*** Electron IPC Main: open_local_file() ***'); + console.log('ipcMain on open_local_file'); + console.log(`ipcMain open local file from directory: ${local_file_path}/${filename}`); + + let full_local_file_path = null; + + if (use_cwd) { + full_local_file_path = path.join(process.cwd(), local_file_path, filename); + console.log(full_local_file_path); + } else { + full_local_file_path = path.join(local_file_path, filename); + console.log(full_local_file_path); + } + + if (fs.existsSync(full_local_file_path)) { + console.log(`Local file exists: ${full_local_file_path}`); + } else { + console.log(`Local file not found: ${full_local_file_path}`); + return false; + } + + try { + await shell.openPath(full_local_file_path); + } catch (error) { + console.error(error); + return false; + } + + console.log('End: Electron IPC Main: open_local_file()'); + return true; +}); \ No newline at end of file