Skip to content

Commit

Permalink
fix: better error handling + typo correction
Browse files Browse the repository at this point in the history
  • Loading branch information
ajmeese7 committed Mar 2, 2024
1 parent 7988059 commit e703a52
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 7 deletions.
2 changes: 1 addition & 1 deletion backend/server/src/vfs.js
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ const createRequestFactory = (findMountpoint) =>
const [target, ...rest] = getter(req, res);
const [resource] = rest;

if (resouce instanceof Stream) {
if (resource instanceof Stream) {
resource.once("error", reject);
}

Expand Down
1 change: 1 addition & 0 deletions website/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"serve": "node src/server/index.js",
"build": "webpack && npm run build:manifest",
"build:production": "NODE_ENV=production rush build",
"build:prod": "npm run build:production",
"build:manifest": "meese-cli package:discover",
"package:discover": "meese-cli package:discover",
"package:create": "meese-cli package:create",
Expand Down
16 changes: 10 additions & 6 deletions website/src/server/auth/adapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,17 @@ module.exports = (_core, _options) => ({
groups = ["guest"];
} else {
// Validate the user against the 'database'
const users = JSON.parse(process.env.meeseOS_users);
const usernameExists = Object.prototype.hasOwnProperty.call(users, username);
if (usernameExists) {
const passwordCorrect = users[username].password === password;
if (passwordCorrect) {
groups = users[username].groups;
try {
const users = JSON.parse(process.env.meeseOS_users);
const usernameExists = Object.prototype.hasOwnProperty.call(users, username);
if (usernameExists) {
const passwordCorrect = users[username].password === password;
if (passwordCorrect) {
groups = users[username].groups;
}
}
} catch (e) {
console.error("Error validating user against the database:", e);
}
}

Expand Down
2 changes: 2 additions & 0 deletions website/src/server/auth/template.env.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
"groups": ["user"]
}
},
// Randomly generate these:
// node -e "console.log(require('crypto').randomBytes(32).toString('hex'))"
"SESSION_SECRET": "thiswouldbenefitfrombeingrandomlygenerated",
"JWT_SECRET": "youshouldprobablyrandomlygeneratethis",
"JWT_REFRESH": "youshoulddefinitelyrandomlygeneratethisaswell",
Expand Down

0 comments on commit e703a52

Please sign in to comment.