Skip to content

Commit

Permalink
Always use consistent JWT secret in dev (thepeacockproject#349)
Browse files Browse the repository at this point in the history
Signed-off-by: Reece Dunham <[email protected]>
  • Loading branch information
RDIL authored Dec 6, 2023
1 parent dfceb31 commit 589ba85
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 11 deletions.
4 changes: 0 additions & 4 deletions components/flags.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,10 +105,6 @@ const defaultFlags: Flags = {
desc: "[Development - Workspace required] Toggle loading of plugins with a .ts/.cts extension inside the /plugins folder",
default: false,
},
developmentAllowRuntimeRestart: {
desc: "[Development] When set to true, it will be possible to restart Peacock while the game is running and connected.",
default: false,
},
leaderboardsHost: {
desc: "[Development] Please do not modify - intended for development only",
default: "https://backend.rdil.rocks",
Expand Down
2 changes: 1 addition & 1 deletion components/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,7 @@ app.get(
},
)

if (getFlag("developmentAllowRuntimeRestart")) {
if (PEACOCK_DEV) {
app.use(async (req: RequestWithJwt, _res, next): Promise<void> => {
if (!req.jwt) {
next()
Expand Down
10 changes: 4 additions & 6 deletions components/oauthToken.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,10 @@ import {
SteamH2Strategy,
SteamScpcStrategy,
} from "./entitlementStrategies"
import { getFlag } from "./flags"

export const JWT_SECRET =
getFlag("developmentAllowRuntimeRestart") || PEACOCK_DEV
? "secret"
: randomBytes(32).toString("hex")
export const JWT_SECRET = PEACOCK_DEV
? "secret"
: randomBytes(32).toString("hex")

export async function handleOauthToken(
req: RequestWithJwt,
Expand Down Expand Up @@ -198,7 +196,7 @@ export async function handleOauthToken(
log(LogLevel.DEBUG, "Unable to load profile information.")
}

/*
/*
Store user auth for all games except scpc
*/
if (!isFrankenstein) {
Expand Down

0 comments on commit 589ba85

Please sign in to comment.