Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/models/Operator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,8 @@ export default class Operator {
if (userid) {
this.cache[userid] = permissions;
}
//user?.log.info(user.id,this.id,this.roles,this.authenticated);
//user?.log.info(permissions);
return permissions;
}
}
6 changes: 5 additions & 1 deletion src/services/Server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,13 +112,16 @@ export default class Server {

let code = 0;
let output = undefined;
let operatorid = undefined;

let error = false as boolean | unknown;
try {
let user = undefined;
if (userid !== undefined) {
user = await User.getUser(userid);
}
const operator = await Server.getOperator(request, user);
operatorid = operator.id;

output = await Fairpost.execute(operator, user, command, args);
code = 200;
Expand All @@ -141,6 +144,7 @@ export default class Server {
{
request: {
user: username,
operator: operatorid,
command: command,
arguments: args,
},
Expand Down Expand Up @@ -188,7 +192,7 @@ export default class Server {
"Set-Cookie",
cookie.serialize("FairpostSession", token, {
httpOnly: true,
secure: process.env.FAIRPOST_SESSION_SECURE === "false",
secure: process.env.FAIRPOST_SESSION_SECURE !== "false",
sameSite: (process.env.FAIRPOST_SESSION_SAMESITE ?? "strict") as
| "strict"
| "lax"
Expand Down