80 Commits

Author SHA1 Message Date
Scott Idem
fdbd12b64f First iteration of the conversion to use SvelteKit. 2024-08-14 19:26:39 -04:00
Scott Idem
54ae460da5 Unknown 2023-07-27 09:12:44 -04:00
9a7b2b4089 Clean up of code. Prep for simplify later. 2023-06-03 01:34:55 -04:00
5e04deab9c Clean up and simplify the initial loading. This needs more testing. 2023-06-03 01:09:16 -04:00
Scott Idem
99984e7b6c Making file check more efficent. 2023-05-26 18:50:52 -04:00
Scott Idem
fb02fc80a0 Making things easier. 2023-05-26 17:06:38 -04:00
Scott Idem
bc4bf6d294 Making things easier. 2023-05-26 15:20:32 -04:00
Scott Idem
29111e8dce Work on the config and setup 2023-05-24 22:16:26 -04:00
Scott Idem
a25978cf6f No longer using the macOS config path. 2023-05-14 16:03:12 -04:00
Scott Idem
6c7a81f915 Version bump 2023-05-14 15:05:04 -04:00
Scott Idem
9f9ad8b1bb More robust loading. General clean up 2023-05-14 15:03:27 -04:00
Scott Idem
75c5d289cf More robust loading 2023-05-14 14:56:17 -04:00
Scott Idem
4870a56dad Clean up of config 2023-04-24 21:27:45 -04:00
Scott Idem
86feb8517a Getting ready for BG 2023-04-24 18:46:40 -04:00
30b7a00229 Updates for native app to make it work again. Still some left to do. 2023-04-22 13:34:31 -04:00
Scott Idem
ff342fd9ea Updates to style paths and related 2022-11-29 16:47:29 -05:00
Scott Idem
ced234fa08 Clean up 2022-10-28 17:57:55 -04:00
Scott Idem
c37c87f6d4 Work on child processes with node.js 2022-10-27 12:56:19 -04:00
Scott Idem
cdae86dd86 Updated config file name. Cleaned up files. 2022-10-26 17:50:49 -04:00
Scott Idem
14cc3d1c3e Updated config file name 2022-10-26 17:34:26 -04:00
Scott Idem
a54d2c08bc Added screen media access request 2022-10-26 17:16:58 -04:00
Scott Idem
6e7dacc1e0 Improved dynamic loading of CSS and JS files! 2022-10-17 13:48:01 -04:00
Scott Idem
f3558dc75b Minor changes 2022-10-16 23:27:19 -04:00
Scott Idem
a83334aac7 Adding initial load options 2022-10-16 22:43:26 -04:00
Scott Idem
987642886c Adding initial load options 2022-10-16 22:38:07 -04:00
Scott Idem
fb75d450ac Prep for LCI 2022-10-16 22:37:40 -04:00
Scott Idem
0dce6c89c0 Prep for LCI 2022-10-16 20:07:30 -04:00
Scott Idem
0028df4604 Prep for LCI 2022-10-16 19:23:21 -04:00
Scott Idem
040ab4aa4e Rework of loading the index file. 2022-10-15 23:10:54 -04:00
Scott Idem
2d27750d0e Prep for LCI 2022-10-15 20:19:50 -04:00
Scott Idem
adca2e511b Testing 2022-10-14 17:53:39 -04:00
Scott Idem
eb53e46ebc A lot of clean up!!! 2022-10-14 17:22:14 -04:00
Scott Idem
3a4812de4c A lot of work on the launcher. Moving things from Electron node.js to Svelte. 2022-10-11 20:06:13 -04:00
31203648b4 Dont show dev tools 2022-05-31 11:45:58 -04:00
Scott Idem
e91907a884 Updated for CMSC 2022-05-30 22:40:50 -04:00
Scott Idem
7ac3f1fb16 Clean up 2022-05-25 16:00:53 -04:00
Scott Idem
556f4e66a5 Changed root URLs 2022-05-25 15:22:32 -04:00
Scott Idem
9094b28376 Work on launcher and getting device info 2022-05-25 14:08:56 -04:00
9b1fffe024 Modified index.html to not look for 5000 2022-05-10 12:13:31 -04:00
7745ac1ef0 Modified index.html to not look for 5000 2022-05-10 12:03:11 -04:00
ddda53d643 Modified index.html to not look for 5000 2022-05-10 11:54:10 -04:00
328cd1d51a Modified index.html to not look for 5000 2022-05-10 11:44:42 -04:00
Scott Idem
5105f42479 Update 2022-05-08 15:29:14 -04:00
Scott Idem
ab6a071986 Version update 2022-05-07 18:06:33 -04:00
Scott Idem
d762ec3b20 Version update 2022-05-07 18:05:12 -04:00
Scott Idem
2533410c78 Added kill check for Parallels Acrobat Reader 2022-05-07 17:58:27 -04:00
Scott Idem
60df29243c Sort of bug fix for pkill and process not found 2022-05-07 17:15:47 -04:00
Scott Idem
d67d0085ef Clean up 2022-05-07 16:53:52 -04:00
Scott Idem
8283a4b0f7 Clean up and added run any commands 2022-05-07 16:46:55 -04:00
Scott Idem
c97e84b0ef Bug fixes 2022-05-07 14:44:34 -04:00
Scott Idem
bc1a3b2cc5 Removed old files 2022-05-07 13:33:48 -04:00
Scott Idem
f706855b5b Removed old files 2022-05-07 13:31:51 -04:00
Scott Idem
38f5b39060 Added icons 2022-05-07 13:14:32 -04:00
Scott Idem
143a760128 Cleaned package.json 2022-05-07 12:37:46 -04:00
Scott Idem
976ca7e0c1 Added OSA script function 2022-05-07 12:25:26 -04:00
Scott Idem
491574a438 Added OSA script function. Changed version number 2022-05-07 12:14:10 -04:00
Scott Idem
abd0165164 Added macOS check to kill 2022-05-06 19:19:36 -04:00
Scott Idem
bf97d7acf1 Changed version number 2022-05-06 17:09:02 -04:00
Scott Idem
fd279a9635 Changed version number 2022-05-06 16:58:53 -04:00
Scott Idem
7b4f39760c Work on copy config if needed. 2022-05-06 16:56:12 -04:00
Scott Idem
31b278f238 Work on copy config if needed. 2022-05-06 16:37:35 -04:00
Scott Idem
01d2e214cb Work on copy config if needed. 2022-05-06 16:21:11 -04:00
Scott Idem
d2f0eaa1dc Work on copy config if needed. 2022-05-06 16:20:15 -04:00
Scott Idem
f565e0b421 Work on copy config if needed. 2022-05-06 16:19:39 -04:00
Scott Idem
b4d8dfa756 Work on copy config if needed. 2022-05-06 16:19:01 -04:00
Scott Idem
4bc1e8c4c9 Work on copy config if needed. 2022-05-06 16:08:54 -04:00
Scott Idem
2a56129336 Work on copy config if needed. 2022-05-06 16:01:08 -04:00
Scott Idem
f07aed2a02 Cleaned up loading config 2022-05-06 15:48:26 -04:00
Scott Idem
f6fab17e00 Fixed base URL variable names 2022-05-06 15:09:12 -04:00
Scott Idem
4c65d9dc42 Clean up of launcher and added new Node and Electron functions 2022-05-06 14:50:52 -04:00
Scott Idem
98bd835342 Clean up of launcher 2022-05-05 20:49:10 -04:00
6802eac1d9 Pointing to onsite server 2022-04-19 01:09:21 -04:00
0906248fd1 Pointing to onsite server 2022-04-19 01:07:33 -04:00
26b48c4fc1 Not showing dev tools by default. 2022-04-19 00:10:27 -04:00
1860f9c09e Clean up of installed modules. Removed usb, screen, and request. 2022-04-18 20:39:56 -04:00
0b7921f660 Updates 2022-04-18 20:26:34 -04:00
Scott Idem
8ec3eb0b6a Minor change 2022-04-17 16:12:14 -04:00
Scott Idem
42a119cf34 Bug fix downloading? 2022-04-16 20:05:35 -04:00
Scott Idem
6a788c11b4 Changing base URLs 2022-04-16 19:34:08 -04:00
Scott Idem
88d166a8d8 Changing base URLs 2022-04-16 19:31:59 -04:00
39 changed files with 5630 additions and 5465 deletions

9
.gitignore vendored
View File

@@ -8,7 +8,7 @@
*.sock *.sock
*.csv *.csv
*.xlsx *.xlsx
#*.pdf # *.pdf
*.cfg *.cfg
*.ini *.ini
*.bak *.bak
@@ -20,7 +20,8 @@ backups/
tmp/ tmp/
temp/ temp/
development/ development/
.vscode # .vscode
*.code-workspace # *.code-workspace
file_cache/ file_cache/
aether_native_app_config.json
# package-lock.json

View File

@@ -0,0 +1,8 @@
git clone https://scott_idem@bitbucket.org/oneskyit/one-sky-it-app-native.git ~/OSIT_dev/aether_app_native
cd ~/OSIT_dev/aether_app_native/
npm update
npm start
git branch
git checkout development

View File

@@ -1,49 +1,46 @@
{ {
"developer_tools": false,
"native_app_which_html": "default",
"native_app_index_path": "[home]/OSIT/native_app/app/index.html",
"native_app_index_url": "https://app.oneskyit.com/native/index.html",
"native_app_js_css_base_url": "https://demo.oneskyit.com",
"native_app_js_css_base_url_bak": "https://bak-demo.oneskyit.com",
"account_id": "", "account_id": "",
"event_id": "", "event_id": "",
"event_device_id": "", "event_device_id": "soon_to_be_required",
"event_location_id": "", "event_location_id": "",
"event_session_id": "", "event_session_id": "",
"api_secret_key": "XXXXXX", "account_code": "",
"api_remote_base_url": "https://dev-fastapi.oneskyit.com", "event_code": "",
"api_local_base_url": "http://dev-fastapi.oneskyit.local:5005", "event_device_code": "eventually_use_code",
"event_location_code": "",
"event_session_code": "",
"app_root_path": "[home]/OSIT/native_app",
"api_protocol": "https",
"api_server": "api.oneskyit.com",
"api_port": 443,
"api_path": "",
"api_secret_key": "ABCD1234XYZ",
"api_protocol_backup": "https",
"api_server_backup": "bak-api.oneskyit.com",
"api_port_backup": 443,
"api_path_backup": "",
"api_secret_key_backup": "ABCD1234XYZ",
"access_control_allow_origin": "*", "access_control_allow_origin": "*",
"use_local_api": true,
"use_local_db": false,
"idb_name": "osit", "idb_name": "osit",
"idb_event_check_period": 120000,
"idb_event_location_check_period": 90000,
"idb_event_session_check_period": 90000,
"idb_event_presentation_check_period": 90000,
"idb_event_presenter_check_period": 60000,
"idb_event_file_check_period": 30000,
"host_file_cache_path": "[home]/OSIT/file_cache", "local_file_cache_path": "[home]/OSIT/file_cache",
"host_file_cache_check_period": 30000,
"host_file_temp_path": "[home]/OSIT/temp", "host_file_temp_path": "[home]/OSIT/temp",
"main_loop_interval": 2000,
"api_token_loop_interval": 1000,
"api_update_period": 90000,
"api_auth_loop_interval": 100,
"api_token_update_loop_interval": 120000,
"open_tables_loop_interval": 10,
"update_idb_loop_interval": 10,
"idb_to_launcher_loop_interval": 250,
"update_render_loop_interval": 1000,
"check_file_cache_loop_interval": 250,
"display_menu_session_times": true,
"display_session_codes": true,
"display_session_badges": true,
"display_presentation_codes": true,
"display_presentation_badges": true,
"display_presenter_codes": true,
"display_presenter_badges": true,
"display_arrangement": "mirror_and_extend", "display_arrangement": "mirror_and_extend",
"display_builtin_resolution": "", "display_builtin_resolution": "",

View File

@@ -1,4 +0,0 @@
[Dolphin]
Timestamp=2020,1,24,15,51,19
Version=4
ViewMode=2

View File

@@ -3,8 +3,8 @@ body {
height: 100%; height: 100%;
max-height: 100%; */ max-height: 100%; */
margin: .1em; /* margin: .1em;
padding: .1em; padding: .1em; */
} }
section#Main-Body { section#Main-Body {
@@ -16,13 +16,13 @@ section#Main-Body {
} }
section#Main-Nav-Menu { section#Main-Nav-Menu {
min-height: 100%; /* min-height: 100%;
height: 100%; height: 100%;
max-height: 100%; max-height: 100%; */
} }
section#Main-Content { section#Main-Content {
min-height: 100%; /* min-height: 100%;
height: 100%; height: 100%;
max-height: 100%; max-height: 100%; */
} }

View File

Before

Width:  |  Height:  |  Size: 9.5 KiB

After

Width:  |  Height:  |  Size: 9.5 KiB

BIN
app/img/osit_logo_100.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.3 KiB

BIN
app/img/osit_logo_150.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.5 KiB

View File

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

View File

Before

Width:  |  Height:  |  Size: 41 KiB

After

Width:  |  Height:  |  Size: 41 KiB

View File

Before

Width:  |  Height:  |  Size: 6.9 KiB

After

Width:  |  Height:  |  Size: 6.9 KiB

View File

Before

Width:  |  Height:  |  Size: 17 KiB

After

Width:  |  Height:  |  Size: 17 KiB

View File

@@ -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>

47
app/index.bootstrap.html Normal file
View File

@@ -0,0 +1,47 @@
<!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's Aether App - External XXX</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 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" />
<!-- Cascading Style Sheets (CSS) end -->
<!-- JavaScript (JS) start -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/axios/1.1.3/axios.min.js" integrity="sha512-0qU9M9jfqPw6FKkPafM3gy2CBAvUWnYVOfNPDYKVuRTel1PrciTj+a9P3loJB+j0QmN2Y0JYQmkBBS8W+mbezg==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
<script src="https://webrtc.github.io/adapter/adapter-latest.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/socket.io/4.2.0/socket.io.js" integrity="sha512-WL6WGKMPBiM9PnHRYIn5YEtq0Z8XP4fkVb4qy7PP4vhmYQErJ/dySyXuFIMDf1eEYCXCrQrMJfkNwKc9gsjTjA==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/dayjs/1.10.7/dayjs.min.js" integrity="sha512-bwD3VD/j6ypSSnyjuaURidZksoVx3L1RPvTkleC48SbHCZsemT3VKMD39KknPnH728LLXVMTisESIBOAb5/W0Q==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/localforage/1.10.0/localforage.min.js" integrity="sha512-+BMamP0e7wn39JGL8nKAZ3yAQT2dL5oaXWr4ZYlTGkKOaoXM/Yj7c4oy50Ngz5yoUutAG17flueD4F6QpTlPng==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
<!-- JavaScript (JS) end -->
<script type="module">
import {check_and_copy_app_files} from 'https://dev-cmsc.oneskyit.com/srv/assets/js/init_bootstrap_app.js';
check_and_copy_app_files({overwrite: true});
</script>
<script src="script.js"></script>
<link rel="stylesheet" href="style.css">
<style>
</style>
</head>
<body id="Body-Container" class="body_container">
Loaded HTML
</body>
</html>

362
app/index.current.html Normal file
View File

@@ -0,0 +1,362 @@
<!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's Aether App - External</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 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" />
<!-- Cascading Style Sheets (CSS) end -->
<!-- JavaScript (JS) start -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/axios/1.1.3/axios.min.js" integrity="sha512-0qU9M9jfqPw6FKkPafM3gy2CBAvUWnYVOfNPDYKVuRTel1PrciTj+a9P3loJB+j0QmN2Y0JYQmkBBS8W+mbezg==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
<script src="https://webrtc.github.io/adapter/adapter-latest.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/socket.io/4.2.0/socket.io.js" integrity="sha512-WL6WGKMPBiM9PnHRYIn5YEtq0Z8XP4fkVb4qy7PP4vhmYQErJ/dySyXuFIMDf1eEYCXCrQrMJfkNwKc9gsjTjA==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/dayjs/1.10.7/dayjs.min.js" integrity="sha512-bwD3VD/j6ypSSnyjuaURidZksoVx3L1RPvTkleC48SbHCZsemT3VKMD39KknPnH728LLXVMTisESIBOAb5/W0Q==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/localforage/1.10.0/localforage.min.js" integrity="sha512-+BMamP0e7wn39JGL8nKAZ3yAQT2dL5oaXWr4ZYlTGkKOaoXM/Yj7c4oy50Ngz5yoUutAG17flueD4F6QpTlPng==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
<!-- JavaScript (JS) end -->
<script type="module">
import {check_for_native_app_update, check_and_copy_app_files, check_and_get_updated_native_app_config} from 'https://dev-cmsc.oneskyit.com/srv/assets/js/init_bootstrap_app.js';
check_for_native_app_update({overwrite: false});
check_and_copy_app_files({overwrite: true});
check_and_get_updated_native_app_config({overwrite: false})
// let native_app_config = load_init_config();
// console.log('Native App Initial Config:', native_app_config);
// const native_app = require('./script');
// let native_app_config = native_app.load_init_config();
// console.log('Native App Initial Config:', native_app_config);
//
// let native_app_js_css_base_url = native_app_config.native_app_js_css_base_url;
//
// document.aether = {
// name: 'Aether Native App (Electron and Svelte)'
// };
// document.write(`<link rel="stylesheet" href="${native_app_js_css_base_url}/static/css/ae_css_variables.css" />`);
</script>
<script>
const native_app = require('./script');
let native_app_config = native_app.load_init_config();
console.log('Native App Initial Config:', native_app_config);
// native_app_config = native_app.load_full_config(native_app_config);
// console.log('Native App Full Config:', native_app_config);
let native_app_js_css_base_url = native_app_config.native_app_js_css_base_url;
document.aether = {
name: 'Aether Native App (Electron and Svelte)'
};
function is_online(uri) {
let xhr = new XMLHttpRequest();
xhr.open('GET',uri,false);
try {
xhr.send(null);
} catch (error) {
console.error(error);
}
if(xhr.status == 200) {
//is online
return xhr.responseText;
}
else {
//is offline
return null;
}
}
if (is_online(native_app_config.native_app_js_css_base_url)) {
console.log(`Appears to be live: ${native_app_config.native_app_js_css_base_url}`);
} else if (native_app_config.native_app_js_css_base_url_bak) {
console.log(`Appears to be live: ${native_app_config.native_app_js_css_base_url_bak}`);
native_app_js_css_base_url = native_app_config.native_app_js_css_base_url_bak;
} else if (is_online('https://app.oneskyit.com')) {
console.log(`Appears to be live: https://app.oneskyit.com`);
native_app_js_css_base_url = 'https://app.oneskyit.com';
} else if (is_online('https://oneskyit.com')) {
console.log(`One Sky IT appears to be online`);
native_app_js_css_base_url = 'https://oneskyit.com';
} else if (is_online('https://google.com')) {
console.log(`Google appears to be online`);
native_app_js_css_base_url = 'https://google.com';
} else {
console.log('We are offline!');
}
// console.log(`One Sky IT appears to be online ${is_online('https://oneskyit.com')}`);
// console.log(`Google appears to be online ${is_online('https://google.com')}`);
// console.log(is_online('https://oneskyit.com'));
// console.log(is_online('https://cmsc.oneskyit.com'));
// console.log(is_online('https://dev-cmsc.oneskyit.com'));
// console.log(is_online('https://google.com'));
</script>
<!-- One Sky IT Cascading Style Sheets (CSS) -->
<script>document.write(`<link rel="stylesheet" href="${native_app_js_css_base_url}/static/css/ae_css_variables.css" />`);</script>
<script>document.write(`<link rel="stylesheet" href="${native_app_js_css_base_url}/static/css/ae_utilities.css" />`);</script>
<script>document.write(`<link rel="stylesheet" href="${native_app_js_css_base_url}/static/css/ae_shared_components.css" />`);</script>
<script>document.write(`<link rel="stylesheet" href="${native_app_js_css_base_url}/static/css/ae_core_modules_components.css" />`);</script>
<script>document.write(`<link rel="stylesheet" href="${native_app_js_css_base_url}/static/css/ae_layout_base.css" />`);</script>
<script>document.write(`<link rel="stylesheet" href="${native_app_js_css_base_url}/static/css/ae_layout_system.css" />`);</script>
<script>document.write(`<link rel="stylesheet" href="${native_app_js_css_base_url}/static/ae_app_core_bundle.css" />`);</script>
<script>document.write(`<link rel="stylesheet" href="${native_app_js_css_base_url}/static/ae_app_mods_bundle.css" />`);</script>
<script>document.write(`<link rel="stylesheet" href="${native_app_js_css_base_url}/static/ae_app_mod_events_bundle.css" />`);</script>
<script>document.write(`<link rel="stylesheet" href="${native_app_js_css_base_url}/static/css/ae_temp.css" />`);</script>
<script>document.write(`<link rel="stylesheet" href="${native_app_js_css_base_url}/static/css/event.css" />`);</script>
<script>document.write(`<link rel="stylesheet" href="${native_app_js_css_base_url}/static/css/event_launcher.css" />`);</script>
<link rel="stylesheet" href="style.css">
<style>
</style>
<script>
// BEGIN: Environment constants set by server when rendering HTML
// Environment options: development_local, development_remote, production_local, production_remote,
// END: Environment constants set by server when rendering HTML
// BEGIN: Content constants set by server when rendering HTML
// const page_for_id = {"event": native_app_config.event_id, "event_device": native_app_config.event_device_id, "event_location": native_app_config.event_location_id, "event_session": native_app_config.event_session_id}; // Simple key value like object
const page_for = {'event_id': native_app_config.event_id, 'event_device_id': native_app_config.event_device_id, 'event_location_id': native_app_config.event_location_id, 'event_session_id': native_app_config.event_session_id}; // Simple key value like object
console.log('Page For:', page_for);
// END: Content constants set by server when rendering HTML
// BEGIN: Client constants set by server when rendering HTML
const client_account_jwt = {}; // Future use
const client_person_jwt = {}; // Future use
const client_user_jwt = {}; // Future use
let client_account_id = native_app_config.account_id;
// console.log(client_account_id);
// END: Client constants set by server when rendering HTML
// BEGIN: Other constants set by server when rendering HTML
// END: Other constants set by server when rendering HTML
document.aether.cfg = {};
document.aether.cfg.app = { "name": "One Sky IT's Aether Native App DEV", "version": "3.5 DEV", "email": null, "env": null, "mode": "native", "local_file_cache_path": native_app_config.local_file_cache_path, "host_file_temp_path": native_app_config.host_file_temp_path };
document.aether.cfg.api = { "protocol": native_app_config.api_protocol, "server": native_app_config.api_server, "port": native_app_config.api_port, "path": native_app_config.api_path, "secret_key": native_app_config.api_secret_key, "base_url": null, "temporary_token": {"token": null, "expire_on": null}, "protocol_backup": native_app_config.api_protocol_backup, "server_backup": native_app_config.api_server_backup, "port_backup": native_app_config.api_port_backup, "path_backup": native_app_config.api_path_backup, "secret_key_backup": native_app_config.api_secret_key_backup, "base_url_backup": null, "temporary_token_backup": {"token": null, "expire_on": null} };
document.aether.cfg.idb = { "name": native_app_config.idb_name };
document.aether.client = { "account_id": native_app_config.account_id, "site_id": native_app_config.site_id, "site_domain_id": native_app_config.site_domain_id, "person_id": null, "user_id": null, "order_cart_id_random": null, "super_check": false, "manager_check": false, "administrator_check": false, "support_check": false, "assistant_check": false, "trusted_check": false, "verified_check": false, "provisional_check": false, "public_check": false, "user_check": false, "logged_in_check": false, "person_check": false, "authenticated_check": false, "anonymous_check": true, "person_group": null, "user_group": null, "orders_closed_count": 0, "order_count": 0, "app_mode": "native", "administrator_passcode": "11500", "trusted_passcode": "19111", "authenticated_passcode": "20902" };
let page = {}
page['mode'] = null;
// page['page_for_id'] = { 'event': native_app_config.event_id, 'event_device': native_app_config.event_device_id, 'event_location': native_app_config.event_location_id, 'event_session': native_app_config.event_session_id }; // Simple key value like object;
page['page_for'] = { 'event_id': native_app_config.event_id, 'event_device_id': native_app_config.event_device_id, 'event_location_id': native_app_config.event_location_id, 'event_session_id': native_app_config.event_session_id }; // Simple key value like object;
page['current_url_root'] = null;
page['current_url_full_path'] = null;
page['data'] = null; // Pre-populate the page data from the rendering server (Electron app).
page['mode'] = null; // For future use or in other contexts
page['params'] = null; // For future use or in other contexts
document.aether.page = page;
let aether = JSON.stringify(document.aether);
let aether_cfg = JSON.stringify(document.aether.cfg);
let aether_client = JSON.stringify(document.aether.client);
let aether_page = JSON.stringify(document.aether.page);
localStorage.setItem('ae_cfg', aether_cfg);
sessionStorage.setItem('ae', aether);
sessionStorage.setItem('ae_client', aether_client);
sessionStorage.setItem('ae_page', aether_page);
/* ***** **** *** ** * ### * ** *** **** ***** */
let app_online = false;
//let app_use_cached_data = true;
window.addEventListener('online', native_app.currently_online);
window.addEventListener('offline', native_app.currently_offline);
/* ***** **** *** ** * ### * ** *** **** ***** */
const ae_bridge = {
example_var: 'Example Default Value',
get example() {
return this.example_var;
},
set example(new_value) {
this.example_var = new_value;
this.example_var_listener(new_value);
this.example_var_core_listener(new_value);
this.example_var_mods_listener(new_value);
},
example_var_listener: function (new_value) {},
registerNewListener: function (external_listener_function) {
this.example_var_listener = external_listener_function;
},
example_var_core_listener: function (new_value) {},
registerNewCoreListener: function (external_core_listener_function) {
this.example_var_core_listener = external_core_listener_function;
},
example_var_mods_listener: function (new_value) {},
registerNewModsListener: function (external_mods_listener_function) {
this.example_var_mods_listener = external_mods_listener_function;
},
// Monitor change in Access Type
access_type_var: 'anonymous',
get access_type() {
return this.access_type_var;
},
set access_type(new_value) {
this.access_type_var = new_value;
this.access_type_var_core_listener(new_value);
this.access_type_var_mods_listener(new_value);
},
access_type_var_core_listener: function (new_value) {},
register_core_access_type_listener: function (external_core_listener_function) {
this.access_type_var_core_listener = external_core_listener_function;
},
access_type_var_mods_listener: function (new_value) {},
register_mods_access_type_listener: function (external_mods_listener_function) {
this.access_type_var_mods_listener = external_mods_listener_function;
},
// Monitor change in AE Common
ae_com_var: 'anonymous',
get ae_com() {
return this.ae_com_var;
},
set ae_com(new_value) {
this.ae_com_var = new_value;
this.ae_com_var_core_listener(new_value);
this.ae_com_var_mods_listener(new_value);
},
ae_com_var_core_listener: function (new_value) {},
register_core_ae_com_listener: function (external_core_listener_function) {
this.ae_com_var_core_listener = external_core_listener_function;
},
ae_com_var_mods_listener: function (new_value) {},
register_mods_ae_com_listener: function (external_mods_listener_function) {
this.ae_com_var_mods_listener = external_mods_listener_function;
},
// Monitor change in Client
client_var: 'anonymous',
get client() {
return this.client_var;
},
set client(new_value) {
this.client_var = new_value;
this.client_var_core_listener(new_value);
this.client_var_mods_listener(new_value);
},
client_var_core_listener: function (new_value) {},
register_core_client_listener: function (external_core_listener_function) {
this.client_var_core_listener = external_core_listener_function;
},
client_var_mods_listener: function (new_value) {},
register_mods_client_listener: function (external_mods_listener_function) {
this.client_var_mods_listener = external_mods_listener_function;
},
};
/* ***** **** *** ** * ### * ** *** **** ***** */
let svelte_ae_app_core_bundle_js = document.createElement('script');
svelte_ae_app_core_bundle_js.setAttribute('src', `${native_app_js_css_base_url}/static/ae_app_core_bundle.js`);
document.head.appendChild(svelte_ae_app_core_bundle_js);
let svelte_ae_app_mods_bundle_js = document.createElement('script');
svelte_ae_app_mods_bundle_js.setAttribute('src', `${native_app_js_css_base_url}/static/ae_app_mods_bundle.js`);
document.head.appendChild(svelte_ae_app_mods_bundle_js);
let svelte_ae_app_mod_events_bundle_js = document.createElement('script');
svelte_ae_app_mod_events_bundle_js.setAttribute('src', `${native_app_js_css_base_url}/static/ae_app_mod_events_bundle.js`);
document.head.appendChild(svelte_ae_app_mod_events_bundle_js);
</script>
<!-- <script>document.write(`<script src="${native_app_js_css_base_url}/static/svelte/build/bundle.js" crossorigin />`);</script> -->
<!-- JavaScript (JS) end -->
</head>
<body id="Body-Container" class="body_container">
<section id="System-Nav-Menu">Site-Nav-Menu</section>
<div id="Site-Container">
<section id="Site-Header">Site-Header</section>
<nav id="Site-Nav-Menu">Site-Nav-Menu</nav>
<section id="Notifications">
<section id="System-Notifications">System-Notifications (and Site-Notifications)</section><!-- and what would be Site-Notifications-->
</section>
<section id="Main-Body" class="main_template_content svelte_target event_launcher_main Side-Main-Nav-Menu">
<section id="Main-Nav-Menu"></section>
<main id="Main-Content"></main>
</section>
<section id="Site-Set-Access-Type" class="svelte_target set_access_type"></section>
<section id="Site-Footer">Site-Footer</section>
</div>
<section id="Site-Modals"></section>
<section id="System-Footer">Site-Footer</section>
<section id="System-Debug">System-Debug</section>
</body>
<!-- JavaScript (JS) start -->
<!-- <script>const app = require('./js/app_v3');</script> -->
<!-- <script src="js/app_v3.js"></script> -->
<script>
/* ***** **** *** ** * ### * ** *** **** ***** */
/* ***** **** *** ** * ### * ** *** **** ***** */
</script>
<!-- JavaScript (JS) end -->
</html>

View File

@@ -10,200 +10,270 @@
<!-- Cascading Style Sheets (CSS) start --> <!-- Cascading Style Sheets (CSS) start -->
<link rel="preconnect" href="https://fonts.gstatic.com"> <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=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://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 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" /> <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="http://dev.oneskyit.local:5000/static/css/aether_variables.css">
<link rel="stylesheet" href="http://dev.oneskyit.local:5000/static/svelte/build/aether_utilities.css">
<link rel="stylesheet" href="http://dev.oneskyit.local:5000/static/css/aether_system.css">
<!-- <link rel="stylesheet" href="svelte/build/aether_layout.css"> -->
<!-- <link rel="stylesheet" href="css/aether_layout_flow.css"> -->
<!-- <link rel="stylesheet" href="css/aether_layout_grid.css"> -->
<link rel="stylesheet" href="http://dev.oneskyit.local:5000/static/svelte/build/aether_modules_core.css">
<!-- <link rel="stylesheet" href="http://dev.oneskyit.local:5000/static/svelte/build/aether_modules_other.css"> -->
<link href="http://dev.oneskyit.local:5000/static/svelte/build/bundle.css" rel="stylesheet">
<link href="http://dev.oneskyit.local:5000/static/svelte/build/reloading.css" rel="stylesheet">
<link href="http://dev.oneskyit.local:5000/static/css/base_style_grid_layout_v3.css" rel="stylesheet">
<link href="http://dev.oneskyit.local:5000/static/css/base_style_grid_theme_v3.css" rel="stylesheet">
<link href="http://dev.oneskyit.local:5000/static/svelte/build/event_launcher.css" rel="stylesheet">
<link rel="stylesheet" href="css/aether_native_app_v3.css">
<style>
</style>
<!-- Cascading Style Sheets (CSS) end --> <!-- Cascading Style Sheets (CSS) end -->
<!-- JavaScript (JS) start --> <!-- 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://cdnjs.cloudflare.com/ajax/libs/axios/1.1.3/axios.min.js" integrity="sha512-0qU9M9jfqPw6FKkPafM3gy2CBAvUWnYVOfNPDYKVuRTel1PrciTj+a9P3loJB+j0QmN2Y0JYQmkBBS8W+mbezg==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
<script src="https://webrtc.github.io/adapter/adapter-latest.js"></script> <script src="https://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/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://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://cdnjs.cloudflare.com/ajax/libs/localforage/1.10.0/localforage.min.js" integrity="sha512-+BMamP0e7wn39JGL8nKAZ3yAQT2dL5oaXWr4ZYlTGkKOaoXM/Yj7c4oy50Ngz5yoUutAG17flueD4F6QpTlPng==" crossorigin="anonymous" referrerpolicy="no-referrer"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/localforage/1.10.0/localforage.min.js" integrity="sha512-+BMamP0e7wn39JGL8nKAZ3yAQT2dL5oaXWr4ZYlTGkKOaoXM/Yj7c4oy50Ngz5yoUutAG17flueD4F6QpTlPng==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
<!-- JavaScript (JS) end -->
<script src="https://static.oneskyit.com/js/utilities.js"></script>
<!-- <script src="js/app_idb.js"></script> -->
<script> <script>
const app = require('./js/aether_native_app_v3'); const native_app = require('./js/aether_app_native_v4');
let app_config = app.load_config(); let native_app_config = native_app.load_init_config();
console.log(app_config); console.log('Native App Initial Config:', native_app_config);
const flask_env = 'development'; // 'development', 'production' // native_app_config = native_app.load_full_config(native_app_config);
const env = 'development'; // 'development', 'production' // console.log('Native App Full Config:', native_app_config);
const app_env = 'development_local'; // 'development_local', 'development_remote'
const api_env = 'development_local'; // 'development_local', 'development_remote'
const app_mode = 'app'; // null, 'default', 'onsite', 'app'
let client_account_id = app_config.account_id; let native_app_js_css_base_url = native_app_config.native_app_js_css_base_url;
document.aether = {
name: 'Aether Native App (Electron and Svelte)'
};
</script>
<!-- One Sky IT Cascading Style Sheets (CSS) -->
<script>document.write(`<link rel="stylesheet" href="${native_app_js_css_base_url}/static/css/ae_css_variables.css" />`);</script>
<script>document.write(`<link rel="stylesheet" href="${native_app_js_css_base_url}/static/css/ae_utilities.css" />`);</script>
<script>document.write(`<link rel="stylesheet" href="${native_app_js_css_base_url}/static/css/ae_shared_components.css" />`);</script>
<script>document.write(`<link rel="stylesheet" href="${native_app_js_css_base_url}/static/css/ae_core_modules_components.css" />`);</script>
<script>document.write(`<link rel="stylesheet" href="${native_app_js_css_base_url}/static/css/ae_layout_base.css" />`);</script>
<script>document.write(`<link rel="stylesheet" href="${native_app_js_css_base_url}/static/css/ae_layout_system.css" />`);</script>
<script>document.write(`<link rel="stylesheet" href="${native_app_js_css_base_url}/static/ae_app_core_bundle.css" />`);</script>
<script>document.write(`<link rel="stylesheet" href="${native_app_js_css_base_url}/static/ae_app_mods_bundle.css" />`);</script>
<script>document.write(`<link rel="stylesheet" href="${native_app_js_css_base_url}/static/ae_app_mod_events_bundle.css" />`);</script>
<script>document.write(`<link rel="stylesheet" href="${native_app_js_css_base_url}/static/css/ae_temp.css" />`);</script>
<script>document.write(`<link rel="stylesheet" href="${native_app_js_css_base_url}/static/css/event.css" />`);</script>
<script>document.write(`<link rel="stylesheet" href="${native_app_js_css_base_url}/static/css/event_launcher.css" />`);</script>
<link rel="stylesheet" href="css/aether_app_native_v3.css">
<style>
</style>
<script>
// BEGIN: Environment constants set by server when rendering HTML
// Environment options: development_local, development_remote, production_local, production_remote,
// END: Environment constants set by server when rendering HTML
// BEGIN: Content constants set by server when rendering HTML
// const page_for_id = {"event": native_app_config.event_id, "event_device": native_app_config.event_device_id, "event_location": native_app_config.event_location_id, "event_session": native_app_config.event_session_id}; // Simple key value like object
const page_for = {'event_id': native_app_config.event_id, 'event_device_id': native_app_config.event_device_id, 'event_location_id': native_app_config.event_location_id, 'event_session_id': native_app_config.event_session_id}; // Simple key value like object
console.log('Page For:', page_for);
// END: Content constants set by server when rendering HTML
// BEGIN: Client constants set by server when rendering HTML
const client_account_jwt = {}; // Future use
const client_person_jwt = {}; // Future use
const client_user_jwt = {}; // Future use
let client_account_id = native_app_config.account_id;
console.log(client_account_id); console.log(client_account_id);
let event_id = app_config.event_id;
let event_device_id = app_config.event_device_id;
let event_location_id = app_config.event_location_id;
const page_for = { 'event': event_id, 'event_device': event_device_id, 'event_location': event_location_id }; // Simple key value like object // END: Client constants set by server when rendering HTML
console.log(page_for);
const host_file_cache_path = app_config.host_file_cache_path; // 'file_cache/' // BEGIN: Other constants set by server when rendering HTML
// console.log(host_file_cache_path); // END: Other constants set by server when rendering HTML
const host_file_temp_path = app_config.host_file_temp_path; // 'temp/'
// console.log(host_file_temp_path);
let idb_name = app_config.idb_name;
// BEGIN: API section document.aether.cfg = {};
document.aether.cfg.app = { "name": "One Sky IT's Aether Native App DEV", "version": "3.5 DEV", "email": null, "env": null, "mode": "native", "local_file_cache_path": native_app_config.local_file_cache_path, "host_file_temp_path": native_app_config.host_file_temp_path };
document.aether.cfg.api = { "protocol": native_app_config.api_protocol, "server": native_app_config.api_server, "port": native_app_config.api_port, "path": native_app_config.api_path, "secret_key": native_app_config.api_secret_key, "base_url": null, "temporary_token": {"token": null, "expire_on": null}, "protocol_backup": native_app_config.api_protocol_backup, "server_backup": native_app_config.api_server_backup, "port_backup": native_app_config.api_port_backup, "path_backup": native_app_config.api_path_backup, "secret_key_backup": native_app_config.api_secret_key_backup, "base_url_backup": null, "temporary_token_backup": {"token": null, "expire_on": null} };
document.aether.cfg.idb = { "name": native_app_config.idb_name };
const access_control_allow_origin = app_config.access_control_allow_origin;
const api_secret_key = app_config.api_secret_key;
console.log(api_secret_key);
let api_temporary_token = null;
let api_base_url = null; document.aether.client = { "account_id": native_app_config.account_id, "site_id": native_app_config.site_id, "site_domain_id": native_app_config.site_domain_id, "person_id": null, "user_id": null, "order_cart_id_random": null, "super_check": false, "manager_check": false, "administrator_check": false, "support_check": false, "assistant_check": false, "trusted_check": false, "verified_check": false, "provisional_check": false, "public_check": false, "user_check": false, "logged_in_check": false, "person_check": false, "authenticated_check": false, "anonymous_check": true, "person_group": null, "user_group": null, "orders_closed_count": 0, "order_count": 0, "app_mode": "native" };
if (app_config.use_local_api) {
api_base_url = app_config.api_local_base_url; // 'http://api.localhost:5001' let page = {}
} else { page['mode'] = null;
api_base_url = app_config.api_remote_base_url; // 'https://api.oneskyit.com' // page['page_for_id'] = { 'event': native_app_config.event_id, 'event_device': native_app_config.event_device_id, 'event_location': native_app_config.event_location_id, 'event_session': native_app_config.event_session_id }; // Simple key value like object;
} page['page_for'] = { 'event_id': native_app_config.event_id, 'event_device_id': native_app_config.event_device_id, 'event_location_id': native_app_config.event_location_id, 'event_session_id': native_app_config.event_session_id }; // Simple key value like object;
page['current_url_root'] = null;
page['current_url_full_path'] = null;
page['data'] = null; // Pre-populate the page data from the rendering server (Electron app).
page['mode'] = null; // For future use or in other contexts
page['params'] = null; // For future use or in other contexts
document.aether.page = page;
/* ***** **** *** ** * ### * ** *** **** ***** */ /* ***** **** *** ** * ### * ** *** **** ***** */
let app_online = false; let app_online = false;
//let app_use_cached_data = true; //let app_use_cached_data = true;
window.addEventListener('online', app.currently_online); window.addEventListener('online', native_app.currently_online);
window.addEventListener('offline', app.currently_offline); window.addEventListener('offline', native_app.currently_offline);
/* ***** **** *** ** * ### * ** *** **** ***** */ /* ***** **** *** ** * ### * ** *** **** ***** */
const ae_bridge = {
example_var: 'Example Default Value',
get example() {
return this.example_var;
},
set example(new_value) {
this.example_var = new_value;
this.example_var_listener(new_value);
this.example_var_core_listener(new_value);
this.example_var_mods_listener(new_value);
},
example_var_listener: function (new_value) {},
registerNewListener: function (external_listener_function) {
this.example_var_listener = external_listener_function;
},
example_var_core_listener: function (new_value) {},
registerNewCoreListener: function (external_core_listener_function) {
this.example_var_core_listener = external_core_listener_function;
},
example_var_mods_listener: function (new_value) {},
registerNewModsListener: function (external_mods_listener_function) {
this.example_var_mods_listener = external_mods_listener_function;
},
// Monitor change in Access Type
access_type_var: 'anonymous',
get access_type() {
return this.access_type_var;
},
set access_type(new_value) {
this.access_type_var = new_value;
this.access_type_var_core_listener(new_value);
this.access_type_var_mods_listener(new_value);
},
access_type_var_core_listener: function (new_value) {},
register_core_access_type_listener: function (external_core_listener_function) {
this.access_type_var_core_listener = external_core_listener_function;
},
access_type_var_mods_listener: function (new_value) {},
register_mods_access_type_listener: function (external_mods_listener_function) {
this.access_type_var_mods_listener = external_mods_listener_function;
},
// Monitor change in AE Common
ae_com_var: 'anonymous',
get ae_com() {
return this.ae_com_var;
},
set ae_com(new_value) {
this.ae_com_var = new_value;
this.ae_com_var_core_listener(new_value);
this.ae_com_var_mods_listener(new_value);
},
ae_com_var_core_listener: function (new_value) {},
register_core_ae_com_listener: function (external_core_listener_function) {
this.ae_com_var_core_listener = external_core_listener_function;
},
ae_com_var_mods_listener: function (new_value) {},
register_mods_ae_com_listener: function (external_mods_listener_function) {
this.ae_com_var_mods_listener = external_mods_listener_function;
},
// Monitor change in Client
client_var: 'anonymous',
get client() {
return this.client_var;
},
set client(new_value) {
this.client_var = new_value;
this.client_var_core_listener(new_value);
this.client_var_mods_listener(new_value);
},
client_var_core_listener: function (new_value) {},
register_core_client_listener: function (external_core_listener_function) {
this.client_var_core_listener = external_core_listener_function;
},
client_var_mods_listener: function (new_value) {},
register_mods_client_listener: function (external_mods_listener_function) {
this.client_var_mods_listener = external_mods_listener_function;
},
};
/* ***** **** *** ** * ### * ** *** **** ***** */
let svelte_ae_app_core_bundle_js = document.createElement('script');
svelte_ae_app_core_bundle_js.setAttribute('src', `${native_app_js_css_base_url}/static/ae_app_core_bundle.js`);
document.head.appendChild(svelte_ae_app_core_bundle_js);
let svelte_ae_app_mods_bundle_js = document.createElement('script');
svelte_ae_app_mods_bundle_js.setAttribute('src', `${native_app_js_css_base_url}/static/ae_app_mods_bundle.js`);
document.head.appendChild(svelte_ae_app_mods_bundle_js);
let svelte_ae_app_mod_events_bundle_js = document.createElement('script');
svelte_ae_app_mod_events_bundle_js.setAttribute('src', `${native_app_js_css_base_url}/static/ae_app_mod_events_bundle.js`);
document.head.appendChild(svelte_ae_app_mod_events_bundle_js);
</script> </script>
<!-- <script defer src="svelte/build/bundle.js" crossorigin></script> --> <!-- <script>document.write(`<script src="${native_app_js_css_base_url}/static/svelte/build/bundle.js" crossorigin />`);</script> -->
<script defer src="http://dev.oneskyit.local:5000/static/svelte/build/bundle.js" crossorigin></script>
<!-- JavaScript (JS) end -->
<!-- JavaScript (JS) end -->
</head> </head>
<body class="body_container"> <body id="Body-Container" class="body_container">
<section id="System-Nav-Menu">Site-Nav-Menu</section> <section id="System-Nav-Menu">Site-Nav-Menu</section>
<section id="Site-Header">Site-Header</section>
<section id="Site-Nav-Menu">Site-Nav-Menu</section>
<section id="System-Notifications">System-Notifications (and Site-Notifications)</section><!-- and what would be Site-Notifications--> <div id="Site-Container">
<section id="Main-Body" class="main_template_content svelte_target event_launcher_main"> <section id="Site-Header">Site-Header</section>
</section>
<nav id="Site-Nav-Menu">Site-Nav-Menu</nav>
<section id="Notifications">
<section id="System-Notifications">System-Notifications (and Site-Notifications)</section><!-- and what would be Site-Notifications-->
</section>
<section id="Main-Body" class="main_template_content svelte_target event_launcher_main Side-Main-Nav-Menu">
<section id="Main-Nav-Menu"></section>
<main id="Main-Content"></main>
</section>
<section id="Site-Footer">Site-Footer</section>
</div>
<section id="Site-Modals"></section>
<section id="Site-Footer">Site-Footer</section>
<section id="System-Footer">Site-Footer</section> <section id="System-Footer">Site-Footer</section>
<section id="System-Debug">System-Debug</section> <section id="System-Debug">System-Debug</section>
</body> </body>
<!-- JavaScript (JS) start --> <!-- JavaScript (JS) start -->
<!-- One Sky IT default custom JavaScript (JS) -->
<!-- One Sky IT site custom JavaScript (JS) -->
<!-- <script>const app = require('./js/app_v3');</script> --> <!-- <script>const app = require('./js/app_v3');</script> -->
<!-- <script src="js/app_v3.js"></script> --> <!-- <script src="js/app_v3.js"></script> -->
<script> <script>
/* ***** **** *** ** * ### * ** *** **** ***** */ /* ***** **** *** ** * ### * ** *** **** ***** */
// BEGIN: Load IDB section
// let idb_name = app_config.idb_name;
// let tbl_event = null;
// let tbl_event_location = null;
// let tbl_event_session = null;
// let tbl_event_presentation = null;
// let tbl_event_presenter = null;
// let tbl_event_file = null;
// let tbl_hosted_file = null;
// let tbl_event_key_count = null;
// let tbl_event_location_key_count = null;
// let tbl_event_session_key_count = null;
// let tbl_event_presentation_key_count = null;
// let tbl_event_presenter_key_count = null;
// let tbl_event_file_key_count = null;
// let tbl_hosted_file_key_count = null;
// 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) {
// console.log('********* Not yet sure how this works... ');
// } else {
// console.log('One or more of the IDB tables has 0 records. The IDB probably needs to be updated.');
// return true;
// }
// console.log(tbl_event);
// console.log(tbl_event_location);
// console.log(tbl_event_session);
// console.log(tbl_event_presentation);
// console.log(tbl_event_presenter);
// console.log(tbl_event_file);
// console.log(tbl_hosted_file);
// })
// .catch(function (error) {
// console.log('Something went wrong opening the IDB tables.');
// console.log(error);
// return false;
// });
/* ***** **** *** ** * ### * ** *** **** ***** */ /* ***** **** *** ** * ### * ** *** **** ***** */
</script> </script>
<!-- JavaScript (JS) end -->
</html> </html>

View File

@@ -0,0 +1,632 @@
'use strict';
const os = require('os');
const path = require('path');
const fs = require('fs');
const fs_promises = require('node:fs/promises');
const child_process = require('child_process');
const { ipcRenderer } = require('electron');
// import psList from 'ps-list';
// const ps_list = require('ps-list');
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;
exports.load_config = function () {
console.log('*** Electron framework: load_config() ***');
let cwd = process.cwd();
console.log(`CWD: ${cwd}`);
try {
if (cwd == '/') {
cwd = home_directory;
}
console.log('Reading directory...');
let directory_list = fs_promises.readdir(cwd).then(function (read_dir_result) {
console.log('Got contents:');
for (let file of read_dir_result) {
console.log(file);
}
});
} catch (err) {
console.error(err);
}
// 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 default_config_path = 'config.json.default';
console.log(default_config_path);
let config_path = null;
// Set the config path for macOS or Linux
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);
}
// Look for the config file and copy the default if not found.
if (fs.existsSync(config_directory)) {
console.log('Config directory found: '+config_directory);
} 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);
}
config_path = path.join(config_directory, 'config.json');
// Attempt to open the config file. The preferred location is based on the OS's config directory.
if (fs.existsSync(config_path)) {
console.log(`Config file (config.json) found under ${config_directory}`);
} else if (!fs.existsSync(config_path) && fs.existsSync(default_config_path)) {
fs.copyFileSync(default_config_path, config_path);
console.log('Default config file copied: '+config_directory);
// config = JSON.parse(fs.readFileSync(config_path));
// console.log('Config file read.');
} else if (fs.existsSync(path.join(cwd, 'config.json'))) {
//fs.copyFileSync(default_config_path, config_path);
//console.log('Default config file copied: '+config_directory);
console.log(`Config file (config.json) not found under ${config_directory}. Using config in CWD. ${cwd}`);
config_path = path.join(cwd, 'config.json');
console.log(`Config file (config.json) not found under ${config_directory}. Using config in CWD. ${cwd}`);
let found_config_path = path.join(cwd, 'config.json');
fs.copyFileSync(found_config_path, config_path);
console.log(`Found config file copied: ${config_directory}`);
} else if (fs.existsSync(path.join(cwd, 'config.json.default'))) {
console.log(`Config file (config.json) not found under ${config_directory} or CWD. Using default config in CWD. ${cwd}`);
default_config_path = path.join(cwd, 'config.json.default');
fs.copyFileSync(default_config_path, config_path);
console.log(`Default config file copied: ${config_directory}`);
} else {
console.log('Can not find a config file.');
return false;
}
config = JSON.parse(fs.readFileSync(config_path));
console.log('Config file read.');
config.home_directory = home_directory; // From the OS platform
config.tmp_directory = tmp_directory; // From the OS platform
config.app_root_path = config.app_root_path.replace('[home]', home_directory);
config.app_root_path = config.app_root_path.replace('[tmp]', tmp_directory);
console.log(config.app_root_path);
config.local_file_cache_path = config.local_file_cache_path.replace('[home]', home_directory);
config.local_file_cache_path = config.local_file_cache_path.replace('[tmp]', tmp_directory);
console.log(config.local_file_cache_path);
// if (fs.existsSync(config.local_file_cache_path)) {
// } else {
// fs.mkdirSync(config.local_file_cache_path);
// console.log(`Host file cache directory created: ${config.local_file_cache_path}`);
// }
config.host_file_temp_path = config.host_file_temp_path.replace('[home]', home_directory);
config.host_file_temp_path = config.host_file_temp_path.replace('[tmp]', tmp_directory);
console.log(config.host_file_temp_path);
// if (fs.existsSync(config.host_file_temp_path)) {
// } else {
// fs.mkdirSync(config.host_file_temp_path);
// console.log(`Host file temp directory created: ${config.host_file_temp_path}`);
// }
let import_config_to_ipc_result = ipcRenderer.invoke('import_config', config).then((result) => {
console.log('IPC import config finished');
console.log(result);
return true;
})
//console.log(config);
return config;
}
// Check for local file
// Updated 2022-05-06
exports.check_local_file = async function ({local_file_path, filename}) {
console.log('*** Electron framework export: check_local_file() ***');
// console.log('Check for local file');
console.log(`Local File Path: ${local_file_path}; Filename: ${filename}`);
let full_local_file_path = path.join(local_file_path, filename);
console.log(full_local_file_path);
if (fs.existsSync(full_local_file_path)) {
console.log(`Local file exists: ${full_local_file_path}`);
return true;
} else {
return false;
}
}
// Check local hash file cache
// Used by Svelte Event Launcher
// NOTE: Trying to replace this with something directly in the Svelte app part. 2022-10-11
// Updated 2022-05-06
exports.check_hash_file_cache = async function ({local_file_cache_path, hash}) {
// console.log('*** Electron framework export: check_hash_file_cache() ***');
// console.log('Check local hash file cache');
console.log(`*** Electron framework export: check_hash_file_cache() *** Host File Cache Path: ${local_file_cache_path}; Hash: ${hash}`);
let hash_filename = `${hash}.file`;
let subdirectory = hash_filename.substring(0,2);
let subdirectory_path = path.join(local_file_cache_path, subdirectory);
if (fs.existsSync(subdirectory_path)) {
} else {
console.log(`Hashed file subdirectory not found in cache: ${subdirectory_path}`);
return false;
}
let hash_file_cache_path = path.join(subdirectory_path, hash_filename);
// console.log(hash_file_cache_path);
if (fs.existsSync(hash_file_cache_path)) {
// console.log(`Hashed file exists in cache: ${hash_file_cache_path}`);
return true;
} else {
console.log(`Hashed file not found in cache: ${hash_file_cache_path}`);
return false;
}
}
// Download hash file to cache
// Used by Svelte Event Launcher
// Updated 2022-05-06
exports.download_hash_file_to_cache = async function ({api_base_url, local_file_cache_path, event_file_id=null, hash=null}) {
// console.log('*** Electron framework export: download_hash_file_to_cache() ***');
// console.log('Download hash file to cache');
console.log(`*** Electron framework export: download_hash_file_to_cache() *** Base URL: ${api_base_url}; Host File Cache Path: ${local_file_cache_path}; Event File ID: ${event_file_id}; Hash: ${hash}`);
let endpoint = `/event/file/${event_file_id}/download`;
let hash_filename = `${hash}.file`;
let subdirectory = hash_filename.substring(0,2);
let subdirectory_path = path.join(local_file_cache_path, subdirectory);
if (fs.existsSync(subdirectory_path)) {
} else {
fs.mkdirSync(subdirectory_path);
console.log(`Subdirectory directory created: ${subdirectory_path}`);
}
let hash_file_cache_path = path.join(subdirectory_path, hash_filename);
if (fs.existsSync(hash_file_cache_path)) {
if (check_hash) {
const file_buffer = fs.readFileSync(hash_file_cache_path);
const file_hash_sha256 = crypto.createHash('sha256');
file_hash_sha256.update(file_buffer);
const file_hash_sha256_check = file_hash_sha256.digest('hex');S
if (file_hash_sha256_check == hash) {
console.log('File hash match', file_hash_sha256_check);
return true;
} else {
// This should only happen if the file is actively being downloaded or it is corrupt.
console.log('File hash does not match', file_hash_sha256_check);
return false;
}
}
}
// console.log(`!!!ABOUT TO CALL DOWNLOAD FILE HANDLER!!! exports.download_hash_file_to_cache(); Base URL: ${api_base_url}`);
let download_file_result = await ipcRenderer.invoke('download_file', api_base_url, endpoint, hash_file_cache_path).then((result) => {
if (result) {
console.log('IPC download file process finished successfully');
return true;
} else if (result == null) {
console.log('IPC Download Result (file not found?):', result);
return null;
} else {
console.log('IPC Download Result (file being downloaded or something went wrong):', result);
return false;
}
});
// console.log(`!!!DONE WITH DOWNLOAD FILE HANDLER!!! exports.download_hash_file_to_cache(); Base URL: ${api_base_url}`);
return download_file_result;
}
// Open cached hash file after copying to temp directory
// Used by Svelte Event Launcher
// NOTE: Trying to replace this with something directly in the Svelte app part. 2022-10-11
// Updated 2022-05-06
exports.open_hash_file_to_temp = async function ({local_file_cache_path, hash, host_file_temp_path, filename}) {
console.log('*** Electron framework export: open_hash_file_to_temp() ***');
// console.log('Open cached hash file after copying to temp directory');
console.log(`Host File Cache Path: ${local_file_cache_path}; Hash: ${hash}; Host File Temp Path: ${host_file_temp_path}; Filename: ${filename}`);
let subdirectory = hash.substring(0,2);
let subdirectory_path = path.join(local_file_cache_path, subdirectory);
if (fs.existsSync(subdirectory_path)) {
} else {
console.log(`Hashed file subdirectory not found in cache: ${subdirectory_path}`);
return false;
}
let open_hash_file_to_temp_result = await ipcRenderer.invoke('open_hash_file_to_temp', subdirectory_path, hash, host_file_temp_path, filename).then((result) => {
console.log('IPC open hash file to temp finished');
console.log(result);
return true;
})
// let result = await ipcRenderer.send('open_local_file', local_file_cache_path, hash, host_file_temp_path, filename);
// console.log(result);
console.log(open_hash_file_to_temp_result);
console.log('End: open_hash_file_to_temp()');
if (open_hash_file_to_temp_result) {
console.log('File opened successfully');
return true;
} else {
console.log('File was not opened successfully');
return false;
}
}
// Open local file
// Used by Svelte Event Launcher
// NOTE: Trying to replace this with something directly in the Svelte app part. 2022-10-11
// Updated 2022-03-10
exports.open_local_file = async function ({local_file_path, filename}) {
console.log('*** Electron framework export: open_local_file() ***');
// console.log('Open local file');
console.log(`Local File Path: ${local_file_path}; Filename: ${filename}`);
// let full_local_file_path = path.join(local_file_path, filename);
// console.log(full_local_file_path);
// if (fs.existsSync(full_local_file_path)) {
// console.log(`Local file exists: ${full_local_file_path}`);
// // return true;
// } else {
// return false;
// }
let open_local_file_result = await ipcRenderer.invoke('open_local_file', local_file_path, filename).then((result) => {
console.log('IPC open local file finished');
console.log(result);
return true;
})
console.log(open_local_file_result);
console.log('End: open_local_file()');
if (open_local_file_result) {
console.log('File opened successfully');
return true;
} else {
console.log('File was not opened successfully');
return false;
}
}
// // Check local file cache and download from server if needed.
// // Updated 2022-03-09
// // exports.check_file_cache = async function ({local_file_cache_path, event_file_id, hash}) {
// exports.check_file_cache = async function ({api_base_url, local_file_cache_path, event_file_id, hash}) {
// console.log('*** Electron framework export: check_file_cache() ***');
// // console.log('Check local file cache and download from server if needed.');
// console.log(`Host File Cache Path: ${local_file_cache_path}; Event File ID: ${event_file_id}; Hash: ${hash}`);
// // NOTE: event_file_id is the event_file.id_random or event_file.event_file_id_random
// let hash_filename = hash+'.file';
// let save_path = path.join(local_file_cache_path, hash_filename);
// console.log(save_path);
// if (fs.existsSync(save_path)) {
// console.log('Hashed file cache already exists: '+save_path);
// return true;
// } else {
// console.log('Hashed file not found in local cache. Downloading file: '+save_path);
// let endpoint = `/event/file/${event_file_id}/download`;
// let result = await ipcRenderer.send('download_file', api_base_url, endpoint, save_path); // Must download file using main node.js thread.
// console.log(result);
// return new Promise((resolve, reject) => {
// ipcRenderer.once('download_file_reply', function(event, response){
// console.log(response);
// return response;
// })
// resolve(true);
// });
// // await ipcRenderer.once('download_file_reply', function(event, response){
// // console.log(response);
// // return response;
// // });
// // result.then(function (response) {
// // console.log('Downloaded!!!???');
// // return true;
// // }).catch(function (error) {
// // console.log(error);
// // return false;
// // });
// // return result;
// // console.log(result);
// // if (result) {
// // return true;
// // } else {
// // return false;
// // }
// }
// }
// Check local file cache and download from server if needed. Must use IPC to Main to download file. Set a Promise to wait for download_file_reply.
// Updated 2022-03-09
async function check_file_cache({api_base_url, local_file_cache_path, event_file_id, hash}) {
console.log('*** Electron framework: check_file_cache() ***');
// console.log('Check local file cache and download from server if needed.');
console.log(`Host File Cache Path: ${local_file_cache_path}; Event File ID: ${event_file_id}; Hash: ${hash}`);
// NOTE: event_file_id is the event_file.id_random or event_file.event_file_id_random
let hash_filename = hash+'.file';
let save_path = path.join(local_file_cache_path, hash_filename);
console.log(save_path);
if (fs.existsSync(save_path)) {
console.log('Hashed file cache already exists: '+save_path);
return true;
} else {
console.log('Hashed file not found in local cache. Downloading file: '+save_path);
let endpoint = `/event/file/${event_file_id}/download`;
let result = await ipcRenderer.send('download_file', api_base_url, endpoint, save_path); // Must download file using main node.js thread.
console.log(result);
return new Promise((resolve, reject) => {
ipcRenderer.once('download_file_reply', function(event, response){
console.log(response);
return response;
})
resolve(true);
});
// await ipcRenderer.once('download_file_reply', function(event, response){
// console.log(response);
// return response;
// });
// result.then(function (response) {
// console.log('Downloaded!!!???');
// return true;
// }).catch(function (error) {
// console.log(error);
// return false;
// });
// return result;
// console.log(result);
// if (result) {
// return true;
// } else {
// return false;
// }
}
}
// IPC to Main: Open local file cache if available. Copy to temp directory with given filename first.
// Updated 2022-03-09
async function open_local_file({local_file_cache_path, hash, host_file_temp_path, filename}) {
console.log('*** Electron framework: open_local_file() ***');
// console.log('Open local file cache if available. Copy to temp directory with given filename first.');
console.log(`Host File Cache Path: ${local_file_cache_path}; Hash: ${hash}; Host File Temp Path: ${host_file_temp_path}; Filename: ${filename}`);
console.log(local_file_cache_path);
console.log(hash);
console.log(filename);
let result = await ipcRenderer.send('open_local_file', local_file_cache_path, hash, host_file_temp_path, filename);
console.log(result);
return true;
}
// No longer needed? Not referenced as of 2022-10-11
exports.check_file_cache_and_open_local_file = async function ({local_file_cache_path, event_file_id, hash, host_file_temp_path, filename}) {
console.log('*** Electron framework: check_file_cache_and_open_local_file() ***');
console.log('Checking the local file cache against the remote server and then opening the local file.');
let check_file_cache_result = check_file_cache({local_file_cache_path: local_file_cache_path, event_file_id: event_file_id, hash: hash});
console.log(check_file_cache_result);
if (check_file_cache_result) {
let open_local_file_result = open_local_file({local_file_cache_path: local_file_cache_path, hash: hash, host_file_temp_path: host_file_temp_path, filename: filename});
console.log(open_local_file_result);
return open_local_file_result;
}
ipcRenderer.once('download_file_reply', function(event, response){
console.log(response);
let open_local_file_result = open_local_file({local_file_cache_path: local_file_cache_path, hash: hash, host_file_temp_path: host_file_temp_path, filename: filename});
console.log(open_local_file_result);
return open_local_file_result;
})
}
// Kill processes
// Updated 2022-05-07
exports.kill_processes = async function ({process_name = null}) {
console.log('*** Electron framework export: kill_processes() ***');
console.log(process_name); // process_name or grep pattern
let cmd = '';
if (os.platform == 'darwin') {
// cmd = `osascript -e 'quit app "${process_name}" saving no'`;
cmd = `osascript -e 'quit application "${process_name}" saving no'`;
} else {
cmd = `pkill ${process_name}`;
}
child_process.exec(cmd, (err, stdout, stdin) => {
// if (err) throw err;
if (err) console.log(err);
console.log(stdout);
});
console.log(`Killed processes matching ${process_name}`);
if (os.platform == 'darwin') {
if (process_name == 'Parallels:Acrobat Reader') {
// Regular expression: (Parallels).*(Acrobat Reader)
// This will find any process with Parallels and Acrobat Reader in the name
cmd = `pkill -i -f '(Parallels).*(Acrobat Reader)'`;
child_process.exec(cmd, (err, stdout, stdin) => {
if (err) throw err;
console.log(stdout);
});
console.log('Killed Parallels Acrobat Reader process');
}
if (process_name == 'Parallels:PowerPoint') {
// Regular expression: (Parallels).*(PowerPoint)
// This will find any process with Parallels and PowerPoint in the name
cmd = `pkill -i -f '(Parallels).*(PowerPoint)'`;
child_process.exec(cmd, (err, stdout, stdin) => {
if (err) throw err;
console.log(stdout);
});
console.log('Killed Parallels PowerPoint process');
}
}
// let signal = 'SIGTERM'; // 'SIGTERM', 'SIGINT', 'SIGHUP'
// process.kill(pid, signal);
// process.kill(pid, 0); // Special case test if process exists
return true;
}
// Run raw osascript
// Updated 2022-05-07
exports.run_osascript = async function ({cmd=null, interactive=false, language=null, flags='h', program_file=null}) {
console.log('*** Electron framework export: run_osascript() ***');
console.log(cmd);
if (os.platform == 'darwin') {
} else {
console.log('Not available for this platform. macOS (darwin) only.');
return false;
}
let osascript_str = '';
if (Array.isArray(cmd)) {
console.log('List of cmd strings');
let cmds_str = '';
for (let i = 0; i < cmd.length; i++) {
cmds_str += `-e '${cmd[i]}'`;
}
osascript_str = `osascript ${cmds_str}`
} else if (typeof cmd === 'string') {
console.log('Single cmd string');
osascript_str = `osascript -e '${cmd}'`;
} else {
return false;
}
if (language) {
console.log(`Language: ${language}`);
osascript_str = `${osascript_str} -l ${language}`;
}
if (flags) {
console.log(`Flags: ${flags}`);
osascript_str = `${osascript_str} -s ${flags}`;
}
console.log(`OSA Script String: ${osascript_str}`);
child_process.exec(osascript_str, (err, stdout, stdin) => {
if (err) throw err;
console.log(stdout);
console.log(stdin);
});
console.log('Finished');
return true;
}
// Run raw command
// Updated 2022-05-07
exports.run_cmd = async function ({cmd=null}) {
console.log('*** Electron framework export: run_cmd() ***');
console.log(`Command String: ${cmd}`);
child_process.exec(cmd, (err, stdout, stdin) => {
if (err) throw err;
console.log(stdout);
console.log(stdin);
});
console.log('Finished');
return true;
}
// Run raw command
// Updated 2022-05-25
exports.get_device_info = async function () {
console.log('*** Electron framework export: get_device_info() ***');
let data = {};
data['arch'] = os.arch();
data['hostname'] = os.hostname();
data['cpus'] = os.cpus();
data['freemem'] = os.freemem();
data['totalmem'] = os.totalmem();
data['loadavg'] = os.loadavg();
data['networkInterfaces'] = os.networkInterfaces();
data['platform'] = os.platform();
data['release'] = os.release();
data['uptime'] = os.uptime();
data['version'] = os.version();
console.log(data);
return data;
}

File diff suppressed because it is too large Load Diff

View File

@@ -1,390 +0,0 @@
'use strict';
const os = require('os');
const path = require('path');
const fs = require('fs');
const { ipcRenderer } = require('electron');
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;
exports.load_config = function () {
console.log('*** Electron framework: load_config() ***');
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;
// Set the config path for macOS or Linux
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);
}
// Look for the config file and copy the default if not found.
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);
}
// Attempt to open the config file. The preferred location is based on the OS's config directory.
if (fs.existsSync(config_path)) {
console.log('Config 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();
}
config.host_file_cache_path = config.host_file_cache_path.replace('[home]', home_directory);
config.host_file_cache_path = config.host_file_cache_path.replace('[tmp]', tmp_directory);
console.log(config.host_file_cache_path);
config.host_file_temp_path = config.host_file_temp_path.replace('[home]', home_directory);
config.host_file_temp_path = config.host_file_temp_path.replace('[tmp]', tmp_directory);
console.log(config.host_file_temp_path);
let import_config_to_ipc_result = ipcRenderer.invoke('import_config', config).then((result) => {
console.log('IPC import config finished');
console.log(result);
return true;
})
//console.log(config);
return config;
}
// Check for local file
// Updated 2022-03-10
exports.check_local_file = async function ({local_file_path, filename}) {
console.log('*** Electron framework export: check_local_file() ***');
// console.log('Check for local file');
console.log(`Local File Path: ${local_file_path}; Filename: ${filename}`);
let full_local_file_path = path.join(local_file_path, filename);
console.log(full_local_file_path);
if (fs.existsSync(full_local_file_path)) {
console.log(`Local file exists: ${full_local_file_path}`);
return true;
} else {
return false;
}
}
// Check local hash file cache
// Updated 2022-03-09
exports.check_hash_file_cache = async function ({host_file_cache_path, hash}) {
console.log('*** Electron framework export: check_hash_file_cache() ***');
// console.log('Check local hash file cache');
console.log(`Host File Cache Path: ${host_file_cache_path}; Hash: ${hash}`);
let hash_filename = `${hash}.file`;
let hash_file_cache_path = path.join(host_file_cache_path, hash_filename);
// console.log(hash_file_cache_path);
if (fs.existsSync(hash_file_cache_path)) {
console.log(`Hashed file exists in cache: ${hash_file_cache_path}`);
return true;
} else {
console.log(`Hashed file not found in cache: ${hash_file_cache_path}`);
return false;
}
}
// Download hash file to cache
// Updated 2022-03-09
exports.download_hash_file_to_cache = async function ({host_file_cache_path, event_file_id=null, hash=null}) {
console.log('*** Electron framework export: download_hash_file_to_cache() ***');
// console.log('Download hash file to cache');
console.log(`Host File Cache Path: ${host_file_cache_path}; Event File ID: ${event_file_id}; Hash: ${hash}`);
let endpoint = `/event/file/${event_file_id}/download`;
let hash_filename = `${hash}.file`;
let hash_file_cache_path = path.join(host_file_cache_path, hash_filename);
// console.log(hash_file_cache_path);
let download_file_result = await ipcRenderer.invoke('download_file', api_base_url, endpoint, hash_file_cache_path).then((result) => {
console.log('IPC download file process finished');
// console.log(result);
return true;
});
// console.log(download_file_result);
// console.log('End: download_hash_file_to_cache()');
if (download_file_result) {
console.log('File downloaded successfully');
return true;
} else {
console.log('File was not downloaded successfully');
return false;
}
}
// Open cached hash file after copying to temp directory
// Updated 2022-03-09
exports.open_hash_file_to_temp = async function ({host_file_cache_path, hash, host_file_temp_path, filename}) {
console.log('*** Electron framework export: open_hash_file_to_temp() ***');
// console.log('Open cached hash file after copying to temp directory');
console.log(`Host File Cache Path: ${host_file_cache_path}; Hash: ${hash}; Host File Temp Path: ${host_file_temp_path}; Filename: ${filename}`);
let open_hash_file_to_temp_result = await ipcRenderer.invoke('open_hash_file_to_temp', host_file_cache_path, hash, host_file_temp_path, filename).then((result) => {
console.log('IPC open hash file to temp finished');
console.log(result);
return true;
})
// let result = await ipcRenderer.send('open_local_file', host_file_cache_path, hash, host_file_temp_path, filename);
// console.log(result);
console.log(open_hash_file_to_temp_result);
console.log('End: open_hash_file_to_temp()');
if (open_hash_file_to_temp_result) {
console.log('File opened successfully');
return true;
} else {
console.log('File was not opened successfully');
return false;
}
}
// Open local file
// Updated 2022-03-10
exports.open_local_file = async function ({local_file_path, filename}) {
console.log('*** Electron framework export: open_local_file() ***');
// console.log('Open local file');
console.log(`Local File Path: ${local_file_path}; Filename: ${filename}`);
// let full_local_file_path = path.join(local_file_path, filename);
// console.log(full_local_file_path);
// if (fs.existsSync(full_local_file_path)) {
// console.log(`Local file exists: ${full_local_file_path}`);
// // return true;
// } else {
// return false;
// }
let open_local_file_result = await ipcRenderer.invoke('open_local_file', local_file_path, filename).then((result) => {
console.log('IPC open local file finished');
console.log(result);
return true;
})
console.log(open_local_file_result);
console.log('End: open_local_file()');
if (open_local_file_result) {
console.log('File opened successfully');
return true;
} else {
console.log('File was not opened successfully');
return false;
}
}
// Check local file cache and download from server if needed.
// Updated 2022-03-09
// exports.check_file_cache = async function ({host_file_cache_path, event_file_id, hash}) {
exports.check_file_cache = async function ({host_file_cache_path, event_file_id, hash}) {
console.log('*** Electron framework export: check_file_cache() ***');
// console.log('Check local file cache and download from server if needed.');
console.log(`Host File Cache Path: ${host_file_cache_path}; Event File ID: ${event_file_id}; Hash: ${hash}`);
// NOTE: event_file_id is the event_file.id_random or event_file.event_file_id_random
let hash_filename = hash+'.file';
let save_path = path.join(host_file_cache_path, hash_filename);
console.log(save_path);
if (fs.existsSync(save_path)) {
console.log('Hashed file cache already exists: '+save_path);
return true;
} else {
console.log('Hashed file not found in local cache. Downloading file: '+save_path);
let endpoint = `/event/file/${event_file_id}/download`;
let result = await ipcRenderer.send('download_file', api_base_url, endpoint, save_path); // Must download file using main node.js thread.
console.log(result);
return new Promise((resolve, reject) => {
ipcRenderer.once('download_file_reply', function(event, response){
console.log(response);
return response;
})
resolve(true);
});
// await ipcRenderer.once('download_file_reply', function(event, response){
// console.log(response);
// return response;
// });
// result.then(function (response) {
// console.log('Downloaded!!!???');
// return true;
// }).catch(function (error) {
// console.log(error);
// return false;
// });
// return result;
// console.log(result);
// if (result) {
// return true;
// } else {
// return false;
// }
}
}
// Check local file cache and download from server if needed. Must use IPC to Main to download file. Set a Promise to wait for download_file_reply.
// Updated 2022-03-09
async function check_file_cache({host_file_cache_path, event_file_id, hash}) {
console.log('*** Electron framework: check_file_cache() ***');
// console.log('Check local file cache and download from server if needed.');
console.log(`Host File Cache Path: ${host_file_cache_path}; Event File ID: ${event_file_id}; Hash: ${hash}`);
// NOTE: event_file_id is the event_file.id_random or event_file.event_file_id_random
let hash_filename = hash+'.file';
let save_path = path.join(host_file_cache_path, hash_filename);
console.log(save_path);
if (fs.existsSync(save_path)) {
console.log('Hashed file cache already exists: '+save_path);
return true;
} else {
console.log('Hashed file not found in local cache. Downloading file: '+save_path);
let endpoint = `/event/file/${event_file_id}/download`;
let result = await ipcRenderer.send('download_file', api_base_url, endpoint, save_path); // Must download file using main node.js thread.
console.log(result);
return new Promise((resolve, reject) => {
ipcRenderer.once('download_file_reply', function(event, response){
console.log(response);
return response;
})
resolve(true);
});
// await ipcRenderer.once('download_file_reply', function(event, response){
// console.log(response);
// return response;
// });
// result.then(function (response) {
// console.log('Downloaded!!!???');
// return true;
// }).catch(function (error) {
// console.log(error);
// return false;
// });
// return result;
// console.log(result);
// if (result) {
// return true;
// } else {
// return false;
// }
}
}
// IPC to Main: Open local file cache if available. Copy to temp directory with given filename first.
// Updated 2022-03-09
async function open_local_file({host_file_cache_path, hash, host_file_temp_path, filename}) {
console.log('*** Electron framework: open_local_file() ***');
// console.log('Open local file cache if available. Copy to temp directory with given filename first.');
console.log(`Host File Cache Path: ${host_file_cache_path}; Hash: ${hash}; Host File Temp Path: ${host_file_temp_path}; Filename: ${filename}`);
console.log(host_file_cache_path);
console.log(hash);
console.log(filename);
let result = await ipcRenderer.send('open_local_file', host_file_cache_path, hash, host_file_temp_path, filename);
console.log(result);
return true;
}
exports.check_file_cache_and_open_local_file = async function ({host_file_cache_path, event_file_id, hash, host_file_temp_path, filename}) {
console.log('*** Electron framework: check_file_cache_and_open_local_file() ***');
console.log('Checking the local file cache against the remote server and then opening the local file.');
let check_file_cache_result = check_file_cache({host_file_cache_path: host_file_cache_path, event_file_id: event_file_id, hash: hash});
console.log(check_file_cache_result);
if (check_file_cache_result) {
let open_local_file_result = open_local_file({host_file_cache_path: host_file_cache_path, hash: hash, host_file_temp_path: host_file_temp_path, filename: filename});
console.log(open_local_file_result);
return open_local_file_result;
}
ipcRenderer.once('download_file_reply', function(event, response){
console.log(response);
let open_local_file_result = open_local_file({host_file_cache_path: host_file_cache_path, hash: hash, host_file_temp_path: host_file_temp_path, filename: filename});
console.log(open_local_file_result);
return open_local_file_result;
})
}

1391
app/script.current.js Normal file

File diff suppressed because it is too large Load Diff

0
app/script.js Normal file
View File

0
app/style.css Normal file
View File

28
app/style.current.css Normal file
View File

@@ -0,0 +1,28 @@
body {
/* min-height: 100%;
height: 100%;
max-height: 100%; */
/* margin: .1em;
padding: .1em; */
}
section#Main-Body {
/* outline: solid thin red; */
/* min-height: 100%;
height: 100%;
max-height: 100%; */
}
section#Main-Nav-Menu {
/* min-height: 100%;
height: 100%;
max-height: 100%; */
}
section#Main-Content {
/* min-height: 100%;
height: 100%;
max-height: 100%; */
}

View File

@@ -1,878 +0,0 @@
html {
/* Parent Layout */
/* Box Model */
/* Positioning */
/*height: 100%;*/
/* Display */
}
body {
/* Parent Layout */
/* Box Model */
/* Positioning */
margin-bottom: 2.25rem; /* full height */
/* margin: 0; */
/* padding: 0; */
/* Display */
}
nav {
}
/* *** BEGIN *** Layout *** System Menu (root menu) *** */
/* *** END *** Layout *** System Menu (root menu) *** */
/* Aether System Styles */
/* Most of this should not be overridden by the client unless using something like an iframe for specific content. */
/* *** BEGIN *** System *** General *** */
/* *** END *** System *** General *** */
/* *** BEGIN *** System *** System Menu (root menu) *** */
.system_menu {
z-index: 1040; /* Bootstrap's modal background is also z-index: 1040 */
position: fixed;
top: 0;
left: 50%;
/*height: .1rem;*/
height: 2.68rem;
/*height: 6.12rem;*/
width: 100vw;
max-width: 1440px; /*100vw*/
transform: translateX(-50%);
margin: 0 0;
margin-bottom: .1rem;
padding-top: .03rem;
padding-left: .03rem;
padding-right: .03rem;
padding-bottom: .03rem;
overflow: hidden;
display: flex;
flex-direction: row;
/*background: linear-gradient(to right, rgba(220,220,220,.9) 25%, rgba(128,128,128,.8) 50%, rgba(220,220,220,.9) 75%);*/
border: solid thick transparent;
border-top: none;
border-left: solid thick hsl(var(--hue-green),var(--saturation-least),var(--lum-darkest));
border-right: solid thick hsl(var(--hue-green),var(--saturation-least),var(--lum-darkest));
border-bottom: solid thin hsl(var(--hue-green),var(--saturation-least),var(--lum-darkest));
border-bottom: none;
border-image:
linear-gradient(
to bottom,
hsl(var(--hue-green),var(--saturation-least),var(--lum-darkest)),
transparent
) 1;
/* NOTE: transition when no longer hovering */
transition-property: height;
transition-delay: 4s;
transition-duration: .1s;
transition-timing-function: linear;
}
.system_menu:hover {
z-index: 1051; /* Bootstrap's modal background is z-index: 1040 */
border-left: solid thick hsl(var(--hue-green),var(--saturation-most),var(--lum-darkest));
border-right: solid thick hsl(var(--hue-green),var(--saturation-most),var(--lum-darkest));
border-bottom: solid thin hsl(var(--hue-green),var(--saturation-most),var(--lum-darkest));
border-image:
linear-gradient(
to top,
hsl(var(--hue-green),var(--saturation-most),var(--lum-darkest)),
transparent
) 1;
background-image: linear-gradient(to right, hsla(var(--hue-yellow), var(--saturation-less), var(--lum-lightest).1) 0%, hsla(var(--hue-yellow), var(--saturation-less), var(--lum-lightest),.9) 3%, hsla(var(--hue-yellow), var(--saturation-less), var(--lum-lightest),.9) 97%, hsla(var(--hue-yellow), var(--saturation-less), var(--lum-lightest),.1) 100%);
height: 5.33rem;
/* NOTE: transition when hover starts */
transition-property: height;
transition-delay: 1.5s;
transition-duration: .15s;
transition-timing-function: linear;
}
.system_menu_clicked {
z-index: 1051; /* Bootstrap's modal background is z-index: 1040 */
border-left: solid thick hsl(var(--hue-green),var(--saturation-most),var(--lum-darkest));
border-right: solid thick hsl(var(--hue-green),var(--saturation-most),var(--lum-darkest));
border-bottom: solid thin hsl(var(--hue-green),var(--saturation-most),var(--lum-darkest));
border-image:
linear-gradient(
to top,
hsl(var(--hue-green),var(--saturation-most),var(--lum-darkest)),
transparent
) 1;
background-image: linear-gradient(to right, hsla(var(--hue-yellow), var(--saturation-less), var(--lum-lightest).1) 0%, hsla(var(--hue-yellow), var(--saturation-less), var(--lum-lightest),.9) 3%, hsla(var(--hue-yellow), var(--saturation-less), var(--lum-lightest),.9) 97%, hsla(var(--hue-yellow), var(--saturation-less), var(--lum-lightest),.1) 100%);
height: 5.33rem;
/* NOTE: transition when hover starts */
transition-property: height;
transition-delay: 0s;
transition-duration: .15s;
transition-timing-function: linear;
}
.system_menu_begin {
/*border: solid thin red;*/
align-self: flex-end;
display: flex;
/*align-content: center;*/
align-items: center;
/*justify-content: center;*/
height: 100%;
padding: 0 .25rem;
text-shadow: 0 0 .25rem hsla(var(--hue-blue), var(--saturation-least), var(--lum-lightest),1), 0 0 .75rem hsla(var(--hue-blue), var(--saturation-least), var(--lum-lightest),1), 0 0 1rem hsla(var(--hue-blue), var(--saturation-least), var(--lum-lightest),1);
color: black;
/*background-image: linear-gradient(to right, hsla(var(--hue-blue), var(--saturation-least), var(--lum-lighter),0) 0%, hsla(var(--hue-blue), var(--saturation-least), var(--lum-lighter),.9) 3%, hsla(var(--hue-blue), var(--saturation-least), var(--lum-lighter),.9) 97%, hsla(var(--hue-blue), var(--saturation-least), var(--lum-lighter),0) 100%);*/
}
.system_menu_begin:hover {
}
.system_menu_center {
/*border: solid thin blue;*/
align-self: flex-end;
flex: auto;
display: flex;
flex-direction: column;
/*background-image: linear-gradient(to right, hsla(var(--hue-blue), var(--saturation-least), var(--lum-mid),.1) 25%, hsla(var(--hue-blue), var(--saturation-least), var(--lum-mid),.8) 50%, hsla(var(--hue-blue), var(--saturation-least), var(--lum-mid),.9) 75%);*/
}
.system_menu_end {
/*border: solid thin red;*/
align-self: flex-end;
display: flex;
/*align-content: center;*/
align-items: center;
/*justify-content: center;*/
height: 100%;
padding: 0 .25rem;
text-shadow: 0 0 .25rem white, 0 0 .75rem hsla(var(--hue-blue), var(--saturation-least), var(--lum-lightest),1), 0 0 1rem hsla(var(--hue-blue), var(--saturation-least), var(--lum-lightest),1);
color: black;
/*background-image: linear-gradient(to right, hsla(var(--hue-blue), var(--saturation-least), var(--lum-lightest),0) 0%, hsla(var(--hue-blue), var(--saturation-least), var(--lum-lightest),.6) 20%, hsla(var(--hue-blue), var(--saturation-least), var(--lum-lightest),.6) 80%, hsla(var(--hue-blue), var(--saturation-least), var(--lum-lightest),0) 100%);*/
}
.system_menu_end:hover {
}
.system_menu_hidden {
border-bottom: none;
align-self: flex-end;
flex: auto;
width: 100%;
display: flex;
flex-direction: row;
justify-content: space-between;
margin: 0;
padding: .1rem .75rem;
/*background-image: linear-gradient(to right, hsla(var(--hue-blue), var(--saturation-least), var(--lum-lightest),0) 0%, hsla(var(--hue-blue), var(--saturation-least), var(--lum-lightest),.9) 3%, hsla(var(--hue-blue), var(--saturation-least), var(--lum-lightest),.9) 97%, hsla(var(--hue-blue), var(--saturation-least), var(--lum-lightest),0) 100%);*/
}
.system_menu_hidden:hover {
/*border-bottom: solid thin gray;*/
}
.system_menu_visible {
border-bottom: none;
/*border-bottom: solid thin gray;*/
align-self: flex-end;
flex: auto;
width: 100%;
display: flex;
flex-direction: row;
justify-content: space-between;
margin: 0;
padding: .1rem .75rem;
/*background-image: linear-gradient(to right, hsla(var(--hue-blue), var(--saturation-least), var(--lum-lightest),0) 0%, hsla(var(--hue-blue), var(--saturation-least), var(--lum-lightest),.9) 3%, hsla(var(--hue-blue), var(--saturation-least), var(--lum-lightest),.9) 97%, hsla(var(--hue-blue), var(--saturation-least), var(--lum-lightest),0) 100%);*/
}
.system_menu_visible:hover {
/*border-bottom: solid thin gray;*/
}
.system_menu_name {
/*border: dashed thin blue;*/
/*flex: auto;*/
display: flex;
flex-direction: row;
justify-content: flex-begin;
align-items: center;
margin: 0;
padding: 0rem .5rem;
background-image: linear-gradient(to right, hsla(var(--hue-blue), var(--saturation-least), var(--lum-lightest),0) 0%, hsla(var(--hue-blue), var(--saturation-least), var(--lum-lightest),.8) 3%, hsla(var(--hue-blue), var(--saturation-least), var(--lum-lightest),.8) 97%, hsla(var(--hue-blue), var(--saturation-least), var(--lum-lightest),0) 100%);
}
.system_menu_name img {
max-height: 1rem;
}
.system_menu_information {
/*border: dashed thin green;*/
/*flex: auto;*/
align-self: flex-end;
display: flex;
flex-direction: row;
justify-content: flex-end;
align-items: center;
margin: 0;
padding: 0rem .5rem;
background-image: linear-gradient(to right, hsla(var(--hue-blue), var(--saturation-least), var(--lum-lightest),0) 0%, hsla(var(--hue-blue), var(--saturation-least), var(--lum-lightest),.8) 3%, hsla(var(--hue-blue), var(--saturation-least), var(--lum-lightest),.8) 97%, hsla(var(--hue-blue), var(--saturation-least), var(--lum-lightest),0) 100%);
}
.system_menu_information:hover {
/*background-color: gray;*/
/*background-image: linear-gradient(to right, hsla(var(--hue-blue), var(--saturation-least), var(--lum-lighter),0) 0%, hsla(var(--hue-blue), var(--saturation-least), var(--lum-lighter),.9) 3%, hsla(var(--hue-blue), var(--saturation-least), var(--lum-lighter),.9) 97%, hsla(var(--hue-blue), var(--saturation-least), var(--lum-lighter),0) 100%);*/
background-image: linear-gradient(to right, hsla(var(--hue-blue), var(--saturation-least), var(--lum-lightest),.0) 0%, hsla(var(--hue-blue), var(--saturation-least), var(--lum-lightest),.97) 3%, hsla(var(--hue-blue), var(--saturation-least), var(--lum-lightest),.97) 97%, hsla(var(--hue-blue), var(--saturation-least), var(--lum-lightest),.0) 100%);
}
.system_menu_float {
z-index: 1040;
position: fixed;
top: 2.75rem;
right: .1rem;
background-color: rgba(220,175,175,.8);
padding: .1rem .5rem;
/*position: fixed; top: 0; right: 0; */
}
/* Set style based on the user's permissions */
.system_menu.user_super {
border-left: solid thick hsl(var(--hue-red),var(--saturation-most),var(--lum-darkest));
border-right: solid thick hsl(var(--hue-red),var(--saturation-most),var(--lum-darkest));
border-bottom: solid thin hsl(var(--hue-red),var(--saturation-most),var(--lum-darkest));
border-image:
linear-gradient(
to top,
hsl(var(--hue-red),var(--saturation-most),var(--lum-darkest)),
transparent
) 1;
background-image:
linear-gradient(
to bottom,
hsl(var(--hue-red),var(--saturation-most),var(--lum-darkest)),
transparent
);
}
.system_menu.user_manager {
border-left: solid thick hsl(var(--hue-red),var(--saturation-most),var(--lum-darkest));
border-right: solid thick hsl(var(--hue-red),var(--saturation-most),var(--lum-darkest));
border-bottom: solid thin hsl(var(--hue-red),var(--saturation-most),var(--lum-darkest));
border-image:
linear-gradient(
to top,
hsl(var(--hue-red),var(--saturation-most),var(--lum-darkest)),
transparent
) 1;
background-image:
linear-gradient(
to bottom,
hsl(var(--hue-orange),var(--saturation-most),var(--lum-darkest)),
transparent
);
}
.system_menu.user_administrator {
border-left: solid thick hsl(var(--hue-red),var(--saturation-most),var(--lum-darkest));
border-right: solid thick hsl(var(--hue-red),var(--saturation-most),var(--lum-darkest));
border-bottom: solid thin hsl(var(--hue-red),var(--saturation-most),var(--lum-darkest));
border-image:
linear-gradient(
to top,
hsl(var(--hue-red),var(--saturation-most),var(--lum-darkest)),
transparent
) 1;
background-image:
linear-gradient(
to bottom,
hsl(var(--hue-yellow),var(--saturation-most),var(--lum-darkest)),
transparent
);
}
.system_menu.user_verified {
border-left: solid thick hsl(var(--hue-red),var(--saturation-most),var(--lum-darkest));
border-right: solid thick hsl(var(--hue-red),var(--saturation-most),var(--lum-darkest));
border-bottom: solid thin hsl(var(--hue-red),var(--saturation-most),var(--lum-darkest));
border-image:
linear-gradient(
to top,
hsl(var(--hue-green),var(--saturation-most),var(--lum-darkest)),
transparent
) 1;
background-image:
linear-gradient(
to bottom,
hsl(var(--hue-yellow),var(--saturation-most),var(--lum-darkest)),
transparent
);
}
.system_menu.user_authenticated {
border-left: solid thick hsl(var(--hue-red),var(--saturation-most),var(--lum-darkest));
border-right: solid thick hsl(var(--hue-red),var(--saturation-most),var(--lum-darkest));
border-bottom: solid thin hsl(var(--hue-red),var(--saturation-most),var(--lum-darkest));
border-image:
linear-gradient(
to top,
hsl(var(--hue-green),var(--saturation-most),var(--lum-darkest)),
transparent
) 1;
background-image:
linear-gradient(
to bottom,
hsl(var(--hue-cyan),var(--saturation-most),var(--lum-darkest)),
transparent
);
}
.system_menu .user_status_options {
font-size: .8rem;
line-height: 1rem;
}
/* *** END *** System *** System Menu (root menu) *** */
/* *** BEGIN *** System *** User Login *** */
.user_login .account__name--container {
font-size: 1.1rem;
font-weight: bold;
}
.user_login .account__none--container {
font-size: 1.1rem;
font-weight: bold;
color: darkred;
}
.user_login .show_password, .user_change_password .show_password {
font-size: 1.1rem;
line-height: 3.0rem;
color: darkred;
cursor: zoom-in; /*progress*/
}
.user_login .show_password:hover, .user_change_password .show_password:hover {
font-size: 1.3rem;
}
/* *** END *** System *** User Login *** */
/* *** BEGIN *** System *** System Footer *** */
/* system_footer or system_footer or system_status is the global (root) footer or status bar */
.system_footer {
position: fixed;
/*width: 100vw;*/
bottom: 0;
margin: 0 0;
padding: 0 .5rem;
color: gray;
background: #eee;
}
.system_footer .footer_left {
float: left;
}
.system_footer .footer_right {
float: right;
}
/* *** END *** System *** System Footer *** */
/* *** BEGIN *** System *** Debug *** */
.view_debug {
cursor: help;
}
.hidden_debug {
display: none;
position: fixed;
bottom: 1.5rem;
right: 0;
background: pink;
border: dashed thin pink;
margin: .25rem .25rem .25rem;
padding: .25rem;
opacity: .5;
font-size: .7rem;
overflow-y: scroll;
max-height: 96.75vh;
z-index: 1050; /* Bootstrap 4 sticky-top class has a z-index of 1020 */
}
.hidden_debug:hover {
z-index: 1051;
border: solid thin pink;
opacity: .95;
}
/* *** END *** System *** Debug *** */
/* BEGIN: Global System Classes */
/* BEGIN: Main section of the page layout */
.site_header {
padding-top: .5rem;
padding-bottom: .5rem;
margin-bottom: .25rem;
max-height: 15rem; /* Just in case something is added that is very high. */
width: 95%;
max-width: 1400px;
}
.site_header img {
max-width: 100%;
max-height: 8rem; /* Just in case something is added that is very high. */
/*border: solid thin #aaa;*/
border-radius: .25rem;
}
/* primary_menu is generally the site_menu */
.primary_menu {
z-index: 1040; /* Bootstrap's modal background is also z-index: 1040 */
/*padding-top: 2rem;*/
width: 95%;
max-width: 1400px; /* 2048px or 2560px is 2K */
margin-bottom: .25rem;
padding-right: 1.75rem;
padding-left: 1.75rem;
background-image: linear-gradient(to right, rgba(255,255,255,.7) 0%, rgba(255,255,255,.95) 3%, rgba(255,255,255,.95) 97%, rgba(255,255,255,.7) 100%);
}
.primary_menu:hover {
z-index: 1041; /* Bootstrap's modal background is also z-index: 1040 */
}
.flash_messages {
width: 95%;
max-width: 1400px; /* 2048px or 2560px is 2K */
margin-bottom: .25rem;
padding-top: .25rem;
padding-right: 1.75rem;
padding-bottom: .25rem;
padding-left: 1.75rem;
background-image: linear-gradient(to right, #ffff80 0%, #ffffe1 2%, #ffffe1 98%, #ffff80 100%);
/*border: solid thin #ffff80;*/
}
.flash_messages ul {
margin: .25rem .25rem .25rem .25rem;
padding: .25rem .25rem .25rem .25rem;
}
.flash_messages li {
list-style-type: circle;
}
.flash_messages li.info {
/*background-color: green;*/
}
.flash_messages .flashes {
}
.flash_messages.show_dev .debug {
}
/* BEGIN: main_template_content section of the page layout */
.main_template_container {
/*border: dashed medium darkred;
* background-color: red;*/
position: relative;
/*display: flex;*/
align-items: stretch;
height: auto;
min-height: 60vh;
width: 95%;
max-width: 1400px; /* 2048px or 2560px is 2K */
margin: .5rem auto;
padding: 0;
}
/* secondary_menu is generally the page_menu or object_type_menu */
.secondary_menu {
/*border: dashed medium darkgreen;
* background-color: green;*/
/*position: relative;*/
margin-top: .25rem;
margin-right: 0rem;
margin-bottom: .25rem;
margin-left: 0rem;
padding-top: .25rem;
padding-right: 1.75rem;
padding-bottom: .25rem;
padding-left: 1.75rem;
width: 100%;
min-width: 100%;
max-width: 100%;
background-image: linear-gradient(to right, rgba(255,255,255,.7) 0%, rgba(255,255,255,.95) 3%, rgba(255,255,255,.95) 97%, rgba(255,255,255,.7) 100%);
}
.secondary_menu>.btn-toolbar>.btn-group {
margin-left: .1em;
margin-right: .1em;
}
.secondary_menu>.btn-toolbar>.btn-group>.btn {
margin-left: .05em;
margin-right: .05em;
/*
* border-left: solid thin #aaa;
* border-right: solid thin #aaa;*/
}
.main_template_content {
/*border: dashed medium darkgreen;
* background-color: green;*/
position: relative;
/*display: flex;
* align-items: stretch;*/
margin-top: .25rem;
margin-right: 0rem; /* Keep 0 to avoid horizontal scroll */
margin-bottom: .25rem;
margin-left: 0rem; /* Keep 0 to avoid horizontal scroll */
padding-top: .5rem;
padding-right: 1.75rem;
padding-bottom: .5rem;
padding-left: 1.75rem;
height: 100%;
min-height: 50vh;
max-height: 100%;
width: 100%;
min-width: 100%;
max-width: 100%;
/*background: white;*/
/*background-image: linear-gradient(to right, #eee 0%, #fff 2%, #fff 98%, #eee 100%);*/
background-image: linear-gradient(to right, rgba(255,255,255,.7) 0%, rgba(255,255,255,.95) 3%, rgba(255,255,255,.95) 97%, rgba(255,255,255,.7) 100%);
}
/* END: main_template_content section of the page layout */
/* END: Global System Classes */
/*X-Small devices (portrait phones, less than 576px)*/
/*No media query for `xs` since this is the default in Bootstrap*/
/*x-Small devices (portrait phones, less than 576px)*/
@media (max-width: 575px) {
.viewport_width {
padding-left: .5rem;
padding-right: .5rem;
background-color: blue;
color: white;
}
.viewport_width::after {
content: 'xs';
padding-left: .5rem;
}
header.site_header, nav.primary_menu.site_menu, section.flash_messages, div.main_template_container {
width: 100%;
}
.main_template_container {
width: 100%;
margin: 0rem auto;
padding: 0;
}
.main_template_content {
margin-top: .05rem;
margin-right: 0rem; /* Keep 0 to avoid horizontal scroll */
margin-bottom: .05rem;
margin-left: 0rem; /* Keep 0 to avoid horizontal scroll */
padding-top: .0rem;
padding-right: .05rem;
padding-bottom: .0rem;
padding-left: .05rem;
}
footer.system_footer {
font-size: .8em;
}
}
/*Small devices (landscape phones, 576px and up)*/
@media (min-width: 576px) {
.viewport_width {
padding-left: .5rem;
padding-right: .5rem;
background-color: green;
color: black;
}
.viewport_width::after {
content: 'sm';
padding-left: .5rem;
}
header.site_header, nav.primary_menu.site_menu, section.flash_messages, div.main_template_container {
width: 97%;
}
.main_template_container {
width: 97%;
margin: .25rem auto;
padding: 0;
}
.main_template_content {
margin-top: .1rem;
margin-right: 0rem;
margin-bottom: .1rem;
margin-left: 0rem;
padding-top: .25rem;
padding-right: 1.00rem;
padding-bottom: .25rem;
padding-left: 1.00rem;
}
footer.system_footer {
font-size: .85em;
}
}
/*Medium devices (tablets, 768px and up)*/
@media (min-width: 768px) {
.viewport_width {
padding-left: .5rem;
padding-right: .5rem;
background-color: yellow;
color: black;
}
.viewport_width::after {
content: 'md';
padding-left: .5rem;
}
footer.system_footer {
font-size: 1em;
}
}
/*Large devices (desktops, 992px and up)*/
@media (min-width: 992px) {
.viewport_width {
padding-left: .5rem;
padding-right: .5rem;
background-color: orange;
color: black;
}
.viewport_width::after {
content: 'lg';
padding-left: .5rem;
}
}
/*X-Large devices (large desktops, 1200px and up)*/
@media (min-width: 1200px) {
.viewport_width {
padding-left: .5rem;
padding-right: .5rem;
background-color: red;
color: white;
}
.viewport_width::after {
content: 'xl';
padding-left: .5rem;
}
}
/*XX-Large devices (larger desktops, 1400px and up)*/
@media (min-width: 1400px) {
.viewport_width {
background-color: black;
color: white;
}
.viewport_width::after {
content: 'xxl';
padding-left: .5rem;
}
}
@media print {
@page {
size: Letter; /*Legal*/
margin: .5in !important; /* top and bottom margin is set to .41 because of Google Chrome */
padding: 0in;
}
body {
background-color: white !important;
background-image: none !important;
color: black !important;
margin: .25in !important;
padding: .1in !important;
border: solid thin #eeeeee;
}
.system_menu {
display: none;
}
.system_menu_float {
display: none;
}
.site_header {
display: none;
}
.site_menu {
display: none;
}
.flash_messages {
display: none;
}
.main_template_container {
/*border: dashed thin red;*/
background-color: white !important;
background-image: none !important;
color: black !important;
margin: .01in !important;
padding: .0in !important;
min-width: 0 !important;
/*width: 0 !important;*/
max-width: 100% !important;
display: flex;
align-items: center;
}
.secondary_menu {
display: none;
}
.main_template_content {
/*border: dotted thin red;*/
background-color: white !important;
background-image: none !important;
color: black !important;
margin: .01in !important;
padding: .01in !important;
min-width: 0 !important;
/*width: 0 !important;*/
max-width: 100% !important;
display: flex;
align-items: center;
}
.system_footer {
display: none;
}
.hidden_debug {
display: none;
}
}
.page_help {
float: right;
}
.page_links {
float: right;
}

View File

@@ -1 +0,0 @@

View File

@@ -1 +0,0 @@

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -1,60 +0,0 @@
/* This file will trigger the browser to reload quickly */
/* Component types */
/* A section is a main component and should be outlined. It may be displayed as block. */
section.component {
outline: dashed thin;
outline-color: var(--default-color-lighter);
}
section.component:hover {
outline: dashed thin;
outline-color: var(--default-color-light);
}
/* A div is a shared component, block, and should not be styled internally */
div.component {
outline: dotted thin;
outline-color: var(--default-color-lighter);
}
div.component:hover {
outline-color: var(--default-color-light);
}
/* A span is a shared component, inline, and should not be styled internally */
span.component {
outline: dotted thin;
outline-color: var(--default-color-lighter);
}
span.component:hover {
outline-color: var(--default-color-light);
}
.main_template_container {
/*outline: dashed medium green;*/
}
.main_template_content {
/*outline: dashed thin red;*/
}
.qr_scanner_form {
/*outline: solid thin green;*/
}
.qr_scanner {
/*outline: solid thin pink;*/
}
.badge_body {
/*outline: dotted thin red;*/
}
.badge_person_name {
/*outline: dashed thin pink;*/
}
.badge_affiliations_location {
/*outline: dashed thin pink;*/
}

279
app/test.html Normal file
View File

@@ -0,0 +1,279 @@
<!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's Aether App</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 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" />
<!-- Cascading Style Sheets (CSS) end -->
<!-- JavaScript (JS) start -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/axios/1.1.3/axios.min.js" integrity="sha512-0qU9M9jfqPw6FKkPafM3gy2CBAvUWnYVOfNPDYKVuRTel1PrciTj+a9P3loJB+j0QmN2Y0JYQmkBBS8W+mbezg==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
<script src="https://webrtc.github.io/adapter/adapter-latest.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/socket.io/4.2.0/socket.io.js" integrity="sha512-WL6WGKMPBiM9PnHRYIn5YEtq0Z8XP4fkVb4qy7PP4vhmYQErJ/dySyXuFIMDf1eEYCXCrQrMJfkNwKc9gsjTjA==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/dayjs/1.10.7/dayjs.min.js" integrity="sha512-bwD3VD/j6ypSSnyjuaURidZksoVx3L1RPvTkleC48SbHCZsemT3VKMD39KknPnH728LLXVMTisESIBOAb5/W0Q==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/localforage/1.10.0/localforage.min.js" integrity="sha512-+BMamP0e7wn39JGL8nKAZ3yAQT2dL5oaXWr4ZYlTGkKOaoXM/Yj7c4oy50Ngz5yoUutAG17flueD4F6QpTlPng==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
<!-- JavaScript (JS) end -->
<script>
const native_app = require('./js/aether_app_native_v4');
let native_app_config = native_app.load_init_config();
console.log('Native App Initial Config:', native_app_config);
// native_app_config = native_app.load_full_config(native_app_config);
// console.log('Native App Full Config:', native_app_config);
let native_app_js_css_base_url = native_app_config.native_app_js_css_base_url;
document.aether = {
name: 'Aether Native App (Electron and Svelte)'
};
</script>
<!-- One Sky IT Cascading Style Sheets (CSS) -->
<script>document.write(`<link rel="stylesheet" href="${native_app_js_css_base_url}/static/css/ae_css_variables.css" />`);</script>
<script>document.write(`<link rel="stylesheet" href="${native_app_js_css_base_url}/static/css/ae_utilities.css" />`);</script>
<script>document.write(`<link rel="stylesheet" href="${native_app_js_css_base_url}/static/css/ae_shared_components.css" />`);</script>
<script>document.write(`<link rel="stylesheet" href="${native_app_js_css_base_url}/static/css/ae_core_modules_components.css" />`);</script>
<script>document.write(`<link rel="stylesheet" href="${native_app_js_css_base_url}/static/css/ae_layout_base.css" />`);</script>
<script>document.write(`<link rel="stylesheet" href="${native_app_js_css_base_url}/static/css/ae_layout_system.css" />`);</script>
<script>document.write(`<link rel="stylesheet" href="${native_app_js_css_base_url}/static/ae_app_core_bundle.css" />`);</script>
<script>document.write(`<link rel="stylesheet" href="${native_app_js_css_base_url}/static/ae_app_mods_bundle.css" />`);</script>
<script>document.write(`<link rel="stylesheet" href="${native_app_js_css_base_url}/static/ae_app_mod_events_bundle.css" />`);</script>
<script>document.write(`<link rel="stylesheet" href="${native_app_js_css_base_url}/static/css/ae_temp.css" />`);</script>
<script>document.write(`<link rel="stylesheet" href="${native_app_js_css_base_url}/static/css/event.css" />`);</script>
<script>document.write(`<link rel="stylesheet" href="${native_app_js_css_base_url}/static/css/event_launcher.css" />`);</script>
<link rel="stylesheet" href="css/aether_app_native_v3.css">
<style>
</style>
<script>
// BEGIN: Environment constants set by server when rendering HTML
// Environment options: development_local, development_remote, production_local, production_remote,
// END: Environment constants set by server when rendering HTML
// BEGIN: Content constants set by server when rendering HTML
// const page_for_id = {"event": native_app_config.event_id, "event_device": native_app_config.event_device_id, "event_location": native_app_config.event_location_id, "event_session": native_app_config.event_session_id}; // Simple key value like object
const page_for = {'event_id': native_app_config.event_id, 'event_device_id': native_app_config.event_device_id, 'event_location_id': native_app_config.event_location_id, 'event_session_id': native_app_config.event_session_id}; // Simple key value like object
console.log('Page For:', page_for);
// END: Content constants set by server when rendering HTML
// BEGIN: Client constants set by server when rendering HTML
const client_account_jwt = {}; // Future use
const client_person_jwt = {}; // Future use
const client_user_jwt = {}; // Future use
let client_account_id = native_app_config.account_id;
console.log(client_account_id);
// END: Client constants set by server when rendering HTML
// BEGIN: Other constants set by server when rendering HTML
// END: Other constants set by server when rendering HTML
document.aether.cfg = {};
document.aether.cfg.app = { "name": "One Sky IT's Aether Native App DEV", "version": "3.5 DEV", "email": null, "env": null, "mode": "native", "local_file_cache_path": native_app_config.local_file_cache_path, "host_file_temp_path": native_app_config.host_file_temp_path };
document.aether.cfg.api = { "protocol": native_app_config.api_protocol, "server": native_app_config.api_server, "port": native_app_config.api_port, "path": native_app_config.api_path, "secret_key": native_app_config.api_secret_key, "base_url": null, "temporary_token": {"token": null, "expire_on": null}, "protocol_backup": native_app_config.api_protocol_backup, "server_backup": native_app_config.api_server_backup, "port_backup": native_app_config.api_port_backup, "path_backup": native_app_config.api_path_backup, "secret_key_backup": native_app_config.api_secret_key_backup, "base_url_backup": null, "temporary_token_backup": {"token": null, "expire_on": null} };
document.aether.cfg.idb = { "name": native_app_config.idb_name };
document.aether.client = { "account_id": native_app_config.account_id, "site_id": native_app_config.site_id, "site_domain_id": native_app_config.site_domain_id, "person_id": null, "user_id": null, "order_cart_id_random": null, "super_check": false, "manager_check": false, "administrator_check": false, "support_check": false, "assistant_check": false, "trusted_check": false, "verified_check": false, "provisional_check": false, "public_check": false, "user_check": false, "logged_in_check": false, "person_check": false, "authenticated_check": false, "anonymous_check": true, "person_group": null, "user_group": null, "orders_closed_count": 0, "order_count": 0, "app_mode": "native" };
let page = {}
page['mode'] = null;
// page['page_for_id'] = { 'event': native_app_config.event_id, 'event_device': native_app_config.event_device_id, 'event_location': native_app_config.event_location_id, 'event_session': native_app_config.event_session_id }; // Simple key value like object;
page['page_for'] = { 'event_id': native_app_config.event_id, 'event_device_id': native_app_config.event_device_id, 'event_location_id': native_app_config.event_location_id, 'event_session_id': native_app_config.event_session_id }; // Simple key value like object;
page['current_url_root'] = null;
page['current_url_full_path'] = null;
page['data'] = null; // Pre-populate the page data from the rendering server (Electron app).
page['mode'] = null; // For future use or in other contexts
page['params'] = null; // For future use or in other contexts
document.aether.page = page;
/* ***** **** *** ** * ### * ** *** **** ***** */
let app_online = false;
//let app_use_cached_data = true;
window.addEventListener('online', native_app.currently_online);
window.addEventListener('offline', native_app.currently_offline);
/* ***** **** *** ** * ### * ** *** **** ***** */
const ae_bridge = {
example_var: 'Example Default Value',
get example() {
return this.example_var;
},
set example(new_value) {
this.example_var = new_value;
this.example_var_listener(new_value);
this.example_var_core_listener(new_value);
this.example_var_mods_listener(new_value);
},
example_var_listener: function (new_value) {},
registerNewListener: function (external_listener_function) {
this.example_var_listener = external_listener_function;
},
example_var_core_listener: function (new_value) {},
registerNewCoreListener: function (external_core_listener_function) {
this.example_var_core_listener = external_core_listener_function;
},
example_var_mods_listener: function (new_value) {},
registerNewModsListener: function (external_mods_listener_function) {
this.example_var_mods_listener = external_mods_listener_function;
},
// Monitor change in Access Type
access_type_var: 'anonymous',
get access_type() {
return this.access_type_var;
},
set access_type(new_value) {
this.access_type_var = new_value;
this.access_type_var_core_listener(new_value);
this.access_type_var_mods_listener(new_value);
},
access_type_var_core_listener: function (new_value) {},
register_core_access_type_listener: function (external_core_listener_function) {
this.access_type_var_core_listener = external_core_listener_function;
},
access_type_var_mods_listener: function (new_value) {},
register_mods_access_type_listener: function (external_mods_listener_function) {
this.access_type_var_mods_listener = external_mods_listener_function;
},
// Monitor change in AE Common
ae_com_var: 'anonymous',
get ae_com() {
return this.ae_com_var;
},
set ae_com(new_value) {
this.ae_com_var = new_value;
this.ae_com_var_core_listener(new_value);
this.ae_com_var_mods_listener(new_value);
},
ae_com_var_core_listener: function (new_value) {},
register_core_ae_com_listener: function (external_core_listener_function) {
this.ae_com_var_core_listener = external_core_listener_function;
},
ae_com_var_mods_listener: function (new_value) {},
register_mods_ae_com_listener: function (external_mods_listener_function) {
this.ae_com_var_mods_listener = external_mods_listener_function;
},
// Monitor change in Client
client_var: 'anonymous',
get client() {
return this.client_var;
},
set client(new_value) {
this.client_var = new_value;
this.client_var_core_listener(new_value);
this.client_var_mods_listener(new_value);
},
client_var_core_listener: function (new_value) {},
register_core_client_listener: function (external_core_listener_function) {
this.client_var_core_listener = external_core_listener_function;
},
client_var_mods_listener: function (new_value) {},
register_mods_client_listener: function (external_mods_listener_function) {
this.client_var_mods_listener = external_mods_listener_function;
},
};
/* ***** **** *** ** * ### * ** *** **** ***** */
let svelte_ae_app_core_bundle_js = document.createElement('script');
svelte_ae_app_core_bundle_js.setAttribute('src', `${native_app_js_css_base_url}/static/ae_app_core_bundle.js`);
document.head.appendChild(svelte_ae_app_core_bundle_js);
let svelte_ae_app_mods_bundle_js = document.createElement('script');
svelte_ae_app_mods_bundle_js.setAttribute('src', `${native_app_js_css_base_url}/static/ae_app_mods_bundle.js`);
document.head.appendChild(svelte_ae_app_mods_bundle_js);
let svelte_ae_app_mod_events_bundle_js = document.createElement('script');
svelte_ae_app_mod_events_bundle_js.setAttribute('src', `${native_app_js_css_base_url}/static/ae_app_mod_events_bundle.js`);
document.head.appendChild(svelte_ae_app_mod_events_bundle_js);
</script>
<!-- <script>document.write(`<script src="${native_app_js_css_base_url}/static/svelte/build/bundle.js" crossorigin />`);</script> -->
<!-- JavaScript (JS) end -->
</head>
<body id="Body-Container" class="body_container">
<section id="System-Nav-Menu">Site-Nav-Menu</section>
<div id="Site-Container">
<section id="Site-Header">Site-Header</section>
<nav id="Site-Nav-Menu">Site-Nav-Menu</nav>
<section id="Notifications">
<section id="System-Notifications">System-Notifications (and Site-Notifications)</section><!-- and what would be Site-Notifications-->
</section>
<section id="Main-Body" class="main_template_content svelte_target event_launcher_main Side-Main-Nav-Menu">
<section id="Main-Nav-Menu"></section>
<main id="Main-Content"></main>
</section>
<section id="Site-Footer">Site-Footer</section>
</div>
<section id="Site-Modals"></section>
<section id="System-Footer">Site-Footer</section>
<section id="System-Debug">System-Debug</section>
</body>
<!-- JavaScript (JS) start -->
<!-- <script>const app = require('./js/app_v3');</script> -->
<!-- <script src="js/app_v3.js"></script> -->
<script>
/* ***** **** *** ** * ### * ** *** **** ***** */
/* ***** **** *** ** * ### * ** *** **** ***** */
</script>
<!-- JavaScript (JS) end -->
</html>

View File

@@ -1,79 +0,0 @@
{
"account_id": "_XY7DXtc9MY",
"event_id": "pjrcghqwert",
"event_device_id": "dbgMWS3KEHE",
"event_location_id": null,
"event_session_id": null,
"event_presentation_id": null,
"event_presenter_id": null,
"event_file_id": null,
"api_secret_key": "dFP6J9DVj9hUgIMn-fNIqg",
"api_remote_base_url": "https://dev-fastapi.oneskyit.com",
"api_local_base_url": "http://dev-fastapi.oneskyit.local:5005",
"access_control_allow_origin": "*",
"use_local_api": true,
"use_local_db": false,
"idb_name": "osit",
"idb_event_check_period": 120000,
"idb_event_location_check_period": 90000,
"idb_event_session_check_period": 90000,
"idb_event_presentation_check_period": 90000,
"idb_event_presenter_check_period": 60000,
"idb_event_file_check_period": 30000,
"host_file_cache_path": "[home]/tmp/OSIT/file_cache",
"host_file_cache_check_period": 30000,
"host_file_temp_path": "[home]/tmp/OSIT/temp",
"main_loop_interval": 2000,
"api_token_loop_interval": 1000,
"api_update_period": 90000,
"api_auth_loop_interval": 100,
"api_token_update_loop_interval": 120000,
"open_tables_loop_interval": 10,
"update_idb_loop_interval": 10,
"idb_to_launcher_loop_interval": 250,
"update_render_loop_interval": 1000,
"check_file_cache_loop_interval": 250,
"display_menu_session_times": true,
"display_session_codes": true,
"display_session_badges": true,
"display_presentation_codes": true,
"display_presentation_badges": true,
"display_presenter_codes": true,
"display_presenter_badges": true,
"display_arrangement": "mirror_and_extend",
"display_builtin_resolution": "",
"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" }
]
}

View File

@@ -1,42 +0,0 @@
{
"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" }
]
}

403
index.js
View File

@@ -2,71 +2,259 @@ const { app, BrowserWindow, ipcMain, shell, systemPreferences } = require('elect
const axios = require('axios'); const axios = require('axios');
const crypto = require('crypto');
const fs = require('fs'); const fs = require('fs');
//const http = require('http');
const os = require('os'); const os = require('os');
const path = require('path'); const path = require('path');
const process = require('process'); const process = require('process');
const { strict } = require('assert');
//const http = require('http');
//const request = require('request'); //const request = require('request');
//const url = require('url'); //const url = require('url');
// const usb = require('usb') // Compiled with an old version of Node.js // const usb = require('usb') // Compiled with an old version of Node.js
console.log(`OS: ${os.type()} ${process.getSystemVersion()}`);
// console.log(process.getSystemVersion());
let home_directory = require('os').homedir(); let home_directory = require('os').homedir();
console.log('Home: '+home_directory); console.log('Home: '+home_directory);
let tmp_directory = require('os').tmpdir(); let tmp_directory = require('os').tmpdir();
console.log('Temporary: '+tmp_directory); console.log('Temporary: '+tmp_directory);
let config = null; // Set the config path for macOS or Linux
let host_file_cache_path = null; let config_directory = 'OSIT/native_app';
let config_filename = 'ae_native_app_sk_config.json';
let config_path = '';
let local_file_cache_path = null;
let host_file_temp_path = null; let host_file_temp_path = null;
console.log(os.type()); let endpoints_in_progress = [];
console.log(process.getSystemVersion());
/* Look for and load a JSON formatted config file. */
if (os.platform == 'darwin') {
let config_path_default = path.join(home_directory, config_directory, config_filename);
let config_path_macos = path.join(home_directory, 'Library/Application Support/OSIT', config_filename);
// let config_path_opt2 = path.join(home_directory, 'OSIT', config_filename);
if (fs.existsSync(config_path_default)) {
console.log('Default config file path exists: '+config_path_default);
config_path = config_path_default;
} else if (fs.existsSync(config_path_macos)) {
console.log('macOS config file path exists: '+config_path_macos);
config_path = config_path_macos;
} else {
console.log(`No config file found: ${config_path_default} or ${config_path_macos}`);
config_path = '';
// fs.mkdirSync(config_file_directory_path, true);
// console.log('Config directory path created: '+config_file_directory_path);
}
console.log(`Using config found on macOS: ${config_path}`);
} else if (os.platform == 'linux') {
let config_path_default = path.join(home_directory, config_directory, config_filename);
let config_path_linux_os = path.join(home_directory, '.config/OSIT', config_filename);
let config_path_temp = path.join(home_directory, 'tmp/OSIT', config_filename);
if (fs.existsSync(config_path_default)) {
console.log('Default config file path exists: '+config_path_default);
config_path = config_path_default;
} else if (fs.existsSync(config_path_linux_os)) {
console.log('Linux config file path exists: '+config_path_linux_os);
config_path = config_path_linux_os;
} else if (fs.existsSync(config_path_temp)) {
console.log('Temp config file path exists: '+config_path_temp);
config_path = config_path_temp;
} else {
console.log(`No config file found: ${config_path_default} or ${config_path_linux_os} or ${config_path_temp}`);
config_path = '';
}
console.log(`Using config found on Linux: ${config_path}`);
}
let config = JSON.parse(fs.readFileSync(config_path));
console.log('Config file read.', config);
/*
Minimal configuration contains:
* conf_file_check_path = '~/OSIT/sync/admin_share/internal/ae_osit_app.default.conf'
* conf_file_check_path_backup = 'ae_osit_app.conf'
* api_pref_use = 'local' or 'remote' or 'backup'
* api_base_url_local = https://local-api.oneskyit.com
* api_base_url_remote = https://api.oneskyit.com
* api_base_url_backup = https://bak-api.oneskyit.com
* app_pref_use = 'local' or 'remote' or 'backup'
* app_base_url_local = https://local-demo.oneskyit.com
* app_base_url_remote = https://demo.oneskyit.com
* app_base_url_backup = https://bak-demo.oneskyit.com
* device_id = 'abcd1234'
*/
/*
Ask for permissions from macOS to use the microphone, screen, camera. The OS may delay actually asking for permission until the permission is actually attempted to be used. It may be worth doing a test attempt early on if access has not already been granted. -STI 2023-06-03
*/
if (os.type == 'Darwin') { if (os.type == 'Darwin') {
if (systemPreferences.getMediaAccessStatus('microphone') != 'granted') { if (systemPreferences.getMediaAccessStatus('microphone') != 'granted') {
systemPreferences.askForMediaAccess('microphone'); systemPreferences.askForMediaAccess('microphone');
} else { } else {
console.log(systemPreferences.getMediaAccessStatus('microphone')); console.log('Microphone access:', systemPreferences.getMediaAccessStatus('microphone'));
}
if (systemPreferences.getMediaAccessStatus('screen') != 'granted') {
systemPreferences.askForMediaAccess('screen');
} else {
console.log('Screen access:', systemPreferences.getMediaAccessStatus('screen'));
} }
if (systemPreferences.getMediaAccessStatus('camera') != 'granted') { if (systemPreferences.getMediaAccessStatus('camera') != 'granted') {
systemPreferences.askForMediaAccess('camera'); systemPreferences.askForMediaAccess('camera');
} else { } else {
console.log(systemPreferences.getMediaAccessStatus('camera')); console.log('Camera access:', systemPreferences.getMediaAccessStatus('camera'));
} }
} }
async function get_url_cfg() {
let base_url = `${config.api_protocol}://${config.api_server}:${config.api_port}/${config.api_path}`;
let axios_api = axios.create({
baseURL: base_url,
timeout: 60000, // in milliseconds; 60000 = 60 seconds
/* other custom settings */
});
// axios_api.defaults.headers = config['headers'];
// axios.defaults.baseURL = `${config.api_protocol}://${config.api_server}:${config.api_port}/${config.api_path}`;
axios_api.defaults.headers.common['Access-Control-Allow-Origin'] = config.access_control_allow_origin; // '*'; // app_config.access_control_allow_origin;
axios_api.defaults.headers.common['content-type'] = 'application/json';
axios_api.defaults.headers.common['x-aether-api-key'] = config.api_secret_key;
// axios_api.defaults.headers.common['x-account-id'] = config.account_id ?? 'xFP7AhU8Zlc';
axios_api.defaults.headers.common['x-no-account-id'] = 'nothing to see here';
let event_device_id = config.event_device_id ?? 'dbgMWS3KEHE';
// let endpoint = `/event/device/${event_device_id}`;
let endpoint = `/v2/crud/event/device/${event_device_id}`;
let params = {
inc_event_cfg: false,
inc_event_location: false,
enabled: 'enabled',
};
let response_data_promise = await axios_api.get(
endpoint,
{
params: params,
onDownloadProgress: (progressEvent) => {
let percent_completed = Math.round(
(progressEvent.loaded * 100) / progressEvent.total
);
console.log('GET Data Timestamp:', progressEvent.timeStamp, 'Total:', progressEvent.total, 'Loaded:', progressEvent.loaded, 'Percent Completed', percent_completed);
// temp_get_object_percent_completed = percent_completed;
}
}
)
.then(function (response) {
console.log(`Response: ${response}`);
let return_data = response.data['data'];
if (Array.isArray(return_data)) {
console.log(`Data result is an array/list. Array length: ${return_data.length}`);
} else {
console.log(`Data result is a dictionary/object, not an array/list.`);
}
return return_data;
})
.catch(function (error) {
console.log(`Base URL: ${base_url} | Endpoint: ${endpoint}`);
console.log('Error Message:', error.message); // Is this needed here or below in the in the else portion???
if (error.response) {
console.log(`Response Status: ${error.response.status}; Status Text: ${error.response.statusText}`);
} else {
console.log('Error:', error);
}
console.log('Full Error:', error);
if (error.response && error.response.status === 404) {
return null; // Returning null since there were no results
}
return false; // Returning false since something may have gone wrong. Also more in line with what the API returns.
});
return response_data_promise;
}
let new_config = get_url_cfg();
console.log(new_config);
function createWindow () { function createWindow () {
// Create the browser window. // Create the browser window.
win = new BrowserWindow({ win = new BrowserWindow({
width: 1500, // 1500 1280 height: config.height ?? 720,
height: 1024, // 1024 width: config.width ?? 1280,
backgroundColor: '#aaa', backgroundColor: '#aaa',
icon: './app/img/favicon.ico', icon: './app/img/favicon.ico',
webPreferences: { webPreferences: {
contextIsolation: false, contextIsolation: false,
nodeIntegration: true, nodeIntegration: true,
nodeIntegrationInWorker: true nodeIntegrationInWorker: true,
enableRemoteModule: true
} }
}) })
// win.setMinimumSize(1024, 768); // win.setMinimumSize(1024, 768);
win.setMinimumSize(1280, 768); // win.setMinimumSize(1280, 768);
win.setMinimumSize(1400, 768);
//win.setFullScreenable(false) //win.setFullScreenable(false)
win.FullScreenable = false; win.FullScreenable = false;
// win.webContents.session.clearStorageData(['filesystem']); // Does this do anything??? // win.webContents.session.clearStorageData(['filesystem']); // Does this do anything???
// and load the index.html of the app. // native_app_which_html = 'default', 'path', 'url'
win.loadFile('app/index.html'); // 'default' (url) is within the bundled native app
// 'path' (external to app) is a file path on the host, probably under the home directory
// 'url' is over HTTPS, maybe onsite or offsite
// unknown points to an index.html file in the app directory
// Load the index.html of the app
if (config.native_app_which_html == '' || config.native_app_which_html == 'default') {
// win.loadFile('app/index.html');
let index_url = config.native_app_index_url ?? 'https://oneskyit.com/';
win.loadURL(index_url);
} else if (config.native_app_which_html == 'path') {
let index_path = '';
if (config.native_app_index_path) {
index_path = config.native_app_index_path.replace('[home]', home_directory);
} else {
index_path = path.join(home_directory, 'OSIT/native_app/app/index.html');
}
win.loadFile(index_path);
} else if (config.native_app_which_html == 'url') {
let index_url = config.native_app_index_url ?? 'https://oneskyit.com/';
win.loadURL(index_url);
} else {
win.loadFile('app/index.html');
}
// Open the DevTools. // Open the DevTools.
win.webContents.openDevTools(); if (config.developer_tools) {
win.webContents.openDevTools(); // Comment out for production
}
// Emitted when the window is closed. // Emitted when the window is closed.
win.on('closed', () => { win.on('closed', () => {
@@ -93,6 +281,9 @@ app.on('window-all-closed', () => {
// On macOS it is common for applications and their menu bar // On macOS it is common for applications and their menu bar
// to stay active until the user quits explicitly with Cmd + Q // to stay active until the user quits explicitly with Cmd + Q
if (process.platform !== 'darwin') { if (process.platform !== 'darwin') {
if (win) {
win.close();
}
app.quit(); app.quit();
} }
}) })
@@ -117,14 +308,14 @@ ipcMain.handle('import_config', async (event, config_data) => {
config = config_data; config = config_data;
host_file_cache_path = config.host_file_cache_path; local_file_cache_path = config.local_file_cache_path;
host_file_temp_path = config.host_file_temp_path; host_file_temp_path = config.host_file_temp_path;
if (fs.existsSync(host_file_cache_path)) { if (fs.existsSync(local_file_cache_path)) {
console.log('Host file cache path exists: '+host_file_cache_path); console.log('Host file cache path exists: '+local_file_cache_path);
} else { } else {
fs.mkdirSync(host_file_cache_path, true); fs.mkdirSync(local_file_cache_path, true);
console.log('Host file cache path created: '+host_file_cache_path); console.log('Host file cache path created: '+local_file_cache_path);
} }
if (fs.existsSync(host_file_temp_path)) { if (fs.existsSync(host_file_temp_path)) {
@@ -140,51 +331,93 @@ ipcMain.handle('import_config', async (event, config_data) => {
// Download file to path // Download file to path
// full_save_path should be the full path that includes the filename // full_save_path should be the full path that includes the filename
// Updated 2022-03-09 // Updated 2023-05-14
ipcMain.handle('download_file', async (event, api_base_url, api_endpoint, full_save_path) => { ipcMain.handle('download_file', async (event, api_base_url, api_endpoint, full_save_path, hash=null, verify_hash=false, overwrite_existing=false, offset_minutes=3) => {
console.log('*** Electron IPC Main: download_file() ***'); console.log('*** Electron IPC Main: download_file() ***');
// console.log('ipcMain on download_file: api_base_url='+api_base_url+' | api_temporary_token='+api_temporary_token); // console.log('ipcMain on download_file: api_base_url='+api_base_url+' | api_temporary_token='+api_temporary_token);
console.log('ipcMain on download_file: api_base_url='+api_base_url); // console.log('ipcMain on download_file: api_base_url='+api_base_url);
console.log('ipcMain download and save file: HTTP '+api_endpoint+' -> FILE '+full_save_path); console.log(`ipcMain download and save file: HTTP ${api_endpoint} -> FILE ${full_save_path}`);
if (!api_base_url) {
let result = await download_file(api_base_url, api_endpoint, full_save_path); console.log('API Base URL is required. Returning false');
return false;
console.log(result); }
console.log('End: Electron IPC Main: download_file()');
// return 'Return from Electron IPC Main download_file()';
return result;
});
// Download file to path
// full_save_path should be the full path that includes the filename
// Updated 2022-03-09
async function download_file(api_base_url, api_endpoint, full_save_path) {
console.log('*** node.js: download_file() ***');
axios.defaults.baseURL = api_base_url; axios.defaults.baseURL = api_base_url;
axios.defaults.headers.common['Access-Control-Allow-Origin'] = config.access_control_allow_origin; // '*'; // app_config.access_control_allow_origin; axios.defaults.headers.common['Access-Control-Allow-Origin'] = config.access_control_allow_origin; // '*'; // app_config.access_control_allow_origin;
axios.defaults.headers.common['content-type'] = 'application/json'; axios.defaults.headers.common['content-type'] = 'application/json';
axios.defaults.headers.common['x-aether-api-key'] = config.api_secret_key; // 'dFP6J9DVj9hUgIMn-fNIqg'; // api_secret_key; axios.defaults.headers.common['x-aether-api-key'] = config.api_secret_key;
axios.defaults.headers.common['x-account-id'] = config.account_id; // '_XY7DXtc9MY'; // account_id; axios.defaults.headers.common['x-account-id'] = config.account_id;
const url = api_endpoint; const url = api_endpoint;
const tmp_full_save_path = full_save_path+'.tmp';
if (fs.existsSync(tmp_full_save_path)) {
console.log(`A temp download file was found! ${tmp_full_save_path}`);
let stats = null;
try {
stats = fs.statSync(tmp_full_save_path);
// console.log(`File Accessed Last: ${stats.atime}`); // File data last changed (actual contents)
console.log(`File Data Last Modified: ${stats.mtime}`); // File data last changed (actual contents)
console.log(`File Metadata Last Modified: ${stats.ctime}`); // File metadata last changed (filename, permissions, etc)
} catch (error) {
console.log(error);
}
let current_datetime = new Date();
// In minutes. After 5ish minutes of no changes to the file content seems reasonable? Tested with 3 minutes for multiple meetings and no noticable problem.
let offset_datetime = new Date(current_datetime.getTime() - offset_minutes*60000);
// console.log(`Times: ${current_datetime} ${offset_datetime} | File ${stats.mtime}`);
if (stats.mtime < offset_datetime) {
console.log(`Marking as expired temp file based on modified datetime. Expire after: ${offset_minutes} minutes`);
overwrite_existing = true;
} else {
console.log(`Temp download file has not expired yet. Expire after: ${offset_minutes} minutes`);
// return false;
return 'tmp';
}
}
if (fs.existsSync(full_save_path)) {
console.log(`A cached file was found! ${full_save_path}`);
if (verify_hash) {
const file_buffer = fs.readFileSync(full_save_path);
const file_hash_sha256 = crypto.createHash('sha256');
file_hash_sha256.update(file_buffer);
const file_hash_sha256_check = file_hash_sha256.digest('hex');
if (file_hash_sha256_check == hash) {
// console.log('File hash match', file_hash_sha256_check);
} else {
console.log('File hash does not match', file_hash_sha256_check);
if (overwrite_existing) {
console.log('Going to overwrite the existing file because the hash does not match.');
} else {
return false;
}
}
}
// return false;
}
console.log('Endpoints in Progress:', endpoints_in_progress);
if (endpoints_in_progress.includes(api_endpoint)) {
console.log(`Endpoint already being downloaded: ${api_endpoint}`);
// return false;
return 'in_progress';
}
// console.log(`Done with checks. Time to download! Endpoint: ${api_endpoint}`);
endpoints_in_progress.push(api_endpoint);
let download_result = await axios({ let download_result = await axios({
method: 'get', method: 'get',
url: url, url: url,
responseType: 'stream' /* responseType must be stream */ responseType: 'stream' /* responseType must be stream */
}).then(function (response) { }).then(function (response) {
console.log('Downloading...'); console.log(`Creating write stream for downloading endpoint: ${api_endpoint}`);
// response.data.pipe(fs.createWriteStream(full_save_path)); const writer = fs.createWriteStream(tmp_full_save_path);
// return true;
// response.data.pipe(fs.createWriteStream(full_save_path));
// return true;
const writer = fs.createWriteStream(full_save_path);
console.log('Write stream created');
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
response.data.pipe(writer); response.data.pipe(writer);
@@ -197,41 +430,67 @@ async function download_file(api_base_url, api_endpoint, full_save_path) {
reject(err); reject(err);
}); });
writer.on('close', () => { writer.on('close', () => {
console.log('Writer close!');
if (!error) { if (!error) {
// console.log(`Download complete! Writer closed.`);
resolve(true); resolve(true);
} else {
console.log('Writer closed unexpectedly!', error);
} }
//no need to call the reject here, as it will have been called in the //no need to call the reject here, as it will have been called in the
//'error' stream; //'error' stream;
}); });
}); });
}) })
.then(function (response) {
console.log(`Download complete. Temporary file moved/renamed: ${full_save_path}`);
fs.renameSync(tmp_full_save_path, full_save_path);
for( let i = 0; i < endpoints_in_progress.length; i++){
if ( endpoints_in_progress[i] === api_endpoint) {
endpoints_in_progress.splice(i, 1);
// NOTE: Decrement the index variable so it does not skip the next item in the array.
i--;
}
}
return true;
})
.catch(function (error) { .catch(function (error) {
console.log(`Error downloading! Endpoint: ${api_endpoint}`); console.log(`Error downloading! Endpoint: ${api_endpoint}`);
// console.log(error);
// console.log(error.response); for( let i = 0; i < endpoints_in_progress.length; i++){
if ( endpoints_in_progress[i] === api_endpoint) {
endpoints_in_progress.splice(i, 1);
// NOTE: Decrement the index variable so it does not skip the next item in the array.
i--;
}
}
if (error.response) {
console.log(`Response Status: ${error.response.status}; Status Text: ${error.response.statusText}`);
} else {
console.log('Error:', error);
}
if (error.response && error.response.status === 404) { if (error.response && error.response.status === 404) {
return null; // Returning null since there were no results return null; // Returning null since there were no results
} }
console.log(`Response Status: ${error.response.status}; Status Text: ${error.response.statusText}`);
return false; // Returning false since something may have gone wrong. Also more in line with what the API returns. return false; // Returning false since something may have gone wrong. Also more in line with what the API returns.
}); });
// console.log(`Done with download function! Endpoint: ${api_endpoint}`);
console.log(download_result);
console.log('End: download_file()');
// return 'Return from download_file()';
return download_result; return download_result;
} });
ipcMain.handle('open_hash_file_to_temp', async (event, host_file_cache_path, hash, host_file_temp_path, filename) => { ipcMain.handle('open_hash_file_to_temp', async (event, local_file_cache_path, hash, host_file_temp_path, filename, verify_hash=true) => {
console.log('*** Electron IPC Main: open_hash_file_to_temp() ***'); console.log('*** Electron IPC Main: open_hash_file_to_temp() ***');
console.log('ipcMain on open_hash_file_to_temp'); console.log('ipcMain on open_hash_file_to_temp');
console.log(`ipcMain open hash file from temp directory: ${host_file_cache_path} -> ${host_file_temp_path}/${filename}`); console.log(`ipcMain open hash file from temp directory: ${local_file_cache_path} -> ${host_file_temp_path}/${filename}`);
// NOTE: This may be needed later? Uncomment if paths are relative to working directory. // NOTE: This may be needed later? Uncomment if paths are relative to working directory.
// let cache_file_path = path.join(process.cwd(), host_file_cache_path); // let cache_file_path = path.join(process.cwd(), local_file_cache_path);
let cache_file_path = host_file_cache_path; let cache_file_path = local_file_cache_path;
console.log(cache_file_path); console.log(cache_file_path);
let hash_filename = hash+'.file'; let hash_filename = hash+'.file';
@@ -251,15 +510,29 @@ ipcMain.handle('open_hash_file_to_temp', async (event, host_file_cache_path, has
} }
if (fs.existsSync(full_cache_file_path)) { if (fs.existsSync(full_cache_file_path)) {
console.log(`Hashed file exists in cache: ${full_cache_file_path}`); // console.log(`Hashed file exists in cache: ${full_cache_file_path}`);
console.log(`Copying file to temp: ${open_temp_file_path}`); console.log(`Copying file to temp: ${open_temp_file_path}`);
try { try {
await fs.copyFileSync(full_cache_file_path, open_temp_file_path); fs.copyFileSync(full_cache_file_path, open_temp_file_path);
} catch (error) { } catch (error) {
console.error(error); console.error(error);
return false; return false;
} }
if (verify_hash) {
const file_buffer = fs.readFileSync(full_cache_file_path);
const file_hash_sha256 = crypto.createHash('sha256');
file_hash_sha256.update(file_buffer);
const file_hash_sha256_check = file_hash_sha256.digest('hex');
if (file_hash_sha256_check == hash) {
// console.log('File hash match', file_hash_sha256_check);
} else {
console.log('File hash does not match', file_hash_sha256_check);
return false;
}
}
// console.log('Creating file link: '+open_temp_file_path); // console.log('Creating file link: '+open_temp_file_path);
// fs.linkSync(full_cache_file_path, open_temp_file_path); // fs.linkSync(full_cache_file_path, open_temp_file_path);
} else { } else {
@@ -274,9 +547,7 @@ ipcMain.handle('open_hash_file_to_temp', async (event, host_file_cache_path, has
return false; return false;
} }
console.log(true);
console.log('End: Electron IPC Main: open_hash_file_to_temp()'); console.log('End: Electron IPC Main: open_hash_file_to_temp()');
// return 'Return from Electron IPC Main open_hash_file_to_temp()';
return true; return true;
}); });

4333
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -1,7 +1,7 @@
{ {
"name": "aether_app_native", "name": "aether_app_native",
"productName": "Aether App", "productName": "Aether App: Native",
"version": "3.0.0", "version": "2024.8.14.1",
"description": "One Sky IT's Native Aether App", "description": "One Sky IT's Native Aether App",
"main": "index.js", "main": "index.js",
"scripts": { "scripts": {
@@ -9,19 +9,17 @@
"start_nogpu": "electron . --disable-gpu", "start_nogpu": "electron . --disable-gpu",
"test": "echo \"Error: no test specified\" && exit 1" "test": "echo \"Error: no test specified\" && exit 1"
}, },
"author": "", "author": "Scott Idem",
"license": "ISC", "license": "ISC",
"dependencies": { "dependencies": {
"axios": "^0.26.0", "axios": "^1.1.2",
"fs": "0.0.1-security", "child_process": "^1.0.2",
"os": "^0.1.1", "fs": "^0.0.1-security",
"path": "^0.12.7", "os": "^0.1.2",
"request": "^2.88.2", "path": "^0.12.7"
"screen": "^0.2.10",
"usb": "^1.6.2"
}, },
"devDependencies": { "devDependencies": {
"electron": "^17.4.0", "electron": "^31.0.0",
"electron-packager": "^15.4.0" "electron-packager": "^17.1.2"
} }
} }

View File

@@ -1 +0,0 @@
test.txt file