diff --git a/README.md b/README.md
index 5a091f0..b64b056 100644
--- a/README.md
+++ b/README.md
@@ -87,14 +87,14 @@ yarn test
You can configure application using configs in /config
directory.
-| Property | Role |
-|-------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------|
- | port
| to set port of application |
- | database
| to name directory with data |
- | rcFile
| to set destination of codexdocsrc config file |
- | uploads
| to set destination of directory to save uploads |
- | secret
| to set secret |
- | faviconURL
| to set url to get favicon. Server uploads file by url and saves it to temporary directory. And you can get favicon by /favicon route of application |
+| Property | Role |
+|----------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------|
+ | port
| to set port of application |
+ | database
| to name directory with data |
+ | rcFile
| to set destination of codexdocsrc config file |
+ | uploads
| to set destination of directory to save uploads |
+ | secret
| to set secret |
+ | favicon
| to set url or path to get favicon. Server uploads file by url and saves it to temporary directory. And you can get favicon by /favicon static route of application |
You can configure application using configs in /config
directory.
diff --git a/config/development.json b/config/development.json
index fbedc51..c7968be 100644
--- a/config/development.json
+++ b/config/development.json
@@ -4,5 +4,5 @@
"rcFile": "./.codexdocsrc",
"uploads": "public/uploads",
"secret": "iamasecretstring",
- "faviconURL": ""
+ "favicon": ""
}
diff --git a/config/production.json b/config/production.json
index daaa167..102f201 100644
--- a/config/production.json
+++ b/config/production.json
@@ -4,5 +4,5 @@
"rcFile": "./.codexdocsrc",
"uploads": "/uploads",
"secret": "iamasecretstring",
- "faviconURL": ""
+ "favicon": ""
}
diff --git a/config/testing.json b/config/testing.json
index 5f122bb..cb29838 100644
--- a/config/testing.json
+++ b/config/testing.json
@@ -4,5 +4,5 @@
"rcFile": "./src/test/.codexdocsrc",
"uploads": "public/uploads_test",
"secret": "iamasecretstring",
- "faviconURL": ""
+ "favicon": ""
}
diff --git a/src/backend/app.ts b/src/backend/app.ts
index 2b38ab3..819c9e4 100644
--- a/src/backend/app.ts
+++ b/src/backend/app.ts
@@ -16,7 +16,7 @@ const app = express();
const localConfig = rcParser.getConfiguration();
// Get url to upload favicon from config
-const faviconURL: string = appConfig.get('faviconURL');
+const faviconURL: string = appConfig.get('favicon');
app.locals.config = localConfig;
// view engine setup
diff --git a/src/backend/routes/aliases.ts b/src/backend/routes/aliases.ts
index 01614af..b6d5eea 100644
--- a/src/backend/routes/aliases.ts
+++ b/src/backend/routes/aliases.ts
@@ -3,7 +3,6 @@ import Aliases from '../controllers/aliases';
import Pages from '../controllers/pages';
import Alias from '../models/alias';
import verifyToken from './middlewares/token';
-import app from '../app';
const router = express.Router();
@@ -37,7 +36,7 @@ router.get('*', verifyToken, async (req: Request, res: Response) => {
page,
pageParent,
config: req.app.locals.config,
- favicon: app.locals.favicon,
+ favicon: req.app.locals.favicon,
});
}
}
diff --git a/src/backend/routes/auth.ts b/src/backend/routes/auth.ts
index e647930..c6cb6a8 100644
--- a/src/backend/routes/auth.ts
+++ b/src/backend/routes/auth.ts
@@ -2,7 +2,6 @@ import express, { Request, Response } from 'express';
import jwt from 'jsonwebtoken';
import config from 'config';
import csrf from 'csurf';
-import app from '../app';
const router = express.Router();
const csrfProtection = csrf({ cookie: true });
@@ -15,7 +14,7 @@ router.get('/auth', csrfProtection, function (req: Request, res: Response) {
res.render('auth', {
title: 'Login page',
csrfToken: req.csrfToken(),
- favicon: app.locals.favicon,
+ favicon: req.app.locals.favicon,
});
});
@@ -29,7 +28,7 @@ router.post('/auth', parseForm, csrfProtection, async (req: Request, res: Respon
title: 'Login page',
header: 'Password not set',
csrfToken: req.csrfToken(),
- favicon: app.locals.favicon,
+ favicon: req.app.locals.favicon,
});
return;
@@ -40,7 +39,7 @@ router.post('/auth', parseForm, csrfProtection, async (req: Request, res: Respon
title: 'Login page',
header: 'Wrong password',
csrfToken: req.csrfToken(),
- favicon: app.locals.favicon,
+ favicon: req.app.locals.favicon,
});
return;
@@ -63,7 +62,7 @@ router.post('/auth', parseForm, csrfProtection, async (req: Request, res: Respon
title: 'Login page',
header: 'Password not set',
csrfToken: req.csrfToken(),
- favicon: app.locals.favicon
+ favicon: req.app.locals.favicon
});
return;
diff --git a/src/backend/routes/home.ts b/src/backend/routes/home.ts
index a1824b8..86d9af8 100644
--- a/src/backend/routes/home.ts
+++ b/src/backend/routes/home.ts
@@ -1,6 +1,5 @@
import express, { Request, Response } from 'express';
import verifyToken from './middlewares/token';
-import app from '../app';
const router = express.Router();
@@ -12,7 +11,7 @@ router.get('/', verifyToken, async (req: Request, res: Response) => {
return res.redirect(config.startPage);
}
res.render('pages/index', { isAuthorized: res.locals.isAuthorized,
- favicon: app.locals.favicon });
+ favicon: req.app.locals.favicon });
});
export default router;
diff --git a/src/backend/routes/pages.ts b/src/backend/routes/pages.ts
index 86b80f6..c74efca 100644
--- a/src/backend/routes/pages.ts
+++ b/src/backend/routes/pages.ts
@@ -3,7 +3,6 @@ import Pages from '../controllers/pages';
import PagesOrder from '../controllers/pagesOrder';
import verifyToken from './middlewares/token';
import allowEdit from './middlewares/locals';
-import app from '../app';
const router = express.Router();
@@ -17,7 +16,7 @@ router.get('/page/new', verifyToken, allowEdit, async (req: Request, res: Respon
res.render('pages/form', {
pagesAvailable,
page: null,
- favicon: app.locals.favicon,
+ favicon: req.app.locals.favicon,
});
} catch (error) {
res.status(404);
@@ -45,7 +44,7 @@ router.get('/page/edit/:id', verifyToken, allowEdit, async (req: Request, res: R
page,
parentsChildrenOrdered,
pagesAvailable,
- favicon: app.locals.favicon,
+ favicon: req.app.locals.favicon,
});
} catch (error) {
res.status(404);
@@ -68,7 +67,7 @@ router.get('/page/:id', verifyToken, async (req: Request, res: Response, next: N
page,
pageParent,
config: req.app.locals.config,
- favicon: app.locals.favicon,
+ favicon: req.app.locals.favicon,
});
} catch (error) {
res.status(404);