summaryrefslogtreecommitdiffstats
path: root/dist
diff options
context:
space:
mode:
Diffstat (limited to 'dist')
-rwxr-xr-xdist/js/app.js2
-rw-r--r--dist/js/messaging.js90
-rwxr-xr-xdist/pages/about.html2
-rwxr-xr-xdist/pages/messaging.html1
-rwxr-xr-xdist/sw.js4
5 files changed, 61 insertions, 38 deletions
diff --git a/dist/js/app.js b/dist/js/app.js
index d9a5e16..09e4c86 100755
--- a/dist/js/app.js
+++ b/dist/js/app.js
@@ -3,7 +3,7 @@
const app_version = "1.0.13-beta";
-const previous_commit = "2eaa58fd631705101eeb6a946f548f936747c30e";
+const previous_commit = "5de19af5e33c527e4b47091b5eba010f002b73eb";
if ("serviceWorker" in navigator) {
navigator.serviceWorker.register("/sw.js")
diff --git a/dist/js/messaging.js b/dist/js/messaging.js
index 34963a3..dba57ef 100644
--- a/dist/js/messaging.js
+++ b/dist/js/messaging.js
@@ -38,40 +38,62 @@ function htmlDecode(value) {
// ---------------------------------
// Try to fetch name:id directory
-function loadDirectory() {
- $.ajax({
- url: DIRECTORY_URL,
- crossDomain: true,
-
- dataType: "json",
- cache: false,
- type: "GET",
-
- success: (data) => {
- // If we were able to retrieve it, update the saved directory
- localforage.setItem("directory", data);
- directory = data;
- // Populate autocomplete
- populateAutocomplete();
- },
-
- error: () => {
- // Otherwise, try to retrieve stored directory
- localforage.getItem("directory").then((stored_directory) => {
- if (stored_directory === null) {
- // If unable, set directory to null (so other functions know that we don't have it)
- UIAlert( D("nameDirectoryNotSet"), "loadDirectory(): stored_directory === null" );
- directory = null;
- // Disable send button
- document.getElementById("msg-send").disabled = true;
- } else {
- directory = stored_directory;
- // Populate autocomplete
- populateAutocomplete();
- }
- });
- }
- });
+async function loadDirectory() {
+ $.ajax({
+ url: DIRECTORY_URL,
+ crossDomain: true,
+ dataType: "json",
+ cache: false,
+ type: "GET",
+ success: async function (data) {
+ // If we were able to retrieve it, update the saved directory
+ let promises_to_run = [
+ localforage.getItem("username").then((value) => {
+ username = value;
+ }),
+ localforage.getItem("password").then((value) => {
+ password = value;
+ }),
+ localforage.getItem("grades").then((value) => {
+ grades = value;
+ })
+ ];
+ await Promise.all(promises_to_run);
+ var gsecdata;
+ try {
+ let gsecInstance = new gsec();
+ await gsecInstance.login(username, password);
+ gsecdata = await gsecInstance.fetchTeachersDirectory().catch( (err) => {
+ gsecErrorHandlerUI(err);
+ setLoading(false);
+ });
+ } catch (err) {
+ gsecErrorHandlerUI(err);
+ setLoading(false);
+ }
+ directory = {...gsecdata, ...data };
+ console.log(directory);
+ localforage.setItem("directory", directory);
+ // Populate autocomplete
+ populateAutocomplete();
+ },
+ error: () => {
+ // Otherwise, try to retrieve stored directory
+ localforage.getItem("directory").then((stored_directory) => {
+ if (stored_directory === null) {
+ // If unable, set directory to null (so other functions know that we don't have it)
+ UIAlert( D("nameDirectoryNotSet"), "loadDirectory(): stored_directory === null" );
+ directory = null;
+ // Disable send button
+ document.getElementById("msg-send").disabled = true;
+ } else {
+ directory = stored_directory;
+ // Populate autocomplete
+ populateAutocomplete();
+ }
+ });
+ }
+ });
}
function populateAutocomplete() {
diff --git a/dist/pages/about.html b/dist/pages/about.html
index 5229181..0618a8a 100755
--- a/dist/pages/about.html
+++ b/dist/pages/about.html
@@ -142,7 +142,7 @@
<div class="row">
<p>
<small>
- ^HEAD 2eaa58fd631705101eeb6a946f548f936747c30e
+ ^HEAD 5de19af5e33c527e4b47091b5eba010f002b73eb
</small>
</p>
</div>
diff --git a/dist/pages/messaging.html b/dist/pages/messaging.html
index 1fe716b..e3d98f2 100755
--- a/dist/pages/messaging.html
+++ b/dist/pages/messaging.html
@@ -27,6 +27,7 @@
<script src="/js/lang/bundle.js"></script>
<script src="/js/lib/xss.js"></script>
<script src="/js/lib/sjcl.js"></script>
+ <script src="/js/gsec.js"></script>
<link rel="shortcut icon" type="image/png" href="/favicon.png" />
<script type="text/javascript" src="/js/messaging.js"></script>
diff --git a/dist/sw.js b/dist/sw.js
index 719f3a1..f56988b 100755
--- a/dist/sw.js
+++ b/dist/sw.js
@@ -3,8 +3,8 @@
// Change version to cause cache refresh
-const static_cache_name = "site-static-1.0.13-beta-2eaa58f";
-// latest commit is 2eaa58fd631705101eeb6a946f548f936747c30e
+const static_cache_name = "site-static-1.0.13-beta-5de19af";
+// latest commit is 5de19af5e33c527e4b47091b5eba010f002b73eb
// Got them with find . -not -path '*/\.*' | sed "s/.*/\"&\",/" | grep -v sw.js
// sw.js NE SME BITI CACHAN, ker vsebuje verzijo!