Prepare for migration to new site
This commit is contained in:
parent
5f710832b0
commit
64be61f62d
@ -62,7 +62,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="text-description">
|
<div class="text-description">
|
||||||
<p>New feature: <a href="./pis.html">Find PIS by Headcode</a></p>
|
<p>New feature: <a href="./pis.html">Find PIS by Headcode</a></p>
|
||||||
<p>Coming Soon: Staff Depature Boards & Live Train Data</p>
|
<p>Later this month: New website & Staff Departure Boards</p>
|
||||||
<p>Customise your quick links on the <a href="./settings.html">Settings</a> page.</p>
|
<p>Customise your quick links on the <a href="./settings.html">Settings</a> page.</p>
|
||||||
</div>
|
</div>
|
||||||
<!-- Footer -->
|
<!-- Footer -->
|
||||||
|
@ -21,7 +21,7 @@ async function cmdOut(message) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function registerKey(key) { // Posts key to server and listens for response.
|
async function registerKey(key) { // Posts key to server and listens for response.
|
||||||
const url = `${window.location.origin}/api/v1/register/register`
|
const url = `${apiEndpoint}/v1/register/register`
|
||||||
const res = await fetch(url, { // The response will contain the UUID which will be registered
|
const res = await fetch(url, { // The response will contain the UUID which will be registered
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: {
|
headers: {
|
||||||
@ -37,7 +37,7 @@ async function registerKey(key) { // Posts key to server and listens for respons
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function checkAuth(key) {
|
async function checkAuth(key) {
|
||||||
const url = `${window.location.origin}/api/v1/auth/test`
|
const url = `${apiEndpoint}/v1/auth/test`
|
||||||
const res = await fetch(url, {
|
const res = await fetch(url, {
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
redirect: 'follow',
|
redirect: 'follow',
|
||||||
|
@ -51,7 +51,7 @@ async function parseData(values){
|
|||||||
async function getData(type, value){
|
async function getData(type, value){
|
||||||
log(`find-code.getData: Looking for: ${type} '${value}'`, 'INFO')
|
log(`find-code.getData: Looking for: ${type} '${value}'`, 'INFO')
|
||||||
try {
|
try {
|
||||||
var url = `${window.location.origin}/api/v1/find/${type}/${value}`
|
var url = `${apiEndpoint}/v1/find/${type}/${value}`
|
||||||
var resp = await fetch(url)
|
var resp = await fetch(url)
|
||||||
return await resp.json()
|
return await resp.json()
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
@ -73,7 +73,7 @@ async function send() {
|
|||||||
redirect: 'follow',
|
redirect: 'follow',
|
||||||
body: payload
|
body: payload
|
||||||
}
|
}
|
||||||
var res = await fetch(`${window.location.origin}/api/v1/issue`, opt)
|
var res = await fetch(`${apiEndpoint}/v1/issue`, opt)
|
||||||
if (res.status == 200) {
|
if (res.status == 200) {
|
||||||
setLoadingDesc('Success')
|
setLoadingDesc('Success')
|
||||||
vibe('ok')
|
vibe('ok')
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/* eslint-disable no-unused-vars */
|
/* eslint-disable no-unused-vars */
|
||||||
/* Fetch Functions */
|
/* Fetch Functions */
|
||||||
async function publicLdb(stn) {
|
async function publicLdb(stn) {
|
||||||
var url = `${window.location.origin}/api/v1/ldb/${stn}`
|
var url = `${apiEndpoint}/v1/ldb/${stn}`
|
||||||
console.time('Time: Fetch LDB Data')
|
console.time('Time: Fetch LDB Data')
|
||||||
var resp = await fetch(url)
|
var resp = await fetch(url)
|
||||||
console.timeEnd('Time: Fetch LDB Data')
|
console.timeEnd('Time: Fetch LDB Data')
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
/* eslint-disable no-unused-vars */
|
/* eslint-disable no-unused-vars */
|
||||||
/* All Page Init */
|
/* All Page Init */
|
||||||
const version = '2023.6.6'
|
const version = '2023.6.7'
|
||||||
|
const apiEndpoint = 'https://owlboard.info/api'
|
||||||
|
|
||||||
/* Feature Detectors */
|
/* Feature Detectors */
|
||||||
|
|
||||||
@ -129,7 +130,7 @@ async function getQuery(param) {
|
|||||||
|
|
||||||
async function getApi(path,auth = false) {
|
async function getApi(path,auth = false) {
|
||||||
let apiVer = 'v1'
|
let apiVer = 'v1'
|
||||||
let url = `${window.location.origin}/api/${apiVer}/${path}`
|
let url = `${apiEndpoint}/${apiVer}/${path}`
|
||||||
log(`getApi: Fetching from endpoint: ${url}, Auth=${auth}`)
|
log(`getApi: Fetching from endpoint: ${url}, Auth=${auth}`)
|
||||||
let options
|
let options
|
||||||
if (auth) {
|
if (auth) {
|
||||||
|
@ -78,7 +78,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
|
async function register() { // Registers a device by sending POST request to API Server
|
||||||
if (! await isRegistered()) {
|
if (! await isRegistered()) {
|
||||||
showLoading()
|
showLoading()
|
||||||
let url = `${window.location.origin}/api/v1/register/request`
|
let url = `${apiEndpoint}/v1/register/request`
|
||||||
let email = document.getElementById('eml').value
|
let email = document.getElementById('eml').value
|
||||||
let res = await fetch(url, {
|
let res = await fetch(url, {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
|
@ -7,7 +7,7 @@ async function init() { // The page init function
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function get() { // Fetch data from API
|
async function get() { // Fetch data from API
|
||||||
var url = `${window.location.origin}/api/v1/stats`
|
var url = `${apiEndpoint}/api/v1/stats`
|
||||||
var resp = await fetch(url)
|
var resp = await fetch(url)
|
||||||
return await resp.json()
|
return await resp.json()
|
||||||
}
|
}
|
||||||
|
@ -40,7 +40,7 @@ async function displayOptions(data) {
|
|||||||
log(`displayOptions: data[${service}] = ${serviceData}`, 'dbug')
|
log(`displayOptions: data[${service}] = ${serviceData}`, 'dbug')
|
||||||
let button = `
|
let button = `
|
||||||
<button class='service_button' onclick='displayOne(data[${service}])'>
|
<button class='service_button' onclick='displayOne(data[${service}])'>
|
||||||
<span class='service_toc'>GW</span>
|
<span class='service_toc'>${serviceData?.operator || 'GW'}</span>
|
||||||
<span class='service_origin_time'>${serviceData['stops'][0]['wttDeparture']}</span>
|
<span class='service_origin_time'>${serviceData['stops'][0]['wttDeparture']}</span>
|
||||||
<span class='service_origin_tiploc'>${serviceData['stops'][0]['tiploc']}</span>
|
<span class='service_origin_tiploc'>${serviceData['stops'][0]['tiploc']}</span>
|
||||||
to
|
to
|
||||||
|
Reference in New Issue
Block a user