openbot 0.4.3 → 0.4.4
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/dist/app/cli.js +1 -1
- package/dist/app/server.js +12 -0
- package/package.json +1 -1
- package/src/app/cli.ts +1 -1
- package/src/app/server.ts +13 -0
package/dist/app/cli.js
CHANGED
|
@@ -16,7 +16,7 @@ function checkNodeVersion() {
|
|
|
16
16
|
}
|
|
17
17
|
}
|
|
18
18
|
checkNodeVersion();
|
|
19
|
-
program.name('openbot').description('OpenBot CLI').version('0.4.
|
|
19
|
+
program.name('openbot').description('OpenBot CLI').version('0.4.4');
|
|
20
20
|
program
|
|
21
21
|
.command('start')
|
|
22
22
|
.description('Start the OpenBot harness')
|
package/dist/app/server.js
CHANGED
|
@@ -129,6 +129,18 @@ export async function startServer(options = {}) {
|
|
|
129
129
|
}
|
|
130
130
|
}
|
|
131
131
|
};
|
|
132
|
+
// Support for Chrome's Private Network Access (PNA)
|
|
133
|
+
// https://developer.chrome.com/blog/private-network-access-preflight/
|
|
134
|
+
app.use((req, res, next) => {
|
|
135
|
+
if (req.headers['access-control-request-private-network'] === 'true') {
|
|
136
|
+
res.setHeader('Access-Control-Allow-Private-Network', 'true');
|
|
137
|
+
}
|
|
138
|
+
// If it's a preflight request, we should also ensure the Vary header is set
|
|
139
|
+
if (req.method === 'OPTIONS') {
|
|
140
|
+
res.setHeader('Vary', 'Access-Control-Request-Private-Network');
|
|
141
|
+
}
|
|
142
|
+
next();
|
|
143
|
+
});
|
|
132
144
|
app.use(cors());
|
|
133
145
|
const resolvePublicBaseUrl = () => getPublicBaseUrl(PORT, config.publicUrl);
|
|
134
146
|
app.use((req, res, next) => {
|
package/package.json
CHANGED
package/src/app/cli.ts
CHANGED
package/src/app/server.ts
CHANGED
|
@@ -164,6 +164,19 @@ export async function startServer(options: ServerOptions = {}) {
|
|
|
164
164
|
}
|
|
165
165
|
};
|
|
166
166
|
|
|
167
|
+
// Support for Chrome's Private Network Access (PNA)
|
|
168
|
+
// https://developer.chrome.com/blog/private-network-access-preflight/
|
|
169
|
+
app.use((req, res, next) => {
|
|
170
|
+
if (req.headers['access-control-request-private-network'] === 'true') {
|
|
171
|
+
res.setHeader('Access-Control-Allow-Private-Network', 'true');
|
|
172
|
+
}
|
|
173
|
+
// If it's a preflight request, we should also ensure the Vary header is set
|
|
174
|
+
if (req.method === 'OPTIONS') {
|
|
175
|
+
res.setHeader('Vary', 'Access-Control-Request-Private-Network');
|
|
176
|
+
}
|
|
177
|
+
next();
|
|
178
|
+
});
|
|
179
|
+
|
|
167
180
|
app.use(cors());
|
|
168
181
|
|
|
169
182
|
const resolvePublicBaseUrl = () => getPublicBaseUrl(PORT, config.publicUrl);
|