Changes for client version to work properly

This commit is contained in:
Rogerio Chaves 2020-04-25 15:06:07 +02:00
parent 1d6ffff158
commit 86dc9d0128
No known key found for this signature in database
GPG Key ID: E6AF5440509B1D94
3 changed files with 8 additions and 5 deletions

View File

@ -12,7 +12,7 @@ if (mode == "client") {
}, 1000); }, 1000);
} }
if (process.env.NODE_ENV != "production") { if (mode == "server" && process.env.NODE_ENV != "production") {
const chokidar = require("chokidar"); const chokidar = require("chokidar");
const watcher = chokidar.watch("./lib"); const watcher = chokidar.watch("./lib");

View File

@ -1,6 +1,6 @@
const { app, shell } = require("electron"); const { app, shell } = require("electron");
app.whenReady().then(() => { app.whenReady().then(() => {
let port = process.env.PORT || 3000; let port = process.env.PORT || 7624;
shell.openExternal(`http://localhost:${port}`); shell.openExternal(`http://localhost:${port}`);
}); });

View File

@ -1,7 +1,7 @@
const ssb = require("./ssb-client"); const ssb = require("./ssb-client");
const express = require("express"); const express = require("express");
const app = express(); const app = express();
const port = process.env.PORT || 3000; const port = process.env.PORT || 7624;
const bodyParser = require("body-parser"); const bodyParser = require("body-parser");
const { const {
asyncRouter, asyncRouter,
@ -44,7 +44,8 @@ if (SENTRY_DSN && process.env.NODE_ENV == "production") {
app.use(bodyParser.json()); app.use(bodyParser.json());
app.use(bodyParser.urlencoded({ extended: true })); app.use(bodyParser.urlencoded({ extended: true }));
app.set("view engine", "ejs"); app.set("view engine", "ejs");
app.use(express.static("public")); app.set('views', `${__dirname}/../views`);
app.use(express.static(`${__dirname}/../public`));
app.use(fileUpload()); app.use(fileUpload());
const cookieSecret = const cookieSecret =
process.env.COOKIES_SECRET || "set_cookie_secret_you_are_unsafe"; // has to be 32-bits process.env.COOKIES_SECRET || "set_cookie_secret_you_are_unsafe"; // has to be 32-bits
@ -55,7 +56,9 @@ const cookieOptions = {
sameSite: "Lax", sameSite: "Lax",
}; };
app.use(cookieParser(cookieSecret)); app.use(cookieParser(cookieSecret));
app.use(cookieEncrypter(cookieSecret)); if (mode != "client") {
app.use(cookieEncrypter(cookieSecret));
}
app.use(expressLayouts); app.use(expressLayouts);
app.set("layout", false); app.set("layout", false);
app.use(async (req, res, next) => { app.use(async (req, res, next) => {