|
|
|
|
@@ -1,497 +0,0 @@
|
|
|
|
|
<!DOCTYPE html>
|
|
|
|
|
<html lang="en">
|
|
|
|
|
<head>
|
|
|
|
|
<meta charset="UTF-8">
|
|
|
|
|
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
|
|
|
|
|
|
|
|
|
<title>One Sky IT</title>
|
|
|
|
|
|
|
|
|
|
<link rel="shortcut icon" type="image/png" href="img/favicon.ico">
|
|
|
|
|
|
|
|
|
|
<!-- Cascading Style Sheets (CSS) start -->
|
|
|
|
|
<link rel="preconnect" href="https://fonts.gstatic.com">
|
|
|
|
|
|
|
|
|
|
<link href="https://fonts.googleapis.com/css2?family=Noto+Sans:ital,wght@0,400;0,700;1,400;1,700&display=swap" rel="stylesheet">
|
|
|
|
|
|
|
|
|
|
<link href="https://fonts.googleapis.com/css2?family=Roboto+Mono:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;1,100;1,200;1,300;1,400;1,500;1,600;1,700&display=swap" rel="stylesheet">
|
|
|
|
|
|
|
|
|
|
<!-- <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-1BmE4kWBq78iYhFldvKuhfTAU6auU8tT94WrHftjDbrCEXSU1oBoqyl2QvZ6jIW3" crossorigin="anonymous"> -->
|
|
|
|
|
|
|
|
|
|
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.4/css/all.min.css" integrity="sha512-1ycn6IcaQQ40/MKBW2W4Rhis/DbILU74C1vSrLJxCq57o941Ym01SwNsOMqvEBFlcgUa6xLiPY/NS5R+E6ztJQ==" crossorigin="anonymous" referrerpolicy="no-referrer" />
|
|
|
|
|
|
|
|
|
|
<!-- One Sky IT default custom Cascading Style Sheets (CSS) -->
|
|
|
|
|
|
|
|
|
|
<!-- One Sky IT site custom Cascading Style Sheets (CSS) -->
|
|
|
|
|
<link rel="stylesheet" href="css/native_app.css">
|
|
|
|
|
|
|
|
|
|
<style>
|
|
|
|
|
</style>
|
|
|
|
|
<!-- Cascading Style Sheets (CSS) end -->
|
|
|
|
|
|
|
|
|
|
<!-- JavaScript (JS) start -->
|
|
|
|
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/axios/0.22.0/axios.min.js" integrity="sha512-m2ssMAtdCEYGWXQ8hXVG4Q39uKYtbfaJL5QMTbhl2kc6vYyubrKHhr6aLLXW4ITeXSywQLn1AhsAaqrJl8Acfg==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
|
|
|
|
|
|
|
|
|
|
<script src="https://webrtc.github.io/adapter/adapter-latest.js"></script>
|
|
|
|
|
|
|
|
|
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/socket.io/4.2.0/socket.io.js" integrity="sha512-WL6WGKMPBiM9PnHRYIn5YEtq0Z8XP4fkVb4qy7PP4vhmYQErJ/dySyXuFIMDf1eEYCXCrQrMJfkNwKc9gsjTjA==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
|
|
|
|
|
|
|
|
|
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/dayjs/1.10.7/dayjs.min.js" integrity="sha512-bwD3VD/j6ypSSnyjuaURidZksoVx3L1RPvTkleC48SbHCZsemT3VKMD39KknPnH728LLXVMTisESIBOAb5/W0Q==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
|
|
|
|
|
|
|
|
|
|
<script src="https://cdn.rawgit.com/mozilla/localForage/master/dist/localforage.js"></script>
|
|
|
|
|
|
|
|
|
|
<!-- <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.bundle.min.js" integrity="sha384-ka7Sk0Gln4gmtz2MlQnikT1wXgYsOg+OMhuP+IlRH9sENBO0LRn5q+8nbTov4+1p" crossorigin="anonymous"></script> -->
|
|
|
|
|
|
|
|
|
|
<!-- JavaScript (JS) end -->
|
|
|
|
|
|
|
|
|
|
</head>
|
|
|
|
|
|
|
|
|
|
<body>
|
|
|
|
|
|
|
|
|
|
<main id="main_content" class="svelte_target event_launcher_main">
|
|
|
|
|
</main>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<!-- JavaScript (JS) start -->
|
|
|
|
|
<!--
|
|
|
|
|
Using node.js may require this: npm install jquery, add script below.
|
|
|
|
|
https://stackoverflow.com/questions/22658015/bootstrap-throws-uncaught-error-bootstraps-javascript-requires-jquery
|
|
|
|
|
-->
|
|
|
|
|
<!--
|
|
|
|
|
<script>
|
|
|
|
|
window.jQuery = window.$ = require('jquery');
|
|
|
|
|
</script>
|
|
|
|
|
-->
|
|
|
|
|
|
|
|
|
|
<!-- One Sky IT default custom JavaScript (JS) -->
|
|
|
|
|
|
|
|
|
|
<!-- One Sky IT site custom JavaScript (JS) -->
|
|
|
|
|
<script>const app = require('./js/module_app');</script>
|
|
|
|
|
<script src="js/app_api.js"></script>
|
|
|
|
|
<script src="js/app_idb.js"></script>
|
|
|
|
|
<script src="js/app_ui_misc.js"></script>
|
|
|
|
|
<script src="js/app_ui_sessions.js"></script>
|
|
|
|
|
<script src="js/app_ui_presentations.js"></script>
|
|
|
|
|
<script src="js/app_ui_presenters.js"></script>
|
|
|
|
|
<script src="js/app_ui_files.js"></script>
|
|
|
|
|
|
|
|
|
|
<script>
|
|
|
|
|
/* ***** **** *** ** * ### * ** *** **** ***** */
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let app_config = app.load_config();
|
|
|
|
|
let account_id = app_config.account_id;
|
|
|
|
|
let event_id = app_config.event_id;
|
|
|
|
|
let event_location_id = app_config.event_location_id;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* ***** **** *** ** * ### * ** *** **** ***** */
|
|
|
|
|
|
|
|
|
|
// BEGIN: Set display options
|
|
|
|
|
|
|
|
|
|
const display_menu_session_times = app_config.display_menu_session_times;
|
|
|
|
|
const display_session_codes = app_config.display_session_codes;
|
|
|
|
|
const display_session_badges = app_config.display_session_badges;
|
|
|
|
|
const display_presentation_codes = app_config.display_presentation_codes; // NOTE: not currently used
|
|
|
|
|
const display_presentation_badges = app_config.display_presentation_badges;
|
|
|
|
|
const display_presenter_codes = app_config.display_presenter_codes; // NOTE: not currently used
|
|
|
|
|
const display_presenter_badges = app_config.display_presenter_badges; // NOTE: not currently used
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// END: Set display options
|
|
|
|
|
|
|
|
|
|
/* ***** **** *** ** * ### * ** *** **** ***** */
|
|
|
|
|
|
|
|
|
|
// BEGIN: API section
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const api_token_loop_interval = app_config.api_token_loop_interval;
|
|
|
|
|
let api_update_period = app_config.idb_event_location_check_period;
|
|
|
|
|
let api_update_datetime = Date.now();
|
|
|
|
|
let waiting_on_api_token = false;
|
|
|
|
|
|
|
|
|
|
const api_secret_key = app_config.api_secret_key;
|
|
|
|
|
let api_temporary_token = null;
|
|
|
|
|
|
|
|
|
|
let api_base_url = null; // 'http://api.localhost:5001' 'https://api.oneskyit.com'
|
|
|
|
|
|
|
|
|
|
if (app_config.use_local_api) {
|
|
|
|
|
api_base_url = app_config.api_local_base_url; // 'http://api.localhost:5001'
|
|
|
|
|
} else {
|
|
|
|
|
api_base_url = app_config.api_remote_base_url; // 'https://api.oneskyit.com'
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
axios.defaults.baseURL = api_base_url;
|
|
|
|
|
axios.defaults.headers.post['Access-Control-Allow-Origin'] = app_config.access_control_allow_origin; // '*';
|
|
|
|
|
|
|
|
|
|
// Axios needs to authenticate first
|
|
|
|
|
let axios_headers_set = false;
|
|
|
|
|
|
|
|
|
|
let app_online = false;
|
|
|
|
|
//let app_use_cached_data = true;
|
|
|
|
|
window.addEventListener('online', app.currently_online);
|
|
|
|
|
window.addEventListener('offline', app.currently_offline);
|
|
|
|
|
|
|
|
|
|
var api_token_loop = setInterval(async function() {
|
|
|
|
|
//console.log('****************** LOOP: API Token Loop ******************');
|
|
|
|
|
|
|
|
|
|
if (app_online && api_update_datetime < Date.now()) {
|
|
|
|
|
//let api_temporary_token_result = api_token_request_async(axios, api_secret_key)
|
|
|
|
|
api_temporary_token = await api_token_request_async(axios, api_secret_key)
|
|
|
|
|
.then(function (result) {
|
|
|
|
|
if (result) {
|
|
|
|
|
console.log('Setting temporary API token to axios Authorization header: '+result);
|
|
|
|
|
axios.defaults.headers.common['Authorization'] = `Token ${result}`;
|
|
|
|
|
//api_temporary_token = result;
|
|
|
|
|
|
|
|
|
|
console.log('Axios headers have been set.');
|
|
|
|
|
axios_headers_set = true;
|
|
|
|
|
api_update_datetime = Date.now() + api_update_period;
|
|
|
|
|
return result;
|
|
|
|
|
} else {
|
|
|
|
|
console.log('The temporary API token appears to have failed. Are we actually online? Setting the app to offline mode.');
|
|
|
|
|
console.log(navigator.onLine);
|
|
|
|
|
app.currently_offline();
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
.catch(function (error) {
|
|
|
|
|
console.log('Something went wrong while trying to request a temporary API token.');
|
|
|
|
|
console.log(error);
|
|
|
|
|
return false;
|
|
|
|
|
});
|
|
|
|
|
} else if (app_online) {
|
|
|
|
|
//console.log('Currently online, but not asking for a new temporary token yet.');
|
|
|
|
|
} else {
|
|
|
|
|
console.log('Currently offline. Can not request a new temporary API token.');
|
|
|
|
|
}
|
|
|
|
|
}, api_token_loop_interval);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Placing this online status check after the api_token_loop just in case?
|
|
|
|
|
if (navigator.onLine) {
|
|
|
|
|
app.currently_online();
|
|
|
|
|
} else {
|
|
|
|
|
app.currently_offline();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// END: API section
|
|
|
|
|
|
|
|
|
|
/* ***** **** *** ** * ### * ** *** **** ***** */
|
|
|
|
|
|
|
|
|
|
// BEGIN: Load IDB section
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let idb_name = app_config.idb_name;
|
|
|
|
|
|
|
|
|
|
var tbl_event = null;
|
|
|
|
|
var tbl_event_location = null;
|
|
|
|
|
var tbl_event_session = null;
|
|
|
|
|
var tbl_event_presentation = null;
|
|
|
|
|
var tbl_event_presenter = null;
|
|
|
|
|
var tbl_event_file = null;
|
|
|
|
|
var tbl_hosted_file = null;
|
|
|
|
|
|
|
|
|
|
var tbl_event_key_count = null;
|
|
|
|
|
var tbl_event_location_key_count = null;
|
|
|
|
|
var tbl_event_session_key_count = null;
|
|
|
|
|
var tbl_event_presentation_key_count = null;
|
|
|
|
|
var tbl_event_presenter_key_count = null;
|
|
|
|
|
var tbl_event_file_key_count = null;
|
|
|
|
|
var tbl_hosted_file_key_count = null;
|
|
|
|
|
|
|
|
|
|
//const open_tables_loop_interval = 10; // only runs briefly on start up
|
|
|
|
|
|
|
|
|
|
const update_idb_loop_interval = app_config.update_idb_loop_interval; // loop forever
|
|
|
|
|
//const update_render_loop_interval = 10000; // loop forever; only run when the launcher object is safe
|
|
|
|
|
|
|
|
|
|
// IDB tables need to be opened
|
|
|
|
|
let idb_tables_opened = false;
|
|
|
|
|
|
|
|
|
|
// check periods and datetimes for update_idb_loop
|
|
|
|
|
let idb_event_check_period = app_config.idb_event_check_period;
|
|
|
|
|
let idb_event_check_datetime = Date.now();
|
|
|
|
|
let idb_event_location_check_period = app_config.idb_event_location_check_period;
|
|
|
|
|
let idb_event_location_check_datetime = Date.now();
|
|
|
|
|
let idb_event_session_check_period = app_config.idb_event_session_check_period;
|
|
|
|
|
let idb_event_session_check_datetime = Date.now();
|
|
|
|
|
let idb_event_presentation_check_period = app_config.idb_event_presentation_check_period;
|
|
|
|
|
let idb_event_presentation_check_datetime = Date.now();
|
|
|
|
|
let idb_event_presenter_check_period = app_config.idb_event_presenter_check_period;
|
|
|
|
|
let idb_event_presenter_check_datetime = Date.now();
|
|
|
|
|
let idb_event_file_check_period = app_config.idb_event_file_check_period;
|
|
|
|
|
let idb_event_file_check_datetime = Date.now();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//let run_update_idb = false;
|
|
|
|
|
let run_check_file_cache = false;
|
|
|
|
|
|
|
|
|
|
let looping_tbl_event = false;
|
|
|
|
|
let looping_tbl_event_location = false;
|
|
|
|
|
let looping_tbl_event_session = false;
|
|
|
|
|
let looping_tbl_event_presentation = false;
|
|
|
|
|
let looping_tbl_event_presenter = false;
|
|
|
|
|
let looping_tbl_event_file = false;
|
|
|
|
|
|
|
|
|
|
//let idb_tables_have_records = false;
|
|
|
|
|
|
|
|
|
|
if (window.indexedDB) {
|
|
|
|
|
console.log('IndexedDB is supported');
|
|
|
|
|
|
|
|
|
|
let load_idb_tables_result = load_idb_tables()
|
|
|
|
|
.then(async function (result) {
|
|
|
|
|
console.log('IDB tables have been opened');
|
|
|
|
|
idb_tables_opened = load_idb_tables_result;
|
|
|
|
|
|
|
|
|
|
console.log('Attempting to use cached IDB data...');
|
|
|
|
|
|
|
|
|
|
if (tbl_event_key_count
|
|
|
|
|
&& tbl_event_location_key_count
|
|
|
|
|
&& tbl_event_session_key_count
|
|
|
|
|
&& tbl_event_presentation_key_count
|
|
|
|
|
&& tbl_event_presenter_key_count
|
|
|
|
|
&& tbl_event_file_key_count) {
|
|
|
|
|
let render_event_records_result = render_event_records();
|
|
|
|
|
let render_event_location_records_result = render_event_location_records();
|
|
|
|
|
let render_event_session_records_result = render_event_session_records()
|
|
|
|
|
.then(async function (result) {
|
|
|
|
|
console.log('Rendering session records has finished. Moving to other records.');
|
|
|
|
|
console.log(result);
|
|
|
|
|
let render_event_presentation_records_result = await render_event_presentation_records();
|
|
|
|
|
let render_event_presenter_records_result = await render_event_presenter_records();
|
|
|
|
|
let render_event_file_records_result = await render_event_file_records();
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
})
|
|
|
|
|
.catch(function (error) {
|
|
|
|
|
console.log('Something went wrong rendering session records.');
|
|
|
|
|
console.log(error);
|
|
|
|
|
return false;
|
|
|
|
|
});
|
|
|
|
|
} else {
|
|
|
|
|
console.log('One or more of the IDB tables has 0 records. The IDB probably needs to be updated.');
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
.catch(function (error) {
|
|
|
|
|
console.log('Something went wrong opening the IDB tables.');
|
|
|
|
|
console.log(error);
|
|
|
|
|
return false;
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
console.log('IndexedDB is NOT supported');
|
|
|
|
|
close();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// END: Load IDB section
|
|
|
|
|
|
|
|
|
|
/* ***** **** *** ** * ### * ** *** **** ***** */
|
|
|
|
|
|
|
|
|
|
// BEGIN: Update IDB section
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var update_idb_loop = setInterval(async function() {
|
|
|
|
|
//console.log('****************** LOOP: Update IDB ******************');
|
|
|
|
|
|
|
|
|
|
if (app_online && axios_headers_set && idb_tables_opened) {
|
|
|
|
|
if (idb_event_check_datetime < Date.now()) {
|
|
|
|
|
console.log('**** *** ** * Time to check events * ** *** ****');
|
|
|
|
|
let v2_account_events = await v2_get_account_events(axios, account_id)
|
|
|
|
|
.then(function (response) {
|
|
|
|
|
for (var i in response) {
|
|
|
|
|
tbl_event.setItem(response[i].id.toString(), response[i]);
|
|
|
|
|
}
|
|
|
|
|
idb_event_check_datetime = Date.now() + idb_event_check_period;
|
|
|
|
|
let render_event_records_result = render_event_records(); // NOTE: v2 idb to ui
|
|
|
|
|
//update_event_ui = true;
|
|
|
|
|
})
|
|
|
|
|
.catch(function (error) {
|
|
|
|
|
console.log('Trying to check events. Something went wrong. Expired token?');
|
|
|
|
|
console.log(error);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (idb_event_location_check_datetime < Date.now()) {
|
|
|
|
|
console.log('**** *** ** * Time to check event locations * ** *** ****');
|
|
|
|
|
let v2_event_locations = await v2_get_event_locations(axios, event_id);
|
|
|
|
|
for (var i in v2_event_locations) {
|
|
|
|
|
tbl_event_location.setItem(v2_event_locations[i].id.toString(), v2_event_locations[i]);
|
|
|
|
|
}
|
|
|
|
|
idb_event_location_check_datetime = Date.now() + idb_event_location_check_period;
|
|
|
|
|
let render_event_location_records_result = render_event_location_records(); // NOTE: v2 idb to ui
|
|
|
|
|
//update_event_location_ui = true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (idb_event_session_check_datetime < Date.now()) {
|
|
|
|
|
console.log('**** *** ** * Time to check event sessions * ** *** ****'); // All event sessions, not just location specific.
|
|
|
|
|
let v2_event_sessions = await v2_get_event_sessions(axios, event_id); // Was v2_get_event_location_sessions
|
|
|
|
|
//tbl_event_session.clear();
|
|
|
|
|
for (var i in v2_event_sessions) {
|
|
|
|
|
tbl_event_session.setItem(v2_event_sessions[i].id.toString(), v2_event_sessions[i]);
|
|
|
|
|
}
|
|
|
|
|
idb_event_session_check_datetime = Date.now() + idb_event_session_check_period;
|
|
|
|
|
let render_event_session_records_result = render_event_session_records(); // NOTE: v2 idb to ui
|
|
|
|
|
//update_event_session_ui = true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (idb_event_presentation_check_datetime < Date.now()) {
|
|
|
|
|
console.log('**** *** ** * Time to check event location presentations * ** *** ****');
|
|
|
|
|
let v2_event_presentations = await v2_get_event_location_presentations(axios, event_location_id);
|
|
|
|
|
for (var i in v2_event_presentations) {
|
|
|
|
|
tbl_event_presentation.setItem(v2_event_presentations[i].id.toString(), v2_event_presentations[i]);
|
|
|
|
|
}
|
|
|
|
|
idb_event_presentation_check_datetime = Date.now() + idb_event_presentation_check_period;
|
|
|
|
|
let render_event_presentation_records_result = await render_event_presentation_records(); // NOTE: v2 idb to ui
|
|
|
|
|
//update_event_presentation_ui = true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (idb_event_presenter_check_datetime < Date.now()) {
|
|
|
|
|
console.log('**** *** ** * Time to check event location presenters * ** *** ****');
|
|
|
|
|
let v2_event_presenters = await v2_get_event_location_presenters(axios, event_location_id);
|
|
|
|
|
for (var i in v2_event_presenters) {
|
|
|
|
|
tbl_event_presenter.setItem(v2_event_presenters[i].id.toString(), v2_event_presenters[i]);
|
|
|
|
|
}
|
|
|
|
|
idb_event_presenter_check_datetime = Date.now() + idb_event_presenter_check_period;
|
|
|
|
|
|
|
|
|
|
let render_event_presenter_records_result = await render_event_presenter_records(); // NOTE: v2 idb to ui
|
|
|
|
|
//update_event_presenter_ui = true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (idb_event_file_check_datetime < Date.now()) {
|
|
|
|
|
console.log('**** *** ** * Time to check event location files * ** *** ****');
|
|
|
|
|
|
|
|
|
|
let v2_event_files = await v2_get_event_files(axios, event_id);
|
|
|
|
|
for (var i in v2_event_files) {
|
|
|
|
|
tbl_event_file.setItem(v2_event_files[i].id.toString(), v2_event_files[i]);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
let v2_event_location_files = await v2_get_event_location_files(axios, event_location_id);
|
|
|
|
|
for (var i in v2_event_location_files) {
|
|
|
|
|
tbl_event_file.setItem(v2_event_location_files[i].id.toString(), v2_event_location_files[i]);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
let v2_event_location_files_sessions = await v2_get_event_location_files_sessions(axios, event_location_id);
|
|
|
|
|
for (var i in v2_event_location_files_sessions) {
|
|
|
|
|
tbl_event_file.setItem(v2_event_location_files_sessions[i].id.toString(), v2_event_location_files_sessions[i]);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
let v2_event_location_files_presentations = await v2_get_event_location_files_presentations(axios, event_location_id);
|
|
|
|
|
for (var i in v2_event_location_files_presentations) {
|
|
|
|
|
tbl_event_file.setItem(v2_event_location_files_presentations[i].id.toString(), v2_event_location_files_presentations[i]);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
let v2_event_location_files_presenters = await v2_get_event_location_files_presenters(axios, event_location_id);
|
|
|
|
|
for (var i in v2_event_location_files_presenters) {
|
|
|
|
|
tbl_event_file.setItem(v2_event_location_files_presenters[i].id.toString(), v2_event_location_files_presenters[i]);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//run_check_file_cache = true; // Set to true so that the local file cache will be checked against the updated event files
|
|
|
|
|
idb_event_file_check_datetime = Date.now() + idb_event_file_check_period;
|
|
|
|
|
|
|
|
|
|
let render_event_file_records_result = await render_event_file_records(); // NOTE: v2 idb to ui
|
|
|
|
|
|
|
|
|
|
let check_file_cache_result = app.check_file_cache()
|
|
|
|
|
.then(function (result) {
|
|
|
|
|
if (result) {
|
|
|
|
|
console.log('Cached files have now been updated.');
|
|
|
|
|
} else {
|
|
|
|
|
console.log('Cached files were not updated.');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//update_event_file_ui = true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
} else if (app_online && idb_tables_opened && !axios_headers_set) {
|
|
|
|
|
console.log('Online and waiting for the Axios headers to be set.');
|
|
|
|
|
} else if (app_online && axios_headers_set && !idb_tables_opened) {
|
|
|
|
|
console.log('Online and Axios headers are set. Waiting for the IDB tables to be opened');
|
|
|
|
|
} else if (!app_online) {
|
|
|
|
|
console.log('Waiting to update IDB once online.');
|
|
|
|
|
} else {
|
|
|
|
|
console.log('This should not happen.');
|
|
|
|
|
}
|
|
|
|
|
}, update_idb_loop_interval);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// END: IDB section
|
|
|
|
|
|
|
|
|
|
/* ***** **** *** ** * ### * ** *** **** ***** */
|
|
|
|
|
|
|
|
|
|
// BEGIN: Cached file section
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const check_file_cache_loop_interval = app_config.check_file_cache_loop_interval; // loop forever; only run after the event_file table has updated
|
|
|
|
|
//const update_render_loop_interval = app_config.update_render_loop_interval; // loop forever
|
|
|
|
|
const host_file_cache_path = app_config.host_file_cache_path; // 'file_cache/'
|
|
|
|
|
|
|
|
|
|
var check_file_cache_loop = setInterval(async function() {
|
|
|
|
|
//console.log('****************** LOOP: Check File Cache ******************');
|
|
|
|
|
|
|
|
|
|
if (run_check_file_cache) {
|
|
|
|
|
console.log('FLAG: check_file_cache='+run_check_file_cache);
|
|
|
|
|
check_file_cache_result = app.check_file_cache();
|
|
|
|
|
|
|
|
|
|
check_file_cache_result.then(function (response) {
|
|
|
|
|
console.log('Cached files have now been updated.');
|
|
|
|
|
});
|
|
|
|
|
run_check_file_cache = false;
|
|
|
|
|
} else {
|
|
|
|
|
//console.log('Flag to run check_file_cache is set to false');
|
|
|
|
|
}
|
|
|
|
|
}, check_file_cache_loop_interval);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// END: Cached file section
|
|
|
|
|
|
|
|
|
|
/* ***** **** *** ** * ### * ** *** **** ***** */
|
|
|
|
|
|
|
|
|
|
// BEGIN: Check online status section
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// NOTE: This might be needed because the navigator.onLine status is not always correct.
|
|
|
|
|
var check_initial_online_status = setInterval(async function() {
|
|
|
|
|
//console.log('****************** LOOP: Check Online Status ******************');
|
|
|
|
|
//console.log('Secondary online status check?');
|
|
|
|
|
//console.log(navigator.onLine);
|
|
|
|
|
//clearInterval(check_initial_online_status);
|
|
|
|
|
/*
|
|
|
|
|
if (navigator.onLine) {
|
|
|
|
|
//app.currently_online();
|
|
|
|
|
} else {
|
|
|
|
|
//app.currently_offline();
|
|
|
|
|
}
|
|
|
|
|
*/
|
|
|
|
|
}, 3000);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// END: Check online status section
|
|
|
|
|
|
|
|
|
|
/* ***** **** *** ** * ### * ** *** **** ***** */
|
|
|
|
|
|
|
|
|
|
// BEGIN: Status clock section
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let status_clock = setInterval(function() {
|
|
|
|
|
//console.log('****************** LOOP: Status Clock ******************');
|
|
|
|
|
//https://date-fns.org/v1.30.1/docs/format
|
|
|
|
|
let datetime_string = dateFns.format(new Date(), 'dddd, Do h:mm:ss A'); //dddd, Do hh:mm:ss A
|
|
|
|
|
document.getElementById('app_datetime').innerHTML = datetime_string;
|
|
|
|
|
}, 1000);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// END: Status clock section
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<!-- <script src="js/test.js"></script>-->
|
|
|
|
|
<!-- JavaScript (JS) end -->
|
|
|
|
|
|
|
|
|
|
</body>
|
|
|
|
|
</html>
|