FullStack: Improve issue API
Signed-off-by: Fred Boniface <fred@fjla.uk>
This commit is contained in:
parent
205c6b5d6b
commit
ef55fb0365
10
UpNext.md
10
UpNext.md
@ -3,9 +3,8 @@
|
|||||||
## 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.
|
||||||
|
|
||||||
@ -18,6 +17,9 @@
|
|||||||
|
|
||||||
* 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:
|
||||||
@ -25,5 +27,7 @@
|
|||||||
* DB Indexes:
|
* DB Indexes:
|
||||||
- "stations": 3ALPHA, STANOX, TIPLOC
|
- "stations": 3ALPHA, STANOX, TIPLOC
|
||||||
- "corpus": 3ALPHA, NLC, NLCDESC(TEXT)
|
- "corpus": 3ALPHA, NLC, NLCDESC(TEXT)
|
||||||
* Add Gitea Issue API
|
* Add sanitizing to Gitea Issue API, currently considered to be unsafe.
|
||||||
|
* 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,6 +4,10 @@
|
|||||||
// 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();
|
||||||
@ -54,7 +58,7 @@ 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);
|
app.use('/api/v1/issue', issueRtr);
|
||||||
|
|
||||||
// Start Express
|
// Start Express
|
||||||
app.listen(srvPort, srvListen, (error) =>{
|
app.listen(srvPort, srvListen, (error) =>{
|
||||||
|
@ -2,6 +2,6 @@ const express = require('express');
|
|||||||
const router = express.Router();
|
const router = express.Router();
|
||||||
const issueController = require('../controllers/issue.controllers');
|
const issueController = require('../controllers/issue.controllers');
|
||||||
|
|
||||||
router.post('/issue', issueController.post);
|
router.post('/', issueController.post);
|
||||||
|
|
||||||
module.exports = router;
|
module.exports = router;
|
@ -3,13 +3,13 @@ const clean = require('../utils/sanitizer.utils')
|
|||||||
|
|
||||||
async function processor(data) {
|
async function processor(data) {
|
||||||
let out = {}
|
let out = {}
|
||||||
out.title = await cleanData(data.title)
|
out.title = await cleanData(data.subject)
|
||||||
out.body = await cleanData(data.body)
|
out.body = await cleanData(data.msg)
|
||||||
sendToGitea(out);
|
sendToGitea(out);
|
||||||
}
|
}
|
||||||
|
|
||||||
async function cleanData(data) {
|
async function cleanData(data) {
|
||||||
return clean.cleanApiEndpointTxt(data)
|
return data //clean.cleanApiEndpointTxt(data)
|
||||||
}
|
}
|
||||||
|
|
||||||
async function sendToGitea(body) {
|
async function sendToGitea(body) {
|
||||||
@ -21,6 +21,7 @@ async function sendToGitea(body) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
await axios.post(url, body, opts)
|
await axios.post(url, body, opts)
|
||||||
|
// Need to read the output from the POST and pass the result upwards to the client.
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
|
@ -52,6 +52,7 @@ 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
Block a user