notherbase-fs 4.5.9 → 4.5.11
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/package.json +1 -1
- package/server/creation.js +13 -14
- package/server/spirit-world.js +2 -1
package/package.json
CHANGED
package/server/creation.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import express from "express";
|
|
2
2
|
import fs from 'fs';
|
|
3
|
+
import path from "path";
|
|
3
4
|
|
|
4
5
|
/**
|
|
5
6
|
* Creation is all the renedered pages in a base.
|
|
@@ -17,8 +18,6 @@ export default class Creation {
|
|
|
17
18
|
|
|
18
19
|
//void
|
|
19
20
|
this.router.use(function(req, res) {
|
|
20
|
-
console.log(req.main);
|
|
21
|
-
|
|
22
21
|
res.redirect("/void");
|
|
23
22
|
});
|
|
24
23
|
}
|
|
@@ -43,19 +42,19 @@ export default class Creation {
|
|
|
43
42
|
explore = async (req, res, next) => {
|
|
44
43
|
try {
|
|
45
44
|
req.main = `index`;
|
|
46
|
-
if (req.params.detail) req.main = req.params.detail
|
|
47
|
-
if (req.params.poi) req.main = req.params.poi
|
|
48
|
-
if (req.params.area) req.main = req.params.area
|
|
49
|
-
if (req.params.region) req.main = req.params.region
|
|
50
|
-
else req.main = "the-front
|
|
51
|
-
req.main = req.contentPath
|
|
45
|
+
if (req.params.detail) req.main = path.join(req.params.detail, req.main);
|
|
46
|
+
if (req.params.poi) req.main = path.join(req.params.poi, req.main);
|
|
47
|
+
if (req.params.area) req.main = path.join(req.params.area, req.main);
|
|
48
|
+
if (req.params.region) req.main = path.join(req.params.region, req.main);
|
|
49
|
+
else req.main = path.join("the-front", req.main);
|
|
50
|
+
req.main = path.join(req.contentPath, req.main);
|
|
52
51
|
req.preprocess = "_preprocess";
|
|
53
|
-
if (req.params.detail) req.preprocess = req.params.detail
|
|
54
|
-
if (req.params.poi) req.preprocess = req.params.poi
|
|
55
|
-
if (req.params.area) req.preprocess = req.params.area
|
|
56
|
-
if (req.params.region) req.preprocess = req.params.region
|
|
57
|
-
else req.preprocess = "the-front
|
|
58
|
-
req.preprocess = req.contentPath
|
|
52
|
+
if (req.params.detail) req.preprocess = path.join(req.params.detail, req.preprocess);
|
|
53
|
+
if (req.params.poi) req.preprocess = path.join(req.params.poi, req.preprocess);
|
|
54
|
+
if (req.params.area) req.preprocess = path.join(req.params.area, req.preprocess);
|
|
55
|
+
if (req.params.region) req.preprocess = path.join(req.params.region, req.preprocess);
|
|
56
|
+
else req.preprocess = path.join("the-front", req.preprocess);
|
|
57
|
+
req.preprocess = path.join(req.contentPath, req.preprocess);
|
|
59
58
|
req.siteTitle = `${this.bases[req.hosting].title} - ${req.params.detail || req.params.poi || req.params.area || req.params.region || "Home"}`;
|
|
60
59
|
req.toRender = "explorer";
|
|
61
60
|
|
package/server/spirit-world.js
CHANGED
|
@@ -3,6 +3,7 @@ import { stripHtml } from "string-strip-html";
|
|
|
3
3
|
import { success, fail } from "./util.js";
|
|
4
4
|
import User from "./user.js";
|
|
5
5
|
import fs from 'fs';
|
|
6
|
+
import path from "path";
|
|
6
7
|
|
|
7
8
|
/**
|
|
8
9
|
* The spirit world is the API of a base.
|
|
@@ -129,7 +130,7 @@ export default class SpiritWorld {
|
|
|
129
130
|
*/
|
|
130
131
|
serve = async (req, res) => {
|
|
131
132
|
try {
|
|
132
|
-
let scriptPath =
|
|
133
|
+
let scriptPath = path.join(req.contentPath, req.body.route, `${req.body.script}.js`);
|
|
133
134
|
|
|
134
135
|
let script, result = null;
|
|
135
136
|
|