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:
|
||||
|
||||
* 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: Check for success and then redirect to /.
|
||||
* Enable text search for `locationName` on find-code page.
|
||||
* Responsive text sizes for boards.
|
||||
|
||||
@ -18,6 +17,9 @@
|
||||
|
||||
* Write service worker for full PWA experience.
|
||||
* Implement error pages.
|
||||
* Issue page: Submit using API.
|
||||
* Issue page: Collect diagnostics such as browser features etc.
|
||||
* Add Gitea Issue API
|
||||
|
||||
|
||||
## Backend:
|
||||
@ -25,5 +27,7 @@
|
||||
* DB Indexes:
|
||||
- "stations": 3ALPHA, STANOX, TIPLOC
|
||||
- "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.
|
6
app.js
6
app.js
@ -4,6 +4,10 @@
|
||||
// licensed separately, each folder contains a license file where a
|
||||
// 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
|
||||
const express = require('express');
|
||||
const app = express();
|
||||
@ -54,7 +58,7 @@ app.use('/api/v1/list', listRtr);
|
||||
app.use('/api/v1/ldb', ldbRtr);
|
||||
app.use('/api/v1/kube', kubeRtr);
|
||||
app.use('/api/v1/find', findRtr);
|
||||
app.use('./api/v1/issue', issueRtr);
|
||||
app.use('/api/v1/issue', issueRtr);
|
||||
|
||||
// Start Express
|
||||
app.listen(srvPort, srvListen, (error) =>{
|
||||
|
@ -2,6 +2,6 @@ const express = require('express');
|
||||
const router = express.Router();
|
||||
const issueController = require('../controllers/issue.controllers');
|
||||
|
||||
router.post('/issue', issueController.post);
|
||||
router.post('/', issueController.post);
|
||||
|
||||
module.exports = router;
|
@ -3,13 +3,13 @@ const clean = require('../utils/sanitizer.utils')
|
||||
|
||||
async function processor(data) {
|
||||
let out = {}
|
||||
out.title = await cleanData(data.title)
|
||||
out.body = await cleanData(data.body)
|
||||
out.title = await cleanData(data.subject)
|
||||
out.body = await cleanData(data.msg)
|
||||
sendToGitea(out);
|
||||
}
|
||||
|
||||
async function cleanData(data) {
|
||||
return clean.cleanApiEndpointTxt(data)
|
||||
return data //clean.cleanApiEndpointTxt(data)
|
||||
}
|
||||
|
||||
async function sendToGitea(body) {
|
||||
@ -21,6 +21,7 @@ async function sendToGitea(body) {
|
||||
}
|
||||
}
|
||||
await axios.post(url, body, opts)
|
||||
// Need to read the output from the POST and pass the result upwards to the client.
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
|
@ -52,6 +52,7 @@ async function cancel() {
|
||||
|
||||
async function send() {
|
||||
setLoadingDesc("Sending\nData")
|
||||
document.getElementById("preflight").style = "display: none"
|
||||
showLoading()
|
||||
var subject = sessionStorage.getItem("preflight_subject");
|
||||
var msg = sessionStorage.getItem("preflight_msg")
|
||||
|
Reference in New Issue
Block a user