notherbase-fs 1.3.1 → 1.3.2
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/explorer.js +52 -31
- package/package.json +1 -1
package/controllers/explorer.js
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
|
+
const db = require("../models");
|
|
2
|
+
const path = require('path');
|
|
3
|
+
const fs = require("fs");
|
|
4
|
+
|
|
5
|
+
let router = require("express").Router();
|
|
6
|
+
|
|
1
7
|
const explorer = async function explorer(worldPath, voidPath) {
|
|
2
|
-
const db = require("../models");
|
|
3
|
-
const path = require('path');
|
|
4
|
-
|
|
5
|
-
let router = require("express").Router();
|
|
6
|
-
|
|
7
8
|
router.post(`/:region/:area/:poi/:detail/serve/:script`, async function(req, res) {
|
|
8
9
|
try {
|
|
9
10
|
let currentAreaRoute = `${req.params.region}/${req.params.area}/${req.params.poi}`;
|
|
@@ -43,19 +44,30 @@ const explorer = async function explorer(worldPath, voidPath) {
|
|
|
43
44
|
const foundInventory = await db.inventory.findOne({ user: req.session.currentUser }).populate("items.item");
|
|
44
45
|
|
|
45
46
|
let main = `${worldPath}/${req.params.region}/${req.params.area}/${req.params.poi}/views/${req.params.detail}`;
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
47
|
+
|
|
48
|
+
if (fs.existsSync(main + ".js")) {
|
|
49
|
+
let context = {
|
|
50
|
+
siteTitle: `NotherBase - ${req.params.detail}`,
|
|
51
|
+
user: foundUser,
|
|
52
|
+
main: main,
|
|
53
|
+
pov: req.query.pov,
|
|
54
|
+
inventory: foundInventory,
|
|
55
|
+
query: req.query,
|
|
56
|
+
dir: worldPath,
|
|
57
|
+
path: path
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
await res.render(`explorer`, context);
|
|
61
|
+
}
|
|
62
|
+
else {
|
|
63
|
+
res.render(`explorer`,
|
|
64
|
+
{
|
|
65
|
+
siteTitle: "NotherBase | The Void",
|
|
66
|
+
user: null,
|
|
67
|
+
inventory: null,
|
|
68
|
+
main: `${voidPath}/index`
|
|
69
|
+
});
|
|
56
70
|
}
|
|
57
|
-
|
|
58
|
-
await res.render(`explorer`, context);
|
|
59
71
|
}
|
|
60
72
|
catch(err) {
|
|
61
73
|
console.log(err);
|
|
@@ -70,18 +82,29 @@ const explorer = async function explorer(worldPath, voidPath) {
|
|
|
70
82
|
|
|
71
83
|
let main = `${worldPath}/${req.params.region}/${req.params.area}/${req.params.poi}/views/index`;
|
|
72
84
|
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
85
|
+
if (fs.existsSync(main + ".js")) {
|
|
86
|
+
let context = {
|
|
87
|
+
siteTitle: `NotherBase - ${req.params.poi}`,
|
|
88
|
+
user: foundUser,
|
|
89
|
+
main: main,
|
|
90
|
+
pov: req.query.pov,
|
|
91
|
+
inventory: foundInventory,
|
|
92
|
+
query: req.query,
|
|
93
|
+
dir: worldPath,
|
|
94
|
+
path: path
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
await res.render(`explorer`, context);
|
|
98
|
+
}
|
|
99
|
+
else {
|
|
100
|
+
res.render(`explorer`,
|
|
101
|
+
{
|
|
102
|
+
siteTitle: "NotherBase | The Void",
|
|
103
|
+
user: null,
|
|
104
|
+
inventory: null,
|
|
105
|
+
main: `${voidPath}/index`
|
|
106
|
+
});
|
|
82
107
|
}
|
|
83
|
-
|
|
84
|
-
await res.render(`explorer`, context);
|
|
85
108
|
}
|
|
86
109
|
catch(err) {
|
|
87
110
|
console.log(err);
|
|
@@ -101,9 +124,7 @@ const explorer = async function explorer(worldPath, voidPath) {
|
|
|
101
124
|
siteTitle: "NotherBase | The Void",
|
|
102
125
|
user: null,
|
|
103
126
|
inventory: null,
|
|
104
|
-
main: `${voidPath}/index
|
|
105
|
-
dir: dir,
|
|
106
|
-
path: path
|
|
127
|
+
main: `${voidPath}/index`
|
|
107
128
|
});
|
|
108
129
|
});
|
|
109
130
|
|