aboutsummaryrefslogtreecommitdiff
path: root/app.js
diff options
context:
space:
mode:
authorJakob Stendahl <14180120+JakobST1n@users.noreply.github.com>2018-12-01 00:28:28 +0100
committerGitHub <noreply@github.com>2018-12-01 00:28:28 +0100
commit19df9946b438b38b9a4f3f57ad002981a1ae1eaf (patch)
treee8eb839a305502584e31e1b1a96c70406b9b6255 /app.js
parentfd7a1b51126f8b8f889807cb7d56bb3626a0e0b5 (diff)
parent7ec685de6e441af1f614bb9d18e25c047d21466b (diff)
downloadLuxcena-Neo-19df9946b438b38b9a4f3f57ad002981a1ae1eaf.tar.gz
Luxcena-Neo-19df9946b438b38b9a4f3f57ad002981a1ae1eaf.zip
Merge pull request #6 from JakobST1n/dev
Written docs, finished CLI
Diffstat (limited to 'app.js')
-rw-r--r--app.js15
1 files changed, 9 insertions, 6 deletions
diff --git a/app.js b/app.js
index 5cdfcbd..a4d9651 100644
--- a/app.js
+++ b/app.js
@@ -7,7 +7,7 @@ let io = require("socket.io").listen(server);
// Firstly we set up all globals, check that the usrData dir exists, if not, we run the setup
let srcDir = __dirname;
-let installDir = "/home/lux-neo/install/"
+let installDir = "/home/lux-neo/"
if (process.argv.length >= 3) { installDir = process.argv[2]; }
let dataDir = installDir + "/userdata/";
if (!fse.existsSync(dataDir)) { throw new Error("APPDIR not found! Exiting..."); }
@@ -55,21 +55,22 @@ fse.ensureDirSync(dataDir + "/usrCode/");
fse.ensureDirSync(dataDir + "/remoteCode/");
// Generate config-files
if (!fse.existsSync(dataDir + "/config/versionChecker.json")) {
- fse.writeJsonSync(dataDir + "/config/versionChecker.json", {
+ fse.writeFileSync(dataDir + "/config/versionChecker.json", JSON.stringify({
"branch": "dev",
"checkInterval": 5
- })
+ }, null, 4));
}
if (!fse.existsSync(dataDir + "/config/strip.json")) {
- fse.writeJsonSync(dataDir + "/config/strip.json", {
- "segments": [9, 8, 8, 8, 8, 8, 4],
+ fse.writeFileSync(dataDir + "/config/strip.json", JSON.stringify({
+ "segments": [],
+ "matrix": [],
"segmentConfiguration": "snake",
"led_pin": 18,
"led_freq_hz": 800000,
"led_dma": 10,
"led_invert": false,
"led_channel": 0
- })
+ }, null, 4));
}
@@ -79,6 +80,8 @@ let neoRuntime = require("./src/neoRuntime")(dataDir);
// Setup static assets
app.use(express.static("public/assets"));
+// Serve docs
+app.use("/docs", express.static("docs/_book/"));
// Gave up using webpack to compile monaco, therefore, loading the already-compiled code. Probably the slowest way possible, but so it goes.
app.use("/monaco-editor", express.static("node_modules/monaco-editor/"));
// Setup all our custom middleware