diff --git a/UpNext.md b/UpNext.md index 4975068..2809959 100644 --- a/UpNext.md +++ b/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. \ No newline at end of file diff --git a/app.js b/app.js index 3256d28..374bc69 100644 --- a/app.js +++ b/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) =>{ diff --git a/src/routes/issue.routes.js b/src/routes/issue.routes.js index 24d6375..00b8d19 100644 --- a/src/routes/issue.routes.js +++ b/src/routes/issue.routes.js @@ -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; \ No newline at end of file diff --git a/src/services/issue.services.js b/src/services/issue.services.js index f9bd56e..52310b9 100644 --- a/src/services/issue.services.js +++ b/src/services/issue.services.js @@ -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 = { diff --git a/static/js/issue.js b/static/js/issue.js index 89fdd4c..a8f65a5 100644 --- a/static/js/issue.js +++ b/static/js/issue.js @@ -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")