mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-01-23 02:35:49 +00:00
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:
parent
03e3ba6ad8
commit
dff0267239
4 changed files with 19 additions and 2 deletions
|
|
@ -9,7 +9,7 @@
|
||||||
<link rel="icon" href="{{ prefix }}/favicon.ico">
|
<link rel="icon" href="{{ prefix }}/favicon.ico">
|
||||||
|
|
||||||
<link rel=stylesheet href="{{ prefix }}/dist/cloudcmd.css">
|
<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>
|
<noscript>
|
||||||
<link rel=stylesheet href="{{ prefix }}/dist/nojs.css">
|
<link rel=stylesheet href="{{ prefix }}/dist/nojs.css">
|
||||||
</noscript>
|
</noscript>
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@ module.exports = (config) => {
|
||||||
function _middle(config, authentication, req, res, next) {
|
function _middle(config, authentication, req, res, next) {
|
||||||
const is = config('auth');
|
const is = config('auth');
|
||||||
|
|
||||||
if (!is)
|
if (!is || req.originalUrl.startsWith("/public/"))
|
||||||
return next();
|
return next();
|
||||||
|
|
||||||
const success = () => next();
|
const success = () => next();
|
||||||
|
|
|
||||||
|
|
@ -178,3 +178,20 @@ test('cloudcmd: sw', async (t) => {
|
||||||
t.equal(status, 200, 'should return sw');
|
t.equal(status, 200, 'should return sw');
|
||||||
t.end();
|
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();
|
||||||
|
});
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue