forked from external-repos/pa11y-dashboard
header and hide fields
This commit is contained in:

committed by
Rowan Manning

parent
c562bb07f3
commit
39435f37e4
@@ -1,12 +0,0 @@
|
|||||||
{
|
|
||||||
"port": 4000,
|
|
||||||
"noindex": true,
|
|
||||||
"readonly": false,
|
|
||||||
|
|
||||||
"webservice": {
|
|
||||||
"database": "mongodb://localhost/pa11y-webservice-test",
|
|
||||||
"host": "0.0.0.0",
|
|
||||||
"port": 3000,
|
|
||||||
"cron": "0 30 0 * * *"
|
|
||||||
}
|
|
||||||
}
|
|
12
route/new.js
12
route/new.js
@@ -36,6 +36,15 @@ function route(app) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
app.express.post('/new', (req, res) => {
|
app.express.post('/new', (req, res) => {
|
||||||
|
|
||||||
|
let parsedHeaders = '';
|
||||||
|
|
||||||
|
try {
|
||||||
|
parsedHeaders = JSON.parse(req.body.headers);
|
||||||
|
} catch (e) {
|
||||||
|
console.log(`error parsing headers object: ${req.body.headers}. Ignoring.`);
|
||||||
|
}
|
||||||
|
|
||||||
const newTask = {
|
const newTask = {
|
||||||
name: req.body.name,
|
name: req.body.name,
|
||||||
url: req.body.url,
|
url: req.body.url,
|
||||||
@@ -45,7 +54,10 @@ function route(app) {
|
|||||||
wait: req.body.wait || undefined,
|
wait: req.body.wait || undefined,
|
||||||
username: req.body.username || undefined,
|
username: req.body.username || undefined,
|
||||||
password: req.body.password || undefined
|
password: req.body.password || undefined
|
||||||
|
headers: parsedHeaders || undefined,
|
||||||
|
hideElements: req.body.hide || undefined
|
||||||
};
|
};
|
||||||
|
|
||||||
app.webservice.tasks.create(newTask, (err, task) => {
|
app.webservice.tasks.create(newTask, (err, task) => {
|
||||||
if (err) {
|
if (err) {
|
||||||
const standards = getStandards().map(standard => {
|
const standards = getStandards().map(standard => {
|
||||||
|
@@ -69,6 +69,8 @@ function route(app) {
|
|||||||
task.wait = req.body.wait;
|
task.wait = req.body.wait;
|
||||||
task.username = req.body.username;
|
task.username = req.body.username;
|
||||||
task.password = req.body.password;
|
task.password = req.body.password;
|
||||||
|
task.headers = req.body.headers;
|
||||||
|
task.hideElements = req.body.hideElements;
|
||||||
const standards = getStandards().map(standard => {
|
const standards = getStandards().map(standard => {
|
||||||
if (standard.title === task.standard) {
|
if (standard.title === task.standard) {
|
||||||
standard.selected = true;
|
standard.selected = true;
|
||||||
|
@@ -102,6 +102,24 @@ along with Pa11y Dashboard. If not, see <http://www.gnu.org/licenses/>.
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group clearfix">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-4 col-sm-4 col-xs-6">
|
||||||
|
<label class="control-label" for="new-task-headers">Headers Object (JSON)</label>
|
||||||
|
<input class="form-control" id="new-task-headers" type="text" name="headers" value="{{task.headers}}" placeholder='{headers: {"Cookie": "foo=bar"}}'/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group clearfix">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-4 col-sm-4 col-xs-6">
|
||||||
|
<label class="control-label" for="new-task-hide-elements">Hide Elements</label>
|
||||||
|
<input class="form-control" id="new-task-hide-elements" type="text" name="hide-elements" value="{{task.hide-elements}}" placeholder=".advert, #modal, div[aria-role=presentation]"/> <em>(CSS selector)</em>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<p class="control-label"><b>Ignore these rules</b> <a target="_blank" href="https://github.com/pa11y/pa11y/wiki/HTML-CodeSniffer-Rules">(full list of rules here)</a></p>
|
<p class="control-label"><b>Ignore these rules</b> <a target="_blank" href="https://github.com/pa11y/pa11y/wiki/HTML-CodeSniffer-Rules">(full list of rules here)</a></p>
|
||||||
|
|
||||||
<div class="standards-lists">
|
<div class="standards-lists">
|
||||||
|
@@ -114,6 +114,24 @@ along with Pa11y Dashboard. If not, see <http://www.gnu.org/licenses/>.
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group clearfix">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-4 col-sm-4 col-xs-6">
|
||||||
|
<label class="control-label" for="new-task-headers">Headers Object (JSON)</label>
|
||||||
|
<input class="form-control" id="new-task-headers" type="text" name="headers" value="{{task.headers}}" placeholder='{headers: {"Cookie": "foo=bar"}}'/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group clearfix">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-4 col-sm-4 col-xs-6">
|
||||||
|
<label class="control-label" for="new-task-hide-elements">Hide Elements</label>
|
||||||
|
<input class="form-control" id="new-task-hide-elements" type="text" name="hide-elements" value="{{task.hide-elements}}" placeholder=".advert, #modal, div[aria-role=presentation]"/> <em>(CSS selector)</em>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<p class="control-label"><b>Ignore these rules</b> <a target="_blank" href="https://github.com/pa11y/pa11y/wiki/HTML-CodeSniffer-Rules">(full list of rules here)</a></p>
|
<p class="control-label"><b>Ignore these rules</b> <a target="_blank" href="https://github.com/pa11y/pa11y/wiki/HTML-CodeSniffer-Rules">(full list of rules here)</a></p>
|
||||||
|
|
||||||
<div class="standards-lists">
|
<div class="standards-lists">
|
||||||
|
Reference in New Issue
Block a user