Skip to content

Commit dff0267

Browse files
authored
fix: cloudcmd: make manifest.json accessible when authentication is enabled (#428)
* Make manifest.json accessable when authentication is enabled * add test for manifest.json availability when authentication is enabled
1 parent 03e3ba6 commit dff0267

File tree

4 files changed

+19
-2
lines changed

4 files changed

+19
-2
lines changed

html/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
<link rel="icon" href="{{ prefix }}/favicon.ico">
1010

1111
<link rel=stylesheet href="{{ prefix }}/dist/cloudcmd.css">
12-
<link rel="manifest" href="{{ prefix }}/static/manifest.json">
12+
<link rel="manifest" href="{{ prefix }}/public/manifest.json">
1313
<noscript>
1414
<link rel=stylesheet href="{{ prefix }}/dist/nojs.css">
1515
</noscript>

server/auth.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ module.exports = (config) => {
1717
function _middle(config, authentication, req, res, next) {
1818
const is = config('auth');
1919

20-
if (!is)
20+
if (!is || req.originalUrl.startsWith("/public/"))
2121
return next();
2222

2323
const success = () => next();

server/cloudcmd.spec.mjs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,3 +178,20 @@ test('cloudcmd: sw', async (t) => {
178178
t.equal(status, 200, 'should return sw');
179179
t.end();
180180
});
181+
182+
test('cloudcmd: manifest.json', async (t) => {
183+
const config = {
184+
auth: true,
185+
};
186+
187+
const options = {
188+
config,
189+
};
190+
191+
const {status} = await request.get('/public/manifest.json', {
192+
options,
193+
});
194+
195+
t.equal(status, 200, 'should return manifest.json even when authentication is enabled');
196+
t.end();
197+
});

0 commit comments

Comments
 (0)