Compare commits
No commits in common. "ef55fb0365b5711168fa8ac2e6855e497437118e" and "a0de55274d886ce9cee4d69d57863794caf17f1f" have entirely different histories.
ef55fb0365
...
a0de55274d
10
UpNext.md
10
UpNext.md
|
@ -3,8 +3,9 @@
|
||||||
## Frontend:
|
## Frontend:
|
||||||
|
|
||||||
* Alerts box should not be clickable, bar should be.
|
* Alerts box should not be clickable, bar should be.
|
||||||
|
* Issue page: Submit using API.
|
||||||
|
* Issue page: Collect diagnostics such as browser features etc.
|
||||||
* Issue page: Captcha.
|
* Issue page: Captcha.
|
||||||
* Issue page: Check for success and then redirect to /.
|
|
||||||
* Enable text search for `locationName` on find-code page.
|
* Enable text search for `locationName` on find-code page.
|
||||||
* Responsive text sizes for boards.
|
* Responsive text sizes for boards.
|
||||||
|
|
||||||
|
@ -17,9 +18,6 @@
|
||||||
|
|
||||||
* Write service worker for full PWA experience.
|
* Write service worker for full PWA experience.
|
||||||
* Implement error pages.
|
* Implement error pages.
|
||||||
* Issue page: Submit using API.
|
|
||||||
* Issue page: Collect diagnostics such as browser features etc.
|
|
||||||
* Add Gitea Issue API
|
|
||||||
|
|
||||||
|
|
||||||
## Backend:
|
## Backend:
|
||||||
|
@ -27,7 +25,5 @@
|
||||||
* DB Indexes:
|
* DB Indexes:
|
||||||
- "stations": 3ALPHA, STANOX, TIPLOC
|
- "stations": 3ALPHA, STANOX, TIPLOC
|
||||||
- "corpus": 3ALPHA, NLC, NLCDESC(TEXT)
|
- "corpus": 3ALPHA, NLC, NLCDESC(TEXT)
|
||||||
* Add sanitizing to Gitea Issue API, currently considered to be unsafe.
|
* Add Gitea Issue API
|
||||||
* Add success test for Gitea Issue API and send the result onto the client.
|
|
||||||
* Rewrite sanitizing functions to remove external dependancy.
|
|
||||||
* Undo changed to make everything an array - frontend code to handle this.
|
* Undo changed to make everything an array - frontend code to handle this.
|
6
app.js
6
app.js
|
@ -4,10 +4,6 @@
|
||||||
// licensed separately, each folder contains a license file where a
|
// licensed separately, each folder contains a license file where a
|
||||||
// different license applies.
|
// different license applies.
|
||||||
|
|
||||||
// While the Node app can serve static files, in production a separate
|
|
||||||
// container should be used for this. See the dockerfile under /static
|
|
||||||
// for this.
|
|
||||||
|
|
||||||
// External Requires
|
// External Requires
|
||||||
const express = require('express');
|
const express = require('express');
|
||||||
const app = express();
|
const app = express();
|
||||||
|
@ -19,7 +15,6 @@ const listRtr = require('./src/routes/list.routes'); // /list endpoints
|
||||||
const ldbRtr = require('./src/routes/ldb.routes'); // /ldb endpoints
|
const ldbRtr = require('./src/routes/ldb.routes'); // /ldb endpoints
|
||||||
const kubeRtr = require('./src/routes/kube.routes'); // /kube endpoints
|
const kubeRtr = require('./src/routes/kube.routes'); // /kube endpoints
|
||||||
const findRtr = require('./src/routes/find.routes'); // /find endpoints
|
const findRtr = require('./src/routes/find.routes'); // /find endpoints
|
||||||
const issueRtr = require('./src/routes/issue.routes') // /issue endpoints
|
|
||||||
const initDb = require('./src/utils/dbinit.utils'); // DB Init Utility
|
const initDb = require('./src/utils/dbinit.utils'); // DB Init Utility
|
||||||
|
|
||||||
// Set Server Configurations
|
// Set Server Configurations
|
||||||
|
@ -58,7 +53,6 @@ app.use('/api/v1/list', listRtr);
|
||||||
app.use('/api/v1/ldb', ldbRtr);
|
app.use('/api/v1/ldb', ldbRtr);
|
||||||
app.use('/api/v1/kube', kubeRtr);
|
app.use('/api/v1/kube', kubeRtr);
|
||||||
app.use('/api/v1/find', findRtr);
|
app.use('/api/v1/find', findRtr);
|
||||||
app.use('/api/v1/issue', issueRtr);
|
|
||||||
|
|
||||||
// Start Express
|
// Start Express
|
||||||
app.listen(srvPort, srvListen, (error) =>{
|
app.listen(srvPort, srvListen, (error) =>{
|
||||||
|
|
|
@ -1,10 +0,0 @@
|
||||||
module.exports = valid
|
|
||||||
|
|
||||||
const valid = [
|
|
||||||
"owlboard.co.uk",
|
|
||||||
"fjla.uk",
|
|
||||||
"gwr.com",
|
|
||||||
"swrailway.com",
|
|
||||||
"firstrail.com",
|
|
||||||
"networkrail.co.uk"
|
|
||||||
]
|
|
|
@ -1,14 +0,0 @@
|
||||||
const issue = require('../services/issue.services');
|
|
||||||
|
|
||||||
async function post(req, res, next){
|
|
||||||
try {
|
|
||||||
res.json(await issue.processor(req.body))
|
|
||||||
} catch (err) {
|
|
||||||
console.error(`Controller Error`, err.message);
|
|
||||||
next(err);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
module.exports = {
|
|
||||||
post
|
|
||||||
}
|
|
|
@ -1,7 +0,0 @@
|
||||||
const express = require('express');
|
|
||||||
const router = express.Router();
|
|
||||||
const issueController = require('../controllers/issue.controllers');
|
|
||||||
|
|
||||||
router.post('/', issueController.post);
|
|
||||||
|
|
||||||
module.exports = router;
|
|
|
@ -1,29 +1,19 @@
|
||||||
const axios = require('axios')
|
const axios = require('axios')
|
||||||
const clean = require('../utils/sanitizer.utils')
|
|
||||||
|
|
||||||
async function processor(data) {
|
|
||||||
let out = {}
|
|
||||||
out.title = await cleanData(data.subject)
|
|
||||||
out.body = await cleanData(data.msg)
|
|
||||||
sendToGitea(out);
|
|
||||||
}
|
|
||||||
|
|
||||||
async function cleanData(data) {
|
|
||||||
return data //clean.cleanApiEndpointTxt(data)
|
|
||||||
}
|
|
||||||
|
|
||||||
async function sendToGitea(body) {
|
async function sendToGitea(body) {
|
||||||
let key = process.env.OWL_GIT_ISSUEBOT
|
let key = process.env.OWL_GIT_ISSUEBOT
|
||||||
let url = process.env.OWL_GIT_APIENDPOINT
|
let url = process.env.OWL_GIT_APIENDPOINT
|
||||||
let opts = {
|
let options = {
|
||||||
headers: {
|
headers: {
|
||||||
Authorization: key
|
Authorization: key
|
||||||
}
|
},
|
||||||
|
data: body,
|
||||||
|
withCredantials: true
|
||||||
}
|
}
|
||||||
await axios.post(url, body, opts)
|
|
||||||
// Need to read the output from the POST and pass the result upwards to the client.
|
await axios.post(url, options)
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
processor
|
sendToGitea
|
||||||
}
|
}
|
|
@ -52,7 +52,6 @@ async function cancel() {
|
||||||
|
|
||||||
async function send() {
|
async function send() {
|
||||||
setLoadingDesc("Sending\nData")
|
setLoadingDesc("Sending\nData")
|
||||||
document.getElementById("preflight").style = "display: none"
|
|
||||||
showLoading()
|
showLoading()
|
||||||
var subject = sessionStorage.getItem("preflight_subject");
|
var subject = sessionStorage.getItem("preflight_subject");
|
||||||
var msg = sessionStorage.getItem("preflight_msg")
|
var msg = sessionStorage.getItem("preflight_msg")
|
||||||
|
|
Reference in New Issue