From 4fb0b34fccc80b963b357ed432c6fdd8f4e18dee Mon Sep 17 00:00:00 2001 From: Fred Boniface Date: Tue, 4 Apr 2023 18:42:55 +0100 Subject: [PATCH 01/76] Closes Issue: Show train length (https://git.fjla.uk/OwlBoard/backend/issues/9) --- index.html | 4 +--- js/simple-board.js | 3 +++ 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/index.html b/index.html index ba7a9eb..fcc9db7 100644 --- a/index.html +++ b/index.html @@ -60,9 +60,7 @@
-

A cache error means that some users are seeing a faulty layout on departure board pages, - an update to fix this has been made available but it may take a few days for this fix to - be downloaded to your device. +

A fault with our bandwidth provider is causing intermittent connectivity. Apologies for any inconvenience.

Customise your quick links on the Settings page.

diff --git a/js/simple-board.js b/js/simple-board.js index fe62945..d6ee334 100644 --- a/js/simple-board.js +++ b/js/simple-board.js @@ -141,6 +141,9 @@ async function displayService(svc) { // Display Operator if (svc.operator) { var opRow = `

A ${svc.operator} service

` + if (svc.length) { + opRow += `, with ${svc.length} carriages`; + } table.insertAdjacentHTML("beforeend", opRow); } // Parse cancelReason & delayReason -- 2.34.1 From be31d7d854ba38e24bc905ddcc11ca4fbfd22ca7 Mon Sep 17 00:00:00 2001 From: Fred Boniface Date: Tue, 4 Apr 2023 18:49:24 +0100 Subject: [PATCH 02/76] Previous fix didn't work. Actually fixes https://git.fjla.uk/OwlBoard/backend/issues/9 this time. --- js/simple-board.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/js/simple-board.js b/js/simple-board.js index d6ee334..3c13afa 100644 --- a/js/simple-board.js +++ b/js/simple-board.js @@ -140,9 +140,11 @@ async function displayService(svc) { table.insertAdjacentHTML("beforeend", row) // Display Operator if (svc.operator) { - var opRow = `

A ${svc.operator} service

` + var opRow = `

A ${svc.operator} service` if (svc.length) { - opRow += `, with ${svc.length} carriages`; + opRow += ` with ${svc.length} carriages

`; + } else { + opRow += `

` } table.insertAdjacentHTML("beforeend", opRow); } -- 2.34.1 From 689340dbb434db89ecbe51c623b028008f3540b6 Mon Sep 17 00:00:00 2001 From: Fred Boniface Date: Tue, 4 Apr 2023 20:31:21 +0100 Subject: [PATCH 03/76] Begin implementation of auth page --- auth.html | 41 +++++++++++++++++++++++++++++++++++++++++ js/auth.js | 38 ++++++++++++++++++++++++++++++++++++++ sw.js | 4 +++- 3 files changed, 82 insertions(+), 1 deletion(-) create mode 100644 auth.html create mode 100644 js/auth.js diff --git a/auth.html b/auth.html new file mode 100644 index 0000000..ae5d5d1 --- /dev/null +++ b/auth.html @@ -0,0 +1,41 @@ + + + + + + + + + + + + + + + + OwlBoard + + + +
+
+
+

Registering

+
+ + + + + + + OwlBoard Logo + +
+

+
+ + + + diff --git a/js/auth.js b/js/auth.js new file mode 100644 index 0000000..91a85ea --- /dev/null +++ b/js/auth.js @@ -0,0 +1,38 @@ +const cmd = document.getElementById("cmd") +init(); + +async function sendHome(){ + await delay(2000); + location.replace('/') +} + +async function cmdOut(message) { + html = "

" + message + "

" + cmd.insertAdjacentHTML("beforeend", html) +} + +async function registerKey(key) { + var url = `${window.location.origin}/api/v1/auth/register`; + let res = await fetch(url, { + method: "POST", + headers: { + "Content-Type": "application/json" + }, + redirect: "follow", + body: JSON.stringify(key) + }) + if (res.JSON['result'] == "ok"){ + return true; + } else { + return false; + } +} + +async function init(){ + cmdOut("Reading registration key"); + const key = await getQuery("key"); + cmdOut(`Key: ${key}`) + cmdOut("Requesting API Key from server"); + let res = await registerKey(key); + console.log(JSON.stringify(res)) +} \ No newline at end of file diff --git a/sw.js b/sw.js index 9324685..08250ac 100644 --- a/sw.js +++ b/sw.js @@ -1,10 +1,11 @@ /* Service Worker */ -const appVersion = "1.2.4" +const appVersion = "1.3.0" const cacheName = `owlboard-${appVersion}`; const cacheIDs = [cacheName]; const cacheFiles = [ "/404.html", + "/auth.html", "/board.html", "/conn-err.html", "/help.html", @@ -28,6 +29,7 @@ const cacheFiles = [ "/js/issue.js", "/js/lib.board.js", "/js/lib.main.js", + "/js/auth.js", "/js/settings.js", "/js/simple-board.js", "/images/icon.svg", -- 2.34.1 From d7a0ba246fcd976067609412abd625f79e3d70a7 Mon Sep 17 00:00:00 2001 From: Fred Boniface Date: Tue, 4 Apr 2023 22:17:11 +0100 Subject: [PATCH 04/76] Bump version for auth compat --- index.html | 2 +- sw.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/index.html b/index.html index fcc9db7..63498c1 100644 --- a/index.html +++ b/index.html @@ -66,7 +66,7 @@ diff --git a/sw.js b/sw.js index 08250ac..b975e29 100644 --- a/sw.js +++ b/sw.js @@ -1,6 +1,6 @@ /* Service Worker */ -const appVersion = "1.3.0" +const appVersion = "2.0.0-dev" const cacheName = `owlboard-${appVersion}`; const cacheIDs = [cacheName]; const cacheFiles = [ -- 2.34.1 From d6806bf3b56135306c62003d4ce23b8b300f5c6e Mon Sep 17 00:00:00 2001 From: Fred Boniface Date: Wed, 5 Apr 2023 13:57:28 +0100 Subject: [PATCH 05/76] Extend settings.html and .js to include registration --- auth.html | 5 ++--- index.html | 2 +- js/lib.main.js | 10 ++++++++++ js/settings.js | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++ settings.html | 8 ++++++++ 5 files changed, 71 insertions(+), 4 deletions(-) diff --git a/auth.html b/auth.html index ae5d5d1..5bdff3c 100644 --- a/auth.html +++ b/auth.html @@ -30,12 +30,11 @@ OwlBoard Logo -
-

+
diff --git a/index.html b/index.html index 63498c1..6265e1c 100644 --- a/index.html +++ b/index.html @@ -66,7 +66,7 @@
diff --git a/js/lib.main.js b/js/lib.main.js index c1d9e0d..e197167 100644 --- a/js/lib.main.js +++ b/js/lib.main.js @@ -1,3 +1,7 @@ +/* All Page Init */ +const version = "2.0.0-dev"; +versionDisplay(); + /* Feature Detectors */ /* Valid values for ${type}: localstorage, sessionstorage */ @@ -16,6 +20,12 @@ async function storageAvailable(type) { // Currently not used } } +async function versionDisplay() { + localStorage.setItem("version", version) + document.getElementById('ver_str').textContent = version + return; +} + /* Array Converter Converts a string to a single item array */ async function makeArray(data) { diff --git a/js/settings.js b/js/settings.js index e053653..c261d54 100644 --- a/js/settings.js +++ b/js/settings.js @@ -3,6 +3,15 @@ const ql = ["ql0","ql1","ql2","ql3","ql4","ql5","ql6","ql7","ql8","ql9","ql10"," storageAvailable("localStorage"); getQl(); hideLoading(); +ifAlreadyRegistered(); + +async function ifAlreadyRegistered() { + if (! await isRegistered()) { return } else { + document.getElementsByName("eml")[0].placeholder = "Registered"; + document.getElementById("reg_text").textContent = "You are already registered"; + document.getElementById("reg_button").textContent = "Log Out"; + } +} async function getQl(){ var qlOpt = await getQuickLinks() @@ -48,6 +57,47 @@ async function clearQl(){ hideDone(); } +async function isRegistered() { + if (localStorage.getItem("uuid")) { + return true + // Also need an API Call here to check if auth is working. + } + localStorage.removeItem("uuid"); + return false +} + +async function register() { + if (! await isRegistered()) { + showLoading() + let url = `${window.location.origin}/api/v1/auth/request`; + let email = document.getElementById("eml").textContent + let res = await fetch(url, { + method: "POST", + headers: { + "Content-Type": "application/json" + }, + redirect: "follow", + body: JSON.stringify({email: email}) + }) + if (res.status == 201) { + showDone(); + } + // Need to send a post request to server with the email address + // the server responds with a 201 or a 401 response. + // Then the done popup can appear with a message asking the user + // to check their emails for the link. The link takes then to the + // auth page which has login in auth.js + } else { + logout() + } +} + +async function logout() { + localStorage.removeItem("uuid"); + location.reload(); + return +} + async function showDone() { document.getElementById("done").style = "opacity: 1"; } diff --git a/settings.html b/settings.html index 15cf967..9bba386 100644 --- a/settings.html +++ b/settings.html @@ -67,6 +67,14 @@
+


+
+

Enter your work email address:

+
+

Once you've registered you will receive an email with a link to create your access key.

+

Your email address is not stored by OwlBoard, accounts do not contain any identifying information and are automatically removed after six months of inactivity.

+

You can use the same email address again on another device to register.

+ \ No newline at end of file -- 2.34.1 From 632031d45387d2cc012bcb5bc814aa9047991ce3 Mon Sep 17 00:00:00 2001 From: Fred Boniface Date: Wed, 5 Apr 2023 16:10:21 +0100 Subject: [PATCH 06/76] Comment client side JS --- js/lib.main.js | 6 +++--- js/settings.js | 27 ++++++++++++++++----------- js/simple-board.js | 21 +++++++++++---------- js/stat.js | 6 +++--- 4 files changed, 33 insertions(+), 27 deletions(-) diff --git a/js/lib.main.js b/js/lib.main.js index e197167..92b1ced 100644 --- a/js/lib.main.js +++ b/js/lib.main.js @@ -20,7 +20,7 @@ async function storageAvailable(type) { // Currently not used } } -async function versionDisplay() { +async function versionDisplay() { // Outputs version string on to any page with a tag with id="ver_str" localStorage.setItem("version", version) document.getElementById('ver_str').textContent = version return; @@ -127,7 +127,7 @@ async function getQuery(param) { } } -async function vibe(type) { +async function vibe(type) { // Offers three standard vibration patterns for consistency let canVibrate = "vibrate" in navigator || "mozVibrate" in navigator if (canVibrate && !("vibrate" in navigator)){ navigator.vibrate = navigator.mozVibrate @@ -144,7 +144,7 @@ async function vibe(type) { } } -async function convertUnixLocal(unix) { +async function convertUnixLocal(unix) { // Convert unix time string to local var jsTime = unix*1000 var dt = new Date(jsTime) return dt.toLocaleString() diff --git a/js/settings.js b/js/settings.js index c261d54..ce57fc2 100644 --- a/js/settings.js +++ b/js/settings.js @@ -1,11 +1,16 @@ +// // Init: +// +// Setup quick links const ql = ["ql0","ql1","ql2","ql3","ql4","ql5","ql6","ql7","ql8","ql9","ql10","ql11"] storageAvailable("localStorage"); getQl(); -hideLoading(); +// Check if already registered ifAlreadyRegistered(); +// Hide loading +hideLoading(); -async function ifAlreadyRegistered() { +async function ifAlreadyRegistered() { // If already registered, show this on the page if (! await isRegistered()) { return } else { document.getElementsByName("eml")[0].placeholder = "Registered"; document.getElementById("reg_text").textContent = "You are already registered"; @@ -13,7 +18,7 @@ async function ifAlreadyRegistered() { } } -async function getQl(){ +async function getQl(){ // Fetch Quick Links from localstorage var qlOpt = await getQuickLinks() if (qlOpt){ var i = 0 @@ -26,8 +31,8 @@ async function getQl(){ } } -async function setQl(){ - await showLoading(); +async function setQl(){ // Fetch Quick Links from text input and save to localstorage + await showLoading();// called as an onclick function var qlSet = [] for (i in ql) { var opt = document.getElementById(`ql${i}`).value @@ -45,7 +50,7 @@ async function setQl(){ hideDone(); } -async function clearQl(){ +async function clearQl(){ // Clear Quick Links from localstorage showLoading(); localStorage.removeItem("qlOpt") log(`settings.setQl: User settings reset to default`, "INFO") @@ -57,7 +62,7 @@ async function clearQl(){ hideDone(); } -async function isRegistered() { +async function isRegistered() { // Check if a device is registered, returns BOOL if (localStorage.getItem("uuid")) { return true // Also need an API Call here to check if auth is working. @@ -66,7 +71,7 @@ async function isRegistered() { return false } -async function register() { +async function register() { // Registers a device by sending POST request to API Server if (! await isRegistered()) { showLoading() let url = `${window.location.origin}/api/v1/auth/request`; @@ -92,16 +97,16 @@ async function register() { } } -async function logout() { +async function logout() { // Simply removed the UUID from localstorage localStorage.removeItem("uuid"); location.reload(); return } -async function showDone() { +async function showDone() { // Diaplays the 'Done' dialogue. document.getElementById("done").style = "opacity: 1"; } -async function hideDone() { +async function hideDone() { // Hides the 'Done' dialogue. document.getElementById("done").style = "opacity: 0"; } \ No newline at end of file diff --git a/js/simple-board.js b/js/simple-board.js index 3c13afa..4308e9e 100644 --- a/js/simple-board.js +++ b/js/simple-board.js @@ -1,8 +1,9 @@ /* Page Init: */ +// Run the init function at page load. init() /* Init function */ -async function init() { +async function init() { // Gets query string and then fetch API response and pass to parsing function console.time("Time: Init to Complete") setLoadingDesc(`Loading\nservices`) var stn = await getQuery("stn"); @@ -87,7 +88,7 @@ async function buildPage(data) { } -async function displayTrains(data) { +async function displayTrains(data) { // Iterated through train services and passes API sections to other functions log(`simple-board.displayTrains: Inserting data in DOM`) for(var i = 0; i < data.length; i++) { // Reset Vars @@ -99,20 +100,20 @@ async function displayTrains(data) { log(`simple-board.displayTrains: Insertion complete`) } -async function displayFerry(ferrySvc) { +async function displayFerry(ferrySvc) { // Iterates through each ferry service and passes to another function for(var i = 0; i < ferrySvc.length; i++) { displayFerryService(ferrySvc[i]) } } -async function displayBus(busSvc) { +async function displayBus(busSvc) { // Iterates through each bus service and passes to other functions. for(var i = 0; i < busSvc.length; i++) { displayBusService(busSvc[i]) buildCallLists(busSvc[i]) } } -async function displayService(svc) { +async function displayService(svc) { // Creates a table row from each train service. var table = document.getElementById("output"); // Determine Time Message @@ -138,17 +139,17 @@ async function displayService(svc) { ` // Put Table Row table.insertAdjacentHTML("beforeend", row) - // Display Operator + // Display Operator where provided (it always will be, I think) if (svc.operator) { var opRow = `

A ${svc.operator} service` - if (svc.length) { + if (svc.length) { // Displays number of carriages where provided opRow += ` with ${svc.length} carriages

`; } else { opRow += `

` } table.insertAdjacentHTML("beforeend", opRow); } - // Parse cancelReason & delayReason + // Parse cancelReason and then delayReason if (svc.cancelReason) { var cancelRow = `

${svc.cancelReason}

` table.insertAdjacentHTML("beforeend", cancelRow); @@ -159,7 +160,7 @@ async function displayService(svc) { } } -async function displayFerryService(svc) { +async function displayFerryService(svc) { // Creates a table for for each ferry service var table = document.getElementById("ferry"); log(JSON.stringify(svc)) // Determine Time Message @@ -196,7 +197,7 @@ async function displayFerryService(svc) { document.getElementById("ferry").style = "display:block" } -async function displayBusService(svc) { +async function displayBusService(svc) { // Creates a table row for each bus service. var table = document.getElementById("bus"); log(JSON.stringify(svc)) // Determine Time Message diff --git a/js/stat.js b/js/stat.js index da34811..86ca7b2 100644 --- a/js/stat.js +++ b/js/stat.js @@ -1,16 +1,16 @@ init(); -async function init() { +async function init() { // The page init function display(await get()) } -async function get() { +async function get() { // Fetch data from API var url = `${window.location.origin}/api/v1/stats`; var resp = await fetch(url); return await resp.json(); } -async function display(data) { +async function display(data) { // Parses and displays data from API document.getElementById('server_host').textContent = data.host; document.getElementById('server_mode').textContent = data.mode || "Unknown"; document.getElementById('ver-bkend').textContent = data.verBkend || "Unknown"; -- 2.34.1 From c7f34c36219f0d1ef8c51795bafef6e8e6e56117 Mon Sep 17 00:00:00 2001 From: Fred Boniface Date: Wed, 5 Apr 2023 16:27:49 +0100 Subject: [PATCH 07/76] More comments to clear my confused brain --- js/auth.js | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/js/auth.js b/js/auth.js index 91a85ea..4d26fb1 100644 --- a/js/auth.js +++ b/js/auth.js @@ -1,5 +1,12 @@ -const cmd = document.getElementById("cmd") -init(); +/* +Auth process: User Requests Key => Server emails key to user => + user opens link on auth.html => + website POSTs key to server => Server checks validity => + Server responds with the users auth key => + auth.js adds this to localStorage +*/ +const cmd = document.getElementById("cmd") // Assign element to const +init(); // Run init function async function sendHome(){ await delay(2000); @@ -11,9 +18,9 @@ async function cmdOut(message) { cmd.insertAdjacentHTML("beforeend", html) } -async function registerKey(key) { +async function registerKey(key) { // Posts key to server and listens for response. var url = `${window.location.origin}/api/v1/auth/register`; - let res = await fetch(url, { + let res = await fetch(url, { // The response will contain the UUID which will be registered method: "POST", headers: { "Content-Type": "application/json" @@ -28,7 +35,7 @@ async function registerKey(key) { } } -async function init(){ +async function init(){ // Reads registration key from query, and calls registerKey(key) cmdOut("Reading registration key"); const key = await getQuery("key"); cmdOut(`Key: ${key}`) -- 2.34.1 From 8e079512ccd36d8544030ba7db4276f648999e4f Mon Sep 17 00:00:00 2001 From: Fred Boniface Date: Wed, 5 Apr 2023 21:10:32 +0100 Subject: [PATCH 08/76] Fix url for registration requests --- js/settings.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/js/settings.js b/js/settings.js index ce57fc2..cb23981 100644 --- a/js/settings.js +++ b/js/settings.js @@ -74,7 +74,7 @@ async function isRegistered() { // Check if a device is registered, returns BOOL async function register() { // Registers a device by sending POST request to API Server if (! await isRegistered()) { showLoading() - let url = `${window.location.origin}/api/v1/auth/request`; + let url = `${window.location.origin}/api/v1/register/request`; let email = document.getElementById("eml").textContent let res = await fetch(url, { method: "POST", -- 2.34.1 From 29d293c77f6a60f3276f5c76bddb3da2da8cc02b Mon Sep 17 00:00:00 2001 From: Fred Boniface Date: Wed, 5 Apr 2023 21:25:28 +0100 Subject: [PATCH 09/76] Fix URL for register in auth.js --- js/auth.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/js/auth.js b/js/auth.js index 4d26fb1..f2e4ed6 100644 --- a/js/auth.js +++ b/js/auth.js @@ -19,7 +19,7 @@ async function cmdOut(message) { } async function registerKey(key) { // Posts key to server and listens for response. - var url = `${window.location.origin}/api/v1/auth/register`; + var url = `${window.location.origin}/api/v1/register/register`; let res = await fetch(url, { // The response will contain the UUID which will be registered method: "POST", headers: { @@ -29,6 +29,7 @@ async function registerKey(key) { // Posts key to server and listens for respons body: JSON.stringify(key) }) if (res.JSON['result'] == "ok"){ + localStorage.setItem("uuid", res.JSON['uuid']) return true; } else { return false; -- 2.34.1 From 30a3bbb831ed360e3a061248643acaa3189d7c2b Mon Sep 17 00:00:00 2001 From: Fred Boniface Date: Wed, 5 Apr 2023 21:35:43 +0100 Subject: [PATCH 10/76] Code tidy --- js/auth.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/js/auth.js b/js/auth.js index f2e4ed6..2dba456 100644 --- a/js/auth.js +++ b/js/auth.js @@ -1,6 +1,6 @@ /* Auth process: User Requests Key => Server emails key to user => - user opens link on auth.html => + user opens link to auth.html => website POSTs key to server => Server checks validity => Server responds with the users auth key => auth.js adds this to localStorage -- 2.34.1 From 38a0cc55e2e4bfed2586f4fd04d4090023874c46 Mon Sep 17 00:00:00 2001 From: Fred Boniface Date: Thu, 6 Apr 2023 20:46:25 +0100 Subject: [PATCH 11/76] Add an unrequired semi-colon. Why? --- js/auth.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/js/auth.js b/js/auth.js index 2dba456..096722b 100644 --- a/js/auth.js +++ b/js/auth.js @@ -29,7 +29,7 @@ async function registerKey(key) { // Posts key to server and listens for respons body: JSON.stringify(key) }) if (res.JSON['result'] == "ok"){ - localStorage.setItem("uuid", res.JSON['uuid']) + localStorage.setItem("uuid", res.JSON['uuid']); return true; } else { return false; -- 2.34.1 From b7bf5a150d00b073bae7a6d3699b5af8198a7695 Mon Sep 17 00:00:00 2001 From: Fred Boniface Date: Fri, 7 Apr 2023 18:59:36 +0100 Subject: [PATCH 12/76] Fixes --- index.html | 25 ++++++++++++------------- js/auth.js | 18 +++++++++++++++++- js/settings.js | 9 ++++----- 3 files changed, 33 insertions(+), 19 deletions(-) diff --git a/index.html b/index.html index 6265e1c..58dd0c6 100644 --- a/index.html +++ b/index.html @@ -7,8 +7,8 @@ - - + + @@ -26,20 +26,20 @@
- - Open menu + + Open menu - - Close menu + + Close menu
@@ -47,7 +47,7 @@ - OwlBoard Logo + OwlBoard Logo
@@ -61,7 +61,6 @@

A fault with our bandwidth provider is causing intermittent connectivity. Apologies for any inconvenience.

-

Customise your quick links on the Settings page.

diff --git a/js/auth.js b/js/auth.js index 096722b..6e5608c 100644 --- a/js/auth.js +++ b/js/auth.js @@ -36,11 +36,27 @@ async function registerKey(key) { // Posts key to server and listens for respons } } +async function checkAuth(key) { + const url = `${window.location.origin}/api/v1/auth/test`; + const res = await fetch(url, { + method: "GET", + redirect: "follow", + headers: { + "uuid": key + } + }) + return res.status === 200 ? true : false +} + async function init(){ // Reads registration key from query, and calls registerKey(key) cmdOut("Reading registration key"); const key = await getQuery("key"); - cmdOut(`Key: ${key}`) + cmdOut(`Temporary: ${key}`) cmdOut("Requesting API Key from server"); let res = await registerKey(key); console.log(JSON.stringify(res)) + cmdOut("Checking key validity") + checkAuth(localStorage.getItem("uuid")) + ? cmdOut("Authentication succesful") + : cmdOut("Authentication failed") } \ No newline at end of file diff --git a/js/settings.js b/js/settings.js index cb23981..4410112 100644 --- a/js/settings.js +++ b/js/settings.js @@ -66,6 +66,7 @@ async function isRegistered() { // Check if a device is registered, returns BOOL if (localStorage.getItem("uuid")) { return true // Also need an API Call here to check if auth is working. + // A Suitable function exists in auth.js - move it to lib.main.js } localStorage.removeItem("uuid"); return false @@ -86,12 +87,10 @@ async function register() { // Registers a device by sending POST request to API }) if (res.status == 201) { showDone(); + hideLoading(); + return; } - // Need to send a post request to server with the email address - // the server responds with a 201 or a 401 response. - // Then the done popup can appear with a message asking the user - // to check their emails for the link. The link takes then to the - // auth page which has login in auth.js + log(`settings.register: Error: Fetch returned: ${res.status}`, "err") } else { logout() } -- 2.34.1 From 74fcbe6ac9257ac032962258dcfb409cd18443cf Mon Sep 17 00:00:00 2001 From: Fred Boniface Date: Fri, 7 Apr 2023 19:10:43 +0100 Subject: [PATCH 13/76] Shift around --- js/index.js | 1 + js/lib.main.js | 3 +-- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/js/index.js b/js/index.js index 6a29703..3eb9f67 100644 --- a/js/index.js +++ b/js/index.js @@ -1,5 +1,6 @@ // Init: pageInit(); +versionDisplay(); if ("serviceWorker" in navigator) { navigator.serviceWorker.register("/sw.js"); diff --git a/js/lib.main.js b/js/lib.main.js index 92b1ced..f9544e2 100644 --- a/js/lib.main.js +++ b/js/lib.main.js @@ -1,6 +1,5 @@ /* All Page Init */ const version = "2.0.0-dev"; -versionDisplay(); /* Feature Detectors */ @@ -46,7 +45,7 @@ const delay = ms => new Promise(res => setTimeout(res, ms)); /* Maintains backwards compatibility for previous implementation of log helper */ async function log(msg, type) { - const mode = "prod" + const mode = "dev" if (mode === "prod" && type != "ERR") { return; } -- 2.34.1 From 14752b4f4272bf21816185e5d77b9963dbd2a747 Mon Sep 17 00:00:00 2001 From: Fred Boniface Date: Fri, 7 Apr 2023 19:18:23 +0100 Subject: [PATCH 14/76] WHAT IS HAPPENING?!?!? --- js/settings.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/js/settings.js b/js/settings.js index 4410112..909e068 100644 --- a/js/settings.js +++ b/js/settings.js @@ -11,7 +11,9 @@ ifAlreadyRegistered(); hideLoading(); async function ifAlreadyRegistered() { // If already registered, show this on the page - if (! await isRegistered()) { return } else { + if (! await isRegistered()) { + return null + } else { document.getElementsByName("eml")[0].placeholder = "Registered"; document.getElementById("reg_text").textContent = "You are already registered"; document.getElementById("reg_button").textContent = "Log Out"; -- 2.34.1 From 7fbe592529a3016994c88f3e778b62d7e48a6565 Mon Sep 17 00:00:00 2001 From: Fred Boniface Date: Fri, 7 Apr 2023 21:15:33 +0100 Subject: [PATCH 15/76] Debugging --- js/auth.js | 26 +++++++++++++------------- js/index.js | 1 - js/settings.js | 2 +- 3 files changed, 14 insertions(+), 15 deletions(-) diff --git a/js/auth.js b/js/auth.js index 6e5608c..33e3d95 100644 --- a/js/auth.js +++ b/js/auth.js @@ -19,21 +19,19 @@ async function cmdOut(message) { } async function registerKey(key) { // Posts key to server and listens for response. - var url = `${window.location.origin}/api/v1/register/register`; - let res = await fetch(url, { // The response will contain the UUID which will be registered + const url = `${window.location.origin}/api/v1/register/register`; + const res = await fetch(url, { // The response will contain the UUID which will be registered method: "POST", headers: { "Content-Type": "application/json" }, redirect: "follow", - body: JSON.stringify(key) + body: JSON.stringify({uuid: key}) }) - if (res.JSON['result'] == "ok"){ - localStorage.setItem("uuid", res.JSON['uuid']); - return true; - } else { - return false; - } + const data = await res.json(); + return res.status === 201 + ? (localStorage.setItem("uuid", data.uuid), true) + : false; } async function checkAuth(key) { @@ -53,10 +51,12 @@ async function init(){ // Reads registration key from query, and calls registerK const key = await getQuery("key"); cmdOut(`Temporary: ${key}`) cmdOut("Requesting API Key from server"); - let res = await registerKey(key); - console.log(JSON.stringify(res)) - cmdOut("Checking key validity") - checkAuth(localStorage.getItem("uuid")) + if (!await registerKey(key)) { + cmdOut("Failed to register key") + hideLoading() + return + } + await checkAuth(localStorage.getItem("uuid")) ? cmdOut("Authentication succesful") : cmdOut("Authentication failed") } \ No newline at end of file diff --git a/js/index.js b/js/index.js index 3eb9f67..50b4817 100644 --- a/js/index.js +++ b/js/index.js @@ -9,7 +9,6 @@ if ("serviceWorker" in navigator) { async function pageInit() { await loadQuickLinks(); hideLoading(); // From lib.main - localStorage.setItem("ver-web", document.getElementById('ver_str').textContent) } async function gotoBoard(station){ diff --git a/js/settings.js b/js/settings.js index 909e068..5bfcded 100644 --- a/js/settings.js +++ b/js/settings.js @@ -78,7 +78,7 @@ async function register() { // Registers a device by sending POST request to API if (! await isRegistered()) { showLoading() let url = `${window.location.origin}/api/v1/register/request`; - let email = document.getElementById("eml").textContent + let email = document.getElementById("eml").value let res = await fetch(url, { method: "POST", headers: { -- 2.34.1 From 589a58d458d7900f923b1b708cf500798a7c8650 Mon Sep 17 00:00:00 2001 From: Fred Boniface Date: Fri, 7 Apr 2023 22:45:31 +0100 Subject: [PATCH 16/76] Minor adjustments --- js/auth.js | 20 ++++++++++++++------ js/lib.main.js | 2 +- 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/js/auth.js b/js/auth.js index 33e3d95..0ed6bb4 100644 --- a/js/auth.js +++ b/js/auth.js @@ -30,7 +30,7 @@ async function registerKey(key) { // Posts key to server and listens for respons }) const data = await res.json(); return res.status === 201 - ? (localStorage.setItem("uuid", data.uuid), true) + ? (localStorage.setItem("uuid", data.api_key), true) : false; } @@ -47,16 +47,24 @@ async function checkAuth(key) { } async function init(){ // Reads registration key from query, and calls registerKey(key) - cmdOut("Reading registration key"); + cmdOut("Reading authorisation code"); const key = await getQuery("key"); - cmdOut(`Temporary: ${key}`) cmdOut("Requesting API Key from server"); if (!await registerKey(key)) { cmdOut("Failed to register key") hideLoading() return } - await checkAuth(localStorage.getItem("uuid")) - ? cmdOut("Authentication succesful") - : cmdOut("Authentication failed") + showLoading() + if (! await checkAuth(localStorage.getItem("uuid"))) { + cmdOut("Authentication Check failed") + cmdOut("Please try again") + hideLoading() + await delay(2000) + location.replace("./") + } + hideLoading(); + cmdOut("Authentication succesful") + await delay(2000) + location.replace("./") } \ No newline at end of file diff --git a/js/lib.main.js b/js/lib.main.js index f9544e2..9cc9747 100644 --- a/js/lib.main.js +++ b/js/lib.main.js @@ -87,7 +87,7 @@ async function hideLoading() { /* DEPRECIATED: Alias for hideLoading() - Marked for removal*/ async function clearLoading() { log("Depreciated function called - clearLoading() - Alias to hideLoading()", "WARN") - await hideLoading(); + hideLoading(); } async function showLoading() { -- 2.34.1 From b529b41911154b9c2af26c3a4f62eb1d83884699 Mon Sep 17 00:00:00 2001 From: Fred Boniface Date: Fri, 7 Apr 2023 23:03:50 +0100 Subject: [PATCH 17/76] Bug squashing --- js/settings.js | 4 ++-- settings.html | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/js/settings.js b/js/settings.js index 5bfcded..bb0b2b6 100644 --- a/js/settings.js +++ b/js/settings.js @@ -105,9 +105,9 @@ async function logout() { // Simply removed the UUID from localstorage } async function showDone() { // Diaplays the 'Done' dialogue. - document.getElementById("done").style = "opacity: 1"; + document.getElementById("done").style = "opacity: 1; display: block"; } async function hideDone() { // Hides the 'Done' dialogue. - document.getElementById("done").style = "opacity: 0"; + document.getElementById("done").style = "opacity: 0; display: none"; } \ No newline at end of file diff --git a/settings.html b/settings.html index 9bba386..9648367 100644 --- a/settings.html +++ b/settings.html @@ -68,12 +68,12 @@


-
+

Enter your work email address:


Once you've registered you will receive an email with a link to create your access key.

-

Your email address is not stored by OwlBoard, accounts do not contain any identifying information and are automatically removed after six months of inactivity.

-

You can use the same email address again on another device to register.

+

Your email address is not stored by OwlBoard, accounts do not contain any identifying information and are automatically removed after three months of inactivity.

+

You can use the same email address again on multiple devices.

-- 2.34.1 From dd61bd3af750486565fd4813b312cdead048c2b0 Mon Sep 17 00:00:00 2001 From: Fred Boniface Date: Mon, 10 Apr 2023 20:30:17 +0100 Subject: [PATCH 18/76] Adjust reg messaging on settings.html --- js/settings.js | 5 +++-- settings.html | 8 ++++---- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/js/settings.js b/js/settings.js index bb0b2b6..701aa1b 100644 --- a/js/settings.js +++ b/js/settings.js @@ -91,8 +91,9 @@ async function register() { // Registers a device by sending POST request to API showDone(); hideLoading(); return; - } - log(`settings.register: Error: Fetch returned: ${res.status}`, "err") + } else if (res.status == 403) + log(`settings.register: Error: Fetch returned: ${res.body['errorCode']}`, "err") + document.getElementsByName("eml")[0].placeholder = "Not Authorised"; } else { logout() } diff --git a/settings.html b/settings.html index 9648367..b2d05c4 100644 --- a/settings.html +++ b/settings.html @@ -71,10 +71,10 @@

Enter your work email address:


-

Once you've registered you will receive an email with a link to create your access key.

-

Your email address is not stored by OwlBoard, accounts do not contain any identifying information and are automatically removed after three months of inactivity.

-

You can use the same email address again on multiple devices.

+

One registration confirmation email will be sent which will include more details about your account

+

Your address will not be stored

+

If your domain is not authorised and you are a using a railway company email address, + submit an issue and it can be added.

- \ No newline at end of file -- 2.34.1 From 4b297508f091a6ef8cc5a6b76272fe1e5650781f Mon Sep 17 00:00:00 2001 From: Fred Boniface Date: Mon, 10 Apr 2023 20:30:44 +0100 Subject: [PATCH 19/76] Remove fault message from index --- index.html | 1 - 1 file changed, 1 deletion(-) diff --git a/index.html b/index.html index 58dd0c6..8d04509 100644 --- a/index.html +++ b/index.html @@ -60,7 +60,6 @@
-

A fault with our bandwidth provider is causing intermittent connectivity. Apologies for any inconvenience.

Customise your quick links on the Settings page.

-- 2.34.1 From 259a7a0db0283314acdbd2561625c0092ac65021 Mon Sep 17 00:00:00 2001 From: Fred Boniface Date: Mon, 10 Apr 2023 20:40:49 +0100 Subject: [PATCH 20/76] Fix CSS bug on settings.html --- styles/settings.css | 1 + 1 file changed, 1 insertion(+) diff --git a/styles/settings.css b/styles/settings.css index 0ba70b7..104ad5d 100644 --- a/styles/settings.css +++ b/styles/settings.css @@ -5,6 +5,7 @@ #done { opacity: 0; + display: none; position: fixed; top: 50%; left: 50%; -- 2.34.1 From 8c572c2eaa142c46f6f6bbaaccfc8e2b19b09a9b Mon Sep 17 00:00:00 2001 From: Fred Boniface Date: Mon, 10 Apr 2023 20:42:19 +0100 Subject: [PATCH 21/76] Fix settings.js bug --- js/settings.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/js/settings.js b/js/settings.js index 701aa1b..9f0d683 100644 --- a/js/settings.js +++ b/js/settings.js @@ -91,9 +91,10 @@ async function register() { // Registers a device by sending POST request to API showDone(); hideLoading(); return; - } else if (res.status == 403) - log(`settings.register: Error: Fetch returned: ${res.body['errorCode']}`, "err") - document.getElementsByName("eml")[0].placeholder = "Not Authorised"; + } else if (res.status == 403) { + log(`settings.register: Error: Fetch returned: ${res.body['errorCode']}`, "err") + document.getElementsByName("eml")[0].placeholder = "Not Authorised"; + } } else { logout() } -- 2.34.1 From bec341c4d6078b29d9fc9c7a56e811a4e4f0b4a4 Mon Sep 17 00:00:00 2001 From: Fred Boniface Date: Mon, 10 Apr 2023 20:42:58 +0100 Subject: [PATCH 22/76] Fix spacing --- js/settings.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/js/settings.js b/js/settings.js index 9f0d683..0d6d003 100644 --- a/js/settings.js +++ b/js/settings.js @@ -97,7 +97,7 @@ async function register() { // Registers a device by sending POST request to API } } else { logout() - } + } } async function logout() { // Simply removed the UUID from localstorage -- 2.34.1 From e466a5437423e5b341778783ccba9862076f7daf Mon Sep 17 00:00:00 2001 From: Fred Boniface Date: Tue, 11 Apr 2023 20:20:47 +0100 Subject: [PATCH 23/76] Update auth page and scripts --- auth.html | 8 ++++++++ js/auth.js | 7 +++++++ 2 files changed, 15 insertions(+) diff --git a/auth.html b/auth.html index 5bdff3c..a91528e 100644 --- a/auth.html +++ b/auth.html @@ -24,6 +24,14 @@ + diff --git a/js/auth.js b/js/auth.js index 0ed6bb4..8e8fc2f 100644 --- a/js/auth.js +++ b/js/auth.js @@ -49,6 +49,13 @@ async function checkAuth(key) { async function init(){ // Reads registration key from query, and calls registerKey(key) cmdOut("Reading authorisation code"); const key = await getQuery("key"); + if (key === "false") { + cmdOut("No valid key found") + cmdOut("Try clicking the link again") + cmdOut("or request a new activation link") + hideLoading() + return + } cmdOut("Requesting API Key from server"); if (!await registerKey(key)) { cmdOut("Failed to register key") -- 2.34.1 From ada28e034c478085e79608f542ba0728403f2da6 Mon Sep 17 00:00:00 2001 From: Fred Boniface Date: Tue, 11 Apr 2023 21:00:07 +0100 Subject: [PATCH 24/76] Minor adjustments --- auth.html | 6 +++--- js/auth.js | 56 +++++++++++++++++++++++++----------------------- styles/board.css | 7 ------ styles/main.css | 6 ++++++ 4 files changed, 38 insertions(+), 37 deletions(-) diff --git a/auth.html b/auth.html index a91528e..7572510 100644 --- a/auth.html +++ b/auth.html @@ -26,9 +26,9 @@ diff --git a/js/auth.js b/js/auth.js index 8e8fc2f..5b25a09 100644 --- a/js/auth.js +++ b/js/auth.js @@ -6,11 +6,12 @@ Auth process: User Requests Key => Server emails key to user => auth.js adds this to localStorage */ const cmd = document.getElementById("cmd") // Assign element to const +versionDisplay(); // Show web version in footer init(); // Run init function async function sendHome(){ await delay(2000); - location.replace('/') + location.replace('./') } async function cmdOut(message) { @@ -47,31 +48,32 @@ async function checkAuth(key) { } async function init(){ // Reads registration key from query, and calls registerKey(key) - cmdOut("Reading authorisation code"); - const key = await getQuery("key"); - if (key === "false") { - cmdOut("No valid key found") - cmdOut("Try clicking the link again") - cmdOut("or request a new activation link") - hideLoading() - return - } - cmdOut("Requesting API Key from server"); - if (!await registerKey(key)) { - cmdOut("Failed to register key") - hideLoading() - return - } - showLoading() - if (! await checkAuth(localStorage.getItem("uuid"))) { - cmdOut("Authentication Check failed") - cmdOut("Please try again") - hideLoading() - await delay(2000) + cmdOut("Reading authorisation code"); + const key = await getQuery("key"); + if (key === "false") { + cmdOut("No valid key found") + cmdOut("Try clicking the link again or request a new activation link") + hideLoading() + return + } + cmdOut("Requesting API Key from server"); + if (!await registerKey(key)) { + cmdOut("Failed to register or invalid key") + cmdOut("Try again later or request a new link") + hideLoading() + return + } + showLoading() + if (! await checkAuth(localStorage.getItem("uuid"))) { + cmdOut("Authentication Check failed") + cmdOut("Please logout and request a new link") + hideLoading() + await delay(2000) + location.replace("./") + } + hideLoading(); + cmdOut("Authentication succesful") + cmdOut("Redirecting to home") + await delay(3000) location.replace("./") - } - hideLoading(); - cmdOut("Authentication succesful") - await delay(2000) - location.replace("./") } \ No newline at end of file diff --git a/styles/board.css b/styles/board.css index fe946bf..19dd40b 100644 --- a/styles/board.css +++ b/styles/board.css @@ -76,13 +76,6 @@ height: 25px; } -#home_icon { - position: absolute; - width: 30px; - right: 10px; - top: 10px; -} - .header-small { text-align: right; padding-right: 5px; diff --git a/styles/main.css b/styles/main.css index f38a7a2..e32ff31 100644 --- a/styles/main.css +++ b/styles/main.css @@ -106,6 +106,12 @@ body { } body a {color:var(--link-color)} body a:visited {color:var(--link-visited-color)} +#home_icon { + position: absolute; + width: 30px; + right: 10px; + top: 10px; +} .titleimg { width: 45%; padding-top: 20px; -- 2.34.1 From 72534805d9843ab44ec7dd441d583b071ca1c21f Mon Sep 17 00:00:00 2001 From: Fred Boniface Date: Tue, 11 Apr 2023 21:36:26 +0100 Subject: [PATCH 25/76] Add staff board type --- board-staff.html | 134 ++++++++++++++++++++++++++ js/staff-board.js | 240 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 374 insertions(+) create mode 100644 board-staff.html create mode 100644 js/staff-board.js diff --git a/board-staff.html b/board-staff.html new file mode 100644 index 0000000..111d695 --- /dev/null +++ b/board-staff.html @@ -0,0 +1,134 @@ + + + + + + + + + + OwlBoard - Loading + + + + + + + + + + +
+
+
+

\nLoading

+
+ +
+ + +
+
+ + + + +

+ +
+
+
+
+ +
+ + + + + + + + + + + + +
Train Services
HeadcodeOriginDest.Plat.Sch Arr.Exp Arr.Sch Dep.Exp Dep.
+
+ +
+

There are no scheduled train services from this station

+
+ +
+ + + + + + + + + + + +
Ferry Services
OriginDest.Sch Arr.Exp Arr.Sch Dep.Exp Dep.
+
+ +
+ + + + + + + + + + + + +
Bus Services
HeadcodeOriginDest.Sch Arr.Exp Arr.Sch Dep.Exp Dep.
+
+ +
+

Oops

+

There was an error with your request

+

You are not authorised to view staff versions, you can sign up in settings

+

The station you are searching for cannot be found

+

The station has no data. It may not be in operation yet/anymore.

+

Connection Error, check your data connection. Retrying.

+
+ + +
+ + \ No newline at end of file diff --git a/js/staff-board.js b/js/staff-board.js new file mode 100644 index 0000000..4308e9e --- /dev/null +++ b/js/staff-board.js @@ -0,0 +1,240 @@ +/* Page Init: */ +// Run the init function at page load. +init() + +/* Init function */ +async function init() { // Gets query string and then fetch API response and pass to parsing function + console.time("Time: Init to Complete") + setLoadingDesc(`Loading\nservices`) + var stn = await getQuery("stn"); + setLoadingDesc(`Loading\n${stn.toUpperCase()}`) + log(`init: Looking up: ${stn}`); + var sv = await getQuery("sv"); + log(`init: Staff Version: ${sv}`); + if (sv === 'true') { + log("init: Staff Version not supported yet.") + log("init: Unable to proceed.") + } else { + try { + var data = await publicLdb(stn) + setLoadingDesc(`${stn.toUpperCase()}\nParsing Data`) + log("simple-board.init: Fetched LDB Data", "INFO") + } catch (err) { + var data = "err" + setLoadingDesc(`Waiting\nConnection`) + log(`simple-board.init: Error fetching data: ${err}`, "ERR") + } + parseLdb(data) + } +} + +/* Check for any errors in data returned from the Fetch call + If no errors, if there are none, call buildPage(). */ +async function parseLdb(data) { + if (data.ERROR == "NOT_FOUND") { // Station not found + hideLoading(); + document.getElementById("error_notice").style = "display: block;"; + document.getElementById("err_not_found").style = "display: block;"; + setHeaders("Not Found",new Date()) + } else if (data == false) { // No data for station + hideLoading(); + document.getElementById("error_notice").style = "display: block;"; + document.getElementById("err_no_data").style = "display:block;"; + setHeaders("No Data",new Date()) + } else if (data == "err") { // Connection Error + await delay(2000); + hideLoading(); + document.getElementById("error_notice").style = "display: block;"; + document.getElementById("err_conn").style = "display: block;"; + setHeaders("Connection Error",new Date()) + showLoading(); + await delay(5000); + log(`parseLdb: Passing to error handler`, "ERR") + errorHandler(); + } else { + buildPage(data); + } +} + +// Build and Display Functions +async function buildPage(data) { + setLoadingDesc('Loading\nData') + var stationName = data.GetStationBoardResult.locationName; + log(`buildPage: Data ready for ${stationName}`); + var generateTime = new Date(await data.GetStationBoardResult.generatedAt); + log(`buildPage: Data prepared at ${generateTime.toLocaleString()}`) + setHeaders(stationName, generateTime); + // Check for notices and if true pass to function + if (data.GetStationBoardResult.nrccMessages) { + setLoadingDesc('Loading\nAlerts') + await displayAlerts(await makeArray(data.GetStationBoardResult.nrccMessages.message)); + } + if (data.GetStationBoardResult.trainServices) { + setLoadingDesc('Loading\nTrains') + displayTrains(await makeArray(data.GetStationBoardResult.trainServices.service)) + } else { + displayNoTrains() + } + if (data.GetStationBoardResult.ferryServices) { + setLoadingDesc('Loading\nFerries') + displayFerry(await makeArray(data.GetStationBoardResult.ferryServices.service)) + } + if (data.GetStationBoardResult.busServices) { + setLoadingDesc('Loading\nBusses') + displayBus(await makeArray(data.GetStationBoardResult.busServices.service)) + } + hideLoading(); + console.timeEnd("Time: Init to Complete") +} + + +async function displayTrains(data) { // Iterated through train services and passes API sections to other functions + log(`simple-board.displayTrains: Inserting data in DOM`) + for(var i = 0; i < data.length; i++) { + // Reset Vars + var svc = data[i]; + displayService(svc); + buildCallLists(svc); + } + document.getElementById("output").style = "display:block;"; + log(`simple-board.displayTrains: Insertion complete`) +} + +async function displayFerry(ferrySvc) { // Iterates through each ferry service and passes to another function + for(var i = 0; i < ferrySvc.length; i++) { + displayFerryService(ferrySvc[i]) + } +} + +async function displayBus(busSvc) { // Iterates through each bus service and passes to other functions. + for(var i = 0; i < busSvc.length; i++) { + displayBusService(busSvc[i]) + buildCallLists(busSvc[i]) + } +} + +async function displayService(svc) { // Creates a table row from each train service. + var table = document.getElementById("output"); + + // Determine Time Message + var sta = await parseTime(svc.sta); + var eta = await parseTime(svc.eta); + var std = await parseTime(svc.std); + var etd = await parseTime(svc.etd); + // Determine Platform Message + //if (svc.platform != undefined){var plt = svc.platform} else {var plt = "-"}; + var plt = await parsePlatform(svc); + // Define Table Row + var row = ` + + + + + + + + + + +
${await parseName(svc.origin.location)}${await parseName(svc.destination.location)}${plt.num}${sta.data}${eta.data}${std.data}${etd.data}
` + // Put Table Row + table.insertAdjacentHTML("beforeend", row) + // Display Operator where provided (it always will be, I think) + if (svc.operator) { + var opRow = `

A ${svc.operator} service` + if (svc.length) { // Displays number of carriages where provided + opRow += ` with ${svc.length} carriages

`; + } else { + opRow += `

` + } + table.insertAdjacentHTML("beforeend", opRow); + } + // Parse cancelReason and then delayReason + if (svc.cancelReason) { + var cancelRow = `

${svc.cancelReason}

` + table.insertAdjacentHTML("beforeend", cancelRow); + } + if (svc.delayReason) { + var delayRow = `

${svc.delayReason}

` + table.insertAdjacentHTML("beforeend", delayRow); + } +} + +async function displayFerryService(svc) { // Creates a table for for each ferry service + var table = document.getElementById("ferry"); + log(JSON.stringify(svc)) + // Determine Time Message + var sta = await parseTime(svc.sta); + var eta = await parseTime(svc.eta); + var std = await parseTime(svc.std); + var etd = await parseTime(svc.etd); + // Determine Platform Message + var plt = ""; + // Define Table Row + var row = ` + + + + + + + + + + +
${await parseName(svc.origin.location)}${await parseName(svc.destination.location)}${plt}${sta.data}${eta.data}${std.data}${etd.data}
` + // Put Table Row + table.insertAdjacentHTML("beforeend", row) + // Parse cancelReason & delayReason + if (svc.cancelReason) { + var cancelRow = `

${svc.cancelReason}

` + table.insertAdjacentHTML("beforeend", cancelRow); + } + if (svc.delayReason) { + var delayRow = `

${svc.delayReason}

` + table.insertAdjacentHTML("beforeend", delayRow); + } + document.getElementById("ferry").style = "display:block" +} + +async function displayBusService(svc) { // Creates a table row for each bus service. + var table = document.getElementById("bus"); + log(JSON.stringify(svc)) + // Determine Time Message + var sta = await parseTime(svc.sta); + var eta = await parseTime(svc.eta); + var std = await parseTime(svc.std); + var etd = await parseTime(svc.etd); + // Determine Platform Message + var plt = ""; + // Define Table Row + var row = ` + + + + + + + + + + +
${svc.origin.location.locationName}${svc.destination.location.locationName}${plt}${sta.data}${eta.data}${std.data}${etd.data}
` + // Put Table Row + table.insertAdjacentHTML("beforeend", row) + // Display operator + if (svc.operator) { + var opRow = `

A ${svc.operator} service

` + table.insertAdjacentHTML("beforeend", opRow); + } + // Parse cancelReason & delayReason + if (svc.cancelReason) { + var cancelRow = `

${svc.cancelReason}

` + table.insertAdjacentHTML("beforeend", cancelRow); + } + if (svc.delayReason) { + var delayRow = `

${svc.delayReason}

` + table.insertAdjacentHTML("beforeend", delayRow); + } + document.getElementById("bus").style = "display:block" +} \ No newline at end of file -- 2.34.1 From 1c8839ca1794db966a3118923c5e7eae896e9651 Mon Sep 17 00:00:00 2001 From: Fred Boniface Date: Sat, 22 Apr 2023 21:46:34 +0100 Subject: [PATCH 26/76] Add PIS Page and some logic --- js/lib.main.js | 46 ++++++++++++++++++++++++++++++++-- js/pis.js | 37 +++++++++++++++++++++++++++ pis.html | 68 ++++++++++++++++++++++++++++++++++++++++++++++++++ styles/pis.css | 7 ++++++ 4 files changed, 156 insertions(+), 2 deletions(-) create mode 100644 js/pis.js create mode 100644 pis.html create mode 100644 styles/pis.css diff --git a/js/lib.main.js b/js/lib.main.js index 9cc9747..e69940f 100644 --- a/js/lib.main.js +++ b/js/lib.main.js @@ -45,7 +45,7 @@ const delay = ms => new Promise(res => setTimeout(res, ms)); /* Maintains backwards compatibility for previous implementation of log helper */ async function log(msg, type) { - const mode = "dev" + const mode = "tst" if (mode === "prod" && type != "ERR") { return; } @@ -126,7 +126,49 @@ async function getQuery(param) { } } -async function vibe(type) { // Offers three standard vibration patterns for consistency +async function getApi(path,auth = false) { + let apiVer = 'v1' + let url = `https://${window.location.origin}/api/${apiVer}/${path}` + log(`getApi: Fetching from endpoint: ${url}, Auth=${auth}`) + try { + var resp = await fetch(url) + if (resp != 200) { + return false + } + if (!resp.ok) { + return false + } + if (resp.json() === "[]") { + return 'empty' + } + return resp.json(); + } catch(err) { + return false + } +} + +async function getApi(path,auth = false) { + let apiVer = 'v1' + let url = `https://${window.location.origin}/api/${apiVer}/${path}` + log(`getApi: Fetching from endpoint: ${url}, Auth=${auth}`) + try { + var resp = await fetch(url) + if (resp != 200) { + return false + } + if (!resp.ok) { + return false + } + if (resp.json() === "[]") { + return 'empty' + } + return resp.json(); + } catch(err) { + return false + } +} + +async function vibe(type) { let canVibrate = "vibrate" in navigator || "mozVibrate" in navigator if (canVibrate && !("vibrate" in navigator)){ navigator.vibrate = navigator.mozVibrate diff --git a/js/pis.js b/js/pis.js new file mode 100644 index 0000000..259aabb --- /dev/null +++ b/js/pis.js @@ -0,0 +1,37 @@ +hideLoading() + +async function findByOrigDest() { + showLoading() + const formData = await fetchOrigDest() + log(`findByOrigDest: Searching for PIS Code for ${JSON.stringify(formData)}`) + const endpoint = `pis/${formData.origin}/${formData.destination}` + const json = await getApi(endpoint) + if (json == false) { + await noData() + } else { + await displayData(json) + } + document.getElementById('crs-box').style = 'display:none' + document.getElementById('result-box').style = 'display:block' + hideLoading() +} + +async function fetchOrigDest() { + var orig = document.getElementById("origin").value + var dest = document.getElementById("destination").value + return {origin: orig, destination: dest} +} + +async function displayData(json) { + log(`displayData: ${JSON.stringify(json)}`) +} + +async function noData() { + msg = '

No results found

' + document.getElementById('result-box').insertAdjacentHTML("beforeend", msg) +} + +async function reset() { + document.getElementById('result-box').style = 'display:none' + document.getElementById('crs-box').style = 'display:block' +} \ No newline at end of file diff --git a/pis.html b/pis.html new file mode 100644 index 0000000..bddeee8 --- /dev/null +++ b/pis.html @@ -0,0 +1,68 @@ + + + + + + + + + + + + + + + OwlBoard - PIS + + + + + + + + + + + + + OwlBoard Logo + +

PIS Codes

+ +
+
+
+

Searching

+
+ +
+

Enter a services start and end CRS stations to see code options and + stopping patterns.

+

Currently supported (Beta): GWR Bristol Metro region only.

+
+

+
+

+ +
+ +
+

Results

+ +
+ + + + + + \ No newline at end of file diff --git a/styles/pis.css b/styles/pis.css new file mode 100644 index 0000000..8c42fb8 --- /dev/null +++ b/styles/pis.css @@ -0,0 +1,7 @@ +#crs-boxes { + display: block; +} + +#result-box { + display: none; +} \ No newline at end of file -- 2.34.1 From f4d008704009e57e433305037618534410541d70 Mon Sep 17 00:00:00 2001 From: Fred Boniface Date: Sat, 22 Apr 2023 21:48:55 +0100 Subject: [PATCH 27/76] Add notes --- js/pis.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/js/pis.js b/js/pis.js index 259aabb..a6c8a06 100644 --- a/js/pis.js +++ b/js/pis.js @@ -23,6 +23,9 @@ async function fetchOrigDest() { } async function displayData(json) { + // Receives the JSON Respose ([{},{}]) containing one or more possible + // PIS codes. Display the code and the stops with a method of scrolling between them. + // Maybe as a table or a carousel? log(`displayData: ${JSON.stringify(json)}`) } -- 2.34.1 From 4ee0fea66f4c1756295eef03a6380b6f43d38fdc Mon Sep 17 00:00:00 2001 From: Fred Boniface Date: Sat, 22 Apr 2023 21:52:42 +0100 Subject: [PATCH 28/76] Change page wording --- js/pis.js | 2 ++ pis.html | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/js/pis.js b/js/pis.js index a6c8a06..4486d7c 100644 --- a/js/pis.js +++ b/js/pis.js @@ -35,6 +35,8 @@ async function noData() { } async function reset() { + document.getElementById('origin').value = "" + document.getElementById('destination').value = "" document.getElementById('result-box').style = 'display:none' document.getElementById('crs-box').style = 'display:block' } \ No newline at end of file diff --git a/pis.html b/pis.html index bddeee8..2819fea 100644 --- a/pis.html +++ b/pis.html @@ -43,7 +43,7 @@
-

Enter a services start and end CRS stations to see code options and +

Enter a services start and end station CRS codes to see code options and stopping patterns.

Currently supported (Beta): GWR Bristol Metro region only.


-- 2.34.1 From d56af14f4fb466afc88564c5b94c090420c2aacb Mon Sep 17 00:00:00 2001 From: Fred Boniface Date: Sat, 22 Apr 2023 21:57:33 +0100 Subject: [PATCH 29/76] Change meta description --- index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.html b/index.html index 8d04509..4e7753f 100644 --- a/index.html +++ b/index.html @@ -2,7 +2,7 @@ - + -- 2.34.1 From 3447c7fa6df70ae482a99d8977fe77760f75566a Mon Sep 17 00:00:00 2001 From: Fred Boniface Date: Sat, 22 Apr 2023 21:58:28 +0100 Subject: [PATCH 30/76] Update meta Description --- pis.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pis.html b/pis.html index 2819fea..14367f6 100644 --- a/pis.html +++ b/pis.html @@ -2,7 +2,7 @@ - + -- 2.34.1 From fe4e271bc95d1375a2e7aca13928c5eb50ff4b27 Mon Sep 17 00:00:00 2001 From: Fred Boniface Date: Sat, 22 Apr 2023 22:01:23 +0100 Subject: [PATCH 31/76] Adjust meta tags, particularly robot tags --- 404.html | 1 + board.html | 1 + conn-err.html | 1 + find-code.html | 2 +- help.html | 3 ++- issue.html | 3 ++- settings.html | 3 ++- stat.html | 1 + 8 files changed, 11 insertions(+), 4 deletions(-) diff --git a/404.html b/404.html index 0ba9f97..dd6f42c 100644 --- a/404.html +++ b/404.html @@ -2,6 +2,7 @@ + diff --git a/board.html b/board.html index 29f3d76..bbac91e 100644 --- a/board.html +++ b/board.html @@ -3,6 +3,7 @@ + diff --git a/conn-err.html b/conn-err.html index ab9797d..65f3629 100644 --- a/conn-err.html +++ b/conn-err.html @@ -2,6 +2,7 @@ + diff --git a/find-code.html b/find-code.html index c1167f2..bee7412 100644 --- a/find-code.html +++ b/find-code.html @@ -2,7 +2,7 @@ - + diff --git a/help.html b/help.html index d52d5d2..479604f 100644 --- a/help.html +++ b/help.html @@ -2,7 +2,8 @@ - + + diff --git a/issue.html b/issue.html index c59c79c..e27e1da 100644 --- a/issue.html +++ b/issue.html @@ -1,7 +1,8 @@ - + + diff --git a/settings.html b/settings.html index b2d05c4..4e0487d 100644 --- a/settings.html +++ b/settings.html @@ -2,7 +2,8 @@ - + + diff --git a/stat.html b/stat.html index 378f1f0..1ec42fd 100644 --- a/stat.html +++ b/stat.html @@ -2,6 +2,7 @@ + OwlBoard - Statistics -- 2.34.1 From 0bf39fbffde181dfb990eaf3ab7fb82364730671 Mon Sep 17 00:00:00 2001 From: Fred Boniface Date: Sat, 22 Apr 2023 22:03:54 +0100 Subject: [PATCH 32/76] Change references to relative --- index.html | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/index.html b/index.html index 4e7753f..ffec2f3 100644 --- a/index.html +++ b/index.html @@ -2,7 +2,7 @@ - + @@ -37,6 +37,7 @@
-

Results

+

Results: 0

-- 2.34.1 From 896ff6a532a41b5314760478d33c8e300b85d9ed Mon Sep 17 00:00:00 2001 From: Fred Boniface Date: Sat, 22 Apr 2023 22:45:24 +0100 Subject: [PATCH 38/76] Add notes --- js/pis.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/js/pis.js b/js/pis.js index c539fdb..b9b372e 100644 --- a/js/pis.js +++ b/js/pis.js @@ -37,7 +37,8 @@ async function insertData(json) { const data = JSON.parse(json) let results = 0 for(var i = 0; i < data.length; i++) { // Break into separate function. Need to - // iterate over stops. + // iterate over stops and print them in the + // format: `AVN, PRI, SHH... etc.` tableData += `${data[i][code]} ${data[i][stops]}` results++ -- 2.34.1 From a63e8611628f773480d4bbc6f54487cdf222a417 Mon Sep 17 00:00:00 2001 From: Fred Boniface Date: Sat, 22 Apr 2023 22:46:46 +0100 Subject: [PATCH 39/76] Remove unneccessary vars --- js/pis.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/js/pis.js b/js/pis.js index b9b372e..26a48b6 100644 --- a/js/pis.js +++ b/js/pis.js @@ -33,7 +33,6 @@ async function insertData(json) { Stations ` div.insertAdjacentHTML("beforeend", tableHtml) - const table = document.getElementById('result-table') const data = JSON.parse(json) let results = 0 for(var i = 0; i < data.length; i++) { // Break into separate function. Need to @@ -44,7 +43,7 @@ async function insertData(json) { results++ } tableData += "" - table.insertAdjacentHTML("beforeend", tableData) + document.getElementById('result-table').insertAdjacentHTML("beforeend", tableData) document.getElementById('result-count').textContent = results } -- 2.34.1 From 1e6b013507f6a7585ccf908cb5c0155a37877914 Mon Sep 17 00:00:00 2001 From: Fred Boniface Date: Sat, 22 Apr 2023 22:47:20 +0100 Subject: [PATCH 40/76] add missing const --- js/pis.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/js/pis.js b/js/pis.js index 26a48b6..dbf13cb 100644 --- a/js/pis.js +++ b/js/pis.js @@ -48,7 +48,7 @@ async function insertData(json) { } async function noData() { - msg = '

No results found

' + const msg = '

No results found

' document.getElementById('result-box').insertAdjacentHTML("beforeend", msg) } -- 2.34.1 From 7a8ab8ad4c5b69f7529fc4aa4507d0f8cc96d6db Mon Sep 17 00:00:00 2001 From: Fred Boniface Date: Mon, 24 Apr 2023 10:51:26 +0100 Subject: [PATCH 41/76] Add db-pis to stats --- js/stat.js | 1 + stat.html | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/js/stat.js b/js/stat.js index 86ca7b2..8a02453 100644 --- a/js/stat.js +++ b/js/stat.js @@ -24,6 +24,7 @@ async function display(data) { // Parses and displays data from API document.getElementById('stations').textContent = dat.stations || "0"; document.getElementById('users').textContent = dat.user || "0"; document.getElementById('meta').textContent = dat.meta || "0"; + document.getElementById('pis').textContent = dat.pis document.getElementById('ver-dbman').textContent = ver.dbmanager || "Unknown"; document.getElementById('ver-web').textContent = localStorage.getItem('ver-web') || "Unknown"; } \ No newline at end of file diff --git a/stat.html b/stat.html index 1ec42fd..245269f 100644 --- a/stat.html +++ b/stat.html @@ -45,6 +45,10 @@ DB-meta + + DB-pis + +

-- 2.34.1 From 096a74b4bb4f5f3ee8351a97c292165cb7bbd429 Mon Sep 17 00:00:00 2001 From: Fred Boniface Date: Mon, 24 Apr 2023 12:10:19 +0100 Subject: [PATCH 42/76] Fix getApi base url --- js/lib.main.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/js/lib.main.js b/js/lib.main.js index e69940f..2c30710 100644 --- a/js/lib.main.js +++ b/js/lib.main.js @@ -128,7 +128,7 @@ async function getQuery(param) { async function getApi(path,auth = false) { let apiVer = 'v1' - let url = `https://${window.location.origin}/api/${apiVer}/${path}` + let url = `${window.location.origin}/api/${apiVer}/${path}` log(`getApi: Fetching from endpoint: ${url}, Auth=${auth}`) try { var resp = await fetch(url) -- 2.34.1 From d54098562d185443eb2ea39558c9f3cfcbbec19b Mon Sep 17 00:00:00 2001 From: Fred Boniface Date: Mon, 24 Apr 2023 12:14:45 +0100 Subject: [PATCH 43/76] Fix findByOrigDest API Path --- js/pis.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/js/pis.js b/js/pis.js index dbf13cb..918394d 100644 --- a/js/pis.js +++ b/js/pis.js @@ -4,7 +4,7 @@ async function findByOrigDest() { showLoading() const formData = await fetchOrigDest() log(`findByOrigDest: Searching for PIS Code for ${JSON.stringify(formData)}`) - const endpoint = `pis/${formData.origin}/${formData.destination}` + const endpoint = `pis/origdest/${formData.origin}/${formData.destination}` const json = await getApi(endpoint) if (json == false) { await noData() -- 2.34.1 From cd3a4dad33266d63ae4287ece85e4aa269336e4b Mon Sep 17 00:00:00 2001 From: Fred Boniface Date: Mon, 24 Apr 2023 12:50:57 +0100 Subject: [PATCH 44/76] Adjust PIS Code --- js/lib.main.js | 9 ++++++--- js/pis.js | 11 +++++------ 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/js/lib.main.js b/js/lib.main.js index 2c30710..81403f2 100644 --- a/js/lib.main.js +++ b/js/lib.main.js @@ -132,16 +132,19 @@ async function getApi(path,auth = false) { log(`getApi: Fetching from endpoint: ${url}, Auth=${auth}`) try { var resp = await fetch(url) - if (resp != 200) { + var json = await resp.json() + log(`resp.status: ${resp.status}`) + log(`resp.json: ${json}`) + if (resp.status != 200) { return false } if (!resp.ok) { return false } - if (resp.json() === "[]") { + if (json === "[]") { return 'empty' } - return resp.json(); + return json; } catch(err) { return false } diff --git a/js/pis.js b/js/pis.js index 918394d..8fa7a6f 100644 --- a/js/pis.js +++ b/js/pis.js @@ -32,18 +32,16 @@ async function insertData(json) { ` - div.insertAdjacentHTML("beforeend", tableHtml) - const data = JSON.parse(json) let results = 0 - for(var i = 0; i < data.length; i++) { // Break into separate function. Need to + for(var i = 0; i < json.length; i++) { // Break into separate function. Need to // iterate over stops and print them in the // format: `AVN, PRI, SHH... etc.` - tableData += ` - ` + tableData += ` + ` results++ } tableData += "
Code Stations
${data[i][code]}${data[i][stops]}
${json[i]['code']}${json[i]['stops']}
" - document.getElementById('result-table').insertAdjacentHTML("beforeend", tableData) + div.insertAdjacentHTML("beforeend", tableData) document.getElementById('result-count').textContent = results } @@ -56,5 +54,6 @@ async function reset() { document.getElementById('origin').value = "" document.getElementById('destination').value = "" document.getElementById('result-box').style = 'display:none' + document.getElementById('result-box').innerHTML = '' document.getElementById('crs-box').style = 'display:block' } \ No newline at end of file -- 2.34.1 From b17894f7f16086c419ba8904de47ae6d5a15d370 Mon Sep 17 00:00:00 2001 From: Fred Boniface Date: Mon, 24 Apr 2023 13:11:13 +0100 Subject: [PATCH 45/76] Try fix type error --- js/pis.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/js/pis.js b/js/pis.js index 8fa7a6f..282ab05 100644 --- a/js/pis.js +++ b/js/pis.js @@ -42,7 +42,9 @@ async function insertData(json) { } tableData += "" div.insertAdjacentHTML("beforeend", tableData) - document.getElementById('result-count').textContent = results + if (results > 1) { + document.getElementById('result-count').textContent = results.toString() + } } async function noData() { -- 2.34.1 From 0596b23355a48d470b47b3016562c36bab058154 Mon Sep 17 00:00:00 2001 From: Fred Boniface Date: Mon, 24 Apr 2023 13:17:06 +0100 Subject: [PATCH 46/76] Add notes --- js/pis.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/js/pis.js b/js/pis.js index 282ab05..c546a5c 100644 --- a/js/pis.js +++ b/js/pis.js @@ -56,6 +56,6 @@ async function reset() { document.getElementById('origin').value = "" document.getElementById('destination').value = "" document.getElementById('result-box').style = 'display:none' - document.getElementById('result-box').innerHTML = '' + document.getElementById('result-box').innerHTML = '' // This removes the results-count. I need to remove the ONLY. document.getElementById('crs-box').style = 'display:block' } \ No newline at end of file -- 2.34.1 From a1a99698d39584f3926038a170fb4b5e3d04423d Mon Sep 17 00:00:00 2001 From: Fred Boniface Date: Tue, 25 Apr 2023 00:16:24 +0100 Subject: [PATCH 47/76] Fix logic around pis reset --- js/pis.js | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/js/pis.js b/js/pis.js index c546a5c..b4f5c1d 100644 --- a/js/pis.js +++ b/js/pis.js @@ -33,9 +33,7 @@ async function insertData(json) { ` let results = 0 - for(var i = 0; i < json.length; i++) { // Break into separate function. Need to - // iterate over stops and print them in the - // format: `AVN, PRI, SHH... etc.` + for(var i = 0; i < json.length; i++) { // Hopefully can style output with CSS tableData += `` results++ @@ -48,7 +46,7 @@ async function insertData(json) { } async function noData() { - const msg = '

No results found

' + const msg = '

No results found

' document.getElementById('result-box').insertAdjacentHTML("beforeend", msg) } @@ -56,6 +54,6 @@ async function reset() { document.getElementById('origin').value = "" document.getElementById('destination').value = "" document.getElementById('result-box').style = 'display:none' - document.getElementById('result-box').innerHTML = '' // This removes the results-count. I need to remove the
Stations
${json[i]['code']} ${json[i]['stops']}
ONLY. + document.getElementById('result-table').remove() document.getElementById('crs-box').style = 'display:block' } \ No newline at end of file -- 2.34.1 From 2bf95e8134c98c5f443ff53982ac5e93dbd66a5d Mon Sep 17 00:00:00 2001 From: Fred Boniface Date: Tue, 25 Apr 2023 00:32:45 +0100 Subject: [PATCH 48/76] Update pis styling --- js/pis.js | 8 ++++---- styles/pis.css | 20 ++++++++++++++++++++ sw.js | 5 ++++- 3 files changed, 28 insertions(+), 5 deletions(-) diff --git a/js/pis.js b/js/pis.js index b4f5c1d..0d59d54 100644 --- a/js/pis.js +++ b/js/pis.js @@ -29,13 +29,13 @@ async function insertData(json) { const div = document.getElementById('result-box') let tableData = `
- - + + ` let results = 0 for(var i = 0; i < json.length; i++) { // Hopefully can style output with CSS - tableData += ` - ` + tableData += ` + ` results++ } tableData += "
CodeStationsCodeStations
${json[i]['code']}${json[i]['stops']}
${json[i]['code']}${json[i]['stops']}
" diff --git a/styles/pis.css b/styles/pis.css index 8c42fb8..3039e47 100644 --- a/styles/pis.css +++ b/styles/pis.css @@ -4,4 +4,24 @@ #result-box { display: none; +} + +#result-table { + margin: auto; + width: 85%; + max-width: 700px; + text-align: center; +} + +#reset { + margin-top: 25px; +} + +.pis-code { + font-weight:bold; +} + +.station { + text-transform:uppercase; + overflow-wrap:anywhere } \ No newline at end of file diff --git a/sw.js b/sw.js index b975e29..8151cc7 100644 --- a/sw.js +++ b/sw.js @@ -1,6 +1,6 @@ /* Service Worker */ -const appVersion = "2.0.0-dev" +const appVersion = "1.2.4-dev-pis" const cacheName = `owlboard-${appVersion}`; const cacheIDs = [cacheName]; const cacheFiles = [ @@ -13,6 +13,7 @@ const cacheFiles = [ "/issue.html", "/find-code.html", "/settings.html", + "/pis.html", "/manifest.json", "/styles/fonts/firamono/firamono-500.woff2", "/styles/fonts/firamono/firamono-regular.woff2", @@ -24,6 +25,7 @@ const cacheFiles = [ "/styles/issue.css", "/styles/main.css", "/styles/settings.css", + "/styles/pis.css", "/js/find-code.js", "/js/index.js", "/js/issue.js", @@ -32,6 +34,7 @@ const cacheFiles = [ "/js/auth.js", "/js/settings.js", "/js/simple-board.js", + "/js/pis.js", "/images/icon.svg", "/images/logo/wide_logo.svg", "/images/logo/mono-logo.svg", -- 2.34.1 From b37cbdb1d0b0e5df633181af3de63a209f97ca32 Mon Sep 17 00:00:00 2001 From: Fred Boniface Date: Tue, 25 Apr 2023 19:30:54 +0100 Subject: [PATCH 49/76] Fix array.join() --- js/pis.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/js/pis.js b/js/pis.js index 0d59d54..0d63305 100644 --- a/js/pis.js +++ b/js/pis.js @@ -35,7 +35,7 @@ async function insertData(json) { let results = 0 for(var i = 0; i < json.length; i++) { // Hopefully can style output with CSS tableData += `${json[i]['code']} - ${json[i]['stops']}` + ${json[i]['stops'].join(', ')}` results++ } tableData += "" -- 2.34.1 From 255382710f19c2adb5b878ee8d69d6398a99a428 Mon Sep 17 00:00:00 2001 From: Fred Boniface Date: Tue, 25 Apr 2023 20:50:19 +0100 Subject: [PATCH 50/76] Style & Script fixes --- js/pis.js | 6 +++--- styles/pis.css | 14 ++++++++++++-- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/js/pis.js b/js/pis.js index 0d63305..1bb214a 100644 --- a/js/pis.js +++ b/js/pis.js @@ -36,13 +36,13 @@ async function insertData(json) { for(var i = 0; i < json.length; i++) { // Hopefully can style output with CSS tableData += `${json[i]['code']} ${json[i]['stops'].join(', ')}` + log(`Count prior to incrementing: ${results}`) results++ + log(`Count after incrementing: ${results}`) } tableData += "" div.insertAdjacentHTML("beforeend", tableData) - if (results > 1) { - document.getElementById('result-count').textContent = results.toString() - } + document.getElementById('result-count').textContent = results.toString() } async function noData() { diff --git a/styles/pis.css b/styles/pis.css index 3039e47..f9cccf0 100644 --- a/styles/pis.css +++ b/styles/pis.css @@ -13,6 +13,14 @@ text-align: center; } +td, th { + border-bottom: 1px solid; +} + +#reset { + margin-top: 25px +} + #reset { margin-top: 25px; } @@ -22,6 +30,8 @@ } .station { - text-transform:uppercase; - overflow-wrap:anywhere + text-transform: uppercase; + overflow-wrap: anywhere; + font-family: firamono, monospace; + line-height: 1.2; } \ No newline at end of file -- 2.34.1 From 28e306cbdba0a1afae66d79e87155b82bdf1428f Mon Sep 17 00:00:00 2001 From: Fred Boniface Date: Tue, 25 Apr 2023 20:56:59 +0100 Subject: [PATCH 51/76] Bump version, add auth required --- js/pis.js | 2 -- pis.html | 2 +- styles/main.css | 4 ++++ sw.js | 2 +- 4 files changed, 6 insertions(+), 4 deletions(-) diff --git a/js/pis.js b/js/pis.js index 1bb214a..e373729 100644 --- a/js/pis.js +++ b/js/pis.js @@ -36,9 +36,7 @@ async function insertData(json) { for(var i = 0; i < json.length; i++) { // Hopefully can style output with CSS tableData += `${json[i]['code']} ${json[i]['stops'].join(', ')}` - log(`Count prior to incrementing: ${results}`) results++ - log(`Count after incrementing: ${results}`) } tableData += "" div.insertAdjacentHTML("beforeend", tableData) diff --git a/pis.html b/pis.html index 0b04c0b..6eb0f16 100644 --- a/pis.html +++ b/pis.html @@ -46,7 +46,7 @@

Enter a services start and end station CRS codes to see code options and stopping patterns.

Currently supported (Beta): GWR Bristol Metro region only.

- +

You must be logged into the free staff version for this feature





diff --git a/styles/main.css b/styles/main.css index e32ff31..7b9944c 100644 --- a/styles/main.css +++ b/styles/main.css @@ -301,6 +301,10 @@ label { transition: 0.5s; } +#auth-required { + color: crimson; +} + /* Footer Styles */ footer { background-color: var(--accent-color); diff --git a/sw.js b/sw.js index 8151cc7..fb60144 100644 --- a/sw.js +++ b/sw.js @@ -1,6 +1,6 @@ /* Service Worker */ -const appVersion = "1.2.4-dev-pis" +const appVersion = "PIS-DEV-23042501" const cacheName = `owlboard-${appVersion}`; const cacheIDs = [cacheName]; const cacheFiles = [ -- 2.34.1 From f1372ff8a93d0c77d4902810c9c2941759ea0aa7 Mon Sep 17 00:00:00 2001 From: Fred Boniface Date: Tue, 25 Apr 2023 21:13:05 +0100 Subject: [PATCH 52/76] Bump version string, adjust style --- pis.html | 2 +- styles/main.css | 2 +- styles/pis.css | 1 + sw.js | 2 +- 4 files changed, 4 insertions(+), 3 deletions(-) diff --git a/pis.html b/pis.html index 6eb0f16..91c5050 100644 --- a/pis.html +++ b/pis.html @@ -46,7 +46,7 @@

Enter a services start and end station CRS codes to see code options and stopping patterns.

Currently supported (Beta): GWR Bristol Metro region only.

-

You must be logged into the free staff version for this feature

+

You will need to be logged into a free rail staff version account for this feature once it has finished testing.





diff --git a/styles/main.css b/styles/main.css index 7b9944c..e8a921f 100644 --- a/styles/main.css +++ b/styles/main.css @@ -302,7 +302,7 @@ label { } #auth-required { - color: crimson; + color: var(--main-warning-color); } /* Footer Styles */ diff --git a/styles/pis.css b/styles/pis.css index f9cccf0..9ad13f0 100644 --- a/styles/pis.css +++ b/styles/pis.css @@ -8,6 +8,7 @@ #result-table { margin: auto; + color: var(--second-text-color); width: 85%; max-width: 700px; text-align: center; diff --git a/sw.js b/sw.js index fb60144..085af27 100644 --- a/sw.js +++ b/sw.js @@ -1,6 +1,6 @@ /* Service Worker */ -const appVersion = "PIS-DEV-23042501" +const appVersion = "PIS-DEV-23042502" const cacheName = `owlboard-${appVersion}`; const cacheIDs = [cacheName]; const cacheFiles = [ -- 2.34.1 From 0f22707fc3b24a2e13f1b43db7fbed0fda317d46 Mon Sep 17 00:00:00 2001 From: Fred Boniface Date: Tue, 25 Apr 2023 21:16:25 +0100 Subject: [PATCH 53/76] Adjustments --- pis.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pis.html b/pis.html index 91c5050..449072a 100644 --- a/pis.html +++ b/pis.html @@ -63,7 +63,7 @@ \ No newline at end of file -- 2.34.1 From 90734cd09892f736d781a2ab8bc232df3f1c1bd4 Mon Sep 17 00:00:00 2001 From: Fred Boniface Date: Fri, 28 Apr 2023 13:45:52 +0100 Subject: [PATCH 54/76] Remove duplicate - merge error --- js/lib.main.js | 21 --------------------- 1 file changed, 21 deletions(-) diff --git a/js/lib.main.js b/js/lib.main.js index 81403f2..1b60e7a 100644 --- a/js/lib.main.js +++ b/js/lib.main.js @@ -150,27 +150,6 @@ async function getApi(path,auth = false) { } } -async function getApi(path,auth = false) { - let apiVer = 'v1' - let url = `https://${window.location.origin}/api/${apiVer}/${path}` - log(`getApi: Fetching from endpoint: ${url}, Auth=${auth}`) - try { - var resp = await fetch(url) - if (resp != 200) { - return false - } - if (!resp.ok) { - return false - } - if (resp.json() === "[]") { - return 'empty' - } - return resp.json(); - } catch(err) { - return false - } -} - async function vibe(type) { let canVibrate = "vibrate" in navigator || "mozVibrate" in navigator if (canVibrate && !("vibrate" in navigator)){ -- 2.34.1 From f525466b84f4be4338f0330ca5b2a866d2963ca7 Mon Sep 17 00:00:00 2001 From: Fred Boniface Date: Fri, 28 Apr 2023 13:52:26 +0100 Subject: [PATCH 55/76] Ad auth option to getApi() --- js/lib.main.js | 17 ++++++++++++++++- js/pis.js | 1 + pis.html | 2 +- 3 files changed, 18 insertions(+), 2 deletions(-) diff --git a/js/lib.main.js b/js/lib.main.js index 1b60e7a..7fd6cb3 100644 --- a/js/lib.main.js +++ b/js/lib.main.js @@ -130,8 +130,23 @@ async function getApi(path,auth = false) { let apiVer = 'v1' let url = `${window.location.origin}/api/${apiVer}/${path}` log(`getApi: Fetching from endpoint: ${url}, Auth=${auth}`) + if (auth) { + let key = localStorage.getItem('uuid') + var options = { + method: "GET", + redirect: "follow", + headers: { + "uuid": key + } + } + } else { + var options = { + method: "GET", + redirect: "follow" + } + } try { - var resp = await fetch(url) + var resp = await fetch(url, options) var json = await resp.json() log(`resp.status: ${resp.status}`) log(`resp.json: ${json}`) diff --git a/js/pis.js b/js/pis.js index e373729..9456b31 100644 --- a/js/pis.js +++ b/js/pis.js @@ -1,4 +1,5 @@ hideLoading() +versionDisplay() async function findByOrigDest() { showLoading() diff --git a/pis.html b/pis.html index 449072a..9d38db2 100644 --- a/pis.html +++ b/pis.html @@ -63,7 +63,7 @@ \ No newline at end of file -- 2.34.1 From ad38085e64095fc781ed7f17748d35433da3e9bd Mon Sep 17 00:00:00 2001 From: Fred Boniface Date: Fri, 28 Apr 2023 13:56:04 +0100 Subject: [PATCH 56/76] Add function to hide the login required notice --- js/lib.main.js | 7 +++++++ pis.html | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/js/lib.main.js b/js/lib.main.js index 7fd6cb3..d510fae 100644 --- a/js/lib.main.js +++ b/js/lib.main.js @@ -165,6 +165,13 @@ async function getApi(path,auth = false) { } } +async function showHideAuthNotice() { + let uuid = localStorage.getItem("uuid") + if (uuid) { + document.getElementById('auth-notice').style = 'display:none' + } +} + async function vibe(type) { let canVibrate = "vibrate" in navigator || "mozVibrate" in navigator if (canVibrate && !("vibrate" in navigator)){ diff --git a/pis.html b/pis.html index 9d38db2..be5505a 100644 --- a/pis.html +++ b/pis.html @@ -46,7 +46,7 @@

Enter a services start and end station CRS codes to see code options and stopping patterns.

Currently supported (Beta): GWR Bristol Metro region only.

-

You will need to be logged into a free rail staff version account for this feature once it has finished testing.

+

You need to be logged into a free rail staff version account for this feature.





-- 2.34.1 From 8194ac0f5b0d5d62b9fa14a26d42ade281db932c Mon Sep 17 00:00:00 2001 From: Fred Boniface Date: Fri, 28 Apr 2023 13:56:24 +0100 Subject: [PATCH 57/76] Call showHieAuthNotice() on pis.js --- js/pis.js | 1 + 1 file changed, 1 insertion(+) diff --git a/js/pis.js b/js/pis.js index 9456b31..75989c9 100644 --- a/js/pis.js +++ b/js/pis.js @@ -1,5 +1,6 @@ hideLoading() versionDisplay() +showHideAuthNotice() async function findByOrigDest() { showLoading() -- 2.34.1 From 218e95b0487e5c2c84f82ea2aa1a2a3147e38c2f Mon Sep 17 00:00:00 2001 From: Fred Boniface Date: Fri, 28 Apr 2023 13:57:06 +0100 Subject: [PATCH 58/76] Fix id name --- js/lib.main.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/js/lib.main.js b/js/lib.main.js index d510fae..16a84b5 100644 --- a/js/lib.main.js +++ b/js/lib.main.js @@ -168,7 +168,7 @@ async function getApi(path,auth = false) { async function showHideAuthNotice() { let uuid = localStorage.getItem("uuid") if (uuid) { - document.getElementById('auth-notice').style = 'display:none' + document.getElementById('auth-required').style = 'display:none' } } -- 2.34.1 From fbb4702b696af4a26ce06bba03369196bd6d4309 Mon Sep 17 00:00:00 2001 From: Fred Boniface Date: Sun, 30 Apr 2023 20:27:04 +0100 Subject: [PATCH 59/76] Adjust frontend version display on stats --- js/stat.js | 2 +- stat.html | 2 +- sw.js | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/js/stat.js b/js/stat.js index 8a02453..7f0ea17 100644 --- a/js/stat.js +++ b/js/stat.js @@ -1,6 +1,7 @@ init(); async function init() { // The page init function + versionDisplay() display(await get()) } @@ -26,5 +27,4 @@ async function display(data) { // Parses and displays data from API document.getElementById('meta').textContent = dat.meta || "0"; document.getElementById('pis').textContent = dat.pis document.getElementById('ver-dbman').textContent = ver.dbmanager || "Unknown"; - document.getElementById('ver-web').textContent = localStorage.getItem('ver-web') || "Unknown"; } \ No newline at end of file diff --git a/stat.html b/stat.html index 245269f..7d04c51 100644 --- a/stat.html +++ b/stat.html @@ -78,7 +78,7 @@ web-frontend - + Unknown

The statistics represent hits & queries from all instances in the stack.

diff --git a/sw.js b/sw.js index 085af27..3a8f45e 100644 --- a/sw.js +++ b/sw.js @@ -1,6 +1,6 @@ /* Service Worker */ -const appVersion = "PIS-DEV-23042502" +const appVersion = "PIS-DEV-23043001" const cacheName = `owlboard-${appVersion}`; const cacheIDs = [cacheName]; const cacheFiles = [ -- 2.34.1 From 92f621b6f90d2613c20c145e3750cdb3b9e4561b Mon Sep 17 00:00:00 2001 From: Fred Boniface Date: Sun, 30 Apr 2023 20:28:30 +0100 Subject: [PATCH 60/76] Add auth flag to PIS.js --- js/pis.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/js/pis.js b/js/pis.js index 75989c9..97cfb88 100644 --- a/js/pis.js +++ b/js/pis.js @@ -7,7 +7,7 @@ async function findByOrigDest() { const formData = await fetchOrigDest() log(`findByOrigDest: Searching for PIS Code for ${JSON.stringify(formData)}`) const endpoint = `pis/origdest/${formData.origin}/${formData.destination}` - const json = await getApi(endpoint) + const json = await getApi(endpoint, auth = true) if (json == false) { await noData() } else { -- 2.34.1 From a7b8fb36d4ca72e77708d129ced0fe2d156b5f41 Mon Sep 17 00:00:00 2001 From: Fred Boniface Date: Sun, 30 Apr 2023 21:10:37 +0100 Subject: [PATCH 61/76] Adjust PIS Styling --- js/lib.main.js | 2 +- js/pis.js | 11 +++++++++-- pis.html | 18 ++++++++++++------ styles/pis.css | 13 ++++++++++--- 4 files changed, 32 insertions(+), 12 deletions(-) diff --git a/js/lib.main.js b/js/lib.main.js index 16a84b5..c443cdf 100644 --- a/js/lib.main.js +++ b/js/lib.main.js @@ -151,7 +151,7 @@ async function getApi(path,auth = false) { log(`resp.status: ${resp.status}`) log(`resp.json: ${json}`) if (resp.status != 200) { - return false + return resp.status } if (!resp.ok) { return false diff --git a/js/pis.js b/js/pis.js index 97cfb88..66fa9e1 100644 --- a/js/pis.js +++ b/js/pis.js @@ -9,7 +9,9 @@ async function findByOrigDest() { const endpoint = `pis/origdest/${formData.origin}/${formData.destination}` const json = await getApi(endpoint, auth = true) if (json == false) { - await noData() + await displayNoData() + } else if (json == 401) { + await displayUnauthorised() } else { await insertData(json) } @@ -45,11 +47,16 @@ async function insertData(json) { document.getElementById('result-count').textContent = results.toString() } -async function noData() { +async function displayNoData() { const msg = '

No results found

' document.getElementById('result-box').insertAdjacentHTML("beforeend", msg) } +async function displayUnauthorised() { + const msg = '

Unauthorised - please ensure you are logged into the rail staff version

' + document.getElementById('result-box').insertAdjacentHTML("beforeend", msg) +} + async function reset() { document.getElementById('origin').value = "" document.getElementById('destination').value = "" diff --git a/pis.html b/pis.html index be5505a..920f643 100644 --- a/pis.html +++ b/pis.html @@ -45,13 +45,19 @@

Enter a services start and end station CRS codes to see code options and stopping patterns.

-

Currently supported (Beta): GWR Bristol Metro region only.

+

Currently supported (Beta): GWR: Bristol Metro, WOS & CDF Southbound.

You need to be logged into a free rail staff version account for this feature.

-
-

-
-

- + +
+
+ +
+
+
+

+
+ +
diff --git a/styles/pis.css b/styles/pis.css index 9ad13f0..e486351 100644 --- a/styles/pis.css +++ b/styles/pis.css @@ -1,5 +1,12 @@ -#crs-boxes { - display: block; +#crs-inputs { + display: flex; + justify-content: center; +} + +.pis-input { + width: 55%; + max-width: 200px; + margin: auto; } #result-box { @@ -19,7 +26,7 @@ td, th { } #reset { - margin-top: 25px + margin-top: 15px } #reset { -- 2.34.1 From ab452d985c64d24b987b8c66e330a33f65ee1234 Mon Sep 17 00:00:00 2001 From: Fred Boniface Date: Sun, 30 Apr 2023 21:18:46 +0100 Subject: [PATCH 62/76] Fixes --- js/pis.js | 1 + pis.html | 23 ++++++++++++----------- 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/js/pis.js b/js/pis.js index 66fa9e1..066a597 100644 --- a/js/pis.js +++ b/js/pis.js @@ -63,4 +63,5 @@ async function reset() { document.getElementById('result-box').style = 'display:none' document.getElementById('result-table').remove() document.getElementById('crs-box').style = 'display:block' + document.getElementById('result-count').textContent = 0 } \ No newline at end of file diff --git a/pis.html b/pis.html index 920f643..66c019e 100644 --- a/pis.html +++ b/pis.html @@ -43,21 +43,22 @@
-

Enter a services start and end station CRS codes to see code options and - stopping patterns.

+

Enter a services start and end station CRS codes to see code options and stopping patterns.

Currently supported (Beta): GWR: Bristol Metro, WOS & CDF Southbound.

You need to be logged into a free rail staff version account for this feature.

-
-
-
- -
-
-
-

+ +
+
+
+ +
+
+
+

+
+ -
-- 2.34.1 From 1d365ea3740a38d5b9e582731dd57b40faa8a8fe Mon Sep 17 00:00:00 2001 From: Fred Boniface Date: Sun, 30 Apr 2023 21:29:51 +0100 Subject: [PATCH 63/76] Fix getApi error handling --- js/lib.main.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/js/lib.main.js b/js/lib.main.js index c443cdf..6dc50bd 100644 --- a/js/lib.main.js +++ b/js/lib.main.js @@ -151,17 +151,17 @@ async function getApi(path,auth = false) { log(`resp.status: ${resp.status}`) log(`resp.json: ${json}`) if (resp.status != 200) { + log(`lib.main: getApi: Response status: ${resp.status}`) return resp.status } if (!resp.ok) { + log(`lib.main: getApi: Fetch error`) return false } - if (json === "[]") { - return 'empty' - } return json; } catch(err) { - return false + log(`lib.main: getApi: Caught fetch error. Status: ${resp.status}`) + return resp.status } } -- 2.34.1 From 2dbdbb2441e66582e4b4a478b3dc2c8c60021f96 Mon Sep 17 00:00:00 2001 From: Fred Boniface Date: Sun, 30 Apr 2023 21:30:10 +0100 Subject: [PATCH 64/76] Remove unavailable placeholder on reginstration box --- settings.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/settings.html b/settings.html index 4e0487d..72cd726 100644 --- a/settings.html +++ b/settings.html @@ -71,7 +71,7 @@


Enter your work email address:

-
+

One registration confirmation email will be sent which will include more details about your account

Your address will not be stored

If your domain is not authorised and you are a using a railway company email address, -- 2.34.1 From 75f4290ba3010420b410070d1fe51d5424dc4b51 Mon Sep 17 00:00:00 2001 From: Fred Boniface Date: Sun, 30 Apr 2023 21:39:25 +0100 Subject: [PATCH 65/76] Adjust robots meta tag --- auth.html | 1 + board-staff.html | 1 + board.html | 1 + js/pis.js | 16 ++++++++++------ 4 files changed, 13 insertions(+), 6 deletions(-) diff --git a/auth.html b/auth.html index 7572510..14e365a 100644 --- a/auth.html +++ b/auth.html @@ -3,6 +3,7 @@ + diff --git a/board-staff.html b/board-staff.html index 111d695..9afc110 100644 --- a/board-staff.html +++ b/board-staff.html @@ -4,6 +4,7 @@ + diff --git a/board.html b/board.html index bbac91e..2c64824 100644 --- a/board.html +++ b/board.html @@ -5,6 +5,7 @@ + diff --git a/js/pis.js b/js/pis.js index 066a597..e749674 100644 --- a/js/pis.js +++ b/js/pis.js @@ -58,10 +58,14 @@ async function displayUnauthorised() { } async function reset() { - document.getElementById('origin').value = "" - document.getElementById('destination').value = "" - document.getElementById('result-box').style = 'display:none' - document.getElementById('result-table').remove() - document.getElementById('crs-box').style = 'display:block' - document.getElementById('result-count').textContent = 0 + try { + document.getElementById('origin').value = "" + document.getElementById('destination').value = "" + document.getElementById('result-box').style = 'display:none' + document.getElementById('result-table').remove() + document.getElementById('crs-box').style = 'display:block' + document.getElementById('result-count').textContent = 0 + } catch(e) { + log(`Nothing to reset`) + } } \ No newline at end of file -- 2.34.1 From 35605cb216a5706705e007ecc0c63d1d7fcc511d Mon Sep 17 00:00:00 2001 From: Fred Boniface Date: Sun, 30 Apr 2023 21:55:56 +0100 Subject: [PATCH 66/76] Add eslint --- .dockerignore | 6 +- .eslintrc.js | 30 ++ .gitignore | 1 + auth.html | 12 +- board-staff.html | 16 +- board.html | 18 +- js/auth.js | 4 +- package-lock.json | 1125 +++++++++++++++++++++++++++++++++++++++++++++ package.json | 14 + pis.html | 12 +- stat.html | 2 +- 11 files changed, 1207 insertions(+), 33 deletions(-) create mode 100644 .eslintrc.js create mode 100644 .gitignore create mode 100644 package-lock.json create mode 100644 package.json diff --git a/.dockerignore b/.dockerignore index 9a715f5..f06a337 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,2 +1,6 @@ .dockerignore -Dockerfile \ No newline at end of file +Dockerfile +package.json +package-lock.json +.eslintrc.js +node_modules \ No newline at end of file diff --git a/.eslintrc.js b/.eslintrc.js new file mode 100644 index 0000000..3a42aef --- /dev/null +++ b/.eslintrc.js @@ -0,0 +1,30 @@ +module.exports = { + 'env': { + 'browser': true, + 'es2021': true + }, + 'extends': 'eslint:recommended', + 'overrides': [ + ], + 'parserOptions': { + 'ecmaVersion': 'latest' + }, + 'rules': { + 'indent': [ + 'error', + 4 + ], + 'linebreak-style': [ + 'error', + 'unix' + ], + 'quotes': [ + 'error', + 'single' + ], + 'semi': [ + 'error', + 'never' + ] + } +} diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..b512c09 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +node_modules \ No newline at end of file diff --git a/auth.html b/auth.html index 14e365a..13990db 100644 --- a/auth.html +++ b/auth.html @@ -1,17 +1,17 @@ - - - + + + - - - + + + OwlBoard diff --git a/board-staff.html b/board-staff.html index 9afc110..fe8f827 100644 --- a/board-staff.html +++ b/board-staff.html @@ -1,19 +1,19 @@ - - + + - + OwlBoard - Loading - - - - + + + + @@ -28,7 +28,7 @@