Skip to content

Commit

Permalink
fix: cloudcmd: make manifest.json accessible when authentication is e…
Browse files Browse the repository at this point in the history
…nabled (#428)

* Make manifest.json accessable when authentication is enabled

* add test for manifest.json availability when authentication is enabled
  • Loading branch information
hagaygo authored Nov 22, 2024
1 parent 03e3ba6 commit dff0267
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 2 deletions.
2 changes: 1 addition & 1 deletion html/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<link rel="icon" href="{{ prefix }}/favicon.ico">

<link rel=stylesheet href="{{ prefix }}/dist/cloudcmd.css">
<link rel="manifest" href="{{ prefix }}/static/manifest.json">
<link rel="manifest" href="{{ prefix }}/public/manifest.json">
<noscript>
<link rel=stylesheet href="{{ prefix }}/dist/nojs.css">
</noscript>
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion server/auth.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ module.exports = (config) => {
function _middle(config, authentication, req, res, next) {
const is = config('auth');

if (!is)
if (!is || req.originalUrl.startsWith("/public/"))
return next();

const success = () => next();
Expand Down
17 changes: 17 additions & 0 deletions server/cloudcmd.spec.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -178,3 +178,20 @@ test('cloudcmd: sw', async (t) => {
t.equal(status, 200, 'should return sw');
t.end();
});

test('cloudcmd: manifest.json', async (t) => {
const config = {
auth: true,
};

const options = {
config,
};

const {status} = await request.get('/public/manifest.json', {
options,
});

t.equal(status, 200, 'should return manifest.json even when authentication is enabled');
t.end();
});

0 comments on commit dff0267

Please sign in to comment.