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
This commit is contained in:
Hagay Goshen 2024-11-22 12:14:34 +02:00 committed by GitHub
parent 03e3ba6ad8
commit dff0267239
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 19 additions and 2 deletions

View file

@ -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>

View file

@ -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();

View file

@ -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();
});