commit 7e79f333c246778d9a4c5bb2bad1d57c003dadba Author: Scott Idem Date: Fri Jan 24 19:51:14 2020 -0500 Initial commit diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..740418b --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +file_cache/ +node_modules/ +temp/ diff --git a/app/.directory b/app/.directory new file mode 100644 index 0000000..59b4964 --- /dev/null +++ b/app/.directory @@ -0,0 +1,4 @@ +[Dolphin] +Timestamp=2020,1,24,15,51,19 +Version=4 +ViewMode=2 diff --git a/app/css/launcher.css b/app/css/launcher.css new file mode 100644 index 0000000..ce05f76 --- /dev/null +++ b/app/css/launcher.css @@ -0,0 +1,44 @@ +body { + margin: .1rem; + padding: .1rem; + /*border: solid thin pink;*/ +} + +.btn_no_case { + text-transform: none; +} + +body > .container { /* allow the container directly under body to be 100% wide*/ + /*max-width: 100%;*/ + margin: 0rem; + padding: 0rem; + /*border: solid thin pink;*/ +} + +body > .container > .row { /* allow the container directly under body to be 100% wide*/ + margin-right: 0; + margin-left: 0; + margin: .1rem; + padding: .1rem; +} + +/* +.btn-info { + background: green; +} + +.btn-info:hover { + background: darkgreen; +} + + +mynewcolor:#77cccc; + +.btn-info { + @include button-variant($mynewcolor, darken($mynewcolor, 7.5%), darken($mynewcolor, 10%), lighten($mynewcolor,5%), lighten($mynewcolor, 10%), darken($mynewcolor,30%)); +} + +.btn-outline-primary { + @include button-outline-variant($mynewcolor, #222222, lighten($mynewcolor,5%), $mynewcolor); +} +*/ diff --git a/app/css/starter-template.css b/app/css/starter-template.css new file mode 100644 index 0000000..7268ad6 --- /dev/null +++ b/app/css/starter-template.css @@ -0,0 +1,19 @@ +/* +body { + padding-top: 3rem; +} +.starter-template { + padding: 1rem 1.5rem; + text-align: center; +} + +.container { + width: auto; + max-width: 2560px; + padding: 0 1rem; +} + +.footer { + background-color: #f5f5f5; +} +*/ diff --git a/app/css/style.css b/app/css/style.css new file mode 100644 index 0000000..e5e707b --- /dev/null +++ b/app/css/style.css @@ -0,0 +1,46 @@ +.bd-placeholder-img { + font-size: 1.125rem; + text-anchor: middle; + -webkit-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; +} + +@media (min-width: 768px) { + .bd-placeholder-img-lg { + font-size: 3.5rem; + } +} + +#file_import_drag_area { + font-size: 3rem; + font-weight: 600; + width: 90%; + height: 15rem; +} + +#file_import_drag_area:hover { + font-size: 3.5rem; + font-weight: 1000; +} + +#file_import_drag_area:hover:before { + /*font-weight: 1000; + content: 'Here';*/ +} + +#file_import_drag_area::before { + content: attr(data-value); + + position: relative; + top: 0; + right: 0; + width: 100%; + height: 15rem; + /*border: 1px solid red;*/ + display: flex; + flex-direction: row; + align-items: center; + justify-content: center; +} diff --git a/app/img/favicon.ico b/app/img/favicon.ico new file mode 100755 index 0000000..cf49949 Binary files /dev/null and b/app/img/favicon.ico differ diff --git a/app/index 2019-12-22.html.bak b/app/index 2019-12-22.html.bak new file mode 100644 index 0000000..4a2b712 --- /dev/null +++ b/app/index 2019-12-22.html.bak @@ -0,0 +1,180 @@ + + + + + + + One Sky IT: macOS App + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
Launcher
+
+ +
+
+ +
+ *event files +
+
+ *location files +
+
+ *sessions
+ **session
+ ***session files
+ ***presentations
+ ****presentation
+ *****presentation files
+ *****presenters
+ ******presenter
+ *******presenter files
+
+
+ +
+ +
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/app/index 2020-01-08.html.bak b/app/index 2020-01-08.html.bak new file mode 100644 index 0000000..213d676 --- /dev/null +++ b/app/index 2020-01-08.html.bak @@ -0,0 +1,242 @@ + + + + + + + One Sky IT: macOS App + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
Launcher
+
+ +
+
+ +
+ *event files +
+
+ *location files +
+
+ *sessions
+ **session
+ ***session files
+ ***presentations
+ ****presentation
+ *****presentation files
+ *****presenters
+ ******presenter
+ *******presenter files
+
+
+ +
+ +
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/app/index 2020-01-09 1.html.bak b/app/index 2020-01-09 1.html.bak new file mode 100644 index 0000000..0813c0c --- /dev/null +++ b/app/index 2020-01-09 1.html.bak @@ -0,0 +1,224 @@ + + + + + + + One Sky IT: macOS App + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
Launcher
+
+ +
+
+ +
+ *event files +
+
+ *location files +
+
+ *sessions
+ **session
+ ***session files
+ ***presentations
+ ****presentation
+ *****presentation files
+ *****presenters
+ ******presenter
+ *******presenter files
+
+
+ +
+ +
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/app/index 2020-01-09 2.html.bak b/app/index 2020-01-09 2.html.bak new file mode 100644 index 0000000..d5fc6ab --- /dev/null +++ b/app/index 2020-01-09 2.html.bak @@ -0,0 +1,289 @@ + + + + + + + One Sky IT: macOS App + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
Launcher
+
+ +
+
+ +
+ *event files +
+
+ *location files +
+
+ *sessions
+ **session
+ ***session files
+ ***presentations
+ ****presentation
+ *****presentation files
+ *****presenters
+ ******presenter
+ *******presenter files
+
+
+ +
+ +
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/app/index 2020-01-21.html.bak b/app/index 2020-01-21.html.bak new file mode 100644 index 0000000..97142cf --- /dev/null +++ b/app/index 2020-01-21.html.bak @@ -0,0 +1,438 @@ + + + + + + + One Sky IT: macOS App + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
Launcher
+
+ +
+
+ +
+ *event files +
+
+ *location files +
+
+ *sessions
+ **session
+ ***session files
+ ***presentations
+ ****presentation
+ *****presentation files
+ *****presenters
+ ******presenter
+ *******presenter files
+
+
+ +
+ +
+
Session Files:
+
+
    +
  • File 1.txt91.22 KB; Jul 7 6:12 AM; win
  • +
  • NASPGHAN 2020: Not happening this is long Filename 2 Hello World Todays date here.pptx1.36 MB; Sep 9 7:17 AM; mac
  • +
+
+
+ +
+
Presentations:
+
+ +
    +
  • +
    How do I best evaluate a cholestatic infant?
    +
    +
      + +
    • Presentation File 1.txt
    • +
    • Presentation File 2.pptx
    • +
    • + Scott Idem +
        +
      • filename.pptx
      • +
      • my new file.pptx
      • +
      +
    • + +
    • + Holly Danner +
        +
      • another filename.key
      • +
      • my new file.pptx
      • +
      +
    • + +
    • + Rick Mathews +
        +
      • another filename.key
      • +
      • my new file.pptx
      • +
      +
    • + +
    +
    + +
  • + +
+ + +
    +
  • +
    Common Feeding Problems and Management Strategies in Autism Spectrum Disorder
    +
    +
      + +
    • Presentation File 2.pptx
    • +
    • + Scott Idem +
        +
      • filename.pptx
      • +
      • my new file.pptx
      • +
      +
    • + +
    • + Rick Mathews +
        +
      • another filename.key
      • +
      • my new file.pptx
      • +
      +
    • + +
    +
    + +
  • + +
+ + +
+
+ + + +

+ +
+ +
Presentations:
+
+
    +
  • File 1.txt
  • +
  • Filename 2.pptx
  • +
+ + +
    +
  • +
    Scott Idem:
    +
    +
      +
    • File 1.txt
    • +
    • Filename 2.pptx
    • +
    +
  • + +
  • +
    Holly Danner:
    +
    +
      +
    • New File 1.txt
    • +
    • My Filename 2.pptx
    • +
    +
  • + +
+ + +
+
Scott Idem:
+
+
    +
  • File 1.txt
  • +
  • Filename 2.pptx
  • +
+
+
+ +
+
Holly Danner:
+
+
    +
  • File 1.txt
  • +
  • Filename 2.pptx
  • +
+
+
+ +
+
+ + +
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/app/index 2020-01-24.html.bak b/app/index 2020-01-24.html.bak new file mode 100644 index 0000000..0844140 --- /dev/null +++ b/app/index 2020-01-24.html.bak @@ -0,0 +1,557 @@ + + + + + + + One Sky IT: macOS App + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
Launcher
+
+ +
+
+ +
+ *event files +
+
+ *location files +
+
+ *sessions
+ **session
+ ***session files
+ ***presentations
+ ****presentation
+ *****presentation files
+ *****presenters
+ ******presenter
+ *******presenter files
+
+
+ +
+ + + + +
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/app/index.html b/app/index.html new file mode 100644 index 0000000..debf38b --- /dev/null +++ b/app/index.html @@ -0,0 +1,552 @@ + + + + + + + One Sky IT: macOS App + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
Please wait while the data is checked and files are cached.
+
+ +
+
+ +
+ +
+
+ +
+
+ +
+
+ +
+ +
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/app/js/app_helper.js b/app/js/app_helper.js new file mode 100644 index 0000000..8d1c8b6 --- /dev/null +++ b/app/js/app_helper.js @@ -0,0 +1 @@ + diff --git a/app/js/app_idb 2020-01-09.js.bak b/app/js/app_idb 2020-01-09.js.bak new file mode 100644 index 0000000..99c804e --- /dev/null +++ b/app/js/app_idb 2020-01-09.js.bak @@ -0,0 +1,413 @@ +const os = require('os'); +const path = require('path'); +const fs = require('fs'); + +const { ipcRenderer } = require('electron'); + + +exports.launcher_cache_check = async function (launcher, api_base_url, api_temporary_token, host_file_cache_path) { + if (typeof launcher.event === 'undefined') { + launcher.event = await api.get_event_details(axios, launcher.event_id); + console.log(launcher.event.id); + idbKeyval.set(launcher.event.id, launcher.event, tbl_event); + /* + .then(function (data) { + console.log(data.id); + idbKeyval.set(data.id, data, tbl_event); + //for (var i in response) { + //var event_record = data[i]; + //idbKeyval.set(response[i].id, response[i], tbl_event); + //} + }); + */ + + } + + if (typeof launcher.location === 'undefined') { + launcher.location = await api.get_event_location_details(axios, launcher.event_id, launcher.event_location_id); + } + + if (typeof launcher.event_files === 'undefined') { + console.log('Check for global event files.'); + let for_id = launcher.event_id; + launcher.event_files = await api.get_files_for_type_for_id(axios, 'event', for_id); + for (var i in launcher.event_files) { + console.log('f: ('+launcher.event_files[i].event_file_id+') '+launcher.event_files[i].event_file_filename+' ***') + file_id = launcher.event_files[i].event_file_id; // NOTE: the .id is the hosted_file.id! + let filename = launcher.event_files[i].hash_sha256+'.file'; + + save_path = path.join(host_file_cache_path, filename); + + if (fs.existsSync(save_path)) { + console.log('Local file already exists: '+save_path); + } else { + console.log('File not found locally. Downloading file: '+save_path); + let api_endpoint = '/event/file/'+file_id+'/download'; + ipcRenderer.send('download_file', api_base_url, api_endpoint, api_temporary_token, save_path); // Must download file using main node.js thread. + } + } + } else { + console.log('No check for global event files'); + } + + + if (typeof launcher.location_files === 'undefined') { + console.log('Check for location specific files.'); + let for_id = launcher.event_location_id; + launcher.location_files = await api.get_files_for_type_for_id(axios, 'location', for_id); + for (var i in launcher.location_files) { + console.log('f: ('+launcher.location_files[i].event_file_id+') '+launcher.location_files[i].event_file_filename+' ***') + file_id = launcher.location_files[i].event_file_id; // NOTE: the .id is the hosted_file.id! + let filename = launcher.location_files[i].hash_sha256+'.file'; + + save_path = path.join(host_file_cache_path, filename); + + if (fs.existsSync(save_path)) { + console.log('Local file already exists: '+save_path); + } else { + console.log('File not found locally. Downloading file: '+save_path); + let api_endpoint = '/event/file/'+file_id+'/download'; + ipcRenderer.send('download_file', api_base_url, api_endpoint, api_temporary_token, save_path); // Must download file using main node.js thread. + } + } + } else { + console.log('No check for location specific files.'); + } + + + if (typeof launcher.sessions === 'undefined') { + console.log('Check for location sessions.'); + launcher.sessions = await api.get_event_location_sessions(axios, launcher.event_id, launcher.event_location_id); + for (var i in launcher.sessions) { + console.log('*** '+launcher.sessions[i].name+' ***') + + // Check for session files start + if (typeof launcher.sessions[i].files === 'undefined') { + console.log('Check for session files.'); + let for_id = launcher.sessions[i].id; + launcher.sessions[i].files = await api.get_files_for_type_for_id(axios, 'session', for_id); + if (launcher.sessions[i].files) { + console.log('Session files found.'); + for (var j in launcher.sessions[i].files) { + console.log('f: ('+launcher.sessions[i].files[j].event_file_id+') '+launcher.sessions[i].files[j].event_file_filename+' ***'); + file_id = launcher.sessions[i].files[j].event_file_id; // NOTE: the .id is the hosted_file.id! + let filename = launcher.sessions[i].files[j].hash_sha256+'.file'; + + save_path = path.join(host_file_cache_path, filename); + + if (fs.existsSync(save_path)) { + console.log('Local file already exists: '+save_path); + } else { + console.log('File not found locally. Downloading file: '+save_path); + let api_endpoint = '/event/file/'+file_id+'/download'; + ipcRenderer.send('download_file', api_base_url, api_endpoint, api_temporary_token, save_path); // Must download file using main node.js thread. + } + } + } else { + console.log('No session files found.'); + } + } else { + console.log('No check for session files.'); + } + // Check for session files end + + // Get session presentations and associated files + launcher.sessions[i].presentations = await api.get_session_presentations(axios, launcher.event_id, launcher.sessions[i].id); + for (var j in launcher.sessions[i].presentations) { + console.log('* '+launcher.sessions[i].presentations[j].name); + + // Check for presentation files start + if (typeof launcher.sessions[i].presentations[j].files === 'undefined') { + console.log('Check for presentation files.'); + let for_id = launcher.sessions[i].presentations[j].id; + launcher.sessions[i].presentations[j].files = await api.get_files_for_type_for_id(axios, 'presentation', for_id); + if (launcher.sessions[i].presentations[j].files) { + console.log('Presentation files found.'); + for (var k in launcher.sessions[i].presentations[j].files) { + console.log('f: ('+launcher.sessions[i].presentations[j].files[k].event_file_id+') '+launcher.sessions[i].presentations[j].files[k].event_file_filename+' ***'); + file_id = launcher.sessions[i].presentations[j].files[k].event_file_id; // NOTE: the .id is the hosted_file.id! + let filename = launcher.sessions[i].presentations[j].files[k].hash_sha256+'.file'; + + save_path = path.join(host_file_cache_path, filename); + + if (fs.existsSync(save_path)) { + console.log('Local file already exists: '+save_path); + } else { + console.log('File not found locally. Downloading file: '+save_path); + let api_endpoint = '/event/file/'+file_id+'/download'; + ipcRenderer.send('download_file', api_base_url, api_endpoint, api_temporary_token, save_path); // Must download file using main node.js thread. + } + } + } else { + console.log('No presentation files found.'); + } + } else { + console.log('No check for presentation files.'); + } + // Check for presentation files end + + + // Get session presentations presenters and associated files + //let event_presentation_id = launcher.sessions[i].presentations[j].id; + launcher.sessions[i].presentations[j].presenters = await api.get_presentation_presenters(axios, launcher.event_id, launcher.sessions[i].id, launcher.sessions[i].presentations[j].id); + for (var k in launcher.sessions[i].presentations[j].presenters) { + console.log('-- '+launcher.sessions[i].presentations[j].presenters[k].given_name+' '+launcher.sessions[i].presentations[j].presenters[k].family_name) + + // Check for presenter files start + if (typeof launcher.sessions[i].presentations[j].presenters[k].files === 'undefined') { + console.log('Check for presenter files.'); + let for_id = launcher.sessions[i].presentations[j].presenters[k].id; + launcher.sessions[i].presentations[j].presenters[k].files = await api.get_files_for_type_for_id(axios, 'presenter', for_id); + if (launcher.sessions[i].presentations[j].presenters[k].files) { + console.log('Presenter files found.'); + for (var l in launcher.sessions[i].presentations[j].presenters[k].files) { + console.log('f: ('+launcher.sessions[i].presentations[j].presenters[k].files[l].event_file_id+') '+launcher.sessions[i].presentations[j].presenters[k].files[l].event_file_filename+' ***') + file_id = launcher.sessions[i].presentations[j].presenters[k].files[l].event_file_id; // NOTE: the .id is the hosted_file.id! + let filename = launcher.sessions[i].presentations[j].presenters[k].files[l].hash_sha256+'.file'; + + save_path = path.join(host_file_cache_path, filename); + + if (fs.existsSync(save_path)) { + console.log('Local file already exists: '+save_path); + } else { + console.log('File not found locally. Downloading file: '+save_path); + let api_endpoint = '/event/file/'+file_id+'/download'; + ipcRenderer.send('download_file', api_base_url, api_endpoint, api_temporary_token, save_path); // Must download file using main node.js thread. + } + } + } else { + console.log('No presenter files found.'); + } + } else { + console.log('No check for presenter files.'); + } + // Check for presenter files end + + } + } + } + } else { + console.log('No check for location sessions.'); + } + + console.log('Location cache check finished.'); + return true; +} + +exports.launcher_render = async function (launcher) { + console.log('Rendering launcher...'); + document.getElementById('location_title').innerHTML = '

Launcher '+launcher.location.name+'@'+launcher.event.name+'

'; + + document.getElementById('event_files_menu').innerHTML = '

Event Files

'; + document.getElementById('event_files_menu').innerHTML += ''; + + document.getElementById('location_files_menu').innerHTML = '

Location Files

'; + document.getElementById('location_files_menu').innerHTML += ''; + + document.getElementById('sessions_menu').innerHTML = '

Sessions

'; + document.getElementById('sessions_menu').innerHTML += ''; + session_detail += ''; // for card-body + session_detail += ' '; // for card + + } + //session_detail += ' '; // for session_presentations + + //session_detail += ''; // for card-group + session_detail += ' '; + + + //document.getElementById('location_detail').innerHTML += session_detail; + + if (typeof(document.getElementById('detail_session_id_'+launcher.sessions[i].id)) != 'undefined' && document.getElementById('detail_session_id_'+launcher.sessions[i].id) != null) { + document.getElementById('detail_session_id_'+launcher.sessions[i].id).innerHTML = session_detail; + } else { + document.getElementById('location_detail').innerHTML += session_detail; + } + + + } + document.getElementById('sessions_menu').innerHTML += ''; + + index_location_detail('btn_view_session'); + + index_open_file_buttons('open_local_file'); + + + //const btn_session_{{ event_presentation.id }}_name = document.querySelector('button#presentation_{{ event_presentation.id }}_name'); + //btn_presentation_{{ event_presentation.id }}_name.onclick = display_hide_poster_for_type_id.bind(this, true, 'presentation', {{ event_presentation.id }}); + console.log('Rendering launcher finished.'); + + return true; +} + + +/* Updated 2019-12-19 */ +function index_location_detail(class_name) { + var class_elements = document.getElementsByClassName(class_name); + + for (var i = 0; i < class_elements.length; i++) { + class_elements[i].addEventListener( 'click', function() {view_session( this.getAttribute('data-session_id')) } ); + } + + return true; +} + + +/* Updated 2019-12-19 */ +function view_session(session_id) { + var class_elements = document.getElementsByClassName('session_detail'); + console.log('*** Session ID: '+session_id); + for (var i = 0; i < class_elements.length; i++) { + console.log('*** checking: '+class_elements[i].getAttribute('data-session_id')); + if (class_elements[i].getAttribute('data-session_id') == session_id) { + console.log('show'); + class_elements[i].classList.remove('d-none'); + class_elements[i].classList.add('d-block'); + } else { + console.log('hide'); + class_elements[i].classList.remove('d-block'); + class_elements[i].classList.add('d-none'); + } + } + + return true; +} + + + + + +/* Updated 2019-12-20 */ +function index_open_file_buttons(class_name) { + var class_elements = document.getElementsByClassName(class_name); + + for (var i = 0; i < class_elements.length; i++) { + //class_elements[i].addEventListener( 'click', function() {open_local_file( this.getAttribute('data-filename')) } ); + + //let directory = 'file_cache/'; + + //directory_and_filename = path.join(directory, class_elements[i].getAttribute('data-filename')); + + let file_path = path.join(host_file_cache_path, class_elements[i].getAttribute('data-hash_sha256')); + let filename = class_elements[i].getAttribute('data-filename'); + + class_elements[i].addEventListener( 'click', function() { ipcRenderer.send('open_local_file', file_path, filename) } ); + //ipcRenderer.send('open_local_file', this.getAttribute('data-filename')); // in render thread + } + + return true; +} + + + +function format_bytes(bytes, decimals = 2) { + if (bytes === 0) return '0 Bytes'; + + const k = 1024; + const dm = decimals < 0 ? 0 : decimals; + const sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB']; + + const i = Math.floor(Math.log(bytes) / Math.log(k)); + + return parseFloat((bytes / Math.pow(k, i)).toFixed(dm)) + ' ' + sizes[i]; +} diff --git a/app/js/hold api.js b/app/js/hold api.js new file mode 100644 index 0000000..b2185fa --- /dev/null +++ b/app/js/hold api.js @@ -0,0 +1,589 @@ +async function api_token_request_async() { + //var api_temporary_token = ''; + axios.defaults.baseURL = 'http://api.localhost:5001'; // 'http://api.localhost:5001' 'https://api.oneskyit.com'; + //axios.defaults.headers.post['Content-Type'] ='application/json;charset=utf-8'; + axios.defaults.headers.post['Access-Control-Allow-Origin'] = '*'; + //axios.defaults.headers.common['Authorization'] = `Token ${api_temporary_token}` + + url = '/api_token_request'; + + let data = { secret_key: 'YWAAk39H2qH0edK6lPH0yg' }; + + //console.log(data); + + try { + const response = await axios.post(url, data); + console.log(response); + api_temporary_token = response.data.temporary_token; + axios.defaults.headers.common['Authorization'] = `Token ${api_temporary_token}`; + return true; + } catch (error) { + console.error(error); + } +} + + +/* +function api_token_request_sync() { + var api_temporary_token = ''; + axios.defaults.baseURL = 'http://api.localhost:5001'; // 'http://api.localhost:5001' 'https://api.oneskyit.com'; + //axios.defaults.headers.post['Content-Type'] ='application/json;charset=utf-8'; + axios.defaults.headers.post['Access-Control-Allow-Origin'] = '*'; + //axios.defaults.headers.common['Authorization'] = `Token ${api_temporary_token}` + + url = '/api_token_request'; + + let data = { secret_key: 'YWAAk39H2qH0edK6lPH0yg' }; + + console.log(data); + + axios.post(url, data) + .then(function (response) { + console.log(response); + api_temporary_token = response.data.temporary_token; + axios.defaults.headers.common['Authorization'] = `Token ${api_temporary_token}`; + return true; + }) + .catch(function (error) { + console.log(error); + return false; + }); + return false; +} +*/ + + +function get_all_events() { + url = '/event'; + + let data = { }; + + //console.log(data); + + axios.get(url) + .then(function (response) { + console.log(response); + + if (response.data != null) { + records = response.data; + + let html = ''; + html += ''; + + /* + role_table = ''; + role_table += ''; + + for (var i in records) { + + role_table += ''; + role_table += ''; + role_table += ''; + role_table += ''; + role_table += ''; + role_table += ''; + role_table += ''; + role_table += ''; + role_table += ''; + role_table += ''; + role_table += ''; + } + + role_table += '
NameFor TypeFor IDDisableEnable OnDisable OnNotesCreated OnUpdated On
'+records[i].name+''+records[i].for_type+''+records[i].for_id+''+records[i].disable+''+records[i].enable_on+''+records[i].disable_on+''+records[i].notes+''+records[i].created_on+''+records[i].updated_on+'
'; + */ + + document.getElementById('events').innerHTML = html; + } else { + document.getElementById('events').innerHTML = 'No events found.'; + } + + return true; + }) + .catch(function (error) { + console.log(error); + return false; + }); + return false; +} + + +function get_event(event_id) { + url = '/event/'+event_id; + + let data = { }; + + //console.log(data); + + axios.get(url) + .then(function (response) { + console.log(response); + + if (response.data != null) { + record = response.data; + + let html = ''; + html += '
'; + html += record.name; + html += '
'; + + document.getElementById('event').innerHTML = html; + } else { + document.getElementById('event').innerHTML = 'Event not found.'; + } + + return true; + }) + .catch(function (error) { + console.log(error); + return false; + }); + return false; +} + + +function get_event_locations(event_id) { + url = '/event/'+event_id+'/location'; + + let data = { }; + + //console.log(data); + + axios.get(url) + .then(function (response) { + console.log(response); + + if (response.data != null) { + records = response.data; + + let html = ''; + html += ''; + + document.getElementById('event_locations').innerHTML = html; + } else { + document.getElementById('event_locations').innerHTML = 'Event locations not found.'; + } + + return true; + }) + .catch(function (error) { + console.log(error); + return false; + }); + return false; +} + + +function get_event_location(event_id, event_location_id) { + url = '/event/'+event_id+'/location/'+event_location_id; + + let data = { }; + + //console.log(data); + + axios.get(url) + .then(function (response) { + console.log(response); + + if (response.data != null) { + record = response.data; + + let html = ''; + html += '
'; + html += record.name; + html += '
'; + + document.getElementById('event_location').innerHTML = html; + } else { + document.getElementById('event_location').innerHTML = 'Event location not found.'; + } + + return true; + }) + .catch(function (error) { + console.log(error); + return false; + }); + return false; +} + + +function get_event_location_sessions(event_id, event_location_id) { + url = '/event/'+event_id+'/location/'+event_location_id+'/session'; + + let data = { }; + + //console.log(data); + + axios.get(url) + .then(function (response) { + console.log(response); + + if (response.data != null) { + record = response.data; + + let html = ''; + html += '
'; + html += record.name; + html += '
'; + + document.getElementById('event_location_sessions').innerHTML = html; + } else { + document.getElementById('event_location_sessions').innerHTML = 'Event location sessions not found.'; + } + + return true; + }) + .catch(function (error) { + console.log(error); + return false; + }); + return false; +} + + + +function get_event_sessions(event_id) { + url = '/event/'+event_id+'/session'; + + let data = { }; + + //console.log(data); + + axios.get(url) + .then(function (response) { + console.log(response); + + if (response.data != null) { + records = response.data; + + let html = ''; + html += ''; + + document.getElementById('event_sessions').innerHTML = html; + } else { + document.getElementById('event_sessions').innerHTML = 'Event sessions not found.'; + } + + return true; + }) + .catch(function (error) { + console.log(error); + return false; + }); + return false; +} + + +function get_event_session(event_id, event_session_id) { + url = '/event/'+event_id+'/session/'+event_session_id; + + let data = { }; + + //console.log(data); + + axios.get(url) + .then(function (response) { + console.log(response); + + if (response.data != null) { + record = response.data; + + let html = ''; + html += '
'; + html += record.name; + html += '
'; + + document.getElementById('event_session').innerHTML = html; + } else { + document.getElementById('event_session').innerHTML = 'Event session not found.'; + } + + return true; + }) + .catch(function (error) { + console.log(error); + return false; + }); + return false; +} + + +function get_event_session_presentations(event_id, event_session_id) { + url = '/event/'+event_id+'/session/'+event_session_id+'/presentation'; + + let data = { }; + + //console.log(data); + + axios.get(url) + .then(function (response) { + console.log(response); + + if (response.data != null) { + records = response.data; + + let html = ''; + html += ''; + + document.getElementById('event_presentations').innerHTML = html; + } else { + document.getElementById('event_presentations').innerHTML = 'Event session presentations not found.'; + } + + return true; + }) + .catch(function (error) { + console.log(error); + return false; + }); + return false; +} + + +function get_event_session_presentation(event_id, event_session_id, event_presentation_id) { + url = '/event/'+event_id+'/session/'+event_session_id+'/presentation/'+event_presentation_id; + + let data = { }; + + //console.log(data); + + axios.get(url) + .then(function (response) { + console.log(response); + + if (response.data != null) { + record = response.data; + + let html = ''; + html += '
'; + html += record.name; + html += '
'; + + document.getElementById('event_presentation').innerHTML = html; + } else { + document.getElementById('event_presentation').innerHTML = 'Event session presentation not found.'; + } + + return true; + }) + .catch(function (error) { + console.log(error); + return false; + }); + return false; +} + + +function get_event_session_presentation_presenters(event_id, event_session_id, event_presentation_id) { + url = '/event/'+event_id+'/session/'+event_session_id+'/presentation/'+event_presentation_id+'/presenter'; + + let data = { }; + + //console.log(data); + + axios.get(url) + .then(function (response) { + console.log(response); + + if (response.data != null) { + records = response.data; + + let html = ''; + html += ''; + + document.getElementById('event_presenters').innerHTML = html; + } else { + document.getElementById('event_presenters').innerHTML = 'Event session presentation presenters not found.'; + } + + return true; + }) + .catch(function (error) { + console.log(error); + return false; + }); + return false; +} + + +function get_event_session_presentation_presenter(event_id, event_session_id, event_presentation_id, event_presenter_id) { + url = '/event/'+event_id+'/session/'+event_session_id+'/presentation/'+event_presentation_id+'/presenter/'+event_presenter_id; + + let data = { }; + + //console.log(data); + + axios.get(url) + .then(function (response) { + console.log(response); + + if (response.data != null) { + record = response.data; + + let html = ''; + html += '
'; + html += record.given_name+' '+record.family_name; + html += '
'; + + document.getElementById('event_presenter').innerHTML = html; + } else { + document.getElementById('event_presenter').innerHTML = 'Event session presentation presenter not found.'; + } + + return true; + }) + .catch(function (error) { + console.log(error); + return false; + }); + return false; +} + + + + +function get_event_files(event_id) { + url = '/event/'+event_id+'/file'; + + let data = { }; + + //console.log(data); + + axios.get(url) + .then(function (response) { + console.log(response); + + if (response.data != null) { + records = response.data; + + let html = ''; + html += ''; + + document.getElementById('event_files').innerHTML = html; + } else { + document.getElementById('event_files').innerHTML = 'Event files not found.'; + } + + return true; + }) + .catch(function (error) { + console.log(error); + return false; + }); + return false; +} + + +function get_event_file(event_id, event_file_id) { + url = '/event/'+event_id+'/file/'+event_file_id; + + let data = { }; + + //console.log(data); + + axios.get(url) + .then(function (response) { + console.log(response); + + if (response.data != null) { + record = response.data; + + let html = ''; + html += '
'; + html += record.filename; + html += '
'; + + document.getElementById('event_file').innerHTML = html; + } else { + document.getElementById('event_file').innerHTML = 'Event file not found.'; + } + + return true; + }) + .catch(function (error) { + console.log(error); + return false; + }); + return false; +} + + +function get_event_file_download(event_id, event_file_id) { + url = '/event/'+event_id+'/file/'+event_file_id+'/download'; + + let data = { }; + + //console.log(data); + + axios.get(url) + .then(function (response) { + console.log(response); + + if (response.data != null) { + record = response.data; + + let html = ''; + html += '
'; + html += 'no idea'; //record.filename; + html += '
'; + + document.getElementById('event_file').innerHTML = html; + } else { + document.getElementById('event_file').innerHTML = 'Event file not found.'; + } + + return true; + }) + .catch(function (error) { + console.log(error); + return false; + }); + return false; +} + + + + + +function api_users() { + url = '/user'; + + let data = { }; + + //console.log(data); + + axios.get(url) + .then(function (response) { + console.log(response); + return true; + }) + .catch(function (error) { + console.log(error); + return false; + }); + return false; +} diff --git a/app/js/hold launcher.js b/app/js/hold launcher.js new file mode 100644 index 0000000..c259a5b --- /dev/null +++ b/app/js/hold launcher.js @@ -0,0 +1,142 @@ +const os = require('os'); +const path = require('path'); +const fs = require('fs'); + +let request_waiting = false; + +setInterval(async function() { + if (typeof axios.defaults.headers.common['Authorization'] !== 'undefined' && axios.defaults.headers.common['Authorization'] != null) { + + if (typeof launcher.sessions === 'undefined') { + console.log('Check for location files.'); + let for_id = launcher.event_location_id; + launcher.files = await api.get_files_for_type_for_id(axios, 'location', for_id); + for (var i in launcher.files) { + console.log('f: ('+launcher.files[i].event_file_id+') '+launcher.files[i].event_file_filename+' ***') + file_id = launcher.files[i].event_file_id; // NOTE: the .id is the hosted_file.id! + filename = launcher.files[i].hash_sha256+'.file'; + + save_path = path.join(file_cache_path, filename); + + //console.log(directory_and_filename); + + if (fs.existsSync(save_path)) { + console.log('Local file already exists: '+save_path); + } else { + console.log('File not found locally. Downloading file: '+save_path); + ipcRenderer.send('download_file', api_base_url, api_endpoint, api_temporary_token, save_path); // Must download file using main node.js thread. + //response.data.pipe(fs.createWriteStream(directory_and_filename)); + } + //let results = await api.download_file_id(axios, file_id, hash_sha256); + + } + } else { + console.log('No check for location files.'); + } + + if (typeof launcher.sessions === 'undefined') { + console.log('Check for location sessions.'); + launcher.sessions = await api.get_event_location_sessions(axios, launcher.event_id, launcher.event_location_id); + for (var i in launcher.sessions) { + console.log('*** '+launcher.sessions[i].name+' ***') + + // Check for session files start + if (typeof launcher.sessions[i].files === 'undefined') { + console.log('Check for session files.'); + let for_id = launcher.sessions[i].id; + launcher.sessions[i].files = await api.get_files_for_type_for_id(axios, 'session', for_id); + if (launcher.sessions[i].files) { + console.log('Session files found.'); + for (var j in launcher.sessions[i].files) { + console.log('f: ('+launcher.sessions[i].files[j].event_file_id+') '+launcher.sessions[i].files[j].event_file_filename+' ***'); + file_id = launcher.sessions[i].files[j].event_file_id; // NOTE: the .id is the hosted_file.id! + hash_sha256 = launcher.sessions[i].files[j].hash_sha256+'.file'; + let results = await api.download_file_id(axios, file_id, hash_sha256); + } + } else { + console.log('No session files found.'); + } + } else { + console.log('No check for session files.'); + } + // Check for session files end + + // Get session presentations and associated files + launcher.sessions[i].presentations = await api.get_session_presentations(axios, launcher.event_id, launcher.sessions[i].id); + for (var j in launcher.sessions[i].presentations) { + console.log('* '+launcher.sessions[i].presentations[j].name); + + // Check for presentation files start + if (typeof launcher.sessions[i].presentations[j].files === 'undefined') { + console.log('Check for presentation files.'); + let for_id = launcher.sessions[i].presentations[j].id; + launcher.sessions[i].presentations[j].files = await api.get_files_for_type_for_id(axios, 'presentation', for_id); + if (launcher.sessions[i].presentations[j].files) { + console.log('Presentation files found.'); + for (var k in launcher.sessions[i].presentations[j].files) { + console.log('f: ('+launcher.sessions[i].presentations[j].files[k].event_file_id+') '+launcher.sessions[i].presentations[j].files[k].event_file_filename+' ***'); + file_id = launcher.sessions[i].presentations[j].files[k].event_file_id; // NOTE: the .id is the hosted_file.id! + hash_sha256 = launcher.sessions[i].presentations[j].files[k].hash_sha256+'.file'; + let results = await api.download_file_id(axios, file_id, hash_sha256); + } + } else { + console.log('No presentation files found.'); + } + } else { + console.log('No check for presentation files.'); + } + // Check for presentation files end + + + // Get session presentations presenters and associated files + //let event_presentation_id = launcher.sessions[i].presentations[j].id; + launcher.sessions[i].presentations[j].presenters = await api.get_presentation_presenters(axios, launcher.event_id, launcher.sessions[i].id, launcher.sessions[i].presentations[j].id); + for (var k in launcher.sessions[i].presentations[j].presenters) { + console.log('-- '+launcher.sessions[i].presentations[j].presenters[k].given_name+' '+launcher.sessions[i].presentations[j].presenters[k].family_name) + + // Check for presenter files start + if (typeof launcher.sessions[i].presentations[j].presenters[k].files === 'undefined') { + console.log('Check for presenter files.'); + let for_id = launcher.sessions[i].presentations[j].presenters[k].id; + launcher.sessions[i].presentations[j].presenters[k].files = await api.get_files_for_type_for_id(axios, 'presenter', for_id); + if (launcher.sessions[i].presentations[j].presenters[k].files) { + console.log('Presenter files found.'); + for (var l in launcher.sessions[i].presentations[j].presenters[k].files) { + console.log('f: ('+launcher.sessions[i].presentations[j].presenters[k].files[l].event_file_id+') '+launcher.sessions[i].presentations[j].presenters[k].files[l].event_file_filename+' ***') + file_id = launcher.sessions[i].presentations[j].presenters[k].files[l].event_file_id; // NOTE: the .id is the hosted_file.id! + hash_sha256 = launcher.sessions[i].presentations[j].presenters[k].files[l].hash_sha256+'.file'; + let results = await api.download_file_id(axios, file_id, hash_sha256); + } + } else { + console.log('No presenter files found.'); + } + } else { + console.log('No check for presenter files.'); + } + // Check for presenter files end + + } + } + } + } else { + console.log('No check for location sessions.'); + } + /* + if (launcher.sessions) { + console.log('Check for session files.'); + let for_id = launcher.event_location_id; + launcher.files = await api.get_files_for_type_for_id(axios, 'location', for_id); + for (var i in launcher.sessions) { + console.log('f: ('+launcher.sessions[i].event_file_id+') '+launcher.files[i].event_file_filename+' ***') + file_id = launcher.files[i].event_file_id; // NOTE: the .id is the hosted_file.id! + let results = await api.download_file_id(axios, file_id); + } + } else { + console.log('No check for location files.'); + } + */ + + } else { + console.log('Waiting a few more seconds to see if Authorization header is set.'); + } +}, 5000); diff --git a/app/js/hold testing.js b/app/js/hold testing.js new file mode 100644 index 0000000..503e060 --- /dev/null +++ b/app/js/hold testing.js @@ -0,0 +1,50 @@ +const { shell } = require('electron'); +const fs = require('fs'); +const screen = require('screen'); + +const path = ''; +const filename = 'test.txt'; + +//Check if file exists +if(fs.existsSync(filename)) { +} else { + console.log("File does not exist. Creating new file.") + fs.writeFile(filename, '', (err) => { + if(err) + console.log(err) + }) +} + +//shell.openItem('test.txt'); + +/* +const path = './'; +if (fs.stat.isDirectory(path)) { + console.log('Directory'); +} else { + console.log('File or nothing'); +} +*/ + +/* +function testing() { + console.log(api_temporary_token); +} +*/ + +/* Testing inter-process communication (IPC) */ +/* +var ipc = require('electron').ipcRenderer; +var authButton = document.getElementById('test_button'); +authButton.addEventListener('click', function(){ + ipc.once('action_reply', function(event, response){ + processResponse(response); + }) + //ipc.send('invoke_action', 'Test PowerPoint.pptx'); + ipc.send('invoke_action', api_temporary_token); +}); + +function processResponse(response) { + document.getElementById('response').innerHTML = "Response: "+response; +} +*/ diff --git a/app/js/launcher.js.bak b/app/js/launcher.js.bak new file mode 100644 index 0000000..c259a5b --- /dev/null +++ b/app/js/launcher.js.bak @@ -0,0 +1,142 @@ +const os = require('os'); +const path = require('path'); +const fs = require('fs'); + +let request_waiting = false; + +setInterval(async function() { + if (typeof axios.defaults.headers.common['Authorization'] !== 'undefined' && axios.defaults.headers.common['Authorization'] != null) { + + if (typeof launcher.sessions === 'undefined') { + console.log('Check for location files.'); + let for_id = launcher.event_location_id; + launcher.files = await api.get_files_for_type_for_id(axios, 'location', for_id); + for (var i in launcher.files) { + console.log('f: ('+launcher.files[i].event_file_id+') '+launcher.files[i].event_file_filename+' ***') + file_id = launcher.files[i].event_file_id; // NOTE: the .id is the hosted_file.id! + filename = launcher.files[i].hash_sha256+'.file'; + + save_path = path.join(file_cache_path, filename); + + //console.log(directory_and_filename); + + if (fs.existsSync(save_path)) { + console.log('Local file already exists: '+save_path); + } else { + console.log('File not found locally. Downloading file: '+save_path); + ipcRenderer.send('download_file', api_base_url, api_endpoint, api_temporary_token, save_path); // Must download file using main node.js thread. + //response.data.pipe(fs.createWriteStream(directory_and_filename)); + } + //let results = await api.download_file_id(axios, file_id, hash_sha256); + + } + } else { + console.log('No check for location files.'); + } + + if (typeof launcher.sessions === 'undefined') { + console.log('Check for location sessions.'); + launcher.sessions = await api.get_event_location_sessions(axios, launcher.event_id, launcher.event_location_id); + for (var i in launcher.sessions) { + console.log('*** '+launcher.sessions[i].name+' ***') + + // Check for session files start + if (typeof launcher.sessions[i].files === 'undefined') { + console.log('Check for session files.'); + let for_id = launcher.sessions[i].id; + launcher.sessions[i].files = await api.get_files_for_type_for_id(axios, 'session', for_id); + if (launcher.sessions[i].files) { + console.log('Session files found.'); + for (var j in launcher.sessions[i].files) { + console.log('f: ('+launcher.sessions[i].files[j].event_file_id+') '+launcher.sessions[i].files[j].event_file_filename+' ***'); + file_id = launcher.sessions[i].files[j].event_file_id; // NOTE: the .id is the hosted_file.id! + hash_sha256 = launcher.sessions[i].files[j].hash_sha256+'.file'; + let results = await api.download_file_id(axios, file_id, hash_sha256); + } + } else { + console.log('No session files found.'); + } + } else { + console.log('No check for session files.'); + } + // Check for session files end + + // Get session presentations and associated files + launcher.sessions[i].presentations = await api.get_session_presentations(axios, launcher.event_id, launcher.sessions[i].id); + for (var j in launcher.sessions[i].presentations) { + console.log('* '+launcher.sessions[i].presentations[j].name); + + // Check for presentation files start + if (typeof launcher.sessions[i].presentations[j].files === 'undefined') { + console.log('Check for presentation files.'); + let for_id = launcher.sessions[i].presentations[j].id; + launcher.sessions[i].presentations[j].files = await api.get_files_for_type_for_id(axios, 'presentation', for_id); + if (launcher.sessions[i].presentations[j].files) { + console.log('Presentation files found.'); + for (var k in launcher.sessions[i].presentations[j].files) { + console.log('f: ('+launcher.sessions[i].presentations[j].files[k].event_file_id+') '+launcher.sessions[i].presentations[j].files[k].event_file_filename+' ***'); + file_id = launcher.sessions[i].presentations[j].files[k].event_file_id; // NOTE: the .id is the hosted_file.id! + hash_sha256 = launcher.sessions[i].presentations[j].files[k].hash_sha256+'.file'; + let results = await api.download_file_id(axios, file_id, hash_sha256); + } + } else { + console.log('No presentation files found.'); + } + } else { + console.log('No check for presentation files.'); + } + // Check for presentation files end + + + // Get session presentations presenters and associated files + //let event_presentation_id = launcher.sessions[i].presentations[j].id; + launcher.sessions[i].presentations[j].presenters = await api.get_presentation_presenters(axios, launcher.event_id, launcher.sessions[i].id, launcher.sessions[i].presentations[j].id); + for (var k in launcher.sessions[i].presentations[j].presenters) { + console.log('-- '+launcher.sessions[i].presentations[j].presenters[k].given_name+' '+launcher.sessions[i].presentations[j].presenters[k].family_name) + + // Check for presenter files start + if (typeof launcher.sessions[i].presentations[j].presenters[k].files === 'undefined') { + console.log('Check for presenter files.'); + let for_id = launcher.sessions[i].presentations[j].presenters[k].id; + launcher.sessions[i].presentations[j].presenters[k].files = await api.get_files_for_type_for_id(axios, 'presenter', for_id); + if (launcher.sessions[i].presentations[j].presenters[k].files) { + console.log('Presenter files found.'); + for (var l in launcher.sessions[i].presentations[j].presenters[k].files) { + console.log('f: ('+launcher.sessions[i].presentations[j].presenters[k].files[l].event_file_id+') '+launcher.sessions[i].presentations[j].presenters[k].files[l].event_file_filename+' ***') + file_id = launcher.sessions[i].presentations[j].presenters[k].files[l].event_file_id; // NOTE: the .id is the hosted_file.id! + hash_sha256 = launcher.sessions[i].presentations[j].presenters[k].files[l].hash_sha256+'.file'; + let results = await api.download_file_id(axios, file_id, hash_sha256); + } + } else { + console.log('No presenter files found.'); + } + } else { + console.log('No check for presenter files.'); + } + // Check for presenter files end + + } + } + } + } else { + console.log('No check for location sessions.'); + } + /* + if (launcher.sessions) { + console.log('Check for session files.'); + let for_id = launcher.event_location_id; + launcher.files = await api.get_files_for_type_for_id(axios, 'location', for_id); + for (var i in launcher.sessions) { + console.log('f: ('+launcher.sessions[i].event_file_id+') '+launcher.files[i].event_file_filename+' ***') + file_id = launcher.files[i].event_file_id; // NOTE: the .id is the hosted_file.id! + let results = await api.download_file_id(axios, file_id); + } + } else { + console.log('No check for location files.'); + } + */ + + } else { + console.log('Waiting a few more seconds to see if Authorization header is set.'); + } +}, 5000); diff --git a/app/js/module_api 2019-12-20.js.bak b/app/js/module_api 2019-12-20.js.bak new file mode 100644 index 0000000..e97c537 --- /dev/null +++ b/app/js/module_api 2019-12-20.js.bak @@ -0,0 +1,422 @@ +const os = require('os'); +const path = require('path'); +const fs = require('fs'); + +const { ipcRenderer } = require('electron'); + +exports.api_token_request_async = async function (axios, secret_key) { + console.log('Requesting API temporary token...'); + const url = '/api_token_request'; + + let data = { secret_key: secret_key }; + + const response = await axios.post(url, data) + .then(function (response) { + //console.log(response); + const api_temporary_token = response.data.temporary_token; + //console.log('API Temporary Token: '+temporary_token); + return api_temporary_token; + }) + .catch(function (error) { + console.error(error); + return error; + }); + return response; +} + + +exports.get_event_location_sessions = async function (axios, event_id, event_location_id) { + console.log('Requesting location sessions...'); + const url = '/event/'+event_id+'/location/'+event_location_id+'/session'; + + const data = await axios.get(url) + .then(function (response) { + //console.log(response.data); + //data = response.data; + return response.data; + }) + .catch(function (error) { + console.log(error); + return error; + }); + + return data; +} + + +exports.get_session_presentations = async function (axios, event_id, event_session_id) { + console.log('Requesting session presentations...'); + const url = '/event/'+event_id+'/session/'+event_session_id+'/presentation'; + + const data = await axios.get(url) + .then(function (response) { + //console.log(response.data); + //data = response.data; + return response.data; + }) + .catch(function (error) { + console.log(error); + return error; + }); + + return data; +} + + +exports.get_presentation_presenters = async function (axios, event_id, event_session_id, event_presentation_id) { + console.log('Requesting presentation presenters...'); + const url = '/event/'+event_id+'/session/'+event_session_id+'/presentation/'+event_presentation_id+'/presenter'; + + const data = await axios.get(url) + .then(function (response) { + //console.log(response.data); + //data = response.data; + return response.data; + }) + .catch(function (error) { + console.log(error); + return error; + }); + + return data; +} + + +exports.get_files_for_type_for_id = async function (axios, for_type, for_id) { + console.log('Requesting files for '+for_type+' '+for_id); + const url = '/event/file/'+for_type+'/'+for_id; + + const data = await axios.get(url) + .then(function (response) { + //console.log(response.data); + //data = response.data; + return response.data; + }) + .catch(function (error) { + console.log(error); + return error; + }); + + return data; +} + + +exports.download_file_id = async function (axios, file_id, filename) { + + ipcRenderer.send('download_file', api_base_url, api_endpoint, api_temporary_token, save_path); // in render thread + + console.log('1: download file id '+file_id); + const url = '/event/file/'+file_id+'/download'; + + //const data = await axios.get(url, responseType: 'stream') + const data = await axios({ + method: "get", + url: url, + responseType: "stream" + }) + .then(function (response) { + console.log('2: downloaded file id '+file_id); + console.log(response); + //console.log(response.data); + + let filename = 'default.txt'; + + if (typeof filename_override === 'undefined' || filename_override == null) { + let headerLine = response.data.headers['content-disposition']; + + console.log(headerLine); + console.log(headerLine.indexOf('="')); + console.log(headerLine.indexOf('=')); + if (headerLine.indexOf('="') != -1) { + let startFileNameIndex = headerLine.indexOf('="') + 2; + let endFileNameIndex = headerLine.lastIndexOf('"'); + filename = headerLine.substring(startFileNameIndex, endFileNameIndex); + } else if (headerLine.indexOf('=') != -1) { + let startFileNameIndex = headerLine.indexOf('=') + 1; + let endFileNameIndex = headerLine.length; + filename = headerLine.substring(startFileNameIndex, endFileNameIndex); + } else { + filename = 'filename_not_found_in_header.txt'; + } + } else { + filename = filename_override; + } + + let directory = 'file_cache/'; + + directory_and_filename = path.join(directory, filename); + + //console.log(directory_and_filename); + + if (fs.existsSync(directory_and_filename)) { + console.log('3a: file already exists: '+directory_and_filename); + } else { + console.log('3b: saving file: '+directory_and_filename); + response.data.pipe(fs.createWriteStream(directory_and_filename)); + } + //data = response.data; + console.log('4: saved file id '+file_id); + return true; + //return response.data; + }) + .catch(function (error) { + console.log(error); + return error; + }); + + //return data; +} + +exports.launcher_cache_check = async function (launcher, api_base_url, api_temporary_token, file_cache_path) { + if (typeof launcher.event_files === 'undefined') { + console.log('Check for global event files.'); + let for_id = launcher.event_id; + launcher.event_files = await api.get_files_for_type_for_id(axios, 'event', for_id); + for (var i in launcher.event_files) { + console.log('f: ('+launcher.event_files[i].event_file_id+') '+launcher.event_files[i].event_file_filename+' ***') + file_id = launcher.event_files[i].event_file_id; // NOTE: the .id is the hosted_file.id! + let filename = launcher.event_files[i].hash_sha256+'.file'; + + save_path = path.join(file_cache_path, filename); + + if (fs.existsSync(save_path)) { + console.log('Local file already exists: '+save_path); + } else { + console.log('File not found locally. Downloading file: '+save_path); + let api_endpoint = '/event/file/'+file_id+'/download'; + ipcRenderer.send('download_file', api_base_url, api_endpoint, api_temporary_token, save_path); // Must download file using main node.js thread. + } + } + } else { + console.log('No check for global event files'); + } + + + if (typeof launcher.location_files === 'undefined') { + console.log('Check for location specific files.'); + let for_id = launcher.event_location_id; + launcher.location_files = await api.get_files_for_type_for_id(axios, 'location', for_id); + for (var i in launcher.location_files) { + console.log('f: ('+launcher.location_files[i].event_file_id+') '+launcher.location_files[i].event_file_filename+' ***') + file_id = launcher.location_files[i].event_file_id; // NOTE: the .id is the hosted_file.id! + let filename = launcher.location_files[i].hash_sha256+'.file'; + + save_path = path.join(file_cache_path, filename); + + if (fs.existsSync(save_path)) { + console.log('Local file already exists: '+save_path); + } else { + console.log('File not found locally. Downloading file: '+save_path); + let api_endpoint = '/event/file/'+file_id+'/download'; + ipcRenderer.send('download_file', api_base_url, api_endpoint, api_temporary_token, save_path); // Must download file using main node.js thread. + } + } + } else { + console.log('No check for location specific files.'); + } + + + if (typeof launcher.sessions === 'undefined') { + console.log('Check for location sessions.'); + launcher.sessions = await api.get_event_location_sessions(axios, launcher.event_id, launcher.event_location_id); + for (var i in launcher.sessions) { + console.log('*** '+launcher.sessions[i].name+' ***') + + // Check for session files start + if (typeof launcher.sessions[i].files === 'undefined') { + console.log('Check for session files.'); + let for_id = launcher.sessions[i].id; + launcher.sessions[i].files = await api.get_files_for_type_for_id(axios, 'session', for_id); + if (launcher.sessions[i].files) { + console.log('Session files found.'); + for (var j in launcher.sessions[i].files) { + console.log('f: ('+launcher.sessions[i].files[j].event_file_id+') '+launcher.sessions[i].files[j].event_file_filename+' ***'); + file_id = launcher.sessions[i].files[j].event_file_id; // NOTE: the .id is the hosted_file.id! + let filename = launcher.sessions[i].files[j].hash_sha256+'.file'; + + save_path = path.join(file_cache_path, filename); + + if (fs.existsSync(save_path)) { + console.log('Local file already exists: '+save_path); + } else { + console.log('File not found locally. Downloading file: '+save_path); + let api_endpoint = '/event/file/'+file_id+'/download'; + ipcRenderer.send('download_file', api_base_url, api_endpoint, api_temporary_token, save_path); // Must download file using main node.js thread. + } + } + } else { + console.log('No session files found.'); + } + } else { + console.log('No check for session files.'); + } + // Check for session files end + + // Get session presentations and associated files + launcher.sessions[i].presentations = await api.get_session_presentations(axios, launcher.event_id, launcher.sessions[i].id); + for (var j in launcher.sessions[i].presentations) { + console.log('* '+launcher.sessions[i].presentations[j].name); + + // Check for presentation files start + if (typeof launcher.sessions[i].presentations[j].files === 'undefined') { + console.log('Check for presentation files.'); + let for_id = launcher.sessions[i].presentations[j].id; + launcher.sessions[i].presentations[j].files = await api.get_files_for_type_for_id(axios, 'presentation', for_id); + if (launcher.sessions[i].presentations[j].files) { + console.log('Presentation files found.'); + for (var k in launcher.sessions[i].presentations[j].files) { + console.log('f: ('+launcher.sessions[i].presentations[j].files[k].event_file_id+') '+launcher.sessions[i].presentations[j].files[k].event_file_filename+' ***'); + file_id = launcher.sessions[i].presentations[j].files[k].event_file_id; // NOTE: the .id is the hosted_file.id! + let filename = launcher.sessions[i].presentations[j].files[k].hash_sha256+'.file'; + + save_path = path.join(file_cache_path, filename); + + if (fs.existsSync(save_path)) { + console.log('Local file already exists: '+save_path); + } else { + console.log('File not found locally. Downloading file: '+save_path); + let api_endpoint = '/event/file/'+file_id+'/download'; + ipcRenderer.send('download_file', api_base_url, api_endpoint, api_temporary_token, save_path); // Must download file using main node.js thread. + } + } + } else { + console.log('No presentation files found.'); + } + } else { + console.log('No check for presentation files.'); + } + // Check for presentation files end + + + // Get session presentations presenters and associated files + //let event_presentation_id = launcher.sessions[i].presentations[j].id; + launcher.sessions[i].presentations[j].presenters = await api.get_presentation_presenters(axios, launcher.event_id, launcher.sessions[i].id, launcher.sessions[i].presentations[j].id); + for (var k in launcher.sessions[i].presentations[j].presenters) { + console.log('-- '+launcher.sessions[i].presentations[j].presenters[k].given_name+' '+launcher.sessions[i].presentations[j].presenters[k].family_name) + + // Check for presenter files start + if (typeof launcher.sessions[i].presentations[j].presenters[k].files === 'undefined') { + console.log('Check for presenter files.'); + let for_id = launcher.sessions[i].presentations[j].presenters[k].id; + launcher.sessions[i].presentations[j].presenters[k].files = await api.get_files_for_type_for_id(axios, 'presenter', for_id); + if (launcher.sessions[i].presentations[j].presenters[k].files) { + console.log('Presenter files found.'); + for (var l in launcher.sessions[i].presentations[j].presenters[k].files) { + console.log('f: ('+launcher.sessions[i].presentations[j].presenters[k].files[l].event_file_id+') '+launcher.sessions[i].presentations[j].presenters[k].files[l].event_file_filename+' ***') + file_id = launcher.sessions[i].presentations[j].presenters[k].files[l].event_file_id; // NOTE: the .id is the hosted_file.id! + let filename = launcher.sessions[i].presentations[j].presenters[k].files[l].hash_sha256+'.file'; + + save_path = path.join(file_cache_path, filename); + + if (fs.existsSync(save_path)) { + console.log('Local file already exists: '+save_path); + } else { + console.log('File not found locally. Downloading file: '+save_path); + let api_endpoint = '/event/file/'+file_id+'/download'; + ipcRenderer.send('download_file', api_base_url, api_endpoint, api_temporary_token, save_path); // Must download file using main node.js thread. + } + } + } else { + console.log('No presenter files found.'); + } + } else { + console.log('No check for presenter files.'); + } + // Check for presenter files end + + } + } + } + } else { + console.log('No check for location sessions.'); + } + + console.log('Location cache check finished.'); + return true; +} + +exports.launcher_render = async function (launcher) { + console.log('Rendering launcher...'); + document.getElementById('location_title').innerHTML = '

Launcher '+launcher.event_location_id+'@'+launcher.event_id+'

'; + + document.getElementById('event_files_menu').innerHTML = '

Event Files

'; + document.getElementById('event_files_menu').innerHTML += ''; + + document.getElementById('location_files_menu').innerHTML = '

Location Files

'; + document.getElementById('location_files_menu').innerHTML += ''; + + document.getElementById('sessions_menu').innerHTML = '

Sessions

'; + document.getElementById('sessions_menu').innerHTML += ''; + + } + document.getElementById('sessions_menu').innerHTML += ''; + + index_sessions_detail('btn_view_session'); + + + //const btn_session_{{ event_presentation.id }}_name = document.querySelector('button#presentation_{{ event_presentation.id }}_name'); + //btn_presentation_{{ event_presentation.id }}_name.onclick = display_hide_poster_for_type_id.bind(this, true, 'presentation', {{ event_presentation.id }}); + + return true; +} + + +/* Updated 2019-12-19 */ +function index_sessions_detail(class_name) { + var class_elements = document.getElementsByClassName(class_name); + + for (var i = 0; i < class_elements.length; i++) { + class_elements[i].addEventListener( 'click', function() {view_session( this.getAttribute('data-session_id')) } ); + } + + return true; +} + + +/* Updated 2019-12-19 */ +function view_session(session_id) { + var class_elements = document.getElementsByClassName('session_detail'); + console.log('*** Session ID: '+session_id); + for (var i = 0; i < class_elements.length; i++) { + console.log('*** checking: '+class_elements[i].getAttribute('data-session_id')); + if (class_elements[i].getAttribute('data-session_id') == session_id) { + console.log('show'); + class_elements[i].classList.remove('d-none'); + class_elements[i].classList.add('d-block'); + } else { + console.log('hide'); + class_elements[i].classList.remove('d-block'); + class_elements[i].classList.add('d-none'); + } + } + + return true; +} diff --git a/app/js/module_api 2020-01-08.js.bak b/app/js/module_api 2020-01-08.js.bak new file mode 100644 index 0000000..2814fc4 --- /dev/null +++ b/app/js/module_api 2020-01-08.js.bak @@ -0,0 +1,614 @@ +const os = require('os'); +const path = require('path'); +const fs = require('fs'); + +const { ipcRenderer } = require('electron'); + +exports.api_token_request_async = async function (axios, secret_key) { + console.log('Requesting API temporary token...'); + const url = '/api_token_request'; + + let data = { secret_key: secret_key }; + + const response = await axios.post(url, data) + .then(function (response) { + //console.log(response); + const api_temporary_token = response.data.temporary_token; + //console.log('API Temporary Token: '+temporary_token); + return api_temporary_token; + }) + .catch(function (error) { + console.error(error); + return error; + }); + return response; +} + + +exports.get_event_details = async function (axios, event_id) { + console.log('Requesting event details...'); + const url = '/event/'+event_id; + + const data = await axios.get(url) + .then(function (response) { + //console.log(response.data); + //data = response.data; + return response.data; + }) + .catch(function (error) { + console.log(error); + return error; + }); + + return data; +} + + +exports.get_event_location_details = async function (axios, event_id, event_location_id) { + console.log('Requesting event location details...'); + const url = '/event/'+event_id+'/location/'+event_location_id; + + const data = await axios.get(url) + .then(function (response) { + //console.log(response.data); + //data = response.data; + return response.data; + }) + .catch(function (error) { + console.log(error); + return error; + }); + + return data; +} + + +exports.get_event_location_sessions = async function (axios, event_id, event_location_id) { + console.log('Requesting location sessions...'); + const url = '/event/'+event_id+'/location/'+event_location_id+'/session'; + + const data = await axios.get(url) + .then(function (response) { + //console.log(response.data); + //data = response.data; + return response.data; + }) + .catch(function (error) { + console.log(error); + return error; + }); + + return data; +} + + +exports.get_session_presentations = async function (axios, event_id, event_session_id) { + console.log('Requesting session presentations...'); + const url = '/event/'+event_id+'/session/'+event_session_id+'/presentation'; + + const data = await axios.get(url) + .then(function (response) { + //console.log(response.data); + //data = response.data; + return response.data; + }) + .catch(function (error) { + console.log(error); + return error; + }); + + return data; +} + + +exports.get_presentation_presenters = async function (axios, event_id, event_session_id, event_presentation_id) { + console.log('Requesting presentation presenters...'); + const url = '/event/'+event_id+'/session/'+event_session_id+'/presentation/'+event_presentation_id+'/presenter'; + + const data = await axios.get(url) + .then(function (response) { + //console.log(response.data); + //data = response.data; + return response.data; + }) + .catch(function (error) { + console.log(error); + return error; + }); + + return data; +} + + +exports.get_files_for_type_for_id = async function (axios, for_type, for_id) { + console.log('Requesting files for '+for_type+' '+for_id); + const url = '/event/file/'+for_type+'/'+for_id; + + const data = await axios.get(url) + .then(function (response) { + //console.log(response.data); + //data = response.data; + return response.data; + }) + .catch(function (error) { + console.log(error); + return error; + }); + + return data; +} + + +exports.download_file_id = async function (axios, file_id, filename) { + + ipcRenderer.send('download_file', api_base_url, api_endpoint, api_temporary_token, save_path); // in render thread + + console.log('1: download file id '+file_id); + const url = '/event/file/'+file_id+'/download'; + + //const data = await axios.get(url, responseType: 'stream') + const data = await axios({ + method: "get", + url: url, + responseType: "stream" + }) + .then(function (response) { + console.log('2: downloaded file id '+file_id); + console.log(response); + //console.log(response.data); + + let filename = 'default.txt'; + + if (typeof filename_override === 'undefined' || filename_override == null) { + let headerLine = response.data.headers['content-disposition']; + + console.log(headerLine); + console.log(headerLine.indexOf('="')); + console.log(headerLine.indexOf('=')); + if (headerLine.indexOf('="') != -1) { + let startFileNameIndex = headerLine.indexOf('="') + 2; + let endFileNameIndex = headerLine.lastIndexOf('"'); + filename = headerLine.substring(startFileNameIndex, endFileNameIndex); + } else if (headerLine.indexOf('=') != -1) { + let startFileNameIndex = headerLine.indexOf('=') + 1; + let endFileNameIndex = headerLine.length; + filename = headerLine.substring(startFileNameIndex, endFileNameIndex); + } else { + filename = 'filename_not_found_in_header.txt'; + } + } else { + filename = filename_override; + } + + let directory = 'file_cache/'; + + directory_and_filename = path.join(directory, filename); + + //console.log(directory_and_filename); + + if (fs.existsSync(directory_and_filename)) { + console.log('3a: file already exists: '+directory_and_filename); + } else { + console.log('3b: saving file: '+directory_and_filename); + response.data.pipe(fs.createWriteStream(directory_and_filename)); + } + //data = response.data; + console.log('4: saved file id '+file_id); + return true; + //return response.data; + }) + .catch(function (error) { + console.log(error); + return error; + }); + + //return data; +} + +exports.launcher_cache_check = async function (launcher, api_base_url, api_temporary_token, file_cache_path) { + + if (typeof launcher.event === 'undefined') { + launcher.event = await api.get_event_details(axios, launcher.event_id); + console.log(launcher.event.id); + idbKeyval.set(launcher.event.id, launcher.event, db_event); + /* + .then(function (data) { + console.log(data.id); + idbKeyval.set(data.id, data, db_event); + //for (var i in response) { + //var event_record = data[i]; + //idbKeyval.set(response[i].id, response[i], db_event); + //} + }); + */ + + } + + if (typeof launcher.location === 'undefined') { + launcher.location = await api.get_event_location_details(axios, launcher.event_id, launcher.event_location_id); + } + + if (typeof launcher.event_files === 'undefined') { + console.log('Check for global event files.'); + let for_id = launcher.event_id; + launcher.event_files = await api.get_files_for_type_for_id(axios, 'event', for_id); + for (var i in launcher.event_files) { + console.log('f: ('+launcher.event_files[i].event_file_id+') '+launcher.event_files[i].event_file_filename+' ***') + file_id = launcher.event_files[i].event_file_id; // NOTE: the .id is the hosted_file.id! + let filename = launcher.event_files[i].hash_sha256+'.file'; + + save_path = path.join(file_cache_path, filename); + + if (fs.existsSync(save_path)) { + console.log('Local file already exists: '+save_path); + } else { + console.log('File not found locally. Downloading file: '+save_path); + let api_endpoint = '/event/file/'+file_id+'/download'; + ipcRenderer.send('download_file', api_base_url, api_endpoint, api_temporary_token, save_path); // Must download file using main node.js thread. + } + } + } else { + console.log('No check for global event files'); + } + + + if (typeof launcher.location_files === 'undefined') { + console.log('Check for location specific files.'); + let for_id = launcher.event_location_id; + launcher.location_files = await api.get_files_for_type_for_id(axios, 'location', for_id); + for (var i in launcher.location_files) { + console.log('f: ('+launcher.location_files[i].event_file_id+') '+launcher.location_files[i].event_file_filename+' ***') + file_id = launcher.location_files[i].event_file_id; // NOTE: the .id is the hosted_file.id! + let filename = launcher.location_files[i].hash_sha256+'.file'; + + save_path = path.join(file_cache_path, filename); + + if (fs.existsSync(save_path)) { + console.log('Local file already exists: '+save_path); + } else { + console.log('File not found locally. Downloading file: '+save_path); + let api_endpoint = '/event/file/'+file_id+'/download'; + ipcRenderer.send('download_file', api_base_url, api_endpoint, api_temporary_token, save_path); // Must download file using main node.js thread. + } + } + } else { + console.log('No check for location specific files.'); + } + + + if (typeof launcher.sessions === 'undefined') { + console.log('Check for location sessions.'); + launcher.sessions = await api.get_event_location_sessions(axios, launcher.event_id, launcher.event_location_id); + for (var i in launcher.sessions) { + console.log('*** '+launcher.sessions[i].name+' ***') + + // Check for session files start + if (typeof launcher.sessions[i].files === 'undefined') { + console.log('Check for session files.'); + let for_id = launcher.sessions[i].id; + launcher.sessions[i].files = await api.get_files_for_type_for_id(axios, 'session', for_id); + if (launcher.sessions[i].files) { + console.log('Session files found.'); + for (var j in launcher.sessions[i].files) { + console.log('f: ('+launcher.sessions[i].files[j].event_file_id+') '+launcher.sessions[i].files[j].event_file_filename+' ***'); + file_id = launcher.sessions[i].files[j].event_file_id; // NOTE: the .id is the hosted_file.id! + let filename = launcher.sessions[i].files[j].hash_sha256+'.file'; + + save_path = path.join(file_cache_path, filename); + + if (fs.existsSync(save_path)) { + console.log('Local file already exists: '+save_path); + } else { + console.log('File not found locally. Downloading file: '+save_path); + let api_endpoint = '/event/file/'+file_id+'/download'; + ipcRenderer.send('download_file', api_base_url, api_endpoint, api_temporary_token, save_path); // Must download file using main node.js thread. + } + } + } else { + console.log('No session files found.'); + } + } else { + console.log('No check for session files.'); + } + // Check for session files end + + // Get session presentations and associated files + launcher.sessions[i].presentations = await api.get_session_presentations(axios, launcher.event_id, launcher.sessions[i].id); + for (var j in launcher.sessions[i].presentations) { + console.log('* '+launcher.sessions[i].presentations[j].name); + + // Check for presentation files start + if (typeof launcher.sessions[i].presentations[j].files === 'undefined') { + console.log('Check for presentation files.'); + let for_id = launcher.sessions[i].presentations[j].id; + launcher.sessions[i].presentations[j].files = await api.get_files_for_type_for_id(axios, 'presentation', for_id); + if (launcher.sessions[i].presentations[j].files) { + console.log('Presentation files found.'); + for (var k in launcher.sessions[i].presentations[j].files) { + console.log('f: ('+launcher.sessions[i].presentations[j].files[k].event_file_id+') '+launcher.sessions[i].presentations[j].files[k].event_file_filename+' ***'); + file_id = launcher.sessions[i].presentations[j].files[k].event_file_id; // NOTE: the .id is the hosted_file.id! + let filename = launcher.sessions[i].presentations[j].files[k].hash_sha256+'.file'; + + save_path = path.join(file_cache_path, filename); + + if (fs.existsSync(save_path)) { + console.log('Local file already exists: '+save_path); + } else { + console.log('File not found locally. Downloading file: '+save_path); + let api_endpoint = '/event/file/'+file_id+'/download'; + ipcRenderer.send('download_file', api_base_url, api_endpoint, api_temporary_token, save_path); // Must download file using main node.js thread. + } + } + } else { + console.log('No presentation files found.'); + } + } else { + console.log('No check for presentation files.'); + } + // Check for presentation files end + + + // Get session presentations presenters and associated files + //let event_presentation_id = launcher.sessions[i].presentations[j].id; + launcher.sessions[i].presentations[j].presenters = await api.get_presentation_presenters(axios, launcher.event_id, launcher.sessions[i].id, launcher.sessions[i].presentations[j].id); + for (var k in launcher.sessions[i].presentations[j].presenters) { + console.log('-- '+launcher.sessions[i].presentations[j].presenters[k].given_name+' '+launcher.sessions[i].presentations[j].presenters[k].family_name) + + // Check for presenter files start + if (typeof launcher.sessions[i].presentations[j].presenters[k].files === 'undefined') { + console.log('Check for presenter files.'); + let for_id = launcher.sessions[i].presentations[j].presenters[k].id; + launcher.sessions[i].presentations[j].presenters[k].files = await api.get_files_for_type_for_id(axios, 'presenter', for_id); + if (launcher.sessions[i].presentations[j].presenters[k].files) { + console.log('Presenter files found.'); + for (var l in launcher.sessions[i].presentations[j].presenters[k].files) { + console.log('f: ('+launcher.sessions[i].presentations[j].presenters[k].files[l].event_file_id+') '+launcher.sessions[i].presentations[j].presenters[k].files[l].event_file_filename+' ***') + file_id = launcher.sessions[i].presentations[j].presenters[k].files[l].event_file_id; // NOTE: the .id is the hosted_file.id! + let filename = launcher.sessions[i].presentations[j].presenters[k].files[l].hash_sha256+'.file'; + + save_path = path.join(file_cache_path, filename); + + if (fs.existsSync(save_path)) { + console.log('Local file already exists: '+save_path); + } else { + console.log('File not found locally. Downloading file: '+save_path); + let api_endpoint = '/event/file/'+file_id+'/download'; + ipcRenderer.send('download_file', api_base_url, api_endpoint, api_temporary_token, save_path); // Must download file using main node.js thread. + } + } + } else { + console.log('No presenter files found.'); + } + } else { + console.log('No check for presenter files.'); + } + // Check for presenter files end + + } + } + } + } else { + console.log('No check for location sessions.'); + } + + console.log('Location cache check finished.'); + return true; +} + +exports.launcher_render = async function (launcher) { + console.log('Rendering launcher...'); + document.getElementById('location_title').innerHTML = '

Launcher '+launcher.location.name+'@'+launcher.event.name+'

'; + + document.getElementById('event_files_menu').innerHTML = '

Event Files

'; + document.getElementById('event_files_menu').innerHTML += ''; + + document.getElementById('location_files_menu').innerHTML = '

Location Files

'; + document.getElementById('location_files_menu').innerHTML += ''; + + document.getElementById('sessions_menu').innerHTML = '

Sessions

'; + document.getElementById('sessions_menu').innerHTML += ''; + session_detail += ''; // for card-body + session_detail += ' '; // for card + + } + //session_detail += ' '; // for session_presentations + + //session_detail += ''; // for card-group + session_detail += ' '; + + + //document.getElementById('location_detail').innerHTML += session_detail; + + if (typeof(document.getElementById('detail_session_id_'+launcher.sessions[i].id)) != 'undefined' && document.getElementById('detail_session_id_'+launcher.sessions[i].id) != null) { + document.getElementById('detail_session_id_'+launcher.sessions[i].id).innerHTML = session_detail; + } else { + document.getElementById('location_detail').innerHTML += session_detail; + } + + + } + document.getElementById('sessions_menu').innerHTML += ''; + + index_location_detail('btn_view_session'); + + index_open_file_buttons('open_local_file'); + + + //const btn_session_{{ event_presentation.id }}_name = document.querySelector('button#presentation_{{ event_presentation.id }}_name'); + //btn_presentation_{{ event_presentation.id }}_name.onclick = display_hide_poster_for_type_id.bind(this, true, 'presentation', {{ event_presentation.id }}); + console.log('Rendering launcher finished.'); + + return true; +} + + +/* Updated 2019-12-19 */ +function index_location_detail(class_name) { + var class_elements = document.getElementsByClassName(class_name); + + for (var i = 0; i < class_elements.length; i++) { + class_elements[i].addEventListener( 'click', function() {view_session( this.getAttribute('data-session_id')) } ); + } + + return true; +} + + +/* Updated 2019-12-19 */ +function view_session(session_id) { + var class_elements = document.getElementsByClassName('session_detail'); + console.log('*** Session ID: '+session_id); + for (var i = 0; i < class_elements.length; i++) { + console.log('*** checking: '+class_elements[i].getAttribute('data-session_id')); + if (class_elements[i].getAttribute('data-session_id') == session_id) { + console.log('show'); + class_elements[i].classList.remove('d-none'); + class_elements[i].classList.add('d-block'); + } else { + console.log('hide'); + class_elements[i].classList.remove('d-block'); + class_elements[i].classList.add('d-none'); + } + } + + return true; +} + + + + + +/* Updated 2019-12-20 */ +function index_open_file_buttons(class_name) { + var class_elements = document.getElementsByClassName(class_name); + + for (var i = 0; i < class_elements.length; i++) { + //class_elements[i].addEventListener( 'click', function() {open_local_file( this.getAttribute('data-filename')) } ); + + //let directory = 'file_cache/'; + + //directory_and_filename = path.join(directory, class_elements[i].getAttribute('data-filename')); + + let file_path = path.join(file_cache_path, class_elements[i].getAttribute('data-hash_sha256')); + let filename = class_elements[i].getAttribute('data-filename'); + + class_elements[i].addEventListener( 'click', function() { ipcRenderer.send('open_local_file', file_path, filename) } ); + //ipcRenderer.send('open_local_file', this.getAttribute('data-filename')); // in render thread + } + + return true; +} + + + +function format_bytes(bytes, decimals = 2) { + if (bytes === 0) return '0 Bytes'; + + const k = 1024; + const dm = decimals < 0 ? 0 : decimals; + const sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB']; + + const i = Math.floor(Math.log(bytes) / Math.log(k)); + + return parseFloat((bytes / Math.pow(k, i)).toFixed(dm)) + ' ' + sizes[i]; +} diff --git a/app/js/module_api.js b/app/js/module_api.js new file mode 100644 index 0000000..05d7221 --- /dev/null +++ b/app/js/module_api.js @@ -0,0 +1,331 @@ +/* +const os = require('os'); +const path = require('path'); +const fs = require('fs'); + +const { ipcRenderer } = require('electron'); +*/ + +exports.api_token_request_async = async function (axios, secret_key) { + console.log('Requesting API temporary token...'); + const url = '/api_token_request'; + + let data = { secret_key: secret_key }; + + const response = await axios.post(url, data) + .then(function (response) { + //console.log(response); + const api_temporary_token = response.data.temporary_token; + //console.log('API Temporary Token: '+temporary_token); + return api_temporary_token; + }) + .catch(function (error) { + console.error(error); + return error; + }); + return response; +} + + +exports.get_event_details = async function (axios, event_id) { + console.log('Requesting event details...'); + const url = '/event/'+event_id; + + const data = await axios.get(url) + .then(function (response) { + //console.log(response.data); + //data = response.data; + return response.data; + }) + .catch(function (error) { + console.log(error); + return error; + }); + + return data; +} + + +exports.get_event_location_details = async function (axios, event_id, event_location_id) { + console.log('Requesting event location details...'); + const url = '/event/'+event_id+'/location/'+event_location_id; + + const data = await axios.get(url) + .then(function (response) { + //console.log(response.data); + //data = response.data; + return response.data; + }) + .catch(function (error) { + console.log(error); + return error; + }); + + return data; +} + + +exports.get_event_location_sessions = async function (axios, event_id, event_location_id) { + console.log('Requesting location sessions...'); + const url = '/event/'+event_id+'/location/'+event_location_id+'/session'; + + const data = await axios.get(url) + .then(function (response) { + //console.log(response.data); + //data = response.data; + return response.data; + }) + .catch(function (error) { + console.log(error); + return error; + }); + + return data; +} + + +exports.get_session_presentations = async function (axios, event_id, event_session_id) { + console.log('Requesting session presentations...'); + const url = '/event/'+event_id+'/session/'+event_session_id+'/presentation'; + + const data = await axios.get(url) + .then(function (response) { + //console.log(response.data); + //data = response.data; + return response.data; + }) + .catch(function (error) { + console.log(error); + return error; + }); + + return data; +} + + +exports.get_presentation_presenters = async function (axios, event_id, event_session_id, event_presentation_id) { + console.log('Requesting presentation presenters...'); + const url = '/event/'+event_id+'/session/'+event_session_id+'/presentation/'+event_presentation_id+'/presenter'; + + const data = await axios.get(url) + .then(function (response) { + //console.log(response.data); + //data = response.data; + return response.data; + }) + .catch(function (error) { + console.log(error); + return error; + }); + + return data; +} + + +exports.get_files_for_type_for_id = async function (axios, for_type, for_id) { + console.log('Requesting files for '+for_type+' '+for_id); + const url = '/event/file/'+for_type+'/'+for_id; + + const data = await axios.get(url) + .then(function (response) { + //console.log(response.data); + //data = response.data; + return response.data; + }) + .catch(function (error) { + console.log(error); + return error; + }); + + return data; +} + +/* +exports.download_file_id = async function (axios, file_id, filename) { + + ipcRenderer.send('download_file', api_base_url, api_endpoint, api_temporary_token, save_path); // in render thread + + console.log('1: download file id '+file_id); + const url = '/event/file/'+file_id+'/download'; + + //const data = await axios.get(url, responseType: 'stream') + const data = await axios({ + method: "get", + url: url, + responseType: "stream" + }) + .then(function (response) { + console.log('2: downloaded file id '+file_id); + console.log(response); + //console.log(response.data); + + let filename = 'default.txt'; + + if (typeof filename_override === 'undefined' || filename_override == null) { + let headerLine = response.data.headers['content-disposition']; + + console.log(headerLine); + console.log(headerLine.indexOf('="')); + console.log(headerLine.indexOf('=')); + if (headerLine.indexOf('="') != -1) { + let startFileNameIndex = headerLine.indexOf('="') + 2; + let endFileNameIndex = headerLine.lastIndexOf('"'); + filename = headerLine.substring(startFileNameIndex, endFileNameIndex); + } else if (headerLine.indexOf('=') != -1) { + let startFileNameIndex = headerLine.indexOf('=') + 1; + let endFileNameIndex = headerLine.length; + filename = headerLine.substring(startFileNameIndex, endFileNameIndex); + } else { + filename = 'filename_not_found_in_header.txt'; + } + } else { + filename = filename_override; + } + + let directory = 'file_cache/'; + + directory_and_filename = path.join(directory, filename); + + //console.log(directory_and_filename); + + if (fs.existsSync(directory_and_filename)) { + console.log('3a: file already exists: '+directory_and_filename); + } else { + console.log('3b: saving file: '+directory_and_filename); + response.data.pipe(fs.createWriteStream(directory_and_filename)); + } + //data = response.data; + console.log('4: saved file id '+file_id); + return true; + //return response.data; + }) + .catch(function (error) { + console.log(error); + return error; + }); + + //return data; +} +*/ + +/* v2 Section */ + +exports.v2_get_account_events = async function (axios, account_id) { + console.log('Requesting account events...'); + const url = '/v2/account/'+account_id+'/events'; + + const data = await axios.get(url) + .then(function (response) { + console.log('v2 account events data: ***'); + console.log(response.data); + console.log('v2 account events data: ^^^'); + return response.data; + }) + .catch(function (error) { + console.log(error); + return error; + }); + + return data; +} + + +exports.v2_get_event_locations = async function (axios, event_id) { + console.log('Requesting event locations...'); + const url = '/v2/event/'+event_id+'/event_locations'; + + const data = await axios.get(url) + .then(function (response) { + console.log('v2 event locations data: ***'); + console.log(response.data); + console.log('v2 event locations data: ^^^'); + return response.data; + }) + .catch(function (error) { + console.log(error); + return error; + }); + + return data; +} + + +exports.v2_get_event_location_sessions = async function (axios, event_location_id) { + console.log('Requesting location sessions...'); + const url = '/v2/event_location/'+event_location_id+'/event_sessions'; + + const data = await axios.get(url) + .then(function (response) { + console.log('v2 location sessions data: ***'); + console.log(response.data); + console.log('v2 location sessions data: ^^^'); + return response.data; + }) + .catch(function (error) { + console.log(error); + return error; + }); + + return data; +} + + +exports.v2_get_event_location_presentations = async function (axios, event_location_id) { + console.log('Requesting location presentations...'); + const url = '/v2/event_location/'+event_location_id+'/event_presentations'; + + const data = await axios.get(url) + .then(function (response) { + console.log('v2 location presentations data: ***'); + console.log(response.data); + console.log('v2 location presentations data: ^^^'); + return response.data; + }) + .catch(function (error) { + console.log(error); + return error; + }); + + return data; +} + + +exports.v2_get_event_location_presenters = async function (axios, event_location_id) { + console.log('Requesting location presenters...'); + const url = '/v2/event_location/'+event_location_id+'/event_presenters'; + + const data = await axios.get(url) + .then(function (response) { + console.log('v2 location presenters data: ***'); + console.log(response.data); + console.log('v2 location presenters data: ^^^'); + return response.data; + }) + .catch(function (error) { + console.log(error); + return error; + }); + + return data; +} + + +exports.v2_get_event_location_files = async function (axios, event_location_id) { + console.log('Requesting location files...'); + const url = '/v2/event_location/'+event_location_id+'/event_files'; + + const data = await axios.get(url) + .then(function (response) { + console.log('v2 location files data: ***'); + console.log(response.data); + console.log('v2 location files data: ^^^'); + //data = response.data; + return response.data; + }) + .catch(function (error) { + console.log(error); + return error; + }); + + return data; +} diff --git a/app/js/module_api.js.bak b/app/js/module_api.js.bak new file mode 100644 index 0000000..79aa6f0 --- /dev/null +++ b/app/js/module_api.js.bak @@ -0,0 +1,300 @@ +const os = require('os'); +const path = require('path'); +const fs = require('fs'); + +const { ipcRenderer } = require('electron'); + +exports.api_token_request_async = async function (axios, secret_key) { + console.log('Requesting API temporary token...'); + const url = '/api_token_request'; + + let data = { secret_key: secret_key }; + + const response = await axios.post(url, data) + .then(function (response) { + //console.log(response); + const api_temporary_token = response.data.temporary_token; + //console.log('API Temporary Token: '+temporary_token); + return api_temporary_token; + }) + .catch(function (error) { + console.error(error); + return error; + }); + return response; +} + + +exports.get_event_location_sessions = async function (axios, event_id, event_location_id) { + console.log('Requesting location sessions...'); + const url = '/event/'+event_id+'/location/'+event_location_id+'/session'; + + const data = await axios.get(url) + .then(function (response) { + //console.log(response.data); + //data = response.data; + return response.data; + }) + .catch(function (error) { + console.log(error); + return error; + }); + + return data; +} + + +exports.get_session_presentations = async function (axios, event_id, event_session_id) { + console.log('Requesting session presentations...'); + const url = '/event/'+event_id+'/session/'+event_session_id+'/presentation'; + + const data = await axios.get(url) + .then(function (response) { + //console.log(response.data); + //data = response.data; + return response.data; + }) + .catch(function (error) { + console.log(error); + return error; + }); + + return data; +} + + +exports.get_presentation_presenters = async function (axios, event_id, event_session_id, event_presentation_id) { + console.log('Requesting presentation presenters...'); + const url = '/event/'+event_id+'/session/'+event_session_id+'/presentation/'+event_presentation_id+'/presenter'; + + const data = await axios.get(url) + .then(function (response) { + //console.log(response.data); + //data = response.data; + return response.data; + }) + .catch(function (error) { + console.log(error); + return error; + }); + + return data; +} + + +exports.get_files_for_type_for_id = async function (axios, for_type, for_id) { + console.log('Requesting files...'); + const url = '/event/file/'+for_type+'/'+for_id; + + const data = await axios.get(url) + .then(function (response) { + //console.log(response.data); + //data = response.data; + return response.data; + }) + .catch(function (error) { + console.log(error); + return error; + }); + + return data; +} + + +exports.download_file_id = async function (axios, file_id, filename) { + + ipcRenderer.send('download_file', api_base_url, api_endpoint, api_temporary_token, save_path); // in render thread + + console.log('1: download file id '+file_id); + const url = '/event/file/'+file_id+'/download'; + + //const data = await axios.get(url, responseType: 'stream') + const data = await axios({ + method: "get", + url: url, + responseType: "stream" + }) + .then(function (response) { + console.log('2: downloaded file id '+file_id); + console.log(response); + //console.log(response.data); + + let filename = 'default.txt'; + + if (typeof filename_override === 'undefined' || filename_override == null) { + let headerLine = response.data.headers['content-disposition']; + + console.log(headerLine); + console.log(headerLine.indexOf('="')); + console.log(headerLine.indexOf('=')); + if (headerLine.indexOf('="') != -1) { + let startFileNameIndex = headerLine.indexOf('="') + 2; + let endFileNameIndex = headerLine.lastIndexOf('"'); + filename = headerLine.substring(startFileNameIndex, endFileNameIndex); + } else if (headerLine.indexOf('=') != -1) { + let startFileNameIndex = headerLine.indexOf('=') + 1; + let endFileNameIndex = headerLine.length; + filename = headerLine.substring(startFileNameIndex, endFileNameIndex); + } else { + filename = 'filename_not_found_in_header.txt'; + } + } else { + filename = filename_override; + } + + let directory = 'file_cache/'; + + directory_and_filename = path.join(directory, filename); + + //console.log(directory_and_filename); + + if (fs.existsSync(directory_and_filename)) { + console.log('3a: file already exists: '+directory_and_filename); + } else { + console.log('3b: saving file: '+directory_and_filename); + response.data.pipe(fs.createWriteStream(directory_and_filename)); + } + //data = response.data; + console.log('4: saved file id '+file_id); + return true; + //return response.data; + }) + .catch(function (error) { + console.log(error); + return error; + }); + + //return data; +} + +exports.launcher_cache = async function (launcher, api_base_url, api_endpoint, api_temporary_token, file_cache_path) { + if (typeof launcher.sessions === 'undefined') { + console.log('Check for location files.'); + let for_id = launcher.event_location_id; + launcher.files = await api.get_files_for_type_for_id(axios, 'location', for_id); + for (var i in launcher.files) { + console.log('f: ('+launcher.files[i].event_file_id+') '+launcher.files[i].event_file_filename+' ***') + file_id = launcher.files[i].event_file_id; // NOTE: the .id is the hosted_file.id! + let filename = launcher.files[i].hash_sha256+'.file'; + + save_path = path.join(file_cache_path, filename); + + //console.log(directory_and_filename); + + if (fs.existsSync(save_path)) { + console.log('Local file already exists: '+save_path); + } else { + console.log('File not found locally. Downloading file: '+save_path); + const api_endpoint = '/event/file/'+file_id+'/download'; + ipcRenderer.send('download_file', api_base_url, api_endpoint, api_temporary_token, save_path); // Must download file using main node.js thread. + //response.data.pipe(fs.createWriteStream(directory_and_filename)); + } + //let results = await api.download_file_id(axios, file_id, hash_sha256); + + } + } else { + console.log('No check for location files.'); + } + + if (typeof launcher.sessions === 'undefined') { + console.log('Check for location sessions.'); + launcher.sessions = await api.get_event_location_sessions(axios, launcher.event_id, launcher.event_location_id); + for (var i in launcher.sessions) { + console.log('*** '+launcher.sessions[i].name+' ***') + + // Check for session files start + if (typeof launcher.sessions[i].files === 'undefined') { + console.log('Check for session files.'); + let for_id = launcher.sessions[i].id; + launcher.sessions[i].files = await api.get_files_for_type_for_id(axios, 'session', for_id); + if (launcher.sessions[i].files) { + console.log('Session files found.'); + for (var j in launcher.sessions[i].files) { + console.log('f: ('+launcher.sessions[i].files[j].event_file_id+') '+launcher.sessions[i].files[j].event_file_filename+' ***'); + file_id = launcher.sessions[i].files[j].event_file_id; // NOTE: the .id is the hosted_file.id! + hash_sha256 = launcher.sessions[i].files[j].hash_sha256+'.file'; + let results = await api.download_file_id(axios, file_id, hash_sha256); + } + } else { + console.log('No session files found.'); + } + } else { + console.log('No check for session files.'); + } + // Check for session files end + + // Get session presentations and associated files + launcher.sessions[i].presentations = await api.get_session_presentations(axios, launcher.event_id, launcher.sessions[i].id); + for (var j in launcher.sessions[i].presentations) { + console.log('* '+launcher.sessions[i].presentations[j].name); + + // Check for presentation files start + if (typeof launcher.sessions[i].presentations[j].files === 'undefined') { + console.log('Check for presentation files.'); + let for_id = launcher.sessions[i].presentations[j].id; + launcher.sessions[i].presentations[j].files = await api.get_files_for_type_for_id(axios, 'presentation', for_id); + if (launcher.sessions[i].presentations[j].files) { + console.log('Presentation files found.'); + for (var k in launcher.sessions[i].presentations[j].files) { + console.log('f: ('+launcher.sessions[i].presentations[j].files[k].event_file_id+') '+launcher.sessions[i].presentations[j].files[k].event_file_filename+' ***'); + file_id = launcher.sessions[i].presentations[j].files[k].event_file_id; // NOTE: the .id is the hosted_file.id! + hash_sha256 = launcher.sessions[i].presentations[j].files[k].hash_sha256+'.file'; + let results = await api.download_file_id(axios, file_id, hash_sha256); + } + } else { + console.log('No presentation files found.'); + } + } else { + console.log('No check for presentation files.'); + } + // Check for presentation files end + + + // Get session presentations presenters and associated files + //let event_presentation_id = launcher.sessions[i].presentations[j].id; + launcher.sessions[i].presentations[j].presenters = await api.get_presentation_presenters(axios, launcher.event_id, launcher.sessions[i].id, launcher.sessions[i].presentations[j].id); + for (var k in launcher.sessions[i].presentations[j].presenters) { + console.log('-- '+launcher.sessions[i].presentations[j].presenters[k].given_name+' '+launcher.sessions[i].presentations[j].presenters[k].family_name) + + // Check for presenter files start + if (typeof launcher.sessions[i].presentations[j].presenters[k].files === 'undefined') { + console.log('Check for presenter files.'); + let for_id = launcher.sessions[i].presentations[j].presenters[k].id; + launcher.sessions[i].presentations[j].presenters[k].files = await api.get_files_for_type_for_id(axios, 'presenter', for_id); + if (launcher.sessions[i].presentations[j].presenters[k].files) { + console.log('Presenter files found.'); + for (var l in launcher.sessions[i].presentations[j].presenters[k].files) { + console.log('f: ('+launcher.sessions[i].presentations[j].presenters[k].files[l].event_file_id+') '+launcher.sessions[i].presentations[j].presenters[k].files[l].event_file_filename+' ***') + file_id = launcher.sessions[i].presentations[j].presenters[k].files[l].event_file_id; // NOTE: the .id is the hosted_file.id! + hash_sha256 = launcher.sessions[i].presentations[j].presenters[k].files[l].hash_sha256+'.file'; + let results = await api.download_file_id(axios, file_id, hash_sha256); + } + } else { + console.log('No presenter files found.'); + } + } else { + console.log('No check for presenter files.'); + } + // Check for presenter files end + + } + } + } + } else { + console.log('No check for location sessions.'); + } + /* + if (launcher.sessions) { + console.log('Check for session files.'); + let for_id = launcher.event_location_id; + launcher.files = await api.get_files_for_type_for_id(axios, 'location', for_id); + for (var i in launcher.sessions) { + console.log('f: ('+launcher.sessions[i].event_file_id+') '+launcher.files[i].event_file_filename+' ***') + file_id = launcher.files[i].event_file_id; // NOTE: the .id is the hosted_file.id! + let results = await api.download_file_id(axios, file_id); + } + } else { + console.log('No check for location files.'); + } + */ +} diff --git a/app/js/module_app.js b/app/js/module_app.js new file mode 100644 index 0000000..22c82ff --- /dev/null +++ b/app/js/module_app.js @@ -0,0 +1,67 @@ +'use strict'; +const os = require('os'); +const path = require('path'); +const fs = require('fs'); + +exports.load_config = function () { + console.log('CWD: '+process.cwd()); + + let home_directory = require('os').homedir(); + console.log('Home: '+home_directory); + + let tmp_directory = require('os').tmpdir(); + console.log('Temporary: '+tmp_directory); + + let config = null; + let config_directory = null; + let default_config_path = path.join(process.cwd(),'config.json.default'); + let config_path = null; + + if (os.platform == 'darwin') { + config_directory = path.join(home_directory, 'Library/Application Support/OSIT'); + console.log('macOS config directory: '+config_directory); + } else if (os.platform == 'linux') { + config_directory = path.join(home_directory, '.config/OSIT'); + console.log('Linux config directory: '+config_directory); + } + + if (fs.existsSync(config_directory)) { + console.log('Config: '+config_directory); + config_path = path.join(config_directory, 'config.json'); + } else { + fs.mkdirSync(config_directory); + console.log('Config directory created: '+config_directory); + + //default_config_path = path.join(process.cwd(),'config.json.default'); + config_path = path.join(config_directory, 'config.json'); + fs.copyFileSync(default_config_path, config_path); + console.log('Default config file copied: '+config_directory); + } + + if (fs.existsSync(config_path)) { + console.log('Config path: '+config_path); + console.log('Config file (config.json) found under '+config_directory+'.'); + + config = JSON.parse(fs.readFileSync(config_path)); + console.log('Config file read.'); + } else if (!fs.existsSync(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('config.json')) { + //fs.copyFileSync(default_config_path, config_path); + //console.log('Default config file copied: '+config_directory); + + config = JSON.parse(fs.readFileSync('config.json')); + console.log('Config file (config.json) not found under '+config_directory+'. Using config in CWD.'); + console.log('Config file read.'); + + //console.log('Config file (config.json) not found under '+config_directory+'. Using config in CWD.'); + //config = JSON.parse(fs.readFileSync('config.json')); + } else { + //close(); + } + return config; +} diff --git a/app/js/module_app_idb 2020-01-21.js.bak b/app/js/module_app_idb 2020-01-21.js.bak new file mode 100644 index 0000000..92fa0ce --- /dev/null +++ b/app/js/module_app_idb 2020-01-21.js.bak @@ -0,0 +1,271 @@ +const os = require('os'); +const path = require('path'); +const fs = require('fs'); + +const { ipcRenderer } = require('electron'); + + +exports.launcher_cache_check = async function (launcher, api_base_url, api_temporary_token, host_file_cache_path) { + if (typeof launcher.event === 'undefined') { + launcher.event = await api.get_event_details(axios, launcher.event_id); + tbl_event.setItem(launcher.event.id.toString(), launcher.event); + /* + .then(function (data) { + console.log(data.id); + idbKeyval.set(data.id, data, tbl_event); + //for (var i in response) { + //var event_record = data[i]; + //idbKeyval.set(response[i].id, response[i], tbl_event); + //} + }); + */ + + } + + if (typeof launcher.location === 'undefined') { + launcher.location = await api.get_event_location_details(axios, launcher.event_id, launcher.event_location_id); + tbl_event_location.setItem(launcher.location.id.toString(), launcher.location); + } + + if (typeof launcher.event_files === 'undefined') { + console.log('Check for global event files.'); + let for_id = launcher.event_id; + launcher.event_files = await api.get_files_for_type_for_id(axios, 'event', for_id); + for (var i in launcher.event_files) { + console.log('f: ('+launcher.event_files[i].event_file_id+') '+launcher.event_files[i].event_file_filename+' ***') + tbl_event_file.setItem(launcher.event_files[i].event_file_id.toString(), launcher.event_files[i]); + + file_id = launcher.event_files[i].event_file_id; // NOTE: the .id is the hosted_file.id! + let filename = launcher.event_files[i].hash_sha256+'.file'; + + save_path = path.join(host_file_cache_path, filename); + + if (fs.existsSync(save_path)) { + console.log('Local file already exists: '+save_path); + } else { + console.log('File not found locally. Downloading file: '+save_path); + let api_endpoint = '/event/file/'+file_id+'/download'; + ipcRenderer.send('download_file', api_base_url, api_endpoint, api_temporary_token, save_path); // Must download file using main node.js thread. + } + } + } else { + console.log('No check for global event files'); + } + + + if (typeof launcher.location_files === 'undefined') { + console.log('Check for location specific files.'); + let for_id = launcher.event_location_id; + launcher.location_files = await api.get_files_for_type_for_id(axios, 'location', for_id); + for (var i in launcher.location_files) { + console.log('f: ('+launcher.location_files[i].event_file_id+') '+launcher.location_files[i].event_file_filename+' ***') + tbl_event_file.setItem(launcher.location_files[i].event_file_id.toString(), launcher.location_files[i]); + + file_id = launcher.location_files[i].event_file_id; // NOTE: the .id is the hosted_file.id! + let filename = launcher.location_files[i].hash_sha256+'.file'; + + save_path = path.join(host_file_cache_path, filename); + + if (fs.existsSync(save_path)) { + console.log('Local file already exists: '+save_path); + } else { + console.log('File not found locally. Downloading file: '+save_path); + let api_endpoint = '/event/file/'+file_id+'/download'; + ipcRenderer.send('download_file', api_base_url, api_endpoint, api_temporary_token, save_path); // Must download file using main node.js thread. + } + } + } else { + console.log('No check for location specific files.'); + } + + + if (typeof launcher.sessions === 'undefined') { + console.log('Check for location sessions.'); + launcher.sessions = await api.get_event_location_sessions(axios, launcher.event_id, launcher.event_location_id); + for (var i in launcher.sessions) { + console.log('*** '+launcher.sessions[i].name+' ***') + tbl_event_session.setItem(launcher.sessions[i].id.toString(), launcher.sessions[i]); + + // Check for session files start + if (typeof launcher.sessions[i].files === 'undefined') { + console.log('Check for session files.'); + let for_id = launcher.sessions[i].id; + launcher.sessions[i].files = await api.get_files_for_type_for_id(axios, 'session', for_id); + if (launcher.sessions[i].files) { + console.log('Session files found.'); + for (var j in launcher.sessions[i].files) { + console.log('f: ('+launcher.sessions[i].files[j].event_file_id+') '+launcher.sessions[i].files[j].event_file_filename+' ***'); + tbl_event_file.setItem(launcher.sessions[i].files[j].event_file_id.toString(), launcher.sessions[i].files[j]); + + file_id = launcher.sessions[i].files[j].event_file_id; // NOTE: the .id is the hosted_file.id! + let filename = launcher.sessions[i].files[j].hash_sha256+'.file'; + + save_path = path.join(host_file_cache_path, filename); + + if (fs.existsSync(save_path)) { + console.log('Local file already exists: '+save_path); + } else { + console.log('File not found locally. Downloading file: '+save_path); + let api_endpoint = '/event/file/'+file_id+'/download'; + ipcRenderer.send('download_file', api_base_url, api_endpoint, api_temporary_token, save_path); // Must download file using main node.js thread. + } + } + } else { + console.log('No session files found.'); + } + } else { + console.log('No check for session files.'); + } + // Check for session files end + + // Get session presentations and associated files + launcher.sessions[i].presentations = await api.get_session_presentations(axios, launcher.event_id, launcher.sessions[i].id); + for (var j in launcher.sessions[i].presentations) { + console.log('* '+launcher.sessions[i].presentations[j].name); + tbl_event_presentation.setItem(launcher.sessions[i].presentations[j].id.toString(), launcher.sessions[i].presentations[j]); + + // Check for presentation files start + if (typeof launcher.sessions[i].presentations[j].files === 'undefined') { + console.log('Check for presentation files.'); + let for_id = launcher.sessions[i].presentations[j].id; + launcher.sessions[i].presentations[j].files = await api.get_files_for_type_for_id(axios, 'presentation', for_id); + if (launcher.sessions[i].presentations[j].files) { + console.log('Presentation files found.'); + for (var k in launcher.sessions[i].presentations[j].files) { + console.log('f: ('+launcher.sessions[i].presentations[j].files[k].event_file_id+') '+launcher.sessions[i].presentations[j].files[k].event_file_filename+' ***'); + tbl_event_file.setItem(launcher.sessions[i].presentations[j].files[k].event_file_id.toString(), launcher.sessions[i].presentations[j].files[k]); + + file_id = launcher.sessions[i].presentations[j].files[k].event_file_id; // NOTE: the .id is the hosted_file.id! + let filename = launcher.sessions[i].presentations[j].files[k].hash_sha256+'.file'; + + save_path = path.join(host_file_cache_path, filename); + + if (fs.existsSync(save_path)) { + console.log('Local file already exists: '+save_path); + } else { + console.log('File not found locally. Downloading file: '+save_path); + let api_endpoint = '/event/file/'+file_id+'/download'; + ipcRenderer.send('download_file', api_base_url, api_endpoint, api_temporary_token, save_path); // Must download file using main node.js thread. + } + } + } else { + console.log('No presentation files found.'); + } + } else { + console.log('No check for presentation files.'); + } + // Check for presentation files end + + + // Get session presentations presenters and associated files + //let event_presentation_id = launcher.sessions[i].presentations[j].id; + launcher.sessions[i].presentations[j].presenters = await api.get_presentation_presenters(axios, launcher.event_id, launcher.sessions[i].id, launcher.sessions[i].presentations[j].id); + for (var k in launcher.sessions[i].presentations[j].presenters) { + console.log('-- '+launcher.sessions[i].presentations[j].presenters[k].given_name+' '+launcher.sessions[i].presentations[j].presenters[k].family_name) + tbl_event_presenter.setItem(launcher.sessions[i].presentations[j].presenters[k].id.toString(), launcher.sessions[i].presentations[j].presenters[k]); + + // Check for presenter files start + if (typeof launcher.sessions[i].presentations[j].presenters[k].files === 'undefined') { + console.log('Check for presenter files.'); + let for_id = launcher.sessions[i].presentations[j].presenters[k].id; + launcher.sessions[i].presentations[j].presenters[k].files = await api.get_files_for_type_for_id(axios, 'presenter', for_id); + if (launcher.sessions[i].presentations[j].presenters[k].files) { + console.log('Presenter files found.'); + for (var l in launcher.sessions[i].presentations[j].presenters[k].files) { + console.log('f: ('+launcher.sessions[i].presentations[j].presenters[k].files[l].event_file_id+') '+launcher.sessions[i].presentations[j].presenters[k].files[l].event_file_filename+' ***'); + tbl_event_file.setItem(launcher.sessions[i].presentations[j].presenters[k].files[l].event_file_id.toString(), launcher.sessions[i].presentations[j].presenters[k].files[l]); + + file_id = launcher.sessions[i].presentations[j].presenters[k].files[l].event_file_id; // NOTE: the .id is the hosted_file.id! + let filename = launcher.sessions[i].presentations[j].presenters[k].files[l].hash_sha256+'.file'; + + save_path = path.join(host_file_cache_path, filename); + + if (fs.existsSync(save_path)) { + console.log('Local file already exists: '+save_path); + } else { + console.log('File not found locally. Downloading file: '+save_path); + let api_endpoint = '/event/file/'+file_id+'/download'; + ipcRenderer.send('download_file', api_base_url, api_endpoint, api_temporary_token, save_path); // Must download file using main node.js thread. + } + } + } else { + console.log('No presenter files found.'); + } + } else { + console.log('No check for presenter files.'); + } + // Check for presenter files end + + } + } + } + } else { + console.log('No check for location sessions.'); + } + + console.log('Location cache check finished.'); + return true; +} + + + + +/* Updated 2019-12-19 */ +function index_location_detail(class_name) { + var class_elements = document.getElementsByClassName(class_name); + + for (var i = 0; i < class_elements.length; i++) { + class_elements[i].addEventListener( 'click', function() {view_session( this.getAttribute('data-session_id')) } ); + } + + return true; +} + + +/* Updated 2019-12-19 */ +function view_session(session_id) { + var class_elements = document.getElementsByClassName('session_detail'); + console.log('*** Session ID: '+session_id); + for (var i = 0; i < class_elements.length; i++) { + console.log('*** checking: '+class_elements[i].getAttribute('data-session_id')); + if (class_elements[i].getAttribute('data-session_id') == session_id) { + console.log('show'); + class_elements[i].classList.remove('d-none'); + class_elements[i].classList.add('d-block'); + } else { + console.log('hide'); + class_elements[i].classList.remove('d-block'); + class_elements[i].classList.add('d-none'); + } + } + + return true; +} + + + + + +/* Updated 2019-12-20 */ +function index_open_file_buttons(class_name) { + var class_elements = document.getElementsByClassName(class_name); + + for (var i = 0; i < class_elements.length; i++) { + //class_elements[i].addEventListener( 'click', function() {open_local_file( this.getAttribute('data-filename')) } ); + + //let directory = 'file_cache/'; + + //directory_and_filename = path.join(directory, class_elements[i].getAttribute('data-filename')); + + let file_path = path.join(host_file_cache_path, class_elements[i].getAttribute('data-hash_sha256')); + let filename = class_elements[i].getAttribute('data-filename'); + + class_elements[i].addEventListener( 'click', function() { ipcRenderer.send('open_local_file', file_path, filename) } ); + //ipcRenderer.send('open_local_file', this.getAttribute('data-filename')); // in render thread + } + + return true; +} + + + diff --git a/app/js/module_app_idb 2020-01-24.js.bak b/app/js/module_app_idb 2020-01-24.js.bak new file mode 100644 index 0000000..aa7dbb9 --- /dev/null +++ b/app/js/module_app_idb 2020-01-24.js.bak @@ -0,0 +1,368 @@ +const os = require('os'); +const path = require('path'); +const fs = require('fs'); + +const { ipcRenderer } = require('electron'); + + +exports.launcher_cache_check = async function (launcher, api_base_url, api_temporary_token, host_file_cache_path) { + if (typeof launcher.event === 'undefined') { + launcher.event = await api.get_event_details(axios, launcher.event_id); + tbl_event.setItem(launcher.event.id.toString(), launcher.event); + /* + .then(function (data) { + console.log(data.id); + idbKeyval.set(data.id, data, tbl_event); + //for (var i in response) { + //var event_record = data[i]; + //idbKeyval.set(response[i].id, response[i], tbl_event); + //} + }); + */ + + } + + if (typeof launcher.location === 'undefined') { + launcher.location = await api.get_event_location_details(axios, launcher.event_id, launcher.event_location_id); + tbl_event_location.setItem(launcher.location.id.toString(), launcher.location); + } + + if (typeof launcher.event_files === 'undefined') { + console.log('Check for global event files.'); + let for_id = launcher.event_id; + launcher.event_files = await api.get_files_for_type_for_id(axios, 'event', for_id); + for (var i in launcher.event_files) { + console.log('f: ('+launcher.event_files[i].event_file_id+') '+launcher.event_files[i].event_file_filename+' ***') + tbl_event_file.setItem(launcher.event_files[i].event_file_id.toString(), launcher.event_files[i]); + + file_id = launcher.event_files[i].event_file_id; // NOTE: the .id is the hosted_file.id! + let filename = launcher.event_files[i].hash_sha256+'.file'; + + save_path = path.join(host_file_cache_path, filename); + + if (fs.existsSync(save_path)) { + console.log('Local file already exists: '+save_path); + } else { + console.log('File not found locally. Downloading file: '+save_path); + let api_endpoint = '/event/file/'+file_id+'/download'; + ipcRenderer.send('download_file', api_base_url, api_endpoint, api_temporary_token, save_path); // Must download file using main node.js thread. + } + } + } else { + console.log('No check for global event files'); + } + + + if (typeof launcher.location_files === 'undefined') { + console.log('Check for location specific files.'); + let for_id = launcher.event_location_id; + launcher.location_files = await api.get_files_for_type_for_id(axios, 'location', for_id); + for (var i in launcher.location_files) { + console.log('f: ('+launcher.location_files[i].event_file_id+') '+launcher.location_files[i].event_file_filename+' ***') + tbl_event_file.setItem(launcher.location_files[i].event_file_id.toString(), launcher.location_files[i]); + + file_id = launcher.location_files[i].event_file_id; // NOTE: the .id is the hosted_file.id! + let filename = launcher.location_files[i].hash_sha256+'.file'; + + save_path = path.join(host_file_cache_path, filename); + + if (fs.existsSync(save_path)) { + console.log('Local file already exists: '+save_path); + } else { + console.log('File not found locally. Downloading file: '+save_path); + let api_endpoint = '/event/file/'+file_id+'/download'; + ipcRenderer.send('download_file', api_base_url, api_endpoint, api_temporary_token, save_path); // Must download file using main node.js thread. + } + } + } else { + console.log('No check for location specific files.'); + } + + + if (typeof launcher.sessions === 'undefined') { + console.log('Check for location sessions.'); + launcher.sessions = await api.get_event_location_sessions(axios, launcher.event_id, launcher.event_location_id); + for (var i in launcher.sessions) { + console.log('*** '+launcher.sessions[i].name+' ***') + tbl_event_session.setItem(launcher.sessions[i].id.toString(), launcher.sessions[i]); + + // Check for session files start + if (typeof launcher.sessions[i].files === 'undefined') { + console.log('Check for session files.'); + let for_id = launcher.sessions[i].id; + launcher.sessions[i].files = await api.get_files_for_type_for_id(axios, 'session', for_id); + if (launcher.sessions[i].files) { + console.log('Session files found.'); + for (var j in launcher.sessions[i].files) { + console.log('f: ('+launcher.sessions[i].files[j].event_file_id+') '+launcher.sessions[i].files[j].event_file_filename+' ***'); + tbl_event_file.setItem(launcher.sessions[i].files[j].event_file_id.toString(), launcher.sessions[i].files[j]); + + file_id = launcher.sessions[i].files[j].event_file_id; // NOTE: the .id is the hosted_file.id! + let filename = launcher.sessions[i].files[j].hash_sha256+'.file'; + + save_path = path.join(host_file_cache_path, filename); + + if (fs.existsSync(save_path)) { + console.log('Local file already exists: '+save_path); + } else { + console.log('File not found locally. Downloading file: '+save_path); + let api_endpoint = '/event/file/'+file_id+'/download'; + ipcRenderer.send('download_file', api_base_url, api_endpoint, api_temporary_token, save_path); // Must download file using main node.js thread. + } + } + } else { + console.log('No session files found.'); + } + } else { + console.log('No check for session files.'); + } + // Check for session files end + + // Get session presentations and associated files + launcher.sessions[i].presentations = await api.get_session_presentations(axios, launcher.event_id, launcher.sessions[i].id); + for (var j in launcher.sessions[i].presentations) { + console.log('* '+launcher.sessions[i].presentations[j].name); + tbl_event_presentation.setItem(launcher.sessions[i].presentations[j].id.toString(), launcher.sessions[i].presentations[j]); + + // Check for presentation files start + if (typeof launcher.sessions[i].presentations[j].files === 'undefined') { + console.log('Check for presentation files.'); + let for_id = launcher.sessions[i].presentations[j].id; + launcher.sessions[i].presentations[j].files = await api.get_files_for_type_for_id(axios, 'presentation', for_id); + if (launcher.sessions[i].presentations[j].files) { + console.log('Presentation files found.'); + for (var k in launcher.sessions[i].presentations[j].files) { + console.log('f: ('+launcher.sessions[i].presentations[j].files[k].event_file_id+') '+launcher.sessions[i].presentations[j].files[k].event_file_filename+' ***'); + tbl_event_file.setItem(launcher.sessions[i].presentations[j].files[k].event_file_id.toString(), launcher.sessions[i].presentations[j].files[k]); + + file_id = launcher.sessions[i].presentations[j].files[k].event_file_id; // NOTE: the .id is the hosted_file.id! + let filename = launcher.sessions[i].presentations[j].files[k].hash_sha256+'.file'; + + save_path = path.join(host_file_cache_path, filename); + + if (fs.existsSync(save_path)) { + console.log('Local file already exists: '+save_path); + } else { + console.log('File not found locally. Downloading file: '+save_path); + let api_endpoint = '/event/file/'+file_id+'/download'; + ipcRenderer.send('download_file', api_base_url, api_endpoint, api_temporary_token, save_path); // Must download file using main node.js thread. + } + } + } else { + console.log('No presentation files found.'); + } + } else { + console.log('No check for presentation files.'); + } + // Check for presentation files end + + + // Get session presentations presenters and associated files + //let event_presentation_id = launcher.sessions[i].presentations[j].id; + launcher.sessions[i].presentations[j].presenters = await api.get_presentation_presenters(axios, launcher.event_id, launcher.sessions[i].id, launcher.sessions[i].presentations[j].id); + for (var k in launcher.sessions[i].presentations[j].presenters) { + console.log('-- '+launcher.sessions[i].presentations[j].presenters[k].given_name+' '+launcher.sessions[i].presentations[j].presenters[k].family_name) + tbl_event_presenter.setItem(launcher.sessions[i].presentations[j].presenters[k].id.toString(), launcher.sessions[i].presentations[j].presenters[k]); + + // Check for presenter files start + if (typeof launcher.sessions[i].presentations[j].presenters[k].files === 'undefined') { + console.log('Check for presenter files.'); + let for_id = launcher.sessions[i].presentations[j].presenters[k].id; + launcher.sessions[i].presentations[j].presenters[k].files = await api.get_files_for_type_for_id(axios, 'presenter', for_id); + if (launcher.sessions[i].presentations[j].presenters[k].files) { + console.log('Presenter files found.'); + for (var l in launcher.sessions[i].presentations[j].presenters[k].files) { + console.log('f: ('+launcher.sessions[i].presentations[j].presenters[k].files[l].event_file_id+') '+launcher.sessions[i].presentations[j].presenters[k].files[l].event_file_filename+' ***'); + tbl_event_file.setItem(launcher.sessions[i].presentations[j].presenters[k].files[l].event_file_id.toString(), launcher.sessions[i].presentations[j].presenters[k].files[l]); + + file_id = launcher.sessions[i].presentations[j].presenters[k].files[l].event_file_id; // NOTE: the .id is the hosted_file.id! + let filename = launcher.sessions[i].presentations[j].presenters[k].files[l].hash_sha256+'.file'; + + save_path = path.join(host_file_cache_path, filename); + + if (fs.existsSync(save_path)) { + console.log('Local file already exists: '+save_path); + } else { + console.log('File not found locally. Downloading file: '+save_path); + let api_endpoint = '/event/file/'+file_id+'/download'; + ipcRenderer.send('download_file', api_base_url, api_endpoint, api_temporary_token, save_path); // Must download file using main node.js thread. + } + } + } else { + console.log('No presenter files found.'); + } + } else { + console.log('No check for presenter files.'); + } + // Check for presenter files end + + } + } + } + } else { + console.log('No check for location sessions.'); + } + + console.log('Location cache check finished.'); + return true; +} + + +exports.idb_to_launcher = async function idb_to_launcher() { + //tbl_example.iterate(tbl_check, tbl_check_success, tbl_check_error); //tbl_check(value, key, iteration) + //let launcher = new Object(); + + // Look for *events* + let tmp_event = []; + tbl_event.iterate(function(event_value, key, iteration) { + tmp_event.push(event_value); + }); + launcher.event = tmp_event; + + // Look for *event files* + let tmp_event_file = [] + tbl_event_file.iterate(function(file_value, key, iteration) { + //console.log('event id: '+launcher.event[0].id+' -> file_id: '+file_value.id+'for type: '+file_value.for_type+' for id: '+file_value.id); + if (file_value.for_type == 'event' && launcher.event[0].id == file_value.for_id) { + tmp_event_file.push(file_value); + } + }).then(function() { + console.log('idb_to_launcher: Iterate tbl_event_file complete') + }); + launcher.event_file = tmp_event_file; + + + // Look for *locations* + let tmp_event_location = [] + tbl_event_location.iterate(function(location_value, key, iteration) { + tmp_event_location.push(location_value); + }); + launcher.location = tmp_event_location; + + // Look for *event location files* + let tmp_event_location_file = [] + tbl_event_file.iterate(function(file_value, key, iteration) { + if (file_value.for_type == 'location' && launcher.location[0].id == file_value.for_id) { + tmp_event_location_file.push(file_value); + } + }); + launcher.location_file = tmp_event_location_file; + + + // Look for *sessions* + let tmp_event_session = [] + tbl_event_session.iterate(function(session_value, session_key, session_iteration) { + //console.log('session id: '+session_value.id); + + + // Look for *session files* + session_value.file = []; + tbl_event_file.iterate(function(session_file_value, session_file_key, session_file_iteration) { + if (session_file_value.for_type == 'session' && session_value.id == session_file_value.for_id) { + //console.log('session id: '+session_value.id+' -> file id: '+session_file_value.id); + session_value.file.push(session_file_value) + //tmp_event_session_file.push(session_file_value); + } + }); + + + // Look for *presentations per session* + session_value.presentation = []; + tbl_event_presentation.iterate(function(presentation_value, presentation_key, presentation_iteration) { + if (session_value.id == presentation_value.event_session_id) { + //console.log('session id: '+session_value.id+' -> presentation id: '+presentation_value.id); + + + // Look for *presentation files* + presentation_value.file = []; + tbl_event_file.iterate(function(presentation_file_value, presentation_file_key, presentation_file_iteration) { + if (presentation_file_value.for_type == 'presentation' && presentation_value.id == presentation_file_value.for_id) { + presentation_value.file.push(presentation_file_value); + } + }); + + + // Look for *presenters per presentation* + presentation_value.presenter = []; + tbl_event_presenter.iterate(function(presenter_value, presenter_key, presenter_iteration) { + if (presentation_value.id == presenter_value.event_presentation_id) { + //console.log('presentation id: '+presentation_value.id+' -> presenter id: '+presenter_value.id); + + // Look for *presenter files* + presenter_value.file = []; + tbl_event_file.iterate(function(presenter_file_value, presenter_file_key, presenter_file_iteration) { + if (presenter_file_value.for_type == 'presenter' && presenter_value.id == presenter_file_value.for_id) { + presenter_value.file.push(presenter_file_value); + } + }); + + + //NOTE for some reason this is adding duplicate presenters to a session + //NOTE is this iterating twice or something??? + /* + tbl_event_file.iterate(function(presenter_file_value, key, iteration) { + + }); + */ + presentation_value.presenter.push(presenter_value); + } + }); + + //NOTE add in presenters and then presenter's files + + + session_value.presentation.push(presentation_value); + }//); + + }); + //}); + + tmp_event_session.push(session_value); + + }).then(function() { + console.log('idb_to_launcher: Iterate tbl_event_session complete') + }); + launcher.session = tmp_event_session; + + /* + console.log('v2 idb to launcher object: ***'); + console.log(launcher); + console.log('v2 idb to launcher object: ^^^'); + */ + + return true; +} + +exports.check_file_cache = async function () { + console.log('Checking the local file cache against the remote server.'); + tbl_event_file.iterate(function(file_value, key, iteration) { + if (file_value.event_location_id == event_location_id) { + console.log('f: ('+file_value.event_file_id+') '+file_value.event_file_filename+' ***') + + file_id = file_value.event_file_id; // NOTE: the .id is the hosted_file.id! + let filename = file_value.hash_sha256+'.file'; + + save_path = path.join(host_file_cache_path, filename); + + if (fs.existsSync(save_path)) { + console.log('Local file already exists: '+save_path); + } else { + console.log('File not found locally. Downloading file: '+save_path); + let api_endpoint = '/event/file/'+file_id+'/download'; + ipcRenderer.send('download_file', api_base_url, api_endpoint, api_temporary_token, save_path); // Must download file using main node.js thread. + } + } + }); +} + + +function tbl_check(value, key, iteration) { + console.log(value); +} + +function tbl_check_success(result) { + console.log(result); +} +function tbl_check_error(result) { + console.log(result); +} diff --git a/app/js/module_app_idb.js b/app/js/module_app_idb.js new file mode 100644 index 0000000..686cf45 --- /dev/null +++ b/app/js/module_app_idb.js @@ -0,0 +1,173 @@ +const os = require('os'); +const path = require('path'); +const fs = require('fs'); + +const { ipcRenderer } = require('electron'); + + +exports.create_load_idb = async function create_load_idb() { + + return true; +} + + +exports.idb_to_launcher = async function idb_to_launcher() { + //tbl_example.iterate(tbl_check, tbl_check_success, tbl_check_error); //tbl_check(value, key, iteration) + //let launcher = new Object(); + + // Look for *events* + let tmp_event = []; + tbl_event.iterate(function(event_value, key, iteration) { + tmp_event.push(event_value); + }); + launcher.event = tmp_event; + + // Look for *event files* + let tmp_event_file = [] + tbl_event_file.iterate(function(file_value, key, iteration) { + //console.log('event id: '+launcher.event[0].id+' -> file_id: '+file_value.id+'for type: '+file_value.for_type+' for id: '+file_value.id); + if (file_value.for_type == 'event' && launcher.event[0].id == file_value.for_id) { + tmp_event_file.push(file_value); + } + }).then(function() { + console.log('idb_to_launcher: Iterate tbl_event_file complete') + }); + launcher.event_file = tmp_event_file; + + + // Look for *locations* + let tmp_event_location = [] + tbl_event_location.iterate(function(location_value, key, iteration) { + tmp_event_location.push(location_value); + }); + launcher.location = tmp_event_location; + + // Look for *event location files* + let tmp_event_location_file = [] + tbl_event_file.iterate(function(file_value, key, iteration) { + if (file_value.for_type == 'location' && launcher.location[0].id == file_value.for_id) { + tmp_event_location_file.push(file_value); + } + }); + launcher.location_file = tmp_event_location_file; + + + // Look for *sessions* + let tmp_event_session = [] + tbl_event_session.iterate(function(session_value, session_key, session_iteration) { + //console.log('session id: '+session_value.id); + + + // Look for *session files* + session_value.file = []; + tbl_event_file.iterate(function(session_file_value, session_file_key, session_file_iteration) { + if (session_file_value.for_type == 'session' && session_value.id == session_file_value.for_id) { + //console.log('session id: '+session_value.id+' -> file id: '+session_file_value.id); + session_value.file.push(session_file_value) + //tmp_event_session_file.push(session_file_value); + } + }); + + + // Look for *presentations per session* + session_value.presentation = []; + tbl_event_presentation.iterate(function(presentation_value, presentation_key, presentation_iteration) { + if (session_value.id == presentation_value.event_session_id) { + //console.log('session id: '+session_value.id+' -> presentation id: '+presentation_value.id); + + + // Look for *presentation files* + presentation_value.file = []; + tbl_event_file.iterate(function(presentation_file_value, presentation_file_key, presentation_file_iteration) { + if (presentation_file_value.for_type == 'presentation' && presentation_value.id == presentation_file_value.for_id) { + presentation_value.file.push(presentation_file_value); + } + }); + + + // Look for *presenters per presentation* + presentation_value.presenter = []; + tbl_event_presenter.iterate(function(presenter_value, presenter_key, presenter_iteration) { + if (presentation_value.id == presenter_value.event_presentation_id) { + //console.log('presentation id: '+presentation_value.id+' -> presenter id: '+presenter_value.id); + + // Look for *presenter files* + presenter_value.file = []; + tbl_event_file.iterate(function(presenter_file_value, presenter_file_key, presenter_file_iteration) { + if (presenter_file_value.for_type == 'presenter' && presenter_value.id == presenter_file_value.for_id) { + presenter_value.file.push(presenter_file_value); + } + }); + + + //NOTE for some reason this is adding duplicate presenters to a session + //NOTE is this iterating twice or something??? + /* + tbl_event_file.iterate(function(presenter_file_value, key, iteration) { + + }); + */ + presentation_value.presenter.push(presenter_value); + } + }); + + //NOTE add in presenters and then presenter's files + + + session_value.presentation.push(presentation_value); + }//); + + }); + //}); + + tmp_event_session.push(session_value); + + }).then(function() { + console.log('idb_to_launcher: Iterate tbl_event_session complete') + }); + launcher.session = tmp_event_session; + + /* + console.log('v2 idb to launcher object: ***'); + console.log(launcher); + console.log('v2 idb to launcher object: ^^^'); + */ + + return true; +} + +exports.check_file_cache = async function () { + console.log('Checking the local file cache against the remote server.'); + tbl_event_file.iterate(function(file_value, key, iteration) { + if (file_value.event_location_id == event_location_id) { + console.log('f: ('+file_value.event_file_id+') '+file_value.event_file_filename+' ***') + + file_id = file_value.event_file_id; // NOTE: the .id is the hosted_file.id! + let filename = file_value.hash_sha256+'.file'; + + save_path = path.join(host_file_cache_path, filename); + + if (fs.existsSync(save_path)) { + console.log('Local file already exists: '+save_path); + } else { + console.log('File not found locally. Downloading file: '+save_path); + let api_endpoint = '/event/file/'+file_id+'/download'; + ipcRenderer.send('download_file', api_base_url, api_endpoint, api_temporary_token, save_path); // Must download file using main node.js thread. + } + } + }); + + return true; +} + + +function tbl_check(value, key, iteration) { + console.log(value); +} + +function tbl_check_success(result) { + console.log(result); +} +function tbl_check_error(result) { + console.log(result); +} diff --git a/app/js/module_app_ui 2020-01-21.js.bak b/app/js/module_app_ui 2020-01-21.js.bak new file mode 100644 index 0000000..762f810 --- /dev/null +++ b/app/js/module_app_ui 2020-01-21.js.bak @@ -0,0 +1,234 @@ +const os = require('os'); +const path = require('path'); +const fs = require('fs'); + +const { ipcRenderer } = require('electron'); + + +exports.launcher_render = async function (launcher) { + console.log('Rendering launcher...'); + document.getElementById('location_title').innerHTML = '

Launcher '+launcher.location.name+'@'+launcher.event.name+'

'; + + document.getElementById('event_files_menu').innerHTML = '

Event Files

'; + document.getElementById('event_files_menu').innerHTML += ''; + + document.getElementById('location_files_menu').innerHTML = '

Location Files

'; + document.getElementById('location_files_menu').innerHTML += ''; + + document.getElementById('sessions_menu').innerHTML = '

Sessions

'; + document.getElementById('sessions_menu').innerHTML += ''; + session_detail += ''; // for card-body + session_detail += ' '; // for card + + } + //session_detail += ' '; // for session_presentations + + //session_detail += ''; // for card-group + session_detail += ' '; + + + //document.getElementById('location_detail').innerHTML += session_detail; + + if (typeof(document.getElementById('detail_session_id_'+launcher.sessions[i].id)) != 'undefined' && document.getElementById('detail_session_id_'+launcher.sessions[i].id) != null) { + document.getElementById('detail_session_id_'+launcher.sessions[i].id).innerHTML = session_detail; + } else { + document.getElementById('location_detail').innerHTML += session_detail; + } + + + } + document.getElementById('sessions_menu').innerHTML += ''; + + index_location_detail('btn_view_session'); + + index_open_file_buttons('open_local_file'); + + + //const btn_session_{{ event_presentation.id }}_name = document.querySelector('button#presentation_{{ event_presentation.id }}_name'); + //btn_presentation_{{ event_presentation.id }}_name.onclick = display_hide_poster_for_type_id.bind(this, true, 'presentation', {{ event_presentation.id }}); + console.log('Rendering launcher finished.'); + + return true; +} + + +/* Updated 2019-12-19 */ +function index_location_detail(class_name) { + var class_elements = document.getElementsByClassName(class_name); + + for (var i = 0; i < class_elements.length; i++) { + class_elements[i].addEventListener( 'click', function() {view_session( this.getAttribute('data-session_id')) } ); + } + + return true; +} + + +/* Updated 2019-12-19 */ +function view_session(session_id) { + var class_elements = document.getElementsByClassName('session_detail'); + console.log('*** Session ID: '+session_id); + for (var i = 0; i < class_elements.length; i++) { + console.log('*** checking: '+class_elements[i].getAttribute('data-session_id')); + if (class_elements[i].getAttribute('data-session_id') == session_id) { + console.log('show'); + class_elements[i].classList.remove('d-none'); + class_elements[i].classList.add('d-block'); + } else { + console.log('hide'); + class_elements[i].classList.remove('d-block'); + class_elements[i].classList.add('d-none'); + } + } + + return true; +} + + + + + +/* Updated 2019-12-20 */ +function index_open_file_buttons(class_name) { + var class_elements = document.getElementsByClassName(class_name); + + for (var i = 0; i < class_elements.length; i++) { + //class_elements[i].addEventListener( 'click', function() {open_local_file( this.getAttribute('data-filename')) } ); + + //let directory = 'file_cache/'; + + //directory_and_filename = path.join(directory, class_elements[i].getAttribute('data-filename')); + + let file_path = path.join(host_file_cache_path, class_elements[i].getAttribute('data-hash_sha256')); + let filename = class_elements[i].getAttribute('data-filename'); + + class_elements[i].addEventListener( 'click', function() { ipcRenderer.send('open_local_file', file_path, filename) } ); + //ipcRenderer.send('open_local_file', this.getAttribute('data-filename')); // in render thread + } + + return true; +} + + + +function format_bytes(bytes, decimals = 2) { + if (bytes === 0) return '0 Bytes'; + + const k = 1024; + const dm = decimals < 0 ? 0 : decimals; + const sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB']; + + const i = Math.floor(Math.log(bytes) / Math.log(k)); + + return parseFloat((bytes / Math.pow(k, i)).toFixed(dm)) + ' ' + sizes[i]; +} diff --git a/app/js/module_app_ui.js b/app/js/module_app_ui.js new file mode 100644 index 0000000..bb0bac0 --- /dev/null +++ b/app/js/module_app_ui.js @@ -0,0 +1,303 @@ +const os = require('os'); +const path = require('path'); +const fs = require('fs'); + +const { ipcRenderer } = require('electron'); + + +exports.render_launcher = async function (launcher_tmp) { + console.log('Rendering launcher_tmp...'); + + console.log('In module_app_ui.js v2 idb to launcher object: ***'); + console.log(launcher_tmp); + console.log('In module_app_ui.js v2 idb to launcher object: ^^^'); + + for (var i in launcher_tmp.event) { + if (launcher_tmp.event[i].id == event_id) { + console.log('*** Event id ('+event_id+') found in launcher object.'); + for (var j in launcher_tmp.location) { + if (launcher_tmp.location[j].id == event_location_id) { + console.log('*** Location id ('+event_location_id+') found in launcher object.'); + document.getElementById('location_title').innerHTML = '

Launcher '+launcher_tmp.location[j].name+'@'+launcher_tmp.event[i].name+'

'; + } else { + } + } + } else { + } + } + + document.getElementById('event_files_menu').innerHTML = '

Event Files

'; + document.getElementById('event_files_menu').innerHTML += ''; + + + document.getElementById('location_files_menu').innerHTML = '

Location Files

'; + document.getElementById('location_files_menu').innerHTML += ''; + + document.getElementById('sessions_menu').innerHTML = '

Sessions

'; + document.getElementById('sessions_menu').innerHTML += ''; + + index_location_detail('btn_view_session'); + + index_open_file_buttons('open_local_file'); + + + //const btn_session_{{ event_presentation.id }}_name = document.querySelector('button#presentation_{{ event_presentation.id }}_name'); + //btn_presentation_{{ event_presentation.id }}_name.onclick = display_hide_poster_for_type_id.bind(this, true, 'presentation', {{ event_presentation.id }}); + console.log('Rendering launcher finished.'); + + return true; +} + + +/* Updated 2019-12-19 */ +function index_location_detail(class_name) { + var class_elements = document.getElementsByClassName(class_name); + + for (var i = 0; i < class_elements.length; i++) { + class_elements[i].addEventListener( 'click', function() {view_session( this.getAttribute('data-session_id')) } ); + } + + return true; +} + + +/* Updated 2019-12-19 */ +function view_session(session_id) { + var class_elements = document.getElementsByClassName('session_detail'); + console.log('*** Session ID: '+session_id); + for (var i = 0; i < class_elements.length; i++) { + console.log('*** checking: '+class_elements[i].getAttribute('data-session_id')); + if (class_elements[i].getAttribute('data-session_id') == session_id) { + console.log('show'); + class_elements[i].classList.remove('d-none'); + class_elements[i].classList.add('d-block'); + } else { + console.log('hide'); + class_elements[i].classList.remove('d-block'); + class_elements[i].classList.add('d-none'); + } + } + + return true; +} + + + + + +/* Updated 2019-12-20 */ +function index_open_file_buttons(class_name) { + var class_elements = document.getElementsByClassName(class_name); + + for (var i = 0; i < class_elements.length; i++) { + //class_elements[i].addEventListener( 'click', function() {open_local_file( this.getAttribute('data-filename')) } ); + + //let directory = 'file_cache/'; + + //directory_and_filename = path.join(directory, class_elements[i].getAttribute('data-filename')); + + let file_path = path.join(host_file_cache_path, class_elements[i].getAttribute('data-hash_sha256')); + let filename = class_elements[i].getAttribute('data-filename'); + + class_elements[i].addEventListener( 'click', function() { ipcRenderer.send('open_local_file', file_path, filename) } ); + //ipcRenderer.send('open_local_file', this.getAttribute('data-filename')); // in render thread + } + + return true; +} + + + +function format_bytes(bytes, decimals = 2) { + if (bytes === 0) return '0 Bytes'; + + const k = 1024; + const dm = decimals < 0 ? 0 : decimals; + const sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB']; + + const i = Math.floor(Math.log(bytes) / Math.log(k)); + + return parseFloat((bytes / Math.pow(k, i)).toFixed(dm)) + ' ' + sizes[i]; +} diff --git a/config.json b/config.json new file mode 100644 index 0000000..9833dc6 --- /dev/null +++ b/config.json @@ -0,0 +1,63 @@ +{ + "account_id": 12, + "event_id": 14, + "event_location_id": 13, + "event_session_id": null, + "event_presentation_id": null, + "event_presenter_id": null, + "event_file_id": null, + "loading_loop_interval": 500, + "main_loop_interval": 2000, + "api_secret_key": "YWAAk39H2qH0edK6lPH0yg", + "use_local_api": true, + "use_local_db": false, + "api_remote_base_url": "https://api.oneskyit.com", + "api_local_base_url": "http://api.localhost:5001", + "access_control_allow_origin": "*", + "remote_db_server": "db.oneskyit.com", + "remote_db_port": "3306", + "remote_db_name": "onesky_ams_test", + "remote_db_username": "username_here", + "remote_db_password": "password_here", + "local_db_server": "db.localhost", + "local_db_port": "3306", + "local_db_name": "onesky_ams_test", + "local_db_username": "username_here", + "local_db_password": "password_here", + "idb_name": "osit", + "idb_check_period": 30000, + "idb_event_check_period": 120000, + "idb_event_location_check_period": 90000, + "idb_event_session_check_period": 60000, + "idb_event_presentation_check_period": 60000, + "idb_event_presenter_check_period": 60000, + "idb_event_file_check_period": 60000, + "host_file_cache_path": "file_cache", + "host_file_cache_check_period": 30000, + "display_arrangement": "mirror_and_extend", + "display_builtin_resolution": "", + "display_builtin_refresh": "", + "display_builtin_rotation": "", + "display_external_resolution": "", + "display_external_refresh": "", + "display_external_rotation": "", + "audio_out_volume": null, + "audio_in_volume": null, + "recording_fps": 30, + "recording_show_cursor": true, + "recording_highlight_clicks": false, + "recording_screen_id": null, + "recording_audio_device_id": null, + "known_builtin_screen_ids": [69732032, 69733952, 69733248], + "known_builtin_audio_device_ids": [ "AppleHDAEngineInput:1B,0,1,0:1", "BuiltInMicrophoneDevice" ], + "recording_video_codec": "h264", + "recording_path": "[home]/recordings", + "recording_base_filename": "recording", + "aperture_bin_path": null, + "recording_start_datetime": "2019-10-12 01:01:01Z", + "recording_stop_datetime": "2019-10-31 23:59:59Z", + "recordings_datetime": [ + { "start": "2019-10-11T09:50:00.00", "stop": "2019-10-11T10:15:00.00" }, + { "start": "2019-10-11T10:50:00.00", "stop": "2019-10-11T11:15:00.00" } + ] +} diff --git a/config.json.default b/config.json.default new file mode 100644 index 0000000..0f64f81 --- /dev/null +++ b/config.json.default @@ -0,0 +1,42 @@ +{ + "api_secret_key": "YWAAk39H2qH0edK6lPH0yg", + "api_remote_base_url": "https://api.oneskyit.com", + "api_local_base_url": "http://api.localhost:5001", + "remote_db_server": "db.oneskyit.com", + "remote_db_port": "3306", + "remote_db_name": "onesky_ams_test", + "remote_db_username": "username_here", + "remote_db_password": "password_here", + "local_db_server": "db.localhost", + "local_db_port": "3306", + "local_db_name": "onesky_ams_test", + "local_db_username": "username_here", + "local_db_password": "password_here", + "local_file_cache":"file_cache", + "display_arrangement": "mirror_and_extend", + "display_builtin_resolution": "", + "display_builtin_refresh": "", + "display_builtin_rotation": "", + "display_external_resolution": "", + "display_external_refresh": "", + "display_external_rotation": "", + "audio_out_volume": "", + "audio_in_volume": "", + "fps": 30, + "show_cursor": true, + "highlight_clicks": false, + "screen_id": null, + "audio_device_id": null, + "known_builtin_screen_ids": [69732032, 69733952, 69733248], + "known_builtin_audio_device_ids": [ "AppleHDAEngineInput:1B,0,1,0:1", "BuiltInMicrophoneDevice" ], + "video_codec": "h264", + "recordings_path": "[home]/recordings", + "base_filename": "recording", + "aperture_bin_path": null, + "recording_start_datetime": "2019-10-12 01:01:01Z", + "recording_stop_datetime": "2019-10-31 23:59:59Z", + "recordings_datetime": [ + { "start": "2019-10-11T09:50:00.00", "stop": "2019-10-11T10:15:00.00" }, + { "start": "2019-10-11T10:50:00.00", "stop": "2019-10-11T11:15:00.00" } + ] +} diff --git a/index.js b/index.js new file mode 100644 index 0000000..34dba32 --- /dev/null +++ b/index.js @@ -0,0 +1,140 @@ +const { app, BrowserWindow, ipcMain, shell, systemPreferences } = require('electron'); + + +const axios = require('axios'); +const fs = require('fs'); +//const http = require('http'); +const os = require('os'); +const path = require('path'); +const process = require('process'); +//const request = require('request'); +//const url = require('url'); +// const usb = require('usb') // Compiled with an old version of Node.js + +console.log(os.type()); +console.log(process.getSystemVersion()); + + +if (os.type == 'Darwin') { + if (systemPreferences.getMediaAccessStatus('microphone') != 'granted') { + systemPreferences.askForMediaAccess('microphone'); + } else { + console.log(systemPreferences.getMediaAccessStatus('microphone')); + } + + if (systemPreferences.getMediaAccessStatus('camera') != 'granted') { + systemPreferences.askForMediaAccess('camera'); + } else { + console.log(systemPreferences.getMediaAccessStatus('camera')); + } +} + + +function createWindow () { + // Create the browser window. + win = new BrowserWindow({ + width: 1500, // 1500 1280 + height: 1024, // 1024 + backgroundColor: '#fff', + icon: './app/img/favicon.ico', + webPreferences: { + nodeIntegration: true + } + }) + + win.setMinimumSize(1024, 768); + + //win.setFullScreenable(false) + win.FullScreenable = false; + + // and load the index.html of the app. + win.loadFile('app/index.html'); + + // Open the DevTools. + win.webContents.openDevTools(); + + // Emitted when the window is closed. + win.on('closed', () => { + // Dereference the window object, usually you would store windows + // in an array if your app supports multi windows, this is the time + // when you should delete the corresponding element. + win = null; + }) + + win.on('minimize', () => { + //win.restore(); + }) +} + + +// This method will be called when Electron has finished +// initialization and is ready to create browser windows. +// Some APIs can only be used after this event occurs. +app.on('ready', createWindow); + + +// Quit when all windows are closed. +app.on('window-all-closed', () => { + // On macOS it is common for applications and their menu bar + // to stay active until the user quits explicitly with Cmd + Q + if (process.platform !== 'darwin') { + app.quit(); + } +}) + + +app.on('activate', () => { + // On macOS it's common to re-create a window in the app when the + // dock icon is clicked and there are no other windows open.location_files + if (win === null) { + createWindow(); + } +}) + + +ipcMain.on('download_file', (event, api_base_url, api_endpoint, api_temporary_token, save_path) => { + console.log('ipcMain download and save file: '+api_endpoint+' -> '+save_path); + + axios.defaults.baseURL = api_base_url; + axios.defaults.headers.post['Access-Control-Allow-Origin'] = '*'; + axios.defaults.headers.common['Authorization'] = `Token ${api_temporary_token}`; + + const url = api_endpoint; + + axios({ + method: 'get', + url: url, + responseType: 'stream' /* responseType must be stream */ + }).then(function (response) { + response.data.pipe(fs.createWriteStream(save_path)); + }); +}); + + + +ipcMain.on('open_local_file', (event, file_path, filename) => { + console.log('ipcMain open local file: '+file_path+' -> '+filename); + + cache_file_path = path.join(process.cwd(), file_path); + console.log(cache_file_path); + + open_file_path = path.join(process.cwd(), 'temp/', filename); + console.log(open_file_path); + + + if (fs.existsSync(open_file_path)) { + //console.log('File link already exists: '+open_file_path); + // NOTE: Should the file be checked to see if it has changed from the hashed cache version??? + // NOTE: What if they made changes to the file locally in temp? The changed file would be used since a new copy is not being made. + // NOTE: It might make sense for this to be a configurable option depending on the group. Some do not allow changes. This helps enforce that. + console.log('File copy already exists: '+open_file_path); + } else { + //console.log('Creating file link: '+open_file_path); + //fs.linkSync(cache_file_path, open_file_path); + console.log('Copying file to temp: '+open_file_path); + fs.copyFileSync(cache_file_path, open_file_path); + } + + shell.openItem(open_file_path); + //fs.open(open_file_path); +}); diff --git a/module_helper.js.bak b/module_helper.js.bak new file mode 100644 index 0000000..dc383b8 --- /dev/null +++ b/module_helper.js.bak @@ -0,0 +1,63 @@ +const os = require('os'); +const path = require('path'); +const fs = require('fs'); + +exports.download_file_id = async function (axios, file_id, filename_override) { + console.log('Downloading file...'); + const url = '/event/file/'+file_id+'/download'; + + const data = await axios({ + method: "get", + url: url, + responseType: "stream" + }) + .then(function (response) { + //console.log(response); + //console.log(response.data); + + let filename = 'default.txt'; + + if (typeof filename_override === 'undefined' || filename_override == null) { + let headerLine = response.data.headers['content-disposition']; + + console.log(headerLine); + console.log(headerLine.indexOf('="')); + console.log(headerLine.indexOf('=')); + if (headerLine.indexOf('="') != -1) { + let startFileNameIndex = headerLine.indexOf('="') + 2; + let endFileNameIndex = headerLine.lastIndexOf('"'); + filename = headerLine.substring(startFileNameIndex, endFileNameIndex); + } else if (headerLine.indexOf('=') != -1) { + let startFileNameIndex = headerLine.indexOf('=') + 1; + let endFileNameIndex = headerLine.length; + filename = headerLine.substring(startFileNameIndex, endFileNameIndex); + } else { + filename = 'filename_not_found_in_header.txt'; + } + } else { + filename = filename_override; + } + + let directory = 'file_cache/'; + + directory_and_filename = path.join(directory, filename); + + //console.log(directory_and_filename); + + if (fs.existsSync(directory_and_filename)) { + console.log('File already exists: '+directory_and_filename); + } else { + console.log('Starting file download: '+directory_and_filename); + response.data.pipe(fs.createWriteStream(directory_and_filename)); + } + //data = response.data; + return true; + //return response.data; + }) + .catch(function (error) { + console.log(error); + return error; + }); + + return data; +} diff --git a/package-lock.json b/package-lock.json new file mode 100644 index 0000000..7c657be --- /dev/null +++ b/package-lock.json @@ -0,0 +1,1411 @@ +{ + "name": "onesky_native", + "version": "1.0.0", + "lockfileVersion": 1, + "requires": true, + "dependencies": { + "@electron/get": { + "version": "1.7.2", + "resolved": "https://registry.npmjs.org/@electron/get/-/get-1.7.2.tgz", + "integrity": "sha512-LSE4LZGMjGS9TloDx0yO44D2UTbaeKRk+QjlhWLiQlikV6J4spgDCjb6z4YIcqmPAwNzlNCnWF4dubytwI+ATA==", + "requires": { + "debug": "^4.1.1", + "env-paths": "^2.2.0", + "fs-extra": "^8.1.0", + "global-agent": "^2.0.2", + "global-tunnel-ng": "^2.7.1", + "got": "^9.6.0", + "sanitize-filename": "^1.6.2", + "sumchecker": "^3.0.1" + }, + "dependencies": { + "debug": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz", + "integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==", + "requires": { + "ms": "^2.1.1" + } + }, + "ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" + } + } + }, + "@sindresorhus/is": { + "version": "0.14.0", + "resolved": "https://registry.npmjs.org/@sindresorhus/is/-/is-0.14.0.tgz", + "integrity": "sha512-9NET910DNaIPngYnLLPeg+Ogzqsi9uM4mSboU5y6p8S5DzMTVEsJZrawi+BoDNUVBa2DhJqQYUFvMDfgU062LQ==" + }, + "@szmarczak/http-timer": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/@szmarczak/http-timer/-/http-timer-1.1.2.tgz", + "integrity": "sha512-XIB2XbzHTN6ieIjfIMV9hlVcfPU26s2vafYWQcZHWXHOxiaRZYEDKEwdl129Zyg50+foYV2jCgtrqSA6qNuNSA==", + "requires": { + "defer-to-connect": "^1.0.1" + } + }, + "@types/node": { + "version": "12.12.20", + "resolved": "https://registry.npmjs.org/@types/node/-/node-12.12.20.tgz", + "integrity": "sha512-VAe+DiwpnC/g448uN+/3gRl4th0BTdrR9gSLIOHA+SUQskaYZQDOHG7xmjiE7JUhjbXnbXytf6Ih+/pA6CtMFQ==" + }, + "ajv": { + "version": "6.10.2", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.10.2.tgz", + "integrity": "sha512-TXtUUEYHuaTEbLZWIKUr5pmBuhDLy+8KYtPYdcV8qC+pOZL+NKqYwvWSRrVXHn+ZmRRAu8vJTAznH7Oag6RVRw==", + "requires": { + "fast-deep-equal": "^2.0.1", + "fast-json-stable-stringify": "^2.0.0", + "json-schema-traverse": "^0.4.1", + "uri-js": "^4.2.2" + } + }, + "ansi-regex": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", + "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=" + }, + "aproba": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/aproba/-/aproba-1.2.0.tgz", + "integrity": "sha512-Y9J6ZjXtoYh8RnXVCMOU/ttDmk1aBjunq9vO0ta5x85WDQiQfUF9sIPBITdbiiIVcBo03Hi3jMxigBtsddlXRw==" + }, + "are-we-there-yet": { + "version": "1.1.5", + "resolved": "https://registry.npmjs.org/are-we-there-yet/-/are-we-there-yet-1.1.5.tgz", + "integrity": "sha512-5hYdAkZlcG8tOLujVDTgCT+uPX0VnpAH28gWsLfzpXYm7wP6mp5Q/gYyR7YQ0cKVJcXJnl3j2kpBan13PtQf6w==", + "requires": { + "delegates": "^1.0.0", + "readable-stream": "^2.0.6" + } + }, + "asn1": { + "version": "0.2.4", + "resolved": "https://registry.npmjs.org/asn1/-/asn1-0.2.4.tgz", + "integrity": "sha512-jxwzQpLQjSmWXgwaCZE9Nz+glAG01yF1QnWgbhGwHI5A6FRIEY6IVqtHhIepHqI7/kyEyQEagBC5mBEFlIYvdg==", + "requires": { + "safer-buffer": "~2.1.0" + } + }, + "assert-plus": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", + "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=" + }, + "asynckit": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", + "integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k=" + }, + "aws-sign2": { + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.7.0.tgz", + "integrity": "sha1-tG6JCTSpWR8tL2+G1+ap8bP+dqg=" + }, + "aws4": { + "version": "1.9.0", + "resolved": "https://registry.npmjs.org/aws4/-/aws4-1.9.0.tgz", + "integrity": "sha512-Uvq6hVe90D0B2WEnUqtdgY1bATGz3mw33nH9Y+dmA+w5DHvUmBgkr5rM/KCHpCsiFNRUfokW/szpPPgMK2hm4A==" + }, + "axios": { + "version": "0.19.0", + "resolved": "https://registry.npmjs.org/axios/-/axios-0.19.0.tgz", + "integrity": "sha512-1uvKqKQta3KBxIz14F2v06AEHZ/dIoeKfbTRkK1E5oqjDnuEerLmYTgJB5AiQZHJcljpg1TuRzdjDR06qNk0DQ==", + "requires": { + "follow-redirects": "1.5.10", + "is-buffer": "^2.0.2" + } + }, + "bcrypt-pbkdf": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.2.tgz", + "integrity": "sha1-pDAdOJtqQ/m2f/PKEaP2Y342Dp4=", + "requires": { + "tweetnacl": "^0.14.3" + } + }, + "bindings": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/bindings/-/bindings-1.5.0.tgz", + "integrity": "sha512-p2q/t/mhvuOj/UeLlV6566GD/guowlr0hHxClI0W9m7MWYkL1F0hLo+0Aexs9HSPCtR1SXQ0TD3MMKrXZajbiQ==", + "requires": { + "file-uri-to-path": "1.0.0" + } + }, + "bl": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/bl/-/bl-3.0.0.tgz", + "integrity": "sha512-EUAyP5UHU5hxF8BPT0LKW8gjYLhq1DQIcneOX/pL/m2Alo+OYDQAJlHq+yseMP50Os2nHXOSic6Ss3vSQeyf4A==", + "requires": { + "readable-stream": "^3.0.1" + }, + "dependencies": { + "readable-stream": { + "version": "3.4.0", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.4.0.tgz", + "integrity": "sha512-jItXPLmrSR8jmTRmRWJXCnGJsfy85mB3Wd/uINMXA65yrnFo0cPClFIUWzo2najVNSl+mx7/4W8ttlLWJe99pQ==", + "requires": { + "inherits": "^2.0.3", + "string_decoder": "^1.1.1", + "util-deprecate": "^1.0.1" + } + } + } + }, + "boolean": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/boolean/-/boolean-3.0.0.tgz", + "integrity": "sha512-OElxJ1lUSinuoUnkpOgLmxp0DC4ytEhODEL6QJU0NpxE/mI4rUSh8h1P1Wkvfi3xQEBcxXR2gBIPNYNuaFcAbQ==", + "optional": true + }, + "buffer-from": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.1.tgz", + "integrity": "sha512-MQcXEUbCKtEo7bhqEs6560Hyd4XaovZlO/k9V3hjVUF/zwW7KBVdSK4gIt/bzwS9MbR5qob+F5jusZsb0YQK2A==" + }, + "cacheable-request": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/cacheable-request/-/cacheable-request-6.1.0.tgz", + "integrity": "sha512-Oj3cAGPCqOZX7Rz64Uny2GYAZNliQSqfbePrgAQ1wKAihYmCUnraBtJtKcGR4xz7wF+LoJC+ssFZvv5BgF9Igg==", + "requires": { + "clone-response": "^1.0.2", + "get-stream": "^5.1.0", + "http-cache-semantics": "^4.0.0", + "keyv": "^3.0.0", + "lowercase-keys": "^2.0.0", + "normalize-url": "^4.1.0", + "responselike": "^1.0.2" + }, + "dependencies": { + "get-stream": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-5.1.0.tgz", + "integrity": "sha512-EXr1FOzrzTfGeL0gQdeFEvOMm2mzMOglyiOXSTpPC+iAjAKftbr3jpCMWynogwYnM+eSj9sHGc6wjIcDvYiygw==", + "requires": { + "pump": "^3.0.0" + } + }, + "lowercase-keys": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/lowercase-keys/-/lowercase-keys-2.0.0.tgz", + "integrity": "sha512-tqNXrS78oMOE73NMxK4EMLQsQowWf8jKooH9g7xPavRT706R6bkQJ6DY2Te7QukaZsulxa30wQ7bk0pm4XiHmA==" + } + } + }, + "caseless": { + "version": "0.12.0", + "resolved": "https://registry.npmjs.org/caseless/-/caseless-0.12.0.tgz", + "integrity": "sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw=" + }, + "chownr": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/chownr/-/chownr-1.1.3.tgz", + "integrity": "sha512-i70fVHhmV3DtTl6nqvZOnIjbY0Pe4kAUjwHj8z0zAdgBtYrJyYwLKCCuRBQ5ppkyL0AkN7HKRnETdmdp1zqNXw==" + }, + "clone-response": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/clone-response/-/clone-response-1.0.2.tgz", + "integrity": "sha1-0dyXOSAxTfZ/vrlCI7TuNQI56Ws=", + "requires": { + "mimic-response": "^1.0.0" + }, + "dependencies": { + "mimic-response": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/mimic-response/-/mimic-response-1.0.1.tgz", + "integrity": "sha512-j5EctnkH7amfV/q5Hgmoal1g2QHFJRraOtmx0JpIqkxhBhI/lJSl1nMpQ45hVarwNETOoWEimndZ4QK0RHxuxQ==" + } + } + }, + "code-point-at": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/code-point-at/-/code-point-at-1.1.0.tgz", + "integrity": "sha1-DQcLTQQ6W+ozovGkDi7bPZpMz3c=" + }, + "combined-stream": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", + "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==", + "requires": { + "delayed-stream": "~1.0.0" + } + }, + "concat-stream": { + "version": "1.6.2", + "resolved": "https://registry.npmjs.org/concat-stream/-/concat-stream-1.6.2.tgz", + "integrity": "sha512-27HBghJxjiZtIk3Ycvn/4kbJk/1uZuJFfuPEns6LaEvpvG1f0hTea8lilrouyo9mVc2GWdcEZ8OLoGmSADlrCw==", + "requires": { + "buffer-from": "^1.0.0", + "inherits": "^2.0.3", + "readable-stream": "^2.2.2", + "typedarray": "^0.0.6" + } + }, + "config-chain": { + "version": "1.1.12", + "resolved": "https://registry.npmjs.org/config-chain/-/config-chain-1.1.12.tgz", + "integrity": "sha512-a1eOIcu8+7lUInge4Rpf/n4Krkf3Dd9lqhljRzII1/Zno/kRtUWnznPO3jOKBmTEktkt3fkxisUcivoj0ebzoA==", + "optional": true, + "requires": { + "ini": "^1.3.4", + "proto-list": "~1.2.1" + } + }, + "console-control-strings": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/console-control-strings/-/console-control-strings-1.1.0.tgz", + "integrity": "sha1-PXz0Rk22RG6mRL9LOVB/mFEAjo4=" + }, + "core-js": { + "version": "3.5.0", + "resolved": "https://registry.npmjs.org/core-js/-/core-js-3.5.0.tgz", + "integrity": "sha512-Ifh3kj78gzQ7NAoJXeTu+XwzDld0QRIwjBLRqAMhuLhP3d2Av5wmgE9ycfnvK6NAEjTkQ1sDPeoEZAWO3Hx1Uw==", + "optional": true + }, + "core-util-is": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", + "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=" + }, + "dashdash": { + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/dashdash/-/dashdash-1.14.1.tgz", + "integrity": "sha1-hTz6D3y+L+1d4gMmuN1YEDX24vA=", + "requires": { + "assert-plus": "^1.0.0" + } + }, + "debug": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz", + "integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==", + "requires": { + "ms": "2.0.0" + } + }, + "decompress-response": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/decompress-response/-/decompress-response-4.2.1.tgz", + "integrity": "sha512-jOSne2qbyE+/r8G1VU+G/82LBs2Fs4LAsTiLSHOCOMZQl2OKZ6i8i4IyHemTe+/yIXOtTcRQMzPcgyhoFlqPkw==", + "requires": { + "mimic-response": "^2.0.0" + } + }, + "deep-extend": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/deep-extend/-/deep-extend-0.6.0.tgz", + "integrity": "sha512-LOHxIOaPYdHlJRtCQfDIVZtfw/ufM8+rVj649RIHzcm/vGwQRXFt6OPqIFWsm2XEMrNIEtWR64sY1LEKD2vAOA==" + }, + "defer-to-connect": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/defer-to-connect/-/defer-to-connect-1.1.1.tgz", + "integrity": "sha512-J7thop4u3mRTkYRQ+Vpfwy2G5Ehoy82I14+14W4YMDLKdWloI9gSzRbV30s/NckQGVJtPkWNcW4oMAUigTdqiQ==" + }, + "define-properties": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.1.3.tgz", + "integrity": "sha512-3MqfYKj2lLzdMSf8ZIZE/V+Zuy+BgD6f164e8K2w7dgnpKArBDerGYpM46IYYcjnkdPNMjPk9A6VFB8+3SKlXQ==", + "optional": true, + "requires": { + "object-keys": "^1.0.12" + } + }, + "delayed-stream": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", + "integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk=" + }, + "delegates": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/delegates/-/delegates-1.0.0.tgz", + "integrity": "sha1-hMbhWbgZBP3KWaDvRM2HDTElD5o=" + }, + "detect-libc": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-1.0.3.tgz", + "integrity": "sha1-+hN8S9aY7fVc1c0CrFWfkaTEups=" + }, + "detect-node": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/detect-node/-/detect-node-2.0.4.tgz", + "integrity": "sha512-ZIzRpLJrOj7jjP2miAtgqIfmzbxa4ZOr5jJc601zklsfEx9oTzmmj2nVpIPRpNlRTIh8lc1kyViIY7BWSGNmKw==", + "optional": true + }, + "duplexer3": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/duplexer3/-/duplexer3-0.1.4.tgz", + "integrity": "sha1-7gHdHKwO08vH/b6jfcCo8c4ALOI=" + }, + "ecc-jsbn": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/ecc-jsbn/-/ecc-jsbn-0.1.2.tgz", + "integrity": "sha1-OoOpBOVDUyh4dMVkt1SThoSamMk=", + "requires": { + "jsbn": "~0.1.0", + "safer-buffer": "^2.1.0" + } + }, + "electron": { + "version": "7.1.5", + "resolved": "https://registry.npmjs.org/electron/-/electron-7.1.5.tgz", + "integrity": "sha512-jagsvNz6Axu2Lsp5PqDgkcR+4BwoPP9YyLgMu9lhpFNRNKpNgfsEqUbtNolkFN/TtmWjxGO+iioWRrGqZHmJ8w==", + "requires": { + "@electron/get": "^1.0.1", + "@types/node": "^12.0.12", + "extract-zip": "^1.0.3" + } + }, + "encodeurl": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz", + "integrity": "sha1-rT/0yG7C0CkyL1oCw6mmBslbP1k=", + "optional": true + }, + "end-of-stream": { + "version": "1.4.4", + "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.4.tgz", + "integrity": "sha512-+uw1inIHVPQoaVuHzRyXd21icM+cnt4CzD5rW+NC1wjOUSTOs+Te7FOv7AhN7vS9x/oIyhLP5PR1H+phQAHu5Q==", + "requires": { + "once": "^1.4.0" + } + }, + "env-paths": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/env-paths/-/env-paths-2.2.0.tgz", + "integrity": "sha512-6u0VYSCo/OW6IoD5WCLLy9JUGARbamfSavcNXry/eu8aHVFei6CD3Sw+VGX5alea1i9pgPHW0mbu6Xj0uBh7gA==" + }, + "es6-error": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/es6-error/-/es6-error-4.1.1.tgz", + "integrity": "sha512-Um/+FxMr9CISWh0bi5Zv0iOD+4cFh5qLeks1qhAopKVAJw3drgKbKySikp7wGhDL0HPeaja0P5ULZrxLkniUVg==", + "optional": true + }, + "escape-string-regexp": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-2.0.0.tgz", + "integrity": "sha512-UpzcLCXolUWcNu5HtVMHYdXJjArjsF9C0aNnquZYY4uW/Vu0miy5YoWvbV345HauVvcAUnpRuhMMcqTcGOY2+w==", + "optional": true + }, + "expand-template": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/expand-template/-/expand-template-2.0.3.tgz", + "integrity": "sha512-XYfuKMvj4O35f/pOXLObndIRvyQ+/+6AhODh+OKWj9S9498pHHn/IMszH+gt0fBCRWMNfk1ZSp5x3AifmnI2vg==" + }, + "extend": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz", + "integrity": "sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==" + }, + "extract-zip": { + "version": "1.6.7", + "resolved": "https://registry.npmjs.org/extract-zip/-/extract-zip-1.6.7.tgz", + "integrity": "sha1-qEC0uK9kAyZMjbV/Txp0Mz74H+k=", + "requires": { + "concat-stream": "1.6.2", + "debug": "2.6.9", + "mkdirp": "0.5.1", + "yauzl": "2.4.1" + }, + "dependencies": { + "debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "requires": { + "ms": "2.0.0" + } + } + } + }, + "extsprintf": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/extsprintf/-/extsprintf-1.3.0.tgz", + "integrity": "sha1-lpGEQOMEGnpBT4xS48V06zw+HgU=" + }, + "fast-deep-equal": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-2.0.1.tgz", + "integrity": "sha1-ewUhjd+WZ79/Nwv3/bLLFf3Qqkk=" + }, + "fast-json-stable-stringify": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", + "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==" + }, + "fd-slicer": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/fd-slicer/-/fd-slicer-1.0.1.tgz", + "integrity": "sha1-i1vL2ewyfFBBv5qwI/1nUPEXfmU=", + "requires": { + "pend": "~1.2.0" + } + }, + "file-uri-to-path": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/file-uri-to-path/-/file-uri-to-path-1.0.0.tgz", + "integrity": "sha512-0Zt+s3L7Vf1biwWZ29aARiVYLx7iMGnEUl9x33fbB/j3jR81u/O2LbqK+Bm1CDSNDKVtJ/YjwY7TUd5SkeLQLw==" + }, + "follow-redirects": { + "version": "1.5.10", + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.5.10.tgz", + "integrity": "sha512-0V5l4Cizzvqt5D44aTXbFZz+FtyXV1vrDN6qrelxtfYQKW0KO0W2T/hkE8xvGa/540LkZlkaUjO4ailYTFtHVQ==", + "requires": { + "debug": "=3.1.0" + } + }, + "forever-agent": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/forever-agent/-/forever-agent-0.6.1.tgz", + "integrity": "sha1-+8cfDEGt6zf5bFd60e1C2P2sypE=" + }, + "form-data": { + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-2.3.3.tgz", + "integrity": "sha512-1lLKB2Mu3aGP1Q/2eCOx0fNbRMe7XdwktwOruhfqqd0rIJWwN4Dh+E3hrPSlDCXnSR7UtZ1N38rVXm+6+MEhJQ==", + "requires": { + "asynckit": "^0.4.0", + "combined-stream": "^1.0.6", + "mime-types": "^2.1.12" + } + }, + "fs": { + "version": "0.0.1-security", + "resolved": "https://registry.npmjs.org/fs/-/fs-0.0.1-security.tgz", + "integrity": "sha1-invTcYa23d84E/I4WLV+yq9eQdQ=" + }, + "fs-constants": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fs-constants/-/fs-constants-1.0.0.tgz", + "integrity": "sha512-y6OAwoSIf7FyjMIv94u+b5rdheZEjzR63GTyZJm5qh4Bi+2YgwLCcI/fPFZkL5PSixOt6ZNKm+w+Hfp/Bciwow==" + }, + "fs-extra": { + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-8.1.0.tgz", + "integrity": "sha512-yhlQgA6mnOJUKOsRUFsgJdQCvkKhcz8tlZG5HBQfReYZy46OwLcY+Zia0mtdHsOo9y/hP+CxMN0TU9QxoOtG4g==", + "requires": { + "graceful-fs": "^4.2.0", + "jsonfile": "^4.0.0", + "universalify": "^0.1.0" + } + }, + "gauge": { + "version": "2.7.4", + "resolved": "https://registry.npmjs.org/gauge/-/gauge-2.7.4.tgz", + "integrity": "sha1-LANAXHU4w51+s3sxcCLjJfsBi/c=", + "requires": { + "aproba": "^1.0.3", + "console-control-strings": "^1.0.0", + "has-unicode": "^2.0.0", + "object-assign": "^4.1.0", + "signal-exit": "^3.0.0", + "string-width": "^1.0.1", + "strip-ansi": "^3.0.1", + "wide-align": "^1.1.0" + } + }, + "get-stream": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-4.1.0.tgz", + "integrity": "sha512-GMat4EJ5161kIy2HevLlr4luNjBgvmj413KaQA7jt4V8B4RDsfpHk7WQ9GVqfYyyx8OS/L66Kox+rJRNklLK7w==", + "requires": { + "pump": "^3.0.0" + } + }, + "getpass": { + "version": "0.1.7", + "resolved": "https://registry.npmjs.org/getpass/-/getpass-0.1.7.tgz", + "integrity": "sha1-Xv+OPmhNVprkyysSgmBOi6YhSfo=", + "requires": { + "assert-plus": "^1.0.0" + } + }, + "github-from-package": { + "version": "0.0.0", + "resolved": "https://registry.npmjs.org/github-from-package/-/github-from-package-0.0.0.tgz", + "integrity": "sha1-l/tdlr/eiXMxPyDoKI75oWf6ZM4=" + }, + "global-agent": { + "version": "2.1.7", + "resolved": "https://registry.npmjs.org/global-agent/-/global-agent-2.1.7.tgz", + "integrity": "sha512-ooK7eqGYZku+LgnbfH/Iv0RJ74XfhrBZDlke1QSzcBt0bw1PmJcnRADPAQuFE+R45pKKDTynAr25SBasY2kvow==", + "optional": true, + "requires": { + "boolean": "^3.0.0", + "core-js": "^3.4.1", + "es6-error": "^4.1.1", + "matcher": "^2.0.0", + "roarr": "^2.14.5", + "semver": "^6.3.0", + "serialize-error": "^5.0.0" + }, + "dependencies": { + "semver": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", + "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", + "optional": true + } + } + }, + "global-tunnel-ng": { + "version": "2.7.1", + "resolved": "https://registry.npmjs.org/global-tunnel-ng/-/global-tunnel-ng-2.7.1.tgz", + "integrity": "sha512-4s+DyciWBV0eK148wqXxcmVAbFVPqtc3sEtUE/GTQfuU80rySLcMhUmHKSHI7/LDj8q0gDYI1lIhRRB7ieRAqg==", + "optional": true, + "requires": { + "encodeurl": "^1.0.2", + "lodash": "^4.17.10", + "npm-conf": "^1.1.3", + "tunnel": "^0.0.6" + } + }, + "globalthis": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/globalthis/-/globalthis-1.0.1.tgz", + "integrity": "sha512-mJPRTc/P39NH/iNG4mXa9aIhNymaQikTrnspeCa2ZuJ+mH2QN/rXwtX3XwKrHqWgUQFbNZKtHM105aHzJalElw==", + "optional": true, + "requires": { + "define-properties": "^1.1.3" + } + }, + "got": { + "version": "9.6.0", + "resolved": "https://registry.npmjs.org/got/-/got-9.6.0.tgz", + "integrity": "sha512-R7eWptXuGYxwijs0eV+v3o6+XH1IqVK8dJOEecQfTmkncw9AV4dcw/Dhxi8MdlqPthxxpZyizMzyg8RTmEsG+Q==", + "requires": { + "@sindresorhus/is": "^0.14.0", + "@szmarczak/http-timer": "^1.1.2", + "cacheable-request": "^6.0.0", + "decompress-response": "^3.3.0", + "duplexer3": "^0.1.4", + "get-stream": "^4.1.0", + "lowercase-keys": "^1.0.1", + "mimic-response": "^1.0.1", + "p-cancelable": "^1.0.0", + "to-readable-stream": "^1.0.0", + "url-parse-lax": "^3.0.0" + }, + "dependencies": { + "decompress-response": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/decompress-response/-/decompress-response-3.3.0.tgz", + "integrity": "sha1-gKTdMjdIOEv6JICDYirt7Jgq3/M=", + "requires": { + "mimic-response": "^1.0.0" + } + }, + "mimic-response": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/mimic-response/-/mimic-response-1.0.1.tgz", + "integrity": "sha512-j5EctnkH7amfV/q5Hgmoal1g2QHFJRraOtmx0JpIqkxhBhI/lJSl1nMpQ45hVarwNETOoWEimndZ4QK0RHxuxQ==" + } + } + }, + "graceful-fs": { + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.3.tgz", + "integrity": "sha512-a30VEBm4PEdx1dRB7MFK7BejejvCvBronbLjht+sHuGYj8PHs7M/5Z+rt5lw551vZ7yfTCj4Vuyy3mSJytDWRQ==" + }, + "har-schema": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/har-schema/-/har-schema-2.0.0.tgz", + "integrity": "sha1-qUwiJOvKwEeCoNkDVSHyRzW37JI=" + }, + "har-validator": { + "version": "5.1.3", + "resolved": "https://registry.npmjs.org/har-validator/-/har-validator-5.1.3.tgz", + "integrity": "sha512-sNvOCzEQNr/qrvJgc3UG/kD4QtlHycrzwS+6mfTrrSq97BvaYcPZZI1ZSqGSPR73Cxn4LKTD4PttRwfU7jWq5g==", + "requires": { + "ajv": "^6.5.5", + "har-schema": "^2.0.0" + } + }, + "has-unicode": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/has-unicode/-/has-unicode-2.0.1.tgz", + "integrity": "sha1-4Ob+aijPUROIVeCG0Wkedx3iqLk=" + }, + "http-cache-semantics": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/http-cache-semantics/-/http-cache-semantics-4.0.3.tgz", + "integrity": "sha512-TcIMG3qeVLgDr1TEd2XvHaTnMPwYQUQMIBLy+5pLSDKYFc7UIqj39w8EGzZkaxoLv/l2K8HaI0t5AVA+YYgUew==" + }, + "http-signature": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.2.0.tgz", + "integrity": "sha1-muzZJRFHcvPZW2WmCruPfBj7rOE=", + "requires": { + "assert-plus": "^1.0.0", + "jsprim": "^1.2.2", + "sshpk": "^1.7.0" + } + }, + "inherits": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" + }, + "ini": { + "version": "1.3.5", + "resolved": "https://registry.npmjs.org/ini/-/ini-1.3.5.tgz", + "integrity": "sha512-RZY5huIKCMRWDUqZlEi72f/lmXKMvuszcMBduliQ3nnWbx9X/ZBQO7DijMEYS9EhHBb2qacRUMtC7svLwe0lcw==" + }, + "is-buffer": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-2.0.4.tgz", + "integrity": "sha512-Kq1rokWXOPXWuaMAqZiJW4XxsmD9zGx9q4aePabbn3qCRGedtH7Cm+zV8WETitMfu1wdh+Rvd6w5egwSngUX2A==" + }, + "is-fullwidth-code-point": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz", + "integrity": "sha1-754xOG8DGn8NZDr4L95QxFfvAMs=", + "requires": { + "number-is-nan": "^1.0.0" + } + }, + "is-typedarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz", + "integrity": "sha1-5HnICFjfDBsR3dppQPlgEfzaSpo=" + }, + "isarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", + "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=" + }, + "isstream": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz", + "integrity": "sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo=" + }, + "jsbn": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/jsbn/-/jsbn-0.1.1.tgz", + "integrity": "sha1-peZUwuWi3rXyAdls77yoDA7y9RM=" + }, + "json-buffer": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/json-buffer/-/json-buffer-3.0.0.tgz", + "integrity": "sha1-Wx85evx11ne96Lz8Dkfh+aPZqJg=" + }, + "json-schema": { + "version": "0.2.3", + "resolved": "https://registry.npmjs.org/json-schema/-/json-schema-0.2.3.tgz", + "integrity": "sha1-tIDIkuWaLwWVTOcnvT8qTogvnhM=" + }, + "json-schema-traverse": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", + "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==" + }, + "json-stringify-safe": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz", + "integrity": "sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus=" + }, + "jsonfile": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-4.0.0.tgz", + "integrity": "sha1-h3Gq4HmbZAdrdmQPygWPnBDjPss=", + "requires": { + "graceful-fs": "^4.1.6" + } + }, + "jsprim": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/jsprim/-/jsprim-1.4.1.tgz", + "integrity": "sha1-MT5mvB5cwG5Di8G3SZwuXFastqI=", + "requires": { + "assert-plus": "1.0.0", + "extsprintf": "1.3.0", + "json-schema": "0.2.3", + "verror": "1.10.0" + } + }, + "keyv": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/keyv/-/keyv-3.1.0.tgz", + "integrity": "sha512-9ykJ/46SN/9KPM/sichzQ7OvXyGDYKGTaDlKMGCAlg2UK8KRy4jb0d8sFc+0Tt0YYnThq8X2RZgCg74RPxgcVA==", + "requires": { + "json-buffer": "3.0.0" + } + }, + "lodash": { + "version": "4.17.15", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.15.tgz", + "integrity": "sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A==", + "optional": true + }, + "lowercase-keys": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/lowercase-keys/-/lowercase-keys-1.0.1.tgz", + "integrity": "sha512-G2Lj61tXDnVFFOi8VZds+SoQjtQC3dgokKdDG2mTm1tx4m50NUHBOZSBwQQHyy0V12A0JTG4icfZQH+xPyh8VA==" + }, + "matcher": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/matcher/-/matcher-2.1.0.tgz", + "integrity": "sha512-o+nZr+vtJtgPNklyeUKkkH42OsK8WAfdgaJE2FNxcjLPg+5QbeEoT6vRj8Xq/iv18JlQ9cmKsEu0b94ixWf1YQ==", + "optional": true, + "requires": { + "escape-string-regexp": "^2.0.0" + } + }, + "mime-db": { + "version": "1.42.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.42.0.tgz", + "integrity": "sha512-UbfJCR4UAVRNgMpfImz05smAXK7+c+ZntjaA26ANtkXLlOe947Aag5zdIcKQULAiF9Cq4WxBi9jUs5zkA84bYQ==" + }, + "mime-types": { + "version": "2.1.25", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.25.tgz", + "integrity": "sha512-5KhStqB5xpTAeGqKBAMgwaYMnQik7teQN4IAzC7npDv6kzeU6prfkR67bc87J1kWMPGkoaZSq1npmexMgkmEVg==", + "requires": { + "mime-db": "1.42.0" + } + }, + "mimic-response": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/mimic-response/-/mimic-response-2.0.0.tgz", + "integrity": "sha512-8ilDoEapqA4uQ3TwS0jakGONKXVJqpy+RpM+3b7pLdOjghCrEiGp9SRkFbUHAmZW9vdnrENWHjaweIoTIJExSQ==" + }, + "minimist": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz", + "integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=" + }, + "mkdirp": { + "version": "0.5.1", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", + "integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=", + "requires": { + "minimist": "0.0.8" + }, + "dependencies": { + "minimist": { + "version": "0.0.8", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz", + "integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=" + } + } + }, + "ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=" + }, + "nan": { + "version": "2.13.2", + "resolved": "https://registry.npmjs.org/nan/-/nan-2.13.2.tgz", + "integrity": "sha512-TghvYc72wlMGMVMluVo9WRJc0mB8KxxF/gZ4YYFy7V2ZQX9l7rgbPg7vjS9mt6U5HXODVFVI2bOduCzwOMv/lw==" + }, + "napi-build-utils": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/napi-build-utils/-/napi-build-utils-1.0.1.tgz", + "integrity": "sha512-boQj1WFgQH3v4clhu3mTNfP+vOBxorDlE8EKiMjUlLG3C4qAESnn9AxIOkFgTR2c9LtzNjPrjS60cT27ZKBhaA==" + }, + "node-abi": { + "version": "2.13.0", + "resolved": "https://registry.npmjs.org/node-abi/-/node-abi-2.13.0.tgz", + "integrity": "sha512-9HrZGFVTR5SOu3PZAnAY2hLO36aW1wmA+FDsVkr85BTST32TLCA1H/AEcatVRAsWLyXS3bqUDYCAjq5/QGuSTA==", + "requires": { + "semver": "^5.4.1" + } + }, + "noop-logger": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/noop-logger/-/noop-logger-0.1.1.tgz", + "integrity": "sha1-lKKxYzxPExdVMAfYlm/Q6EG2pMI=" + }, + "normalize-url": { + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/normalize-url/-/normalize-url-4.5.0.tgz", + "integrity": "sha512-2s47yzUxdexf1OhyRi4Em83iQk0aPvwTddtFz4hnSSw9dCEsLEGf6SwIO8ss/19S9iBb5sJaOuTvTGDeZI00BQ==" + }, + "npm-conf": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/npm-conf/-/npm-conf-1.1.3.tgz", + "integrity": "sha512-Yic4bZHJOt9RCFbRP3GgpqhScOY4HH3V2P8yBj6CeYq118Qr+BLXqT2JvpJ00mryLESpgOxf5XlFv4ZjXxLScw==", + "optional": true, + "requires": { + "config-chain": "^1.1.11", + "pify": "^3.0.0" + } + }, + "npmlog": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/npmlog/-/npmlog-4.1.2.tgz", + "integrity": "sha512-2uUqazuKlTaSI/dC8AzicUck7+IrEaOnN/e0jd3Xtt1KcGpwx30v50mL7oPyr/h9bL3E4aZccVwpwP+5W9Vjkg==", + "requires": { + "are-we-there-yet": "~1.1.2", + "console-control-strings": "~1.1.0", + "gauge": "~2.7.3", + "set-blocking": "~2.0.0" + } + }, + "number-is-nan": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/number-is-nan/-/number-is-nan-1.0.1.tgz", + "integrity": "sha1-CXtgK1NCKlIsGvuHkDGDNpQaAR0=" + }, + "oauth-sign": { + "version": "0.9.0", + "resolved": "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.9.0.tgz", + "integrity": "sha512-fexhUFFPTGV8ybAtSIGbV6gOkSv8UtRbDBnAyLQw4QPKkgNlsH2ByPGtMUqdWkos6YCRmAqViwgZrJc/mRDzZQ==" + }, + "object-assign": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", + "integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=" + }, + "object-keys": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/object-keys/-/object-keys-1.1.1.tgz", + "integrity": "sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA==", + "optional": true + }, + "once": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", + "requires": { + "wrappy": "1" + } + }, + "os": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/os/-/os-0.1.1.tgz", + "integrity": "sha1-IIhF6J4ZOtTZcUdLk5R3NqVtE/M=" + }, + "p-cancelable": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/p-cancelable/-/p-cancelable-1.1.0.tgz", + "integrity": "sha512-s73XxOZ4zpt1edZYZzvhqFa6uvQc1vwUa0K0BdtIZgQMAJj9IbebH+JkgKZc9h+B05PKHLOTl4ajG1BmNrVZlw==" + }, + "path": { + "version": "0.12.7", + "resolved": "https://registry.npmjs.org/path/-/path-0.12.7.tgz", + "integrity": "sha1-1NwqUGxM4hl+tIHr/NWzbAFAsQ8=", + "requires": { + "process": "^0.11.1", + "util": "^0.10.3" + } + }, + "pend": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/pend/-/pend-1.2.0.tgz", + "integrity": "sha1-elfrVQpng/kRUzH89GY9XI4AelA=" + }, + "performance-now": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/performance-now/-/performance-now-2.1.0.tgz", + "integrity": "sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns=" + }, + "pify": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/pify/-/pify-3.0.0.tgz", + "integrity": "sha1-5aSs0sEB/fPZpNB/DbxNtJ3SgXY=", + "optional": true + }, + "prebuild-install": { + "version": "5.3.3", + "resolved": "https://registry.npmjs.org/prebuild-install/-/prebuild-install-5.3.3.tgz", + "integrity": "sha512-GV+nsUXuPW2p8Zy7SarF/2W/oiK8bFQgJcncoJ0d7kRpekEA0ftChjfEaF9/Y+QJEc/wFR7RAEa8lYByuUIe2g==", + "requires": { + "detect-libc": "^1.0.3", + "expand-template": "^2.0.3", + "github-from-package": "0.0.0", + "minimist": "^1.2.0", + "mkdirp": "^0.5.1", + "napi-build-utils": "^1.0.1", + "node-abi": "^2.7.0", + "noop-logger": "^0.1.1", + "npmlog": "^4.0.1", + "pump": "^3.0.0", + "rc": "^1.2.7", + "simple-get": "^3.0.3", + "tar-fs": "^2.0.0", + "tunnel-agent": "^0.6.0", + "which-pm-runs": "^1.0.0" + } + }, + "prepend-http": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/prepend-http/-/prepend-http-2.0.0.tgz", + "integrity": "sha1-6SQ0v6XqjBn0HN/UAddBo8gZ2Jc=" + }, + "process": { + "version": "0.11.10", + "resolved": "https://registry.npmjs.org/process/-/process-0.11.10.tgz", + "integrity": "sha1-czIwDoQBYb2j5podHZGn1LwW8YI=" + }, + "process-nextick-args": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz", + "integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==" + }, + "proto-list": { + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/proto-list/-/proto-list-1.2.4.tgz", + "integrity": "sha1-IS1b/hMYMGpCD2QCuOJv85ZHqEk=", + "optional": true + }, + "psl": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/psl/-/psl-1.6.0.tgz", + "integrity": "sha512-SYKKmVel98NCOYXpkwUqZqh0ahZeeKfmisiLIcEZdsb+WbLv02g/dI5BUmZnIyOe7RzZtLax81nnb2HbvC2tzA==" + }, + "pump": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/pump/-/pump-3.0.0.tgz", + "integrity": "sha512-LwZy+p3SFs1Pytd/jYct4wpv49HiYCqd9Rlc5ZVdk0V+8Yzv6jR5Blk3TRmPL1ft69TxP0IMZGJ+WPFU2BFhww==", + "requires": { + "end-of-stream": "^1.1.0", + "once": "^1.3.1" + } + }, + "punycode": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz", + "integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==" + }, + "qs": { + "version": "6.5.2", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.5.2.tgz", + "integrity": "sha512-N5ZAX4/LxJmF+7wN74pUD6qAh9/wnvdQcjq9TZjevvXzSUo7bfmw91saqMjzGS2xq91/odN2dW/WOl7qQHNDGA==" + }, + "rc": { + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/rc/-/rc-1.2.8.tgz", + "integrity": "sha512-y3bGgqKj3QBdxLbLkomlohkvsA8gdAiUQlSBJnBhfn+BPxg4bc62d8TcBW15wavDfgexCgccckhcZvywyQYPOw==", + "requires": { + "deep-extend": "^0.6.0", + "ini": "~1.3.0", + "minimist": "^1.2.0", + "strip-json-comments": "~2.0.1" + } + }, + "readable-stream": { + "version": "2.3.6", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", + "integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==", + "requires": { + "core-util-is": "~1.0.0", + "inherits": "~2.0.3", + "isarray": "~1.0.0", + "process-nextick-args": "~2.0.0", + "safe-buffer": "~5.1.1", + "string_decoder": "~1.1.1", + "util-deprecate": "~1.0.1" + }, + "dependencies": { + "safe-buffer": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" + } + } + }, + "request": { + "version": "2.88.0", + "resolved": "https://registry.npmjs.org/request/-/request-2.88.0.tgz", + "integrity": "sha512-NAqBSrijGLZdM0WZNsInLJpkJokL72XYjUpnB0iwsRgxh7dB6COrHnTBNwN0E+lHDAJzu7kLAkDeY08z2/A0hg==", + "requires": { + "aws-sign2": "~0.7.0", + "aws4": "^1.8.0", + "caseless": "~0.12.0", + "combined-stream": "~1.0.6", + "extend": "~3.0.2", + "forever-agent": "~0.6.1", + "form-data": "~2.3.2", + "har-validator": "~5.1.0", + "http-signature": "~1.2.0", + "is-typedarray": "~1.0.0", + "isstream": "~0.1.2", + "json-stringify-safe": "~5.0.1", + "mime-types": "~2.1.19", + "oauth-sign": "~0.9.0", + "performance-now": "^2.1.0", + "qs": "~6.5.2", + "safe-buffer": "^5.1.2", + "tough-cookie": "~2.4.3", + "tunnel-agent": "^0.6.0", + "uuid": "^3.3.2" + } + }, + "responselike": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/responselike/-/responselike-1.0.2.tgz", + "integrity": "sha1-kYcg7ztjHFZCvgaPFa3lpG9Loec=", + "requires": { + "lowercase-keys": "^1.0.0" + } + }, + "roarr": { + "version": "2.14.6", + "resolved": "https://registry.npmjs.org/roarr/-/roarr-2.14.6.tgz", + "integrity": "sha512-qjbw0BEesKA+3XFBPt+KVe1PC/Z6ShfJ4wPlx2XifqH5h2Lj8/KQT5XJTsy3n1Es5kai+BwKALaECW3F70B1cg==", + "optional": true, + "requires": { + "boolean": "^3.0.0", + "detect-node": "^2.0.4", + "globalthis": "^1.0.0", + "json-stringify-safe": "^5.0.1", + "semver-compare": "^1.0.0", + "sprintf-js": "^1.1.2" + } + }, + "safe-buffer": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.0.tgz", + "integrity": "sha512-fZEwUGbVl7kouZs1jCdMLdt95hdIv0ZeHg6L7qPeciMZhZ+/gdesW4wgTARkrFWEpspjEATAzUGPG8N2jJiwbg==" + }, + "safer-buffer": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", + "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==" + }, + "sanitize-filename": { + "version": "1.6.3", + "resolved": "https://registry.npmjs.org/sanitize-filename/-/sanitize-filename-1.6.3.tgz", + "integrity": "sha512-y/52Mcy7aw3gRm7IrcGDFx/bCk4AhRh2eI9luHOQM86nZsqwiRkkq2GekHXBBD+SmPidc8i2PqtYZl+pWJ8Oeg==", + "requires": { + "truncate-utf8-bytes": "^1.0.0" + } + }, + "screen": { + "version": "0.2.10", + "resolved": "https://registry.npmjs.org/screen/-/screen-0.2.10.tgz", + "integrity": "sha1-xH6rPUinvQl8qmoPTmbS1s1aRh4=", + "requires": { + "xtend": "~1.0.3" + } + }, + "semver": { + "version": "5.7.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", + "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==" + }, + "semver-compare": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/semver-compare/-/semver-compare-1.0.0.tgz", + "integrity": "sha1-De4hahyUGrN+nvsXiPavxf9VN/w=", + "optional": true + }, + "serialize-error": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/serialize-error/-/serialize-error-5.0.0.tgz", + "integrity": "sha512-/VtpuyzYf82mHYTtI4QKtwHa79vAdU5OQpNPAmE/0UDdlGT0ZxHwC+J6gXkw29wwoVI8fMPsfcVHOwXtUQYYQA==", + "optional": true, + "requires": { + "type-fest": "^0.8.0" + } + }, + "set-blocking": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz", + "integrity": "sha1-BF+XgtARrppoA93TgrJDkrPYkPc=" + }, + "signal-exit": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.2.tgz", + "integrity": "sha1-tf3AjxKH6hF4Yo5BXiUTK3NkbG0=" + }, + "simple-concat": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/simple-concat/-/simple-concat-1.0.0.tgz", + "integrity": "sha1-c0TLuLbib7J9ZrL8hvn21Zl1IcY=" + }, + "simple-get": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/simple-get/-/simple-get-3.1.0.tgz", + "integrity": "sha512-bCR6cP+aTdScaQCnQKbPKtJOKDp/hj9EDLJo3Nw4y1QksqaovlW/bnptB6/c1e+qmNIDHRK+oXFDdEqBT8WzUA==", + "requires": { + "decompress-response": "^4.2.0", + "once": "^1.3.1", + "simple-concat": "^1.0.0" + } + }, + "sprintf-js": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.1.2.tgz", + "integrity": "sha512-VE0SOVEHCk7Qc8ulkWw3ntAzXuqf7S2lvwQaDLRnUeIEaKNQJzV6BwmLKhOqT61aGhfUMrXeaBk+oDGCzvhcug==", + "optional": true + }, + "sshpk": { + "version": "1.16.1", + "resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.16.1.tgz", + "integrity": "sha512-HXXqVUq7+pcKeLqqZj6mHFUMvXtOJt1uoUx09pFW6011inTMxqI8BA8PM95myrIyyKwdnzjdFjLiE6KBPVtJIg==", + "requires": { + "asn1": "~0.2.3", + "assert-plus": "^1.0.0", + "bcrypt-pbkdf": "^1.0.0", + "dashdash": "^1.12.0", + "ecc-jsbn": "~0.1.1", + "getpass": "^0.1.1", + "jsbn": "~0.1.0", + "safer-buffer": "^2.0.2", + "tweetnacl": "~0.14.0" + } + }, + "string-width": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz", + "integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=", + "requires": { + "code-point-at": "^1.0.0", + "is-fullwidth-code-point": "^1.0.0", + "strip-ansi": "^3.0.0" + } + }, + "string_decoder": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", + "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", + "requires": { + "safe-buffer": "~5.1.0" + }, + "dependencies": { + "safe-buffer": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" + } + } + }, + "strip-ansi": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", + "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", + "requires": { + "ansi-regex": "^2.0.0" + } + }, + "strip-json-comments": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-2.0.1.tgz", + "integrity": "sha1-PFMZQukIwml8DsNEhYwobHygpgo=" + }, + "sumchecker": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/sumchecker/-/sumchecker-3.0.1.tgz", + "integrity": "sha512-MvjXzkz/BOfyVDkG0oFOtBxHX2u3gKbMHIF/dXblZsgD3BWOFLmHovIpZY7BykJdAjcqRCBi1WYBNdEC9yI7vg==", + "requires": { + "debug": "^4.1.0" + }, + "dependencies": { + "debug": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz", + "integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==", + "requires": { + "ms": "^2.1.1" + } + }, + "ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" + } + } + }, + "tar-fs": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/tar-fs/-/tar-fs-2.0.0.tgz", + "integrity": "sha512-vaY0obB6Om/fso8a8vakQBzwholQ7v5+uy+tF3Ozvxv1KNezmVQAiWtcNmMHFSFPqL3dJA8ha6gdtFbfX9mcxA==", + "requires": { + "chownr": "^1.1.1", + "mkdirp": "^0.5.1", + "pump": "^3.0.0", + "tar-stream": "^2.0.0" + } + }, + "tar-stream": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/tar-stream/-/tar-stream-2.1.0.tgz", + "integrity": "sha512-+DAn4Nb4+gz6WZigRzKEZl1QuJVOLtAwwF+WUxy1fJ6X63CaGaUAxJRD2KEn1OMfcbCjySTYpNC6WmfQoIEOdw==", + "requires": { + "bl": "^3.0.0", + "end-of-stream": "^1.4.1", + "fs-constants": "^1.0.0", + "inherits": "^2.0.3", + "readable-stream": "^3.1.1" + }, + "dependencies": { + "readable-stream": { + "version": "3.4.0", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.4.0.tgz", + "integrity": "sha512-jItXPLmrSR8jmTRmRWJXCnGJsfy85mB3Wd/uINMXA65yrnFo0cPClFIUWzo2najVNSl+mx7/4W8ttlLWJe99pQ==", + "requires": { + "inherits": "^2.0.3", + "string_decoder": "^1.1.1", + "util-deprecate": "^1.0.1" + } + } + } + }, + "to-readable-stream": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/to-readable-stream/-/to-readable-stream-1.0.0.tgz", + "integrity": "sha512-Iq25XBt6zD5npPhlLVXGFN3/gyR2/qODcKNNyTMd4vbm39HUaOiAM4PMq0eMVC/Tkxz+Zjdsc55g9yyz+Yq00Q==" + }, + "tough-cookie": { + "version": "2.4.3", + "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.4.3.tgz", + "integrity": "sha512-Q5srk/4vDM54WJsJio3XNn6K2sCG+CQ8G5Wz6bZhRZoAe/+TxjWB/GlFAnYEbkYVlON9FMk/fE3h2RLpPXo4lQ==", + "requires": { + "psl": "^1.1.24", + "punycode": "^1.4.1" + }, + "dependencies": { + "punycode": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-1.4.1.tgz", + "integrity": "sha1-wNWmOycYgArY4esPpSachN1BhF4=" + } + } + }, + "truncate-utf8-bytes": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/truncate-utf8-bytes/-/truncate-utf8-bytes-1.0.2.tgz", + "integrity": "sha1-QFkjkJWS1W94pYGENLC3hInKXys=", + "requires": { + "utf8-byte-length": "^1.0.1" + } + }, + "tunnel": { + "version": "0.0.6", + "resolved": "https://registry.npmjs.org/tunnel/-/tunnel-0.0.6.tgz", + "integrity": "sha512-1h/Lnq9yajKY2PEbBadPXj3VxsDDu844OnaAo52UVmIzIvwwtBPIuNvkjuzBlTWpfJyUbG3ez0KSBibQkj4ojg==", + "optional": true + }, + "tunnel-agent": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz", + "integrity": "sha1-J6XeoGs2sEoKmWZ3SykIaPD8QP0=", + "requires": { + "safe-buffer": "^5.0.1" + } + }, + "tweetnacl": { + "version": "0.14.5", + "resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-0.14.5.tgz", + "integrity": "sha1-WuaBd/GS1EViadEIr6k/+HQ/T2Q=" + }, + "type-fest": { + "version": "0.8.1", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.8.1.tgz", + "integrity": "sha512-4dbzIzqvjtgiM5rw1k5rEHtBANKmdudhGyBEajN01fEyhaAIhsoKNy6y7+IN93IfpFtwY9iqi7kD+xwKhQsNJA==", + "optional": true + }, + "typedarray": { + "version": "0.0.6", + "resolved": "https://registry.npmjs.org/typedarray/-/typedarray-0.0.6.tgz", + "integrity": "sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c=" + }, + "universalify": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/universalify/-/universalify-0.1.2.tgz", + "integrity": "sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg==" + }, + "uri-js": { + "version": "4.2.2", + "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.2.2.tgz", + "integrity": "sha512-KY9Frmirql91X2Qgjry0Wd4Y+YTdrdZheS8TFwvkbLWf/G5KNJDCh6pKL5OZctEW4+0Baa5idK2ZQuELRwPznQ==", + "requires": { + "punycode": "^2.1.0" + } + }, + "url-parse-lax": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/url-parse-lax/-/url-parse-lax-3.0.0.tgz", + "integrity": "sha1-FrXK/Afb42dsGxmZF3gj1lA6yww=", + "requires": { + "prepend-http": "^2.0.0" + } + }, + "usb": { + "version": "1.6.2", + "resolved": "https://registry.npmjs.org/usb/-/usb-1.6.2.tgz", + "integrity": "sha512-KcovLXRQuH63iEtnqXyDQGOi5dXHpLM5lZBIUsqSJQToua8nL2sVCieQTkzQBfLe5mCuvk40MgKciI61lgevWw==", + "requires": { + "bindings": "^1.4.0", + "nan": "2.13.2", + "prebuild-install": "^5.3.3" + } + }, + "utf8-byte-length": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/utf8-byte-length/-/utf8-byte-length-1.0.4.tgz", + "integrity": "sha1-9F8VDExm7uloGGUFq5P8u4rWv2E=" + }, + "util": { + "version": "0.10.4", + "resolved": "https://registry.npmjs.org/util/-/util-0.10.4.tgz", + "integrity": "sha512-0Pm9hTQ3se5ll1XihRic3FDIku70C+iHUdT/W926rSgHV5QgXsYbKZN8MSC3tJtSkhuROzvsQjAaFENRXr+19A==", + "requires": { + "inherits": "2.0.3" + }, + "dependencies": { + "inherits": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", + "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=" + } + } + }, + "util-deprecate": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", + "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=" + }, + "uuid": { + "version": "3.3.3", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.3.3.tgz", + "integrity": "sha512-pW0No1RGHgzlpHJO1nsVrHKpOEIxkGg1xB+v0ZmdNH5OAeAwzAVrCnI2/6Mtx+Uys6iaylxa+D3g4j63IKKjSQ==" + }, + "verror": { + "version": "1.10.0", + "resolved": "https://registry.npmjs.org/verror/-/verror-1.10.0.tgz", + "integrity": "sha1-OhBcoXBTr1XW4nDB+CiGguGNpAA=", + "requires": { + "assert-plus": "^1.0.0", + "core-util-is": "1.0.2", + "extsprintf": "^1.2.0" + } + }, + "which-pm-runs": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/which-pm-runs/-/which-pm-runs-1.0.0.tgz", + "integrity": "sha1-Zws6+8VS4LVd9rd4DKdGFfI60cs=" + }, + "wide-align": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/wide-align/-/wide-align-1.1.3.tgz", + "integrity": "sha512-QGkOQc8XL6Bt5PwnsExKBPuMKBxnGxWWW3fU55Xt4feHozMUhdUMaBCk290qpm/wG5u/RSKzwdAC4i51YigihA==", + "requires": { + "string-width": "^1.0.2 || 2" + } + }, + "wrappy": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=" + }, + "xtend": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/xtend/-/xtend-1.0.3.tgz", + "integrity": "sha1-P12Tc1PM7Y4IU5mlY/2yJUHClgo=" + }, + "yauzl": { + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/yauzl/-/yauzl-2.4.1.tgz", + "integrity": "sha1-lSj0QtqxsihOWLQ3m7GU4i4MQAU=", + "requires": { + "fd-slicer": "~1.0.1" + } + } + } +} diff --git a/package.json b/package.json new file mode 100644 index 0000000..05b7792 --- /dev/null +++ b/package.json @@ -0,0 +1,22 @@ +{ + "name": "onesky_native", + "version": "1.0.0", + "description": "One Sky Native App", + "main": "index.js", + "scripts": { + "start": "electron . --disable-gpu", + "test": "echo \"Error: no test specified\" && exit 1" + }, + "author": "", + "license": "ISC", + "dependencies": { + "axios": "^0.19.0", + "electron": "^7.1.5", + "fs": "0.0.1-security", + "os": "^0.1.1", + "path": "^0.12.7", + "request": "^2.88.0", + "screen": "^0.2.10", + "usb": "^1.6.2" + } +} diff --git a/test.txt b/test.txt new file mode 100644 index 0000000..035720c --- /dev/null +++ b/test.txt @@ -0,0 +1 @@ +test.txt file