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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "notherbase-fs",
3
- "version": "4.5.9",
3
+ "version": "4.5.11",
4
4
  "description": "Functions to help make developing for NotherBase easier.",
5
5
  "exports": "./notherbase-fs.js",
6
6
  "scripts": {
@@ -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 + "\\" + req.main;
47
- if (req.params.poi) req.main = req.params.poi + "\\" + req.main;
48
- if (req.params.area) req.main = req.params.area + "\\" + req.main;
49
- if (req.params.region) req.main = req.params.region + "\\" + req.main;
50
- else req.main = "the-front\\" + req.main;
51
- req.main = req.contentPath + "\\" + req.main;
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 + "\\" + req.preprocess;
54
- if (req.params.poi) req.preprocess = req.params.poi + "\\" + req.preprocess;
55
- if (req.params.area) req.preprocess = req.params.area + "\\" + req.preprocess;
56
- if (req.params.region) req.preprocess = req.params.region + "\\" + req.preprocess;
57
- else req.preprocess = "the-front\\" + req.preprocess;
58
- req.preprocess = req.contentPath + "\\" + req.preprocess;
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
 
@@ -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 = `${req.contentPath}${req.body.route}/${req.body.script}.js`;
133
+ let scriptPath = path.join(req.contentPath, req.body.route, `${req.body.script}.js`);
133
134
 
134
135
  let script, result = null;
135
136