181 lines
6.4 KiB
HTML
181 lines
6.4 KiB
HTML
<!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: macOS App</title>
|
|
|
|
<link rel="shortcut icon" type="image/png" href="img/favicon.ico">
|
|
|
|
<!-- Cascading Style Sheets (CSS) start -->
|
|
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css">
|
|
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.10.2/css/all.css">
|
|
|
|
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
|
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js"></script>
|
|
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js"></script>
|
|
|
|
<!-- One Sky IT default custom Cascading Style Sheets (CSS) -->
|
|
|
|
<!-- One Sky IT site custom Cascading Style Sheets (CSS) -->
|
|
<link rel="stylesheet" href="css/starter-template.css">
|
|
<link rel="stylesheet" href="css/style.css">
|
|
<link rel="stylesheet" href="css/launcher.css">
|
|
|
|
<style>
|
|
</style>
|
|
<!-- Cascading Style Sheets (CSS) end -->
|
|
</head>
|
|
|
|
<body>
|
|
|
|
<!--<main id="main_content" role="main" class="container">-->
|
|
<div id="main_content" class="container">
|
|
|
|
<div class="row">
|
|
<div id="location_title" class="location_title border-bottom">Launcher</div>
|
|
</div>
|
|
|
|
<div class="row">
|
|
<div id="location_menu" class="location_menu col-2 border-right">
|
|
|
|
<div id="event_files_menu" class="event_files_menu">
|
|
*event files
|
|
</div>
|
|
<div id="location_files_menu" class="location_files_menu">
|
|
*location files
|
|
</div>
|
|
<div id="sessions_menu" class="sessions_menu">
|
|
*sessions<br>
|
|
**session<br>
|
|
***session files<br>
|
|
***presentations<br>
|
|
****presentation<br>
|
|
*****presentation files<br>
|
|
*****presenters<br>
|
|
******presenter<br>
|
|
*******presenter files<br>
|
|
</div>
|
|
</div>
|
|
|
|
<div id="sessions_detail" class="sessions_detail col">
|
|
|
|
</div>
|
|
</div> <!-- end row div -->
|
|
|
|
</div>
|
|
<!--</main>--> <!-- /.container -->
|
|
|
|
|
|
|
|
<!-- JavaScript (JS) start -->
|
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/axios/0.15.3/axios.min.js" crossorigin></script>
|
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/date-fns/1.30.1/date_fns.min.js"></script>
|
|
|
|
<script src="https://webrtc.github.io/adapter/adapter-latest.js"></script>
|
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/socket.io/2.3.0/socket.io.js" crossorigin></script>
|
|
|
|
|
|
|
|
|
|
|
|
<!-- One Sky IT default custom JavaScript (JS) -->
|
|
<!-- One Sky IT site custom JavaScript (JS) -->
|
|
<script>const api = require('./js/module_api');</script>
|
|
<script src="js/api.js"></script>
|
|
<!--<script src="js/script.js"></script>-->
|
|
<script src="js/testing.js"></script>
|
|
|
|
<script>
|
|
// Development variables:
|
|
let event_id = 14;
|
|
let event_location_id = 13;
|
|
let event_session_id = 827;
|
|
let event_presentation_id = 2002;
|
|
let event_presenter_id = 2539;
|
|
let event_file_id = 28;
|
|
let api_base_url = 'http://192.168.1.7:5001'; // 'http://api.localhost:5001' 'https://api.oneskyit.com';
|
|
|
|
// Initialize variables:
|
|
//const { ipcRenderer } = require('electron');
|
|
//const os = require('os');
|
|
//const path = require('path');
|
|
//const fs = require('fs');
|
|
|
|
const secret_key = 'YWAAk39H2qH0edK6lPH0yg';
|
|
let api_temporary_token = null;
|
|
|
|
axios.defaults.baseURL = api_base_url;
|
|
axios.defaults.headers.post['Access-Control-Allow-Origin'] = '*';
|
|
|
|
api_temporary_token = api.api_token_request_async(axios, secret_key).then( function(result) {
|
|
console.log('Setting temporary API token to axios Authorization header: '+result);
|
|
axios.defaults.headers.common['Authorization'] = `Token ${result}`;
|
|
return result;
|
|
});
|
|
|
|
api_token_request_async().then( function(result) {
|
|
// Do something with result.
|
|
//get_all_events();
|
|
//get_event(event_id);
|
|
//get_event_sessions(event_id);
|
|
//get_event_files(event_id);
|
|
});
|
|
|
|
const loop_delay = 2000; // 2 seconds
|
|
// The datetime is when it should be checked again, not when it was last checked.
|
|
// It may be good to split the object check period into event, location, session, presentation, presenter
|
|
let launcher_object_check_datetime = Date.now(); // default to current datetime in ms
|
|
const launcher_object_check_period = 30000; // 60 seconds
|
|
// The datetime is when it should be checked again, not when it was last checked.
|
|
// It may be good to split the file check period into event, location, session, presentation, presenter
|
|
let launcher_files_check_datetime = Date.now(); // default to current datetime in ms
|
|
const launcher_files_check_period = 30000; // 30 seconds
|
|
const file_cache_path = 'file_cache/';
|
|
|
|
let launcher = new Object(); // This will create the something like location > sessions and location files > presenters and session files > presenter files
|
|
launcher.event_id = event_id;
|
|
launcher.event_location_id = event_location_id;
|
|
|
|
//let launcher_cache_check_results = false;
|
|
let launcher_render_results = false;
|
|
|
|
setInterval(async function() {
|
|
if (typeof axios.defaults.headers.common['Authorization'] !== 'undefined' && axios.defaults.headers.common['Authorization'] != null) {
|
|
|
|
current_datetime = Date.now();
|
|
//let launcher_cache_check_results = false;
|
|
|
|
if (launcher_object_check_datetime < current_datetime) {
|
|
launcher_cache_check_results = api.launcher_cache_check(launcher, api_base_url, api_temporary_token, file_cache_path);
|
|
|
|
launcher_cache_check_results.then(function (response) {
|
|
console.log(launcher);
|
|
launcher_object_check_datetime = Date.now() + launcher_object_check_period;
|
|
|
|
launcher_render_results = api.launcher_render(launcher);
|
|
|
|
});
|
|
|
|
|
|
}
|
|
|
|
} else {
|
|
console.log('Waiting '+loop_delay+'ms to see if Authorization header is set.');
|
|
}
|
|
}, loop_delay);
|
|
|
|
|
|
</script>
|
|
|
|
<script>
|
|
|
|
</script>
|
|
|
|
<!-- <script src="js/launcher.js"></script>-->
|
|
<!-- JavaScript (JS) end -->
|
|
|
|
</body>
|
|
</html>
|