Compare commits
6 Commits
Author | SHA1 | Date | |
---|---|---|---|
f0ce363514 | |||
00392cae2c | |||
8e7c8b9461 | |||
eac4016422 | |||
c218b82924 | |||
c2995b7071 |
BIN
Branding/Organization Avatar/Avatar.png
Normal file
BIN
Branding/Organization Avatar/Avatar.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 20 KiB |
BIN
Branding/Organization Avatar/Avatar.xcf
Normal file
BIN
Branding/Organization Avatar/Avatar.xcf
Normal file
Binary file not shown.
101
README.md
101
README.md
@ -2,103 +2,4 @@
|
||||
|
||||
OwlBoard is both a backend API, and a frontend Arrival/Departure board webapp.
|
||||
|
||||
Powered by Node.JS and using the ldbs-json module, the OwlBoard API provides up to date train departure information for any station in the UK.
|
||||
|
||||
Whilst the application is open source, the webservice (owlboard.fb-infra.uk) is not openly available. National Rail Enquiries have limits on API access so to use this software yourself, you'll need to run your own instance after obtaining your own API key.
|
||||
|
||||
The webservice (owlboard.fb-infra.uk) may contain ads to support the running of the service,
|
||||
if ads are implemented, I intend to avoid 'dubious' advertisers that target and track users.
|
||||
|
||||
Currently only the public API is available as I am currently unable to request a key for the staff version.
|
||||
|
||||
## Requirements:
|
||||
|
||||
To run this server you will need:
|
||||
- Docker or Kubernetes
|
||||
|
||||
## WebApp Colours:
|
||||
|
||||
- See CSS Variables
|
||||
|
||||
## API Endpoints:
|
||||
- /api/v1:
|
||||
|
||||
- /list:
|
||||
- /stations:
|
||||
- GET: Get list of stations
|
||||
- Authenticated: No
|
||||
- Returns JSON: `{"STATION NAME":{"CRS":"code","TIPLOC":"code"}}`
|
||||
|
||||
- /corpus:
|
||||
- GET: Get full CORPUS Data
|
||||
- Authenticated: No
|
||||
- Returns JSON in original CORPUS format minus any blank values.
|
||||
|
||||
- /ldb:
|
||||
- /{crs}:
|
||||
- GET: Get arrival/departure board for {crs}
|
||||
- Authenticated: No
|
||||
- Returns JSON: Formatted as per ldbs-json module.
|
||||
|
||||
- /gitea:
|
||||
- POST: Post issue to Gitea Repo
|
||||
- Authenticated: Yes
|
||||
- Not yet implemented, submit issues at https://git.fjla.uk/fred.boniface/owlboard
|
||||
|
||||
- /kube:
|
||||
- /alive:
|
||||
- GET: Check alive
|
||||
- Authenticated: No
|
||||
- Returns JSON: `{"status":"alive"}`
|
||||
|
||||
- /ready:
|
||||
- GET: Check ready
|
||||
- Authenticated: No
|
||||
- Returns JSON: `{"state":""}` ready or not_ready.
|
||||
|
||||
## Stack:
|
||||
- app.js -> Launches server, Entry Point, defines routers and middlewares.
|
||||
- routes -> Routers - Directs requests to controllers.
|
||||
- controllers -> Checks auth, sends response. Request doesn't pass further.
|
||||
- services -> Provide data and do tasks, uses other services and utils.
|
||||
|
||||
- utils -> Provide utility functions that can be called by services.
|
||||
- configs -> Provide configuration details for other files.
|
||||
- static -> Holds files for static service, should be hosted behind a caching proxy.
|
||||
|
||||
## Configuration:
|
||||
The app is designed to be run within Kubernetes or within a Docker container, as such configuration is provided with environment variables. See the variable name and default options below. If a required configuration is not present the program will exit when that feature is initialised.
|
||||
|
||||
|VAR|DEFAULT|REQUIRED|PURPOSE|
|
||||
|:-:|:-----:|:------:|:-----:|
|
||||
|OWL_SRV_PORT|8460|NO|Web Server Port|
|
||||
|OWL_SRV_LISTEN|0.0.0.0|NO|Web Server Listen Address|
|
||||
|OWL_DB_USER|owl|NO|Database Username|
|
||||
|OWL_DB_PASS|twittwoo|NO|Database Password - Do not leave as default in production|
|
||||
|OWL_DB_NAME|owlboard|NO|Database Name|
|
||||
|OWL_DB_PORT|27017|NO|Database Server Port|
|
||||
|OWL_DB_HOST|localhost|NO|Database Server Host|
|
||||
|OWL_LDB_KEY||YES|National Rail LDBWS API Key|
|
||||
|OWL_LDB_SVKEY||NO|National Rail LDBSVWS API Key|
|
||||
|OWL_LDB_CORPUSUSER||YES|Network Rail CORPUS API Username|
|
||||
|OWL_LDB_CORPUSPASS||YES|Network Rail CORPUS API Password|
|
||||
|OWL_GIT_ISSUEBOT||NO|Gitea API Key for issue reporting|
|
||||
|OWL_GIT_APIENDPOINT||NO|Gitea API Endpoint|
|
||||
|
||||
In the case that OWL_LDB_SVKEY is not available, staff versions of departure board, etc. will not be available.
|
||||
|
||||
In the case that OWL_GIT_ISSUEBOT is not available, the 'Report Issue' page will not be able to POST data.
|
||||
|
||||
## Database Layout
|
||||
|
||||
The OwlBoard application will build the database if required at startup. All it needs is authentication details for a MongoDB server.
|
||||
|
||||
### Collections
|
||||
|
||||
|Collection|Contents|Purpose|
|
||||
|:--------:|:------:|:-----:|
|
||||
|corpus|Raw CORPUS data with blank keys removed|Code lookups|
|
||||
|stations|Cleaned CORPUS Data, any objects with blank 3ALPHA & STANOX fields are removed|Validation before fetching Arr/Dep boards|
|
||||
|meta|Lists the update time of corpus and station data|Will be used to update after a predetermined time period|
|
||||
|
||||
Note that even after removing all objects from the CORPUS with a blank 3ALPHA & STANOX, many items remain which are not stations and will not have a board available. Going forwards methods to remove non-stations from this data will be introduced.
|
||||
**Development of OwlBoard has been moved to [git.fjla.uk/OwlBoard](https://git.fjla.uk/OwlBoard)**
|
@ -1,6 +1,6 @@
|
||||
const version = {
|
||||
api: ["/api/v1/",],
|
||||
app: "0.0.1"
|
||||
app: "0.0.2"
|
||||
};
|
||||
|
||||
module.exports = version;
|
@ -1,6 +1,8 @@
|
||||
const axios = require('axios')
|
||||
const log = require('../utils/log.utils')
|
||||
|
||||
async function processor(data) {
|
||||
log.out(`issueService.processor: Issue received`)
|
||||
let out = {}
|
||||
out.title = data.subject.replace(/<[^>]+>|[\*\$]/g, '');
|
||||
out.body = data.msg.replace(/<[^>]+>|[\*\$]/g, '')
|
||||
@ -18,8 +20,10 @@ async function sendToGitea(body) {
|
||||
var res = await axios.post(url, body, opts)
|
||||
// Need to read the output from the POST and pass the result upwards to the client.
|
||||
if (res.status == 201) {
|
||||
log.out("issueService.sendToGitea: Issue sent to Gitea")
|
||||
return {status: res.status,message:"issue created"}
|
||||
} else {
|
||||
log.out("issueService.sendToGitea: Failed to send issue to Gitea")
|
||||
return {status: res.status,message:"issue not created"}
|
||||
}
|
||||
}
|
||||
|
@ -64,7 +64,7 @@
|
||||
</div>
|
||||
<!-- Footer -->
|
||||
<footer>
|
||||
<p>Created by <a href="https://fredboniface.co.uk" target="_blank" rel="noreferrer noopener">Fred Boniface</a> - 0.0.1</p>
|
||||
<p>Created by <a href="https://fredboniface.co.uk" target="_blank" rel="noreferrer noopener">Fred Boniface</a> - 0.0.3</p>
|
||||
</footer>
|
||||
</body>
|
||||
</html>
|
||||
|
@ -72,7 +72,7 @@ async function send() {
|
||||
redirect: 'follow',
|
||||
body: payload
|
||||
}
|
||||
var res = await fetch("/api/v1/issue", opt)
|
||||
var res = await fetch(`${window.location.origin}/api/v1/issue`, opt)
|
||||
if (res.status == 200) {
|
||||
setLoadingDesc("Success")
|
||||
vibe("ok")
|
||||
|
@ -1,6 +1,6 @@
|
||||
/* Service Worker */
|
||||
|
||||
const appVersion = "0.0.1"
|
||||
const appVersion = "0.0.3"
|
||||
const cacheName = `owlboard-${appVersion}`
|
||||
const cacheIDs = [cacheName]
|
||||
const cacheFiles = [
|
||||
|
Reference in New Issue
Block a user