agendash 3.0.0 → 3.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/csp.js ADDED
@@ -0,0 +1,28 @@
1
+ const CSP = {
2
+ "default-src": [
3
+ "'self'",
4
+ ],
5
+ "script-src": [
6
+ "https://code.jquery.com",
7
+ "https://cdn.jsdelivr.net",
8
+ "https://cdnjs.cloudflare.com",
9
+ "https://stackpath.bootstrapcdn.com",
10
+ "'unsafe-inline'",
11
+ "'unsafe-eval'",
12
+ "'self'",
13
+ ],
14
+ "style-src": [
15
+ "https://cdn.jsdelivr.net",
16
+ "https://stackpath.bootstrapcdn.com",
17
+ "https://fonts.googleapis.com",
18
+ "https://unpkg.com",
19
+ "'self'",
20
+ ],
21
+ "font-src": [
22
+ "https://fonts.gstatic.com",
23
+ ],
24
+ };
25
+
26
+ module.exports = Object.entries(CSP)
27
+ .map(([type, values]) => `${type} ${values.join(" ")}`)
28
+ .join("; ")
@@ -1,12 +1,19 @@
1
1
  const path = require("path");
2
2
  const express = require("express");
3
3
  const bodyParser = require("body-parser");
4
+ const csp = require("../csp");
4
5
 
5
6
  module.exports = (agendash) => {
6
7
  const { api, requeueJobs, deleteJobs, createJob } = agendash;
7
8
  const app = express();
8
9
  app.use(bodyParser.json());
9
10
  app.use(bodyParser.urlencoded({ extended: false }));
11
+
12
+ app.use((req, res, next) => {
13
+ res.header("Content-Security-Policy", csp);
14
+ next();
15
+ });
16
+
10
17
  app.use("/", express.static(path.join(__dirname, "../../public")));
11
18
 
12
19
  app.get("/api", async (request, response) => {
@@ -1,4 +1,5 @@
1
1
  const path = require("path");
2
+ const csp = require("../csp");
2
3
 
3
4
  module.exports = (agendash) => (instance, opts, done) => {
4
5
  const { api, requeueJobs, deleteJobs, createJob } = agendash;
@@ -8,6 +9,7 @@ module.exports = (agendash) => (instance, opts, done) => {
8
9
  });
9
10
 
10
11
  instance.get("/", function (req, reply) {
12
+ reply.header("Content-Security-Policy", csp);
11
13
  return reply.sendFile("index.html");
12
14
  });
13
15
 
@@ -1,11 +1,17 @@
1
1
  const path = require("path");
2
2
  const pack = require("../../package.json");
3
+ const csp = require("../csp");
3
4
 
4
5
  module.exports = (agendash) => {
5
6
  const { api, requeueJobs, deleteJobs, createJob } = agendash;
6
7
  return {
7
8
  pkg: pack,
8
9
  register: (server, options) => {
10
+ server.ext("onPreResponse", (req, h) => {
11
+ req.response.header("Content-Security-Policy", csp);
12
+ return h.continue;
13
+ });
14
+
9
15
  server.route([
10
16
  {
11
17
  method: "GET",
@@ -2,10 +2,16 @@ const path = require("path");
2
2
  const bodyParser = require("koa-bodyparser");
3
3
  const Router = require("koa-router");
4
4
  const koaStatic = require("koa-static");
5
+ const csp = require("../csp");
5
6
 
6
7
  module.exports = (agendash) => {
7
8
  const middlewares = [];
8
9
 
10
+ middlewares.push(async (ctx, next) => {
11
+ await next();
12
+ ctx.set("Content-Security-Policy", csp);
13
+ });
14
+
9
15
  middlewares.push(
10
16
  koaStatic(path.resolve(__dirname, "../../public"), { defer: true })
11
17
  );
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agendash",
3
- "version": "3.0.0",
3
+ "version": "3.1.0",
4
4
  "description": "A modern dashboard for Agenda.js with Pagination and Search capabilities",
5
5
  "main": "app.js",
6
6
  "bin": "bin/agendash-standalone.js",
package/History.md DELETED
@@ -1,106 +0,0 @@
1
- # 3.0.0
2
-
3
- - BREAKING: Drop support for MongoDB v3.4, only >=v3.6 is supported now.
4
- - BREAKING: Drop support for node 10, but added node 16 support.
5
- - feat: add `fastify` support #194
6
- - fix: a lot of rendering issues
7
- - fix: newer version of `mongodb` compatibility #193
8
-
9
- This file won't mention contributors anymore. Because all contributors are listed on the [main page](https://github.com/agenda/agendash) now. Thanks, GitHub!
10
-
11
- # 2.1.0 - JSON validation when creating jobs
12
-
13
- - feat: Add json validator message when createJob #169 (thanks @love8587)
14
-
15
- # 2.0.0 - First public release of v2 as Agendash proper
16
-
17
- Complete rewrite of Agendash in Vue.js!
18
-
19
- Supports Node.js 10 and up.
20
-
21
- # 2.0.0-beta0.8.2 / 2020-12-04 - As agendash2, in parallel repository https://github.com/agenda/agendash-v2
22
-
23
- - fix: search by job name, small side bar design fix and toggle improvements (thanks @simllll)
24
- - fix: joblist reset fix (thanks @simllll)
25
- - fix: improve design on desktop + close sidebar on mobile when clicked on something (thanks @simllll)
26
- - feat: enable options.query as number (thanks @Enubia @simllll)
27
- - feat: multiselect checkboxes (thanks @Enubia @simllll)
28
-
29
- # 2.0.0-beta0.1.0 / 2020-04-30 - First public release of Agendash2 in parallel repository https://github.com/agenda/agendash-v2
30
-
31
- - New frontend written from scratch in Vue.js
32
- - Add search
33
- - Add pagination
34
- - Change default refresh interval to 60 seconds
35
-
36
- # 1.0.0 / 2019-02-25
37
-
38
- - Add Hapi v17 middleware, drop support for Node.js v6 & v7 (#81) by umens (**BREAKING**)
39
- - Support Agenda version 2 by alexkwolfe (**BREAKING**)
40
-
41
- # 0.5.0 / 2019-02-25
42
-
43
- - Update dependencies (#69, #70) (**BREAKING**)
44
- - Agenda `>=0.7.0 <1.0.0` → `^1.0.3` and thus require MongoDB v3+
45
- - async `^1.0.0` → `^2.6.0`
46
- - Drop support for Node.js v4 and v5 (might still work but we're stopping testing these) (**BREAKING**)
47
- - Switch testing with Mocha to [Ava](https://www.npmjs.com/package/ava) (#70)
48
- - Docker support (#54) by WoLfulus
49
- - Fix 404 errors when deleting and re-queuing jobs (#61) by koresar
50
-
51
- # 0.4.0 / 2016-10-27
52
-
53
- - (simison) Agenda dependency version `<1.0.0` to avoid breaking dependency.
54
- - (loris) Fix #24 - Added indexes for faster queries.
55
- - Fix #28 - Removed dependency on Mongo Driver.
56
- - Added API tests with mocha and supertest. No frontend tests.
57
-
58
- # 0.3.2 / 2016-06-30
59
-
60
- - (HugoCornu) Fix #19 "Schedule Job" - Don't repeat job if user didn't want it repeated
61
-
62
- # 0.3.1 / 2016-04-12
63
-
64
- - (simison) Add engines key to package.json
65
-
66
- # 0.3.0 / 2016-04-04
67
-
68
- - (bh-chaker) Schedule Job Feature - create new jobs from the UI
69
- - Limit to 200 jobs on page, no UI for configuration
70
-
71
- # 0.2.1 / 2016-03-25
72
-
73
- - (vziukas) Recurring job count and labels
74
- - Fixed "queued" label colors
75
-
76
- # 0.2.0 / 2016-03-18
77
-
78
- - (vziukas) Configurable title
79
- - Middleware option moved to "options" object
80
-
81
- # 0.1.1 / 2016-03-17
82
-
83
- - (vziukas) multiple instances of agendash can each have a separate agenda
84
-
85
- # 0.1.0 / 2016-03-15
86
-
87
- - (rapidia) remove "arrow function" syntax for non-chrome browsers
88
- - (ebourmalo) Fix the middleware usage and use a proper structure
89
-
90
- # 0.0.5 / 2016-02-24
91
-
92
- - Batch requeue and delete
93
- - Select All and Select None
94
-
95
- # 0.0.4 / 2016-02-24
96
-
97
- - Select multiple jobs
98
-
99
- # 0.0.2 / 2016-02-23
100
-
101
- - version bump so npm will update docs
102
- - Added screenshots
103
-
104
- # 0.0.1 / 2016-02-23
105
-
106
- - Initial Release