notherbase-fs 3.2.16 → 3.2.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/controllers/creation.js +8 -8
- package/notherbase-fs.js +6 -2
- package/package.json +1 -1
package/controllers/creation.js
CHANGED
|
@@ -5,11 +5,12 @@ import fs from 'fs';
|
|
|
5
5
|
* Creation is all the renedered pages in a base.
|
|
6
6
|
*/
|
|
7
7
|
export default class Creation {
|
|
8
|
-
constructor() {
|
|
8
|
+
constructor(siteTitle = "Base") {
|
|
9
|
+
this.siteTitle = siteTitle;
|
|
9
10
|
this.router = express.Router();
|
|
10
11
|
|
|
11
12
|
//home
|
|
12
|
-
this.router.get("/",
|
|
13
|
+
this.router.get("/", this.front, this.explore);
|
|
13
14
|
|
|
14
15
|
//the-front
|
|
15
16
|
this.router.get(`/the-front`, this.front, this.explore);
|
|
@@ -23,8 +24,7 @@ export default class Creation {
|
|
|
23
24
|
this.router.get(`/:region/:area/:poi/:detail`, this.lock, this.detail, this.explore);
|
|
24
25
|
|
|
25
26
|
//void
|
|
26
|
-
this.router.use(function(req, res) {
|
|
27
|
-
console.log(req.path);
|
|
27
|
+
this.router.use(function(req, res) {
|
|
28
28
|
res.redirect("/void");
|
|
29
29
|
});
|
|
30
30
|
}
|
|
@@ -88,7 +88,7 @@ export default class Creation {
|
|
|
88
88
|
*/
|
|
89
89
|
front = async (req, res, next) => {
|
|
90
90
|
req.main = req.contentPath + "/the-front/index";
|
|
91
|
-
req.siteTitle =
|
|
91
|
+
req.siteTitle = this.siteTitle;
|
|
92
92
|
req.toRender = "explorer";
|
|
93
93
|
next();
|
|
94
94
|
}
|
|
@@ -101,7 +101,7 @@ export default class Creation {
|
|
|
101
101
|
*/
|
|
102
102
|
frontDetail = async (req, res, next) => {
|
|
103
103
|
req.main = `${req.contentPath}/the-front/${req.params.frontDetail}/index`;
|
|
104
|
-
req.siteTitle =
|
|
104
|
+
req.siteTitle = `${this.siteTitle} - ${req.params.frontDetail}`;
|
|
105
105
|
req.toRender = "explorer";
|
|
106
106
|
next();
|
|
107
107
|
}
|
|
@@ -114,7 +114,7 @@ export default class Creation {
|
|
|
114
114
|
*/
|
|
115
115
|
poi = async (req, res, next) => {
|
|
116
116
|
req.main = `${req.contentPath}/${req.params.region}/${req.params.area}/${req.params.poi}/index`;
|
|
117
|
-
req.siteTitle =
|
|
117
|
+
req.siteTitle = `${this.siteTitle} - ${req.params.poi}`;
|
|
118
118
|
req.toRender = "explorer";
|
|
119
119
|
next();
|
|
120
120
|
}
|
|
@@ -127,7 +127,7 @@ export default class Creation {
|
|
|
127
127
|
*/
|
|
128
128
|
detail = async (req, res, next) => {
|
|
129
129
|
req.main = `${req.contentPath}/${req.params.region}/${req.params.area}/${req.params.poi}/${req.params.detail}/index`;
|
|
130
|
-
req.siteTitle =
|
|
130
|
+
req.siteTitle = `${this.siteTitle} - ${req.params.detail}`;
|
|
131
131
|
req.toRender = "explorer";
|
|
132
132
|
next();
|
|
133
133
|
}
|
package/notherbase-fs.js
CHANGED
|
@@ -17,11 +17,15 @@ import SpiritWorld from "./controllers/spirit-world.js";
|
|
|
17
17
|
* The engine that runs a nother base.
|
|
18
18
|
*/
|
|
19
19
|
class NotherBaseFS {
|
|
20
|
-
constructor(contentPath, globals = null) {
|
|
20
|
+
constructor(contentPath, globals = null, settings = {}) {
|
|
21
|
+
this.settings = {
|
|
22
|
+
siteTitle: "NotherBase",
|
|
23
|
+
...settings
|
|
24
|
+
}
|
|
21
25
|
this.app = express();
|
|
22
26
|
this.server = http.createServer(this.app);
|
|
23
27
|
this.io = new Server(this.server);
|
|
24
|
-
this.creation = new Creation();
|
|
28
|
+
this.creation = new Creation(this.settings.siteTitle);
|
|
25
29
|
this.spiritWorld = new SpiritWorld(this.io);
|
|
26
30
|
|
|
27
31
|
//set views path
|