notherbase-fs 1.0.28 → 1.0.32

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.
Files changed (2) hide show
  1. package/main.js +20 -20
  2. package/package.json +1 -1
package/main.js CHANGED
@@ -3,56 +3,56 @@ const inventory = require(process.cwd() + "/models/inventory").inventory;
3
3
  let router;
4
4
  let dir;
5
5
 
6
- let explore = function explore(route, styles = [], scripts = [], needsKey = "", dropOff = "") {
7
- styles = styles.map(style => {
6
+ let explore = function explore(route, options) {
7
+ options.styles = options.styles.map(style => {
8
8
  style = `${dir}/styles/${style}`;
9
9
  return style;
10
10
  });
11
11
 
12
- scripts = scripts.map(script => {
12
+ options.scripts = options.scripts.map(script => {
13
13
  script = `${dir}/local-scripts/${script}`;
14
14
  return script;
15
15
  });
16
16
 
17
- let main = "index";
18
- if (route !== "") main = route;
19
- main = `${dir}/views/${main}`;
17
+ options.main = "index";
18
+ if (route !== "") options.main = route;
19
+ options.main = `${dir}/views/${options.main}`;
20
20
 
21
21
  router.get(`/${route}`, async function(req, res) {
22
22
  try {
23
23
  const foundInventory = await inventory.findOne({ user: req.session.currentUser }).populate("items.item");
24
24
 
25
-
26
- if (needsKey !== "" && foundInventory) {
25
+ if (options.needsKey !== "" && foundInventory) {
27
26
  let hasKey = false;
28
27
 
29
28
  for (let i = 0; i < foundInventory.items.length; i++) {
30
- if (foundInventory.items[i].item.name === hasKey) hasKey = true;
29
+ if (foundInventory.items[i].item.name === options.needsKey) hasKey = true;
31
30
  }
32
31
 
33
32
  if (!hasKey) res.redirect(dropOff);
34
33
  else res.render(`explorer`,
35
34
  {
36
35
  siteTitle: "NotherBase",
37
- user: null,
38
- styles: styles,
39
- main: main,
40
- scripts: scripts,
36
+ user: req.session.currentUserFull,
37
+ styles: options.styles,
38
+ main: options.main,
39
+ scripts: options.scripts,
41
40
  pov: req.query.pov,
42
- inventory: foundInventory
41
+ inventory: foundInventory,
42
+ query: req.query
43
43
  });
44
44
  }
45
45
  else res.render(`explorer`,
46
46
  {
47
47
  siteTitle: "NotherBase",
48
- user: null,
49
- styles: styles,
50
- main: main,
51
- scripts: scripts,
48
+ user: req.session.currentUserFull,
49
+ styles: options.styles,
50
+ main: options.main,
51
+ scripts: options.scripts,
52
52
  pov: req.query.pov,
53
- inventory: foundInventory
53
+ inventory: foundInventory,
54
+ query: req.query
54
55
  });
55
-
56
56
  }
57
57
  catch(err) {
58
58
  console.log(err);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "notherbase-fs",
3
- "version": "1.0.28",
3
+ "version": "1.0.32",
4
4
  "description": "Functions to help make developing for NotherBase easier.",
5
5
  "main": "main.js",
6
6
  "scripts": {