@things-factory/shell 7.0.44 → 7.0.49
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/_index.html +1 -25
- package/client/themes/index.css +15 -0
- package/config/config.development.js +55 -0
- package/config/config.production.js +57 -0
- package/dist-server/server-dev.js +12 -0
- package/dist-server/server-dev.js.map +1 -1
- package/dist-server/server.js +12 -0
- package/dist-server/server.js.map +1 -1
- package/dist-server/tsconfig.tsbuildinfo +1 -1
- package/package.json +2 -2
- package/server/server-dev.ts +20 -0
- package/server/server.ts +19 -0
- package/static/index.js +5 -0
- package/views/dependencies-view-graphviz.html +11 -3
- package/views/dependencies-view.html +7 -3
- package/views/graphql.html +9 -3
- package/views/public/home.html +1 -23
- package/views/template.html +1 -1
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@things-factory/shell",
|
3
|
-
"version": "7.0.
|
3
|
+
"version": "7.0.49",
|
4
4
|
"description": "Core module for framework",
|
5
5
|
"bin": {
|
6
6
|
"things-factory": "bin/things-factory",
|
@@ -133,5 +133,5 @@
|
|
133
133
|
"pg": "^8.7.3",
|
134
134
|
"sqlite3": "^5.0.8"
|
135
135
|
},
|
136
|
-
"gitHead": "
|
136
|
+
"gitHead": "3fdc2d9c86f8ebf1470fa5d2155b7b3019df6c0d"
|
137
137
|
}
|
package/server/server-dev.ts
CHANGED
@@ -28,6 +28,9 @@ import http from 'http'
|
|
28
28
|
|
29
29
|
import koaWebpack from '@hatiolab/koa-webpack'
|
30
30
|
import cors from '@koa/cors'
|
31
|
+
|
32
|
+
import crypto from 'crypto'
|
33
|
+
|
31
34
|
import { config, loader, logger, orderedModuleNames } from '@things-factory/env'
|
32
35
|
import { initLicense, checkValidity } from '@things-factory/operato-license-checker'
|
33
36
|
|
@@ -118,6 +121,23 @@ const bootstrap = async () => {
|
|
118
121
|
})
|
119
122
|
)
|
120
123
|
|
124
|
+
app.use(async (ctx, next) => {
|
125
|
+
ctx.set('X-Content-Type-Options', 'nosniff')
|
126
|
+
|
127
|
+
const { directives = {} } = config.get('CSP') || {}
|
128
|
+
|
129
|
+
const nonce = crypto.randomBytes(16).toString('base64')
|
130
|
+
ctx.state.nonce = nonce
|
131
|
+
|
132
|
+
const cspHeader = Object.entries(directives as { [key: string]: string[] })
|
133
|
+
.map(([key, value]) => `${key} ${value.join(' ')}`)
|
134
|
+
.join('; ')
|
135
|
+
|
136
|
+
ctx.set('Content-Security-Policy', cspHeader)
|
137
|
+
|
138
|
+
await next()
|
139
|
+
})
|
140
|
+
|
121
141
|
var subscriptionMiddleware = []
|
122
142
|
process.emit('bootstrap-module-subscription' as any, app, subscriptionMiddleware)
|
123
143
|
|
package/server/server.ts
CHANGED
@@ -28,6 +28,8 @@ import co from 'co'
|
|
28
28
|
import http from 'http'
|
29
29
|
|
30
30
|
import cors from '@koa/cors'
|
31
|
+
import crypto from 'crypto'
|
32
|
+
|
31
33
|
import { config, loader, logger, orderedModuleNames } from '@things-factory/env'
|
32
34
|
import { initLicense, checkValidity } from '@things-factory/operato-license-checker'
|
33
35
|
|
@@ -95,6 +97,23 @@ const bootstrap = async () => {
|
|
95
97
|
})
|
96
98
|
)
|
97
99
|
|
100
|
+
app.use(async (ctx, next) => {
|
101
|
+
ctx.set('X-Content-Type-Options', 'nosniff')
|
102
|
+
|
103
|
+
const { directives = {} } = config.get('CSP') || {}
|
104
|
+
|
105
|
+
const nonce = crypto.randomBytes(16).toString('base64')
|
106
|
+
ctx.state.nonce = nonce
|
107
|
+
|
108
|
+
const cspHeader = Object.entries(directives as { [key: string]: string[] })
|
109
|
+
.map(([key, value]) => `${key} ${value.join(' ')}`)
|
110
|
+
.join('; ')
|
111
|
+
|
112
|
+
ctx.set('Content-Security-Policy', cspHeader)
|
113
|
+
|
114
|
+
await next()
|
115
|
+
})
|
116
|
+
|
98
117
|
var subscriptionMiddleware = []
|
99
118
|
process.emit('bootstrap-module-subscription' as any, app, subscriptionMiddleware)
|
100
119
|
|
package/static/index.js
ADDED
@@ -1,10 +1,18 @@
|
|
1
|
-
<script src="
|
1
|
+
<script src="https://unpkg.com/d3@5.15.0/dist/d3.min.js"></script>
|
2
2
|
<script src="https://unpkg.com/viz.js@1.8.0/viz.js" type="javascript/worker"></script>
|
3
3
|
<script src="https://unpkg.com/d3-graphviz@1.3.1/build/d3-graphviz.min.js"></script>
|
4
4
|
|
5
|
-
<
|
5
|
+
<style nonce="<%= nonce %>">
|
6
|
+
#graph {
|
7
|
+
text-align: center;
|
8
|
+
width: 100%;
|
9
|
+
height: 100%;
|
10
|
+
}
|
11
|
+
</style>
|
12
|
+
|
13
|
+
<div id="graph"></div>
|
6
14
|
|
7
|
-
<script>
|
15
|
+
<script nonce="<%= nonce %>">
|
8
16
|
var model = <%- JSON.stringify(model) %>;
|
9
17
|
|
10
18
|
var { edges, nodes } = model
|
@@ -1,4 +1,4 @@
|
|
1
|
-
<style>
|
1
|
+
<style nonce="<%= nonce %>">
|
2
2
|
svg {
|
3
3
|
width: 100%;
|
4
4
|
height: 100%;
|
@@ -27,14 +27,18 @@
|
|
27
27
|
text {
|
28
28
|
font: 10px sans-serif;
|
29
29
|
pointer-events: none;
|
30
|
-
text-shadow:
|
30
|
+
text-shadow:
|
31
|
+
0 1px 0 #fff,
|
32
|
+
1px 0 0 #fff,
|
33
|
+
0 -1px 0 #fff,
|
34
|
+
-1px 0 0 #fff;
|
31
35
|
}
|
32
36
|
</style>
|
33
37
|
|
34
38
|
<script src="//d3js.org/d3.v3.min.js"></script>
|
35
39
|
<script src="//cdn.jsdelivr.net/npm/d3-graphviz@2.6.1/build/d3-graphviz.min.js"></script>
|
36
40
|
|
37
|
-
<script>
|
41
|
+
<script nonce="<%= nonce %>">
|
38
42
|
var model = <%- JSON.stringify(model) %>;
|
39
43
|
|
40
44
|
var { edges: links, nodes } = model
|
package/views/graphql.html
CHANGED
@@ -1,12 +1,18 @@
|
|
1
|
-
<style>
|
1
|
+
<style nonce="<%= nonce %>">
|
2
2
|
body {
|
3
3
|
margin: 0;
|
4
4
|
}
|
5
|
+
|
6
|
+
#embedded-sandbox {
|
7
|
+
width: 100%;
|
8
|
+
height: 100%;
|
9
|
+
}
|
5
10
|
</style>
|
6
11
|
|
7
|
-
<div
|
12
|
+
<div id="embedded-sandbox"></div>
|
13
|
+
|
8
14
|
<script src="https://embeddable-sandbox.cdn.apollographql.com/_latest/embeddable-sandbox.umd.production.min.js"></script>
|
9
|
-
<script>
|
15
|
+
<script nonce="<%= nonce %>">
|
10
16
|
new window.EmbeddedSandbox({
|
11
17
|
target: '#embedded-sandbox',
|
12
18
|
initialEndpoint: '<%- initialEndpoint %>',
|
package/views/public/home.html
CHANGED
@@ -56,29 +56,7 @@
|
|
56
56
|
<link href="/node_modules/@fontsource/roboto/index.css" rel="stylesheet" />
|
57
57
|
<link rel="stylesheet" href="/theme.css" />
|
58
58
|
|
59
|
-
<
|
60
|
-
body {
|
61
|
-
margin: 0;
|
62
|
-
padding: 0;
|
63
|
-
overflow: auto;
|
64
|
-
|
65
|
-
/* This is a font-stack that tries to use the system-default sans-serifs first */
|
66
|
-
font-family: Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol';
|
67
|
-
line-height: 1.5;
|
68
|
-
-webkit-font-smoothing: antialiased;
|
69
|
-
|
70
|
-
accent-color: var(--md-sys-color-primary);
|
71
|
-
background-color: var(--md-sys-color-background);
|
72
|
-
}
|
73
|
-
</style>
|
74
|
-
|
75
|
-
<script>
|
76
|
-
if ('serviceWorker' in navigator) {
|
77
|
-
navigator.serviceWorker.register('/service-worker.js', {
|
78
|
-
scope: '/'
|
79
|
-
})
|
80
|
-
}
|
81
|
-
</script>
|
59
|
+
<script src="/static/index.js" defer></script>
|
82
60
|
|
83
61
|
<!--- prefetch -->
|
84
62
|
<link rel="prefetch" href="/public/home.js" />
|